@blueking/open-telemetry 0.0.33 → 0.0.35-beta.1
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/README.md +67 -57
- package/dist/bk-rum.global.js +2 -2
- package/dist/bk-rum.global.js.map +1 -1
- package/dist/core/action-activity.d.ts +5 -1
- package/dist/core/action-target.d.ts +19 -0
- package/dist/core/config.d.ts +15 -5
- package/dist/core/event-time.d.ts +7 -0
- package/dist/core/performance-timing.d.ts +13 -0
- package/dist/core/plugin.d.ts +37 -2
- package/dist/core/processor.d.ts +24 -2
- package/dist/core/request-timing.d.ts +3 -2
- package/dist/core/runtime-context.d.ts +62 -2
- package/dist/core/sdk.d.ts +23 -1
- package/dist/core/session-transition.d.ts +19 -0
- package/dist/core/trace-context.d.ts +6 -7
- package/dist/core/view-location.d.ts +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2955 -1483
- package/dist/index.js.map +1 -1
- package/dist/integrations/vue-router.d.ts +25 -0
- package/dist/plugins/action.d.ts +1 -1
- package/dist/plugins/blank-screen-detection.d.ts +11 -0
- package/dist/plugins/blank-screen.d.ts +10 -18
- package/dist/plugins/common.d.ts +4 -2
- package/dist/plugins/document-vitals.d.ts +25 -0
- package/dist/plugins/page-view.d.ts +1 -1
- package/dist/plugins/resource.d.ts +14 -1
- package/dist/plugins/session-state.d.ts +14 -2
- package/dist/plugins/session-store.d.ts +12 -0
- package/dist/plugins/session.d.ts +1 -0
- package/dist/plugins/web-vitals-metrics.d.ts +80 -0
- package/dist/plugins/web-vitals.d.ts +2 -59
- package/dist/schema/attributes.d.ts +63 -0
- package/dist/schema/span.d.ts +5 -2
- package/package.json +9 -4
- package/skills/bk-rum-otele/references/actions.md +54 -37
- package/skills/bk-rum-otele/references/api.md +72 -51
- package/skills/bk-rum-otele/references/architecture.md +16 -16
- package/skills/bk-rum-otele/references/blank-screen.md +72 -142
- package/skills/bk-rum-otele/references/capabilities.md +66 -60
- package/skills/bk-rum-otele/references/configuration.md +101 -98
- package/skills/bk-rum-otele/references/data-model.md +22 -17
- package/skills/bk-rum-otele/references/errors-security.md +13 -13
- package/skills/bk-rum-otele/references/extensions.md +5 -3
- package/skills/bk-rum-otele/references/framework-integration.md +7 -24
- package/skills/bk-rum-otele/references/network.md +62 -49
- package/skills/bk-rum-otele/references/performance.md +62 -30
- package/skills/bk-rum-otele/references/privacy.md +5 -5
- package/skills/bk-rum-otele/references/production.md +9 -13
- package/skills/bk-rum-otele/references/session-context.md +67 -38
- package/skills/bk-rum-otele/references/span-protocol.md +771 -315
- package/skills/bk-rum-otele/references/telemetry-reference.md +288 -213
- package/skills/bk-rum-otele/references/troubleshooting.md +2 -2
- package/skills/bk-rum-otele/references/views-routing.md +103 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bk-rum.global.js","names":["VERSION","VERSION","VERSION","_global","API_NAME","diag","API_NAME","SamplingDecision","API_NAME","global","isFunction","VERSION","VERSION","performance","VERSION","this","this","this","this","this","api.createNoopMeter","context","api.INVALID_SPAN_CONTEXT","this"],"sources":["../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/version.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/semver.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/types.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/diag.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/baggage/internal/symbol.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/baggage/utils.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/context.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/context.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/SamplingResult.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/span_kind.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/status.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context-api.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag-api.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/propagation.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/propagation-api.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/trace.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace-api.js","../../../node_modules/.pnpm/@opentelemetry+context-zone-peer-dep@2.7.1_@opentelemetry+api@1.9.1_zone.js@0.16.2/node_modules/@opentelemetry/context-zone-peer-dep/build/esm/util.js","../../../node_modules/.pnpm/@opentelemetry+context-zone-peer-dep@2.7.1_@opentelemetry+api@1.9.1_zone.js@0.16.2/node_modules/@opentelemetry/context-zone-peer-dep/build/esm/ZoneContextManager.js","../../../node_modules/.pnpm/zone.js@0.16.2/node_modules/zone.js/fesm2015/zone.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/baggage/constants.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/baggage/utils.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/baggage/propagation/W3CBaggagePropagator.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/attributes.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/logging-error-handler.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/global-error-handler.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/environment.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/version.js","../../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/semconv.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/sdk-info.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/index.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/time.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/ExportResult.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/propagation/composite.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/internal/validators.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/trace/TraceState.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/trace/W3CTraceContextPropagator.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/lodash.merge.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/merge.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/promise.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/callback.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/internal/exporter.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/index.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/OTLPExporterBase.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/types.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/shared-configuration.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/bounded-queue-export-promise-handler.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/logging-response-handler.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-export-delegate.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-network-export-delegate.js","../../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/default-service-name.js","../../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/utils.js","../../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/ResourceImpl.js","../../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/common/internal.js","../../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/common/utils.js","../../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js","../../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/trace.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/retrying-transport.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/is-export-retryable.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/fetch-transport.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-browser-http-export-delegate.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/util.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-http-configuration.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/convert-legacy-http-options.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/convert-legacy-browser-http-options.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/create-legacy-browser-delegate.js","../../../node_modules/.pnpm/@opentelemetry+exporter-trace-otlp-http@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/platform/browser/OTLPTraceExporter.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/enums.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Span.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Sampler.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/AlwaysOffSampler.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/AlwaysOnSampler.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/ParentBasedSampler.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/TraceIdRatioBasedSampler.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/config.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/utility.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/BatchSpanProcessorBase.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/export/BatchSpanProcessor.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/RandomIdGenerator.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/semconv.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/TracerMetrics.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/MultiSpanProcessor.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/BasicTracerProvider.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/SimpleSpanProcessor.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-web@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-web/build/esm/StackContextManager.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-web@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-web/build/esm/WebTracerProvider.js","../src/core/id.ts","../src/core/url.ts","../src/schema/attributes.ts","../src/schema/span.ts","../src/plugins/action.ts","../src/plugins/activity.ts","../src/core/page-activity.ts","../src/plugins/blank-screen.ts","../src/core/processor.ts","../src/core/request-timing.ts","../src/core/trace-context.ts","../src/plugins/resource.ts","../src/plugins/common.ts","../src/plugins/csp-violation.ts","../src/core/hash.ts","../src/plugins/device.ts","../src/plugins/error.ts","../src/plugins/long-task.ts","../src/core/route-observer.ts","../src/plugins/page-view.ts","../src/plugins/session-state.ts","../src/plugins/session.ts","../../../node_modules/.pnpm/web-vitals@5.2.0/node_modules/web-vitals/dist/web-vitals.attribution.js","../src/plugins/web-vitals.ts","../src/plugins/websocket.ts","../src/core/action-activity.ts","../package.json","../src/core/config.ts","../src/core/plugin.ts","../src/core/runtime-context.ts","../src/core/sampling.ts","../src/core/sdk.ts","../src/browser.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '1.9.1';\n//# sourceMappingURL=version.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { VERSION } from '../version';\nconst re = /^(\\d+)\\.(\\d+)\\.(\\d+)(-(.+))?$/;\n/**\n * Create a function to test an API version to see if it is compatible with the provided ownVersion.\n *\n * The returned function has the following semantics:\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param ownVersion version which should be checked against\n */\nexport function _makeCompatibilityCheck(ownVersion) {\n const acceptedVersions = new Set([ownVersion]);\n const rejectedVersions = new Set();\n const myVersionMatch = ownVersion.match(re);\n if (!myVersionMatch) {\n // we cannot guarantee compatibility so we always return noop\n return () => false;\n }\n const ownVersionParsed = {\n major: +myVersionMatch[1],\n minor: +myVersionMatch[2],\n patch: +myVersionMatch[3],\n prerelease: myVersionMatch[4],\n };\n // if ownVersion has a prerelease tag, versions must match exactly\n if (ownVersionParsed.prerelease != null) {\n return function isExactmatch(globalVersion) {\n return globalVersion === ownVersion;\n };\n }\n function _reject(v) {\n rejectedVersions.add(v);\n return false;\n }\n function _accept(v) {\n acceptedVersions.add(v);\n return true;\n }\n return function isCompatible(globalVersion) {\n if (acceptedVersions.has(globalVersion)) {\n return true;\n }\n if (rejectedVersions.has(globalVersion)) {\n return false;\n }\n const globalVersionMatch = globalVersion.match(re);\n if (!globalVersionMatch) {\n // cannot parse other version\n // we cannot guarantee compatibility so we always noop\n return _reject(globalVersion);\n }\n const globalVersionParsed = {\n major: +globalVersionMatch[1],\n minor: +globalVersionMatch[2],\n patch: +globalVersionMatch[3],\n prerelease: globalVersionMatch[4],\n };\n // if globalVersion has a prerelease tag, versions must match exactly\n if (globalVersionParsed.prerelease != null) {\n return _reject(globalVersion);\n }\n // major versions must match\n if (ownVersionParsed.major !== globalVersionParsed.major) {\n return _reject(globalVersion);\n }\n if (ownVersionParsed.major === 0) {\n if (ownVersionParsed.minor === globalVersionParsed.minor &&\n ownVersionParsed.patch <= globalVersionParsed.patch) {\n return _accept(globalVersion);\n }\n return _reject(globalVersion);\n }\n if (ownVersionParsed.minor <= globalVersionParsed.minor) {\n return _accept(globalVersion);\n }\n return _reject(globalVersion);\n };\n}\n/**\n * Test an API version to see if it is compatible with this API.\n *\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param version version of the API requesting an instance of the global API\n */\nexport const isCompatible = _makeCompatibilityCheck(VERSION);\n//# sourceMappingURL=semver.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { VERSION } from '../version';\nimport { isCompatible } from './semver';\nconst major = VERSION.split('.')[0];\nconst GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(`opentelemetry.js.api.${major}`);\nconst _global = (typeof globalThis === 'object'\n ? globalThis\n : typeof self === 'object'\n ? self\n : typeof window === 'object'\n ? window\n : typeof global === 'object'\n ? global\n : {});\nexport function registerGlobal(type, instance, diag, allowOverride = false) {\n var _a;\n const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : {\n version: VERSION,\n });\n if (!allowOverride && api[type]) {\n // already registered an API of this type\n const err = new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${type}`);\n diag.error(err.stack || err.message);\n return false;\n }\n if (api.version !== VERSION) {\n // All registered APIs must be of the same version exactly\n const err = new Error(`@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION}`);\n diag.error(err.stack || err.message);\n return false;\n }\n api[type] = instance;\n diag.debug(`@opentelemetry/api: Registered a global for ${type} v${VERSION}.`);\n return true;\n}\nexport function getGlobal(type) {\n var _a, _b;\n const globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version;\n if (!globalVersion || !isCompatible(globalVersion)) {\n return;\n }\n return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type];\n}\nexport function unregisterGlobal(type, diag) {\n diag.debug(`@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`);\n const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];\n if (api) {\n delete api[type];\n }\n}\n//# sourceMappingURL=global-utils.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { getGlobal } from '../internal/global-utils';\n/**\n * Component Logger which is meant to be used as part of any component which\n * will add automatically additional namespace in front of the log message.\n * It will then forward all message to global diag logger\n * @example\n * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' });\n * cLogger.debug('test');\n * // @opentelemetry/instrumentation-http test\n */\nexport class DiagComponentLogger {\n constructor(props) {\n this._namespace = props.namespace || 'DiagComponentLogger';\n }\n debug(...args) {\n return logProxy('debug', this._namespace, args);\n }\n error(...args) {\n return logProxy('error', this._namespace, args);\n }\n info(...args) {\n return logProxy('info', this._namespace, args);\n }\n warn(...args) {\n return logProxy('warn', this._namespace, args);\n }\n verbose(...args) {\n return logProxy('verbose', this._namespace, args);\n }\n}\nfunction logProxy(funcName, namespace, args) {\n const logger = getGlobal('diag');\n // shortcut if logger not set\n if (!logger) {\n return;\n }\n return logger[funcName](namespace, ...args);\n}\n//# sourceMappingURL=ComponentLogger.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * Defines the available internal logging levels for the diagnostic logger, the numeric values\n * of the levels are defined to match the original values from the initial LogLevel to avoid\n * compatibility/migration issues for any implementation that assume the numeric ordering.\n */\nexport var DiagLogLevel;\n(function (DiagLogLevel) {\n /** Diagnostic Logging level setting to disable all logging (except and forced logs) */\n DiagLogLevel[DiagLogLevel[\"NONE\"] = 0] = \"NONE\";\n /** Identifies an error scenario */\n DiagLogLevel[DiagLogLevel[\"ERROR\"] = 30] = \"ERROR\";\n /** Identifies a warning scenario */\n DiagLogLevel[DiagLogLevel[\"WARN\"] = 50] = \"WARN\";\n /** General informational log message */\n DiagLogLevel[DiagLogLevel[\"INFO\"] = 60] = \"INFO\";\n /** General debug log message */\n DiagLogLevel[DiagLogLevel[\"DEBUG\"] = 70] = \"DEBUG\";\n /**\n * Detailed trace level logging should only be used for development, should only be set\n * in a development environment.\n */\n DiagLogLevel[DiagLogLevel[\"VERBOSE\"] = 80] = \"VERBOSE\";\n /** Used to set the logging level to include all logging */\n DiagLogLevel[DiagLogLevel[\"ALL\"] = 9999] = \"ALL\";\n})(DiagLogLevel || (DiagLogLevel = {}));\n//# sourceMappingURL=types.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { DiagLogLevel } from '../types';\nexport function createLogLevelDiagLogger(maxLevel, logger) {\n if (maxLevel < DiagLogLevel.NONE) {\n maxLevel = DiagLogLevel.NONE;\n }\n else if (maxLevel > DiagLogLevel.ALL) {\n maxLevel = DiagLogLevel.ALL;\n }\n // In case the logger is null or undefined\n logger = logger || {};\n function _filterFunc(funcName, theLevel) {\n const theFunc = logger[funcName];\n if (typeof theFunc === 'function' && maxLevel >= theLevel) {\n return theFunc.bind(logger);\n }\n return function () { };\n }\n return {\n error: _filterFunc('error', DiagLogLevel.ERROR),\n warn: _filterFunc('warn', DiagLogLevel.WARN),\n info: _filterFunc('info', DiagLogLevel.INFO),\n debug: _filterFunc('debug', DiagLogLevel.DEBUG),\n verbose: _filterFunc('verbose', DiagLogLevel.VERBOSE),\n };\n}\n//# sourceMappingURL=logLevelLogger.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { DiagComponentLogger } from '../diag/ComponentLogger';\nimport { createLogLevelDiagLogger } from '../diag/internal/logLevelLogger';\nimport { DiagLogLevel } from '../diag/types';\nimport { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';\nconst API_NAME = 'diag';\n/**\n * Singleton object which represents the entry point to the OpenTelemetry internal\n * diagnostic API\n *\n * @since 1.0.0\n */\nexport class DiagAPI {\n /** Get the singleton instance of the DiagAPI API */\n static instance() {\n if (!this._instance) {\n this._instance = new DiagAPI();\n }\n return this._instance;\n }\n /**\n * Private internal constructor\n * @private\n */\n constructor() {\n function _logProxy(funcName) {\n return function (...args) {\n const logger = getGlobal('diag');\n // shortcut if logger not set\n if (!logger)\n return;\n return logger[funcName](...args);\n };\n }\n // Using self local variable for minification purposes as 'this' cannot be minified\n const self = this;\n // DiagAPI specific functions\n const setLogger = (logger, optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }) => {\n var _a, _b, _c;\n if (logger === self) {\n // There isn't much we can do here.\n // Logging to the console might break the user application.\n // Try to log to self. If a logger was previously registered it will receive the log.\n const err = new Error('Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation');\n self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);\n return false;\n }\n if (typeof optionsOrLogLevel === 'number') {\n optionsOrLogLevel = {\n logLevel: optionsOrLogLevel,\n };\n }\n const oldLogger = getGlobal('diag');\n const newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger);\n // There already is an logger registered. We'll let it know before overwriting it.\n if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {\n const stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : '<failed to generate stacktrace>';\n oldLogger.warn(`Current logger will be overwritten from ${stack}`);\n newLogger.warn(`Current logger will overwrite one already registered from ${stack}`);\n }\n return registerGlobal('diag', newLogger, self, true);\n };\n self.setLogger = setLogger;\n self.disable = () => {\n unregisterGlobal(API_NAME, self);\n };\n self.createComponentLogger = (options) => {\n return new DiagComponentLogger(options);\n };\n self.verbose = _logProxy('verbose');\n self.debug = _logProxy('debug');\n self.info = _logProxy('info');\n self.warn = _logProxy('warn');\n self.error = _logProxy('error');\n }\n}\n//# sourceMappingURL=diag.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport class BaggageImpl {\n constructor(entries) {\n this._entries = entries ? new Map(entries) : new Map();\n }\n getEntry(key) {\n const entry = this._entries.get(key);\n if (!entry) {\n return undefined;\n }\n return Object.assign({}, entry);\n }\n getAllEntries() {\n return Array.from(this._entries.entries());\n }\n setEntry(key, entry) {\n const newBaggage = new BaggageImpl(this._entries);\n newBaggage._entries.set(key, entry);\n return newBaggage;\n }\n removeEntry(key) {\n const newBaggage = new BaggageImpl(this._entries);\n newBaggage._entries.delete(key);\n return newBaggage;\n }\n removeEntries(...keys) {\n const newBaggage = new BaggageImpl(this._entries);\n for (const key of keys) {\n newBaggage._entries.delete(key);\n }\n return newBaggage;\n }\n clear() {\n return new BaggageImpl();\n }\n}\n//# sourceMappingURL=baggage-impl.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * Symbol used to make BaggageEntryMetadata an opaque type\n */\nexport const baggageEntryMetadataSymbol = Symbol('BaggageEntryMetadata');\n//# sourceMappingURL=symbol.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { DiagAPI } from '../api/diag';\nimport { BaggageImpl } from './internal/baggage-impl';\nimport { baggageEntryMetadataSymbol } from './internal/symbol';\nconst diag = DiagAPI.instance();\n/**\n * Create a new Baggage with optional entries\n *\n * @param entries An array of baggage entries the new baggage should contain\n */\nexport function createBaggage(entries = {}) {\n return new BaggageImpl(new Map(Object.entries(entries)));\n}\n/**\n * Create a serializable BaggageEntryMetadata object from a string.\n *\n * @param str string metadata. Format is currently not defined by the spec and has no special meaning.\n *\n * @since 1.0.0\n */\nexport function baggageEntryMetadataFromString(str) {\n if (typeof str !== 'string') {\n diag.error(`Cannot create baggage metadata from unknown type: ${typeof str}`);\n str = '';\n }\n return {\n __TYPE__: baggageEntryMetadataSymbol,\n toString() {\n return str;\n },\n };\n}\n//# sourceMappingURL=utils.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * Get a key to uniquely identify a context value\n *\n * @since 1.0.0\n */\nexport function createContextKey(description) {\n // The specification states that for the same input, multiple calls should\n // return different keys. Due to the nature of the JS dependency management\n // system, this creates problems where multiple versions of some package\n // could hold different keys for the same property.\n //\n // Therefore, we use Symbol.for which returns the same key for the same input.\n return Symbol.for(description);\n}\nclass BaseContext {\n /**\n * Construct a new context which inherits values from an optional parent context.\n *\n * @param parentContext a context from which to inherit values\n */\n constructor(parentContext) {\n // for minification\n const self = this;\n self._currentContext = parentContext ? new Map(parentContext) : new Map();\n self.getValue = (key) => self._currentContext.get(key);\n self.setValue = (key, value) => {\n const context = new BaseContext(self._currentContext);\n context._currentContext.set(key, value);\n return context;\n };\n self.deleteValue = (key) => {\n const context = new BaseContext(self._currentContext);\n context._currentContext.delete(key);\n return context;\n };\n }\n}\n/**\n * The root context is used as the default parent context when there is no active context\n *\n * @since 1.0.0\n */\nexport const ROOT_CONTEXT = new BaseContext();\n//# sourceMappingURL=context.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses\n * constant NoopMetrics for all of its methods.\n */\nexport class NoopMeter {\n constructor() { }\n /**\n * @see {@link Meter.createGauge}\n */\n createGauge(_name, _options) {\n return NOOP_GAUGE_METRIC;\n }\n /**\n * @see {@link Meter.createHistogram}\n */\n createHistogram(_name, _options) {\n return NOOP_HISTOGRAM_METRIC;\n }\n /**\n * @see {@link Meter.createCounter}\n */\n createCounter(_name, _options) {\n return NOOP_COUNTER_METRIC;\n }\n /**\n * @see {@link Meter.createUpDownCounter}\n */\n createUpDownCounter(_name, _options) {\n return NOOP_UP_DOWN_COUNTER_METRIC;\n }\n /**\n * @see {@link Meter.createObservableGauge}\n */\n createObservableGauge(_name, _options) {\n return NOOP_OBSERVABLE_GAUGE_METRIC;\n }\n /**\n * @see {@link Meter.createObservableCounter}\n */\n createObservableCounter(_name, _options) {\n return NOOP_OBSERVABLE_COUNTER_METRIC;\n }\n /**\n * @see {@link Meter.createObservableUpDownCounter}\n */\n createObservableUpDownCounter(_name, _options) {\n return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;\n }\n /**\n * @see {@link Meter.addBatchObservableCallback}\n */\n addBatchObservableCallback(_callback, _observables) { }\n /**\n * @see {@link Meter.removeBatchObservableCallback}\n */\n removeBatchObservableCallback(_callback) { }\n}\nexport class NoopMetric {\n}\nexport class NoopCounterMetric extends NoopMetric {\n add(_value, _attributes) { }\n}\nexport class NoopUpDownCounterMetric extends NoopMetric {\n add(_value, _attributes) { }\n}\nexport class NoopGaugeMetric extends NoopMetric {\n record(_value, _attributes) { }\n}\nexport class NoopHistogramMetric extends NoopMetric {\n record(_value, _attributes) { }\n}\nexport class NoopObservableMetric {\n addCallback(_callback) { }\n removeCallback(_callback) { }\n}\nexport class NoopObservableCounterMetric extends NoopObservableMetric {\n}\nexport class NoopObservableGaugeMetric extends NoopObservableMetric {\n}\nexport class NoopObservableUpDownCounterMetric extends NoopObservableMetric {\n}\nexport const NOOP_METER = new NoopMeter();\n// Synchronous instruments\nexport const NOOP_COUNTER_METRIC = new NoopCounterMetric();\nexport const NOOP_GAUGE_METRIC = new NoopGaugeMetric();\nexport const NOOP_HISTOGRAM_METRIC = new NoopHistogramMetric();\nexport const NOOP_UP_DOWN_COUNTER_METRIC = new NoopUpDownCounterMetric();\n// Asynchronous instruments\nexport const NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric();\nexport const NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric();\nexport const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = new NoopObservableUpDownCounterMetric();\n/**\n * Create a no-op Meter\n *\n * @since 1.3.0\n */\nexport function createNoopMeter() {\n return NOOP_METER;\n}\n//# sourceMappingURL=NoopMeter.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @since 1.0.0\n */\nexport const defaultTextMapGetter = {\n get(carrier, key) {\n if (carrier == null) {\n return undefined;\n }\n return carrier[key];\n },\n keys(carrier) {\n if (carrier == null) {\n return [];\n }\n return Object.keys(carrier);\n },\n};\n/**\n * @since 1.0.0\n */\nexport const defaultTextMapSetter = {\n set(carrier, key, value) {\n if (carrier == null) {\n return;\n }\n carrier[key] = value;\n },\n};\n//# sourceMappingURL=TextMapPropagator.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ROOT_CONTEXT } from './context';\nexport class NoopContextManager {\n active() {\n return ROOT_CONTEXT;\n }\n with(_context, fn, thisArg, ...args) {\n return fn.call(thisArg, ...args);\n }\n bind(_context, target) {\n return target;\n }\n enable() {\n return this;\n }\n disable() {\n return this;\n }\n}\n//# sourceMappingURL=NoopContextManager.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { NoopContextManager } from '../context/NoopContextManager';\nimport { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';\nimport { DiagAPI } from './diag';\nconst API_NAME = 'context';\nconst NOOP_CONTEXT_MANAGER = new NoopContextManager();\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Context API\n *\n * @since 1.0.0\n */\nexport class ContextAPI {\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n constructor() { }\n /** Get the singleton instance of the Context API */\n static getInstance() {\n if (!this._instance) {\n this._instance = new ContextAPI();\n }\n return this._instance;\n }\n /**\n * Set the current context manager.\n *\n * @returns true if the context manager was successfully registered, else false\n */\n setGlobalContextManager(contextManager) {\n return registerGlobal(API_NAME, contextManager, DiagAPI.instance());\n }\n /**\n * Get the currently active context\n */\n active() {\n return this._getContextManager().active();\n }\n /**\n * Execute a function with an active context\n *\n * @param context context to be active during function execution\n * @param fn function to execute in a context\n * @param thisArg optional receiver to be used for calling fn\n * @param args optional arguments forwarded to fn\n */\n with(context, fn, thisArg, ...args) {\n return this._getContextManager().with(context, fn, thisArg, ...args);\n }\n /**\n * Bind a context to a target function or event emitter\n *\n * @param context context to bind to the event emitter or function. Defaults to the currently active context\n * @param target function or event emitter to bind\n */\n bind(context, target) {\n return this._getContextManager().bind(context, target);\n }\n _getContextManager() {\n return getGlobal(API_NAME) || NOOP_CONTEXT_MANAGER;\n }\n /** Disable and remove the global context manager */\n disable() {\n this._getContextManager().disable();\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n}\n//# sourceMappingURL=context.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @since 1.0.0\n */\nexport var TraceFlags;\n(function (TraceFlags) {\n /** Represents no flag set. */\n TraceFlags[TraceFlags[\"NONE\"] = 0] = \"NONE\";\n /** Bit to represent whether trace is sampled in trace flags. */\n TraceFlags[TraceFlags[\"SAMPLED\"] = 1] = \"SAMPLED\";\n})(TraceFlags || (TraceFlags = {}));\n//# sourceMappingURL=trace_flags.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { TraceFlags } from './trace_flags';\n/**\n * @since 1.0.0\n */\nexport const INVALID_SPANID = '0000000000000000';\n/**\n * @since 1.0.0\n */\nexport const INVALID_TRACEID = '00000000000000000000000000000000';\n/**\n * @since 1.0.0\n */\nexport const INVALID_SPAN_CONTEXT = {\n traceId: INVALID_TRACEID,\n spanId: INVALID_SPANID,\n traceFlags: TraceFlags.NONE,\n};\n//# sourceMappingURL=invalid-span-constants.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { INVALID_SPAN_CONTEXT } from './invalid-span-constants';\n/**\n * The NonRecordingSpan is the default {@link Span} that is used when no Span\n * implementation is available. All operations are no-op including context\n * propagation.\n */\nexport class NonRecordingSpan {\n constructor(spanContext = INVALID_SPAN_CONTEXT) {\n this._spanContext = spanContext;\n }\n // Returns a SpanContext.\n spanContext() {\n return this._spanContext;\n }\n // By default does nothing\n setAttribute(_key, _value) {\n return this;\n }\n // By default does nothing\n setAttributes(_attributes) {\n return this;\n }\n // By default does nothing\n addEvent(_name, _attributes) {\n return this;\n }\n addLink(_link) {\n return this;\n }\n addLinks(_links) {\n return this;\n }\n // By default does nothing\n setStatus(_status) {\n return this;\n }\n // By default does nothing\n updateName(_name) {\n return this;\n }\n // By default does nothing\n end(_endTime) { }\n // isRecording always returns false for NonRecordingSpan.\n isRecording() {\n return false;\n }\n // By default does nothing\n recordException(_exception, _time) { }\n}\n//# sourceMappingURL=NonRecordingSpan.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { createContextKey } from '../context/context';\nimport { NonRecordingSpan } from './NonRecordingSpan';\nimport { ContextAPI } from '../api/context';\n/**\n * span key\n */\nconst SPAN_KEY = createContextKey('OpenTelemetry Context Key SPAN');\n/**\n * Return the span if one exists\n *\n * @param context context to get span from\n */\nexport function getSpan(context) {\n return context.getValue(SPAN_KEY) || undefined;\n}\n/**\n * Gets the span from the current context, if one exists.\n */\nexport function getActiveSpan() {\n return getSpan(ContextAPI.getInstance().active());\n}\n/**\n * Set the span on a context\n *\n * @param context context to use as parent\n * @param span span to set active\n */\nexport function setSpan(context, span) {\n return context.setValue(SPAN_KEY, span);\n}\n/**\n * Remove current span stored in the context\n *\n * @param context context to delete span from\n */\nexport function deleteSpan(context) {\n return context.deleteValue(SPAN_KEY);\n}\n/**\n * Wrap span context in a NoopSpan and set as span in a new\n * context\n *\n * @param context context to set active span on\n * @param spanContext span context to be wrapped\n */\nexport function setSpanContext(context, spanContext) {\n return setSpan(context, new NonRecordingSpan(spanContext));\n}\n/**\n * Get the span context of the span if it exists.\n *\n * @param context context to get values from\n */\nexport function getSpanContext(context) {\n var _a;\n return (_a = getSpan(context)) === null || _a === void 0 ? void 0 : _a.spanContext();\n}\n//# sourceMappingURL=context-utils.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { INVALID_SPANID, INVALID_TRACEID } from './invalid-span-constants';\nimport { NonRecordingSpan } from './NonRecordingSpan';\n// Valid characters (0-9, a-f, A-F) are marked as 1.\nconst isHex = new Uint8Array([\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,\n 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,\n]);\nfunction isValidHex(id, length) {\n // As of 1.9.0 the id was allowed to be a non-string value,\n // even though it was not possible in the types.\n if (typeof id !== 'string' || id.length !== length)\n return false;\n let r = 0;\n for (let i = 0; i < id.length; i += 4) {\n r +=\n (isHex[id.charCodeAt(i)] | 0) +\n (isHex[id.charCodeAt(i + 1)] | 0) +\n (isHex[id.charCodeAt(i + 2)] | 0) +\n (isHex[id.charCodeAt(i + 3)] | 0);\n }\n return r === length;\n}\n/**\n * @since 1.0.0\n */\nexport function isValidTraceId(traceId) {\n return isValidHex(traceId, 32) && traceId !== INVALID_TRACEID;\n}\n/**\n * @since 1.0.0\n */\nexport function isValidSpanId(spanId) {\n return isValidHex(spanId, 16) && spanId !== INVALID_SPANID;\n}\n/**\n * Returns true if this {@link SpanContext} is valid.\n * @return true if this {@link SpanContext} is valid.\n *\n * @since 1.0.0\n */\nexport function isSpanContextValid(spanContext) {\n return (isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId));\n}\n/**\n * Wrap the given {@link SpanContext} in a new non-recording {@link Span}\n *\n * @param spanContext span context to be wrapped\n * @returns a new non-recording {@link Span} with the provided context\n */\nexport function wrapSpanContext(spanContext) {\n return new NonRecordingSpan(spanContext);\n}\n//# sourceMappingURL=spancontext-utils.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ContextAPI } from '../api/context';\nimport { getSpanContext, setSpan } from '../trace/context-utils';\nimport { NonRecordingSpan } from './NonRecordingSpan';\nimport { isSpanContextValid } from './spancontext-utils';\nconst contextApi = ContextAPI.getInstance();\n/**\n * No-op implementations of {@link Tracer}.\n */\nexport class NoopTracer {\n // startSpan starts a noop span.\n startSpan(name, options, context = contextApi.active()) {\n const root = Boolean(options === null || options === void 0 ? void 0 : options.root);\n if (root) {\n return new NonRecordingSpan();\n }\n const parentFromContext = context && getSpanContext(context);\n if (isSpanContext(parentFromContext) &&\n isSpanContextValid(parentFromContext)) {\n return new NonRecordingSpan(parentFromContext);\n }\n else {\n return new NonRecordingSpan();\n }\n }\n startActiveSpan(name, arg2, arg3, arg4) {\n let opts;\n let ctx;\n let fn;\n if (arguments.length < 2) {\n return;\n }\n else if (arguments.length === 2) {\n fn = arg2;\n }\n else if (arguments.length === 3) {\n opts = arg2;\n fn = arg3;\n }\n else {\n opts = arg2;\n ctx = arg3;\n fn = arg4;\n }\n const parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();\n const span = this.startSpan(name, opts, parentContext);\n const contextWithSpanSet = setSpan(parentContext, span);\n return contextApi.with(contextWithSpanSet, fn, undefined, span);\n }\n}\nfunction isSpanContext(spanContext) {\n return (spanContext !== null &&\n typeof spanContext === 'object' &&\n 'spanId' in spanContext &&\n typeof spanContext['spanId'] === 'string' &&\n 'traceId' in spanContext &&\n typeof spanContext['traceId'] === 'string' &&\n 'traceFlags' in spanContext &&\n typeof spanContext['traceFlags'] === 'number');\n}\n//# sourceMappingURL=NoopTracer.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { NoopTracer } from './NoopTracer';\nconst NOOP_TRACER = new NoopTracer();\n/**\n * Proxy tracer provided by the proxy tracer provider\n *\n * @since 1.0.0\n */\nexport class ProxyTracer {\n constructor(provider, name, version, options) {\n this._provider = provider;\n this.name = name;\n this.version = version;\n this.options = options;\n }\n startSpan(name, options, context) {\n return this._getTracer().startSpan(name, options, context);\n }\n startActiveSpan(_name, _options, _context, _fn) {\n const tracer = this._getTracer();\n return Reflect.apply(tracer.startActiveSpan, tracer, arguments);\n }\n /**\n * Try to get a tracer from the proxy tracer provider.\n * If the proxy tracer provider has no delegate, return a noop tracer.\n */\n _getTracer() {\n if (this._delegate) {\n return this._delegate;\n }\n const tracer = this._provider.getDelegateTracer(this.name, this.version, this.options);\n if (!tracer) {\n return NOOP_TRACER;\n }\n this._delegate = tracer;\n return this._delegate;\n }\n}\n//# sourceMappingURL=ProxyTracer.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { NoopTracer } from './NoopTracer';\n/**\n * An implementation of the {@link TracerProvider} which returns an impotent\n * Tracer for all calls to `getTracer`.\n *\n * All operations are no-op.\n */\nexport class NoopTracerProvider {\n getTracer(_name, _version, _options) {\n return new NoopTracer();\n }\n}\n//# sourceMappingURL=NoopTracerProvider.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ProxyTracer } from './ProxyTracer';\nimport { NoopTracerProvider } from './NoopTracerProvider';\nconst NOOP_TRACER_PROVIDER = new NoopTracerProvider();\n/**\n * Tracer provider which provides {@link ProxyTracer}s.\n *\n * Before a delegate is set, tracers provided are NoOp.\n * When a delegate is set, traces are provided from the delegate.\n * When a delegate is set after tracers have already been provided,\n * all tracers already provided will use the provided delegate implementation.\n *\n * @deprecated This will be removed in the next major version.\n * @since 1.0.0\n */\nexport class ProxyTracerProvider {\n /**\n * Get a {@link ProxyTracer}\n */\n getTracer(name, version, options) {\n var _a;\n return ((_a = this.getDelegateTracer(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version, options));\n }\n getDelegate() {\n var _a;\n return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER;\n }\n /**\n * Set the delegate tracer provider\n */\n setDelegate(delegate) {\n this._delegate = delegate;\n }\n getDelegateTracer(name, version, options) {\n var _a;\n return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options);\n }\n}\n//# sourceMappingURL=ProxyTracerProvider.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.\n * A sampling decision that determines how a {@link Span} will be recorded\n * and collected.\n *\n * @since 1.0.0\n */\nexport var SamplingDecision;\n(function (SamplingDecision) {\n /**\n * `Span.isRecording() === false`, span will not be recorded and all events\n * and attributes will be dropped.\n */\n SamplingDecision[SamplingDecision[\"NOT_RECORD\"] = 0] = \"NOT_RECORD\";\n /**\n * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags}\n * MUST NOT be set.\n */\n SamplingDecision[SamplingDecision[\"RECORD\"] = 1] = \"RECORD\";\n /**\n * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags}\n * MUST be set.\n */\n SamplingDecision[SamplingDecision[\"RECORD_AND_SAMPLED\"] = 2] = \"RECORD_AND_SAMPLED\";\n})(SamplingDecision || (SamplingDecision = {}));\n//# sourceMappingURL=SamplingResult.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @since 1.0.0\n */\nexport var SpanKind;\n(function (SpanKind) {\n /** Default value. Indicates that the span is used internally. */\n SpanKind[SpanKind[\"INTERNAL\"] = 0] = \"INTERNAL\";\n /**\n * Indicates that the span covers server-side handling of an RPC or other\n * remote request.\n */\n SpanKind[SpanKind[\"SERVER\"] = 1] = \"SERVER\";\n /**\n * Indicates that the span covers the client-side wrapper around an RPC or\n * other remote request.\n */\n SpanKind[SpanKind[\"CLIENT\"] = 2] = \"CLIENT\";\n /**\n * Indicates that the span describes producer sending a message to a\n * broker. Unlike client and server, there is no direct critical path latency\n * relationship between producer and consumer spans.\n */\n SpanKind[SpanKind[\"PRODUCER\"] = 3] = \"PRODUCER\";\n /**\n * Indicates that the span describes consumer receiving a message from a\n * broker. Unlike client and server, there is no direct critical path latency\n * relationship between producer and consumer spans.\n */\n SpanKind[SpanKind[\"CONSUMER\"] = 4] = \"CONSUMER\";\n})(SpanKind || (SpanKind = {}));\n//# sourceMappingURL=span_kind.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * An enumeration of status codes.\n *\n * @since 1.0.0\n */\nexport var SpanStatusCode;\n(function (SpanStatusCode) {\n /**\n * The default status.\n */\n SpanStatusCode[SpanStatusCode[\"UNSET\"] = 0] = \"UNSET\";\n /**\n * The operation has been validated by an Application developer or\n * Operator to have completed successfully.\n */\n SpanStatusCode[SpanStatusCode[\"OK\"] = 1] = \"OK\";\n /**\n * The operation contains an error.\n */\n SpanStatusCode[SpanStatusCode[\"ERROR\"] = 2] = \"ERROR\";\n})(SpanStatusCode || (SpanStatusCode = {}));\n//# sourceMappingURL=status.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { ContextAPI } from './api/context';\n/**\n * Entrypoint for context API\n * @since 1.0.0\n */\nexport const context = ContextAPI.getInstance();\n//# sourceMappingURL=context-api.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { DiagAPI } from './api/diag';\n/**\n * Entrypoint for Diag API.\n * Defines Diagnostic handler used for internal diagnostic logging operations.\n * The default provides a Noop DiagLogger implementation which may be changed via the\n * diag.setLogger(logger: DiagLogger) function.\n *\n * @since 1.0.0\n */\nexport const diag = DiagAPI.instance();\n//# sourceMappingURL=diag-api.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * No-op implementations of {@link TextMapPropagator}.\n */\nexport class NoopTextMapPropagator {\n /** Noop inject function does nothing */\n inject(_context, _carrier) { }\n /** Noop extract function does nothing and returns the input context */\n extract(context, _carrier) {\n return context;\n }\n fields() {\n return [];\n }\n}\n//# sourceMappingURL=NoopTextMapPropagator.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ContextAPI } from '../api/context';\nimport { createContextKey } from '../context/context';\n/**\n * Baggage key\n */\nconst BAGGAGE_KEY = createContextKey('OpenTelemetry Baggage Key');\n/**\n * Retrieve the current baggage from the given context\n *\n * @param {Context} Context that manage all context values\n * @returns {Baggage} Extracted baggage from the context\n */\nexport function getBaggage(context) {\n return context.getValue(BAGGAGE_KEY) || undefined;\n}\n/**\n * Retrieve the current baggage from the active/current context\n *\n * @returns {Baggage} Extracted baggage from the context\n */\nexport function getActiveBaggage() {\n return getBaggage(ContextAPI.getInstance().active());\n}\n/**\n * Store a baggage in the given context\n *\n * @param {Context} Context that manage all context values\n * @param {Baggage} baggage that will be set in the actual context\n */\nexport function setBaggage(context, baggage) {\n return context.setValue(BAGGAGE_KEY, baggage);\n}\n/**\n * Delete the baggage stored in the given context\n *\n * @param {Context} Context that manage all context values\n */\nexport function deleteBaggage(context) {\n return context.deleteValue(BAGGAGE_KEY);\n}\n//# sourceMappingURL=context-helpers.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';\nimport { NoopTextMapPropagator } from '../propagation/NoopTextMapPropagator';\nimport { defaultTextMapGetter, defaultTextMapSetter, } from '../propagation/TextMapPropagator';\nimport { getBaggage, getActiveBaggage, setBaggage, deleteBaggage, } from '../baggage/context-helpers';\nimport { createBaggage } from '../baggage/utils';\nimport { DiagAPI } from './diag';\nconst API_NAME = 'propagation';\nconst NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Propagation API\n *\n * @since 1.0.0\n */\nexport class PropagationAPI {\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n constructor() {\n this.createBaggage = createBaggage;\n this.getBaggage = getBaggage;\n this.getActiveBaggage = getActiveBaggage;\n this.setBaggage = setBaggage;\n this.deleteBaggage = deleteBaggage;\n }\n /** Get the singleton instance of the Propagator API */\n static getInstance() {\n if (!this._instance) {\n this._instance = new PropagationAPI();\n }\n return this._instance;\n }\n /**\n * Set the current propagator.\n *\n * @returns true if the propagator was successfully registered, else false\n */\n setGlobalPropagator(propagator) {\n return registerGlobal(API_NAME, propagator, DiagAPI.instance());\n }\n /**\n * Inject context into a carrier to be propagated inter-process\n *\n * @param context Context carrying tracing data to inject\n * @param carrier carrier to inject context into\n * @param setter Function used to set values on the carrier\n */\n inject(context, carrier, setter = defaultTextMapSetter) {\n return this._getGlobalPropagator().inject(context, carrier, setter);\n }\n /**\n * Extract context from a carrier\n *\n * @param context Context which the newly created context will inherit from\n * @param carrier Carrier to extract context from\n * @param getter Function used to extract keys from a carrier\n */\n extract(context, carrier, getter = defaultTextMapGetter) {\n return this._getGlobalPropagator().extract(context, carrier, getter);\n }\n /**\n * Return a list of all fields which may be used by the propagator.\n */\n fields() {\n return this._getGlobalPropagator().fields();\n }\n /** Remove the global propagator */\n disable() {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n _getGlobalPropagator() {\n return getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;\n }\n}\n//# sourceMappingURL=propagation.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { PropagationAPI } from './api/propagation';\n/**\n * Entrypoint for propagation API\n *\n * @since 1.0.0\n */\nexport const propagation = PropagationAPI.getInstance();\n//# sourceMappingURL=propagation-api.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';\nimport { ProxyTracerProvider } from '../trace/ProxyTracerProvider';\nimport { isSpanContextValid, wrapSpanContext, } from '../trace/spancontext-utils';\nimport { deleteSpan, getActiveSpan, getSpan, getSpanContext, setSpan, setSpanContext, } from '../trace/context-utils';\nimport { DiagAPI } from './diag';\nconst API_NAME = 'trace';\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Tracing API\n *\n * @since 1.0.0\n */\nexport class TraceAPI {\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n constructor() {\n this._proxyTracerProvider = new ProxyTracerProvider();\n this.wrapSpanContext = wrapSpanContext;\n this.isSpanContextValid = isSpanContextValid;\n this.deleteSpan = deleteSpan;\n this.getSpan = getSpan;\n this.getActiveSpan = getActiveSpan;\n this.getSpanContext = getSpanContext;\n this.setSpan = setSpan;\n this.setSpanContext = setSpanContext;\n }\n /** Get the singleton instance of the Trace API */\n static getInstance() {\n if (!this._instance) {\n this._instance = new TraceAPI();\n }\n return this._instance;\n }\n /**\n * Set the current global tracer.\n *\n * @returns true if the tracer provider was successfully registered, else false\n */\n setGlobalTracerProvider(provider) {\n const success = registerGlobal(API_NAME, this._proxyTracerProvider, DiagAPI.instance());\n if (success) {\n this._proxyTracerProvider.setDelegate(provider);\n }\n return success;\n }\n /**\n * Returns the global tracer provider.\n */\n getTracerProvider() {\n return getGlobal(API_NAME) || this._proxyTracerProvider;\n }\n /**\n * Returns a tracer from the global tracer provider.\n */\n getTracer(name, version) {\n return this.getTracerProvider().getTracer(name, version);\n }\n /** Remove the global tracer provider */\n disable() {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n this._proxyTracerProvider = new ProxyTracerProvider();\n }\n}\n//# sourceMappingURL=trace.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { TraceAPI } from './api/trace';\n/**\n * Entrypoint for trace API\n *\n * @since 1.0.0\n */\nexport const trace = TraceAPI.getInstance();\n//# sourceMappingURL=trace-api.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * check if an object has `addEventListener` and `removeEventListener` functions.\n * Generally only called with a `TargetWithEvents` but may be called with an `unknown` value.\n * @param obj - The object to check.\n */\nexport function isListenerObject(obj) {\n return (typeof obj === 'object' &&\n obj !== null &&\n 'addEventListener' in obj &&\n typeof obj.addEventListener === 'function' &&\n 'removeEventListener' in obj &&\n typeof obj.removeEventListener === 'function');\n}\n//# sourceMappingURL=util.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ROOT_CONTEXT } from '@opentelemetry/api';\nimport { isListenerObject } from './util';\n/* Key name to be used to save a context reference in Zone */\nconst ZONE_CONTEXT_KEY = 'OT_ZONE_CONTEXT';\n/**\n * ZoneContextManager\n * This module provides an easy functionality for tracing action between asynchronous operations in web.\n * It was not possible with standard [StackContextManager]{@link https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-sdk-trace-web/src/StackContextManager.ts}.\n * It heavily depends on [zone.js]{@link https://www.npmjs.com/package/zone.js}.\n * It stores the information about context in zone. Each Context will have always new Zone;\n * It also supports binding a certain Span to a target that has \"addEventListener\" and \"removeEventListener\".\n * When this happens a new zone is being created and the provided Span is being assigned to this zone.\n */\nexport class ZoneContextManager {\n /**\n * whether the context manager is enabled or not\n */\n _enabled = false;\n /**\n * @param context A context (span) to be executed within target function\n * @param target Function to be executed within the context\n */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n _bindFunction(context, target) {\n const manager = this;\n const contextWrapper = function (...args) {\n return manager.with(context, () => target.apply(this, args));\n };\n Object.defineProperty(contextWrapper, 'length', {\n enumerable: false,\n configurable: true,\n writable: false,\n value: target.length,\n });\n return contextWrapper;\n }\n /**\n * @param context A context (span) to be bind to target\n * @param obj target object on which the listeners will be patched\n */\n _bindListener(context, obj) {\n const target = obj;\n if (target.__ot_listeners !== undefined) {\n return obj;\n }\n target.__ot_listeners = {};\n if (typeof target.addEventListener === 'function') {\n target.addEventListener = this._patchAddEventListener(target, target.addEventListener, context);\n }\n if (typeof target.removeEventListener === 'function') {\n target.removeEventListener = this._patchRemoveEventListener(target, target.removeEventListener);\n }\n return obj;\n }\n /**\n * Creates a new zone\n * @param zoneName zone name\n * @param context A context (span) to be bind with Zone\n */\n _createZone(zoneName, context) {\n return Zone.current.fork({\n name: zoneName,\n properties: {\n [ZONE_CONTEXT_KEY]: context,\n },\n onCancelTask(parentZoneDelegate, currentZone, targetZone, task) {\n if (task.state === 'notScheduled' || task.state === 'running') {\n return task;\n }\n return parentZoneDelegate.cancelTask(targetZone, task);\n },\n });\n }\n /**\n * Patches addEventListener method\n * @param target any target that has \"addEventListener\" method\n * @param original reference to the patched method\n * @param [context] context to be bind to the listener\n */\n _patchAddEventListener(target, original, context) {\n const contextManager = this;\n return function (event, listener, opts) {\n if (target.__ot_listeners === undefined) {\n target.__ot_listeners = {};\n }\n let listeners = target.__ot_listeners[event];\n if (listeners === undefined) {\n listeners = new WeakMap();\n target.__ot_listeners[event] = listeners;\n }\n const patchedListener = contextManager.bind(context, listener);\n // store a weak reference of the user listener to ours\n listeners.set(listener, patchedListener);\n return original.call(this, event, patchedListener, opts);\n };\n }\n /**\n * Patches removeEventListener method\n * @param target any target that has \"removeEventListener\" method\n * @param original reference to the patched method\n */\n _patchRemoveEventListener(target, original) {\n return function (event, listener) {\n if (target.__ot_listeners === undefined ||\n target.__ot_listeners[event] === undefined) {\n return original.call(this, event, listener);\n }\n const events = target.__ot_listeners[event];\n const patchedListener = events.get(listener);\n events.delete(listener);\n return original.call(this, event, patchedListener || listener);\n };\n }\n /**\n * Returns the active context\n */\n active() {\n if (!this._enabled || !Zone.current) {\n return ROOT_CONTEXT;\n }\n return Zone.current.get(ZONE_CONTEXT_KEY) || ROOT_CONTEXT;\n }\n /**\n * Binds a the certain context or the active one to the target function and then returns the target\n * @param context A context (span) to be bind to target\n * @param target a function or event emitter. When target or one of its callbacks is called,\n * the provided context will be used as the active context for the duration of the call.\n */\n bind(context, target) {\n if (typeof target === 'function') {\n return this._bindFunction(context, target);\n }\n else if (isListenerObject(target)) {\n this._bindListener(context, target);\n }\n return target;\n }\n /**\n * Disable the context manager (clears all the contexts)\n */\n disable() {\n this._enabled = false;\n return this;\n }\n /**\n * Enables the context manager and creates a default(root) context\n */\n enable() {\n this._enabled = true;\n return this;\n }\n /**\n * Calls the callback function [fn] with the provided [context].\n * If [context] is undefined then it will use the active context.\n * The context will be set as active\n * @param context A context (span) to be called with provided callback\n * @param fn Callback function\n * @param thisArg optional receiver to be used for calling fn\n * @param args optional arguments forwarded to fn\n */\n with(context, fn, thisArg, ...args) {\n let zoneName = 'otel:with';\n if (fn.name) {\n zoneName += `:${fn.name}`;\n }\n return this._createZone(zoneName, context).run(fn, thisArg, args);\n }\n}\n//# sourceMappingURL=ZoneContextManager.js.map","'use strict';\n/**\n * @license Angular\n * (c) 2010-2026 Google LLC. https://angular.dev/\n * License: MIT\n */\nvar __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\n\n// packages/zone.js/lib/zone-impl.js\nvar global = globalThis;\nfunction __symbol__(name) {\n const symbolPrefix = global[\"__Zone_symbol_prefix\"] || \"__zone_symbol__\";\n return symbolPrefix + name;\n}\nfunction initZone() {\n const performance = global[\"performance\"];\n function mark(name) {\n performance && performance[\"mark\"] && performance[\"mark\"](name);\n }\n function performanceMeasure(name, label) {\n performance && performance[\"measure\"] && performance[\"measure\"](name, label);\n }\n mark(\"Zone\");\n const _ZoneImpl = class _ZoneImpl {\n constructor(parent, zoneSpec) {\n __publicField(this, \"_parent\");\n __publicField(this, \"_name\");\n __publicField(this, \"_properties\");\n __publicField(this, \"_zoneDelegate\");\n this._parent = parent;\n this._name = zoneSpec ? zoneSpec.name || \"unnamed\" : \"<root>\";\n this._properties = zoneSpec && zoneSpec.properties || {};\n this._zoneDelegate = new _ZoneDelegate(this, this._parent && this._parent._zoneDelegate, zoneSpec);\n }\n static assertZonePatched() {\n if (global[\"Promise\"] !== patches[\"ZoneAwarePromise\"]) {\n 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.)\");\n }\n }\n static get root() {\n let zone = _ZoneImpl.current;\n while (zone.parent) {\n zone = zone.parent;\n }\n return zone;\n }\n static get current() {\n return _currentZoneFrame.zone;\n }\n static get currentTask() {\n return _currentTask;\n }\n static __load_patch(name, fn, ignoreDuplicate = false) {\n if (patches.hasOwnProperty(name)) {\n const checkDuplicate = global[__symbol__(\"forceDuplicateZoneCheck\")] === true;\n if (!ignoreDuplicate && checkDuplicate) {\n throw Error(\"Already loaded patch: \" + name);\n }\n } else if (!global[\"__Zone_disable_\" + name]) {\n const perfName = \"Zone:\" + name;\n mark(perfName);\n patches[name] = fn(global, _ZoneImpl, _api);\n performanceMeasure(perfName, perfName);\n }\n }\n get parent() {\n return this._parent;\n }\n get name() {\n return this._name;\n }\n get(key) {\n const zone = this.getZoneWith(key);\n if (zone)\n return zone._properties[key];\n }\n getZoneWith(key) {\n let current = this;\n while (current) {\n if (current._properties.hasOwnProperty(key)) {\n return current;\n }\n current = current._parent;\n }\n return null;\n }\n fork(zoneSpec) {\n if (!zoneSpec)\n throw new Error(\"ZoneSpec required!\");\n return this._zoneDelegate.fork(this, zoneSpec);\n }\n wrap(callback, source) {\n if (typeof callback !== \"function\") {\n throw new Error(\"Expecting function got: \" + callback);\n }\n const _callback = this._zoneDelegate.intercept(this, callback, source);\n const zone = this;\n return function() {\n return zone.runGuarded(_callback, this, arguments, source);\n };\n }\n run(callback, applyThis, applyArgs, source) {\n _currentZoneFrame = { parent: _currentZoneFrame, zone: this };\n try {\n return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);\n } finally {\n _currentZoneFrame = _currentZoneFrame.parent;\n }\n }\n runGuarded(callback, applyThis = null, applyArgs, source) {\n _currentZoneFrame = { parent: _currentZoneFrame, zone: this };\n try {\n try {\n return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);\n } catch (error) {\n if (this._zoneDelegate.handleError(this, error)) {\n throw error;\n }\n }\n } finally {\n _currentZoneFrame = _currentZoneFrame.parent;\n }\n }\n runTask(task, applyThis, applyArgs) {\n if (task.zone != this) {\n throw new Error(\"A task can only be run in the zone of creation! (Creation: \" + (task.zone || NO_ZONE).name + \"; Execution: \" + this.name + \")\");\n }\n const zoneTask = task;\n const { type, data: { isPeriodic = false, isRefreshable = false } = {} } = task;\n if (task.state === notScheduled && (type === eventTask || type === macroTask)) {\n return;\n }\n const reEntryGuard = task.state != running;\n reEntryGuard && zoneTask._transitionTo(running, scheduled);\n const previousTask = _currentTask;\n _currentTask = zoneTask;\n _currentZoneFrame = { parent: _currentZoneFrame, zone: this };\n try {\n if (type == macroTask && task.data && !isPeriodic && !isRefreshable) {\n task.cancelFn = void 0;\n }\n try {\n return this._zoneDelegate.invokeTask(this, zoneTask, applyThis, applyArgs);\n } catch (error) {\n if (this._zoneDelegate.handleError(this, error)) {\n throw error;\n }\n }\n } finally {\n const state = task.state;\n if (state !== notScheduled && state !== unknown) {\n if (type == eventTask || isPeriodic || isRefreshable && state === scheduling) {\n reEntryGuard && zoneTask._transitionTo(scheduled, running, scheduling);\n } else {\n const zoneDelegates = zoneTask._zoneDelegates;\n this._updateTaskCount(zoneTask, -1);\n reEntryGuard && zoneTask._transitionTo(notScheduled, running, notScheduled);\n if (isRefreshable) {\n zoneTask._zoneDelegates = zoneDelegates;\n }\n }\n }\n _currentZoneFrame = _currentZoneFrame.parent;\n _currentTask = previousTask;\n }\n }\n scheduleTask(task) {\n if (task.zone && task.zone !== this) {\n let newZone = this;\n while (newZone) {\n if (newZone === task.zone) {\n throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${task.zone.name}`);\n }\n newZone = newZone.parent;\n }\n }\n task._transitionTo(scheduling, notScheduled);\n const zoneDelegates = [];\n task._zoneDelegates = zoneDelegates;\n task._zone = this;\n try {\n task = this._zoneDelegate.scheduleTask(this, task);\n } catch (err) {\n task._transitionTo(unknown, scheduling, notScheduled);\n this._zoneDelegate.handleError(this, err);\n throw err;\n }\n if (task._zoneDelegates === zoneDelegates) {\n this._updateTaskCount(task, 1);\n }\n if (task.state == scheduling) {\n task._transitionTo(scheduled, scheduling);\n }\n return task;\n }\n scheduleMicroTask(source, callback, data, customSchedule) {\n return this.scheduleTask(new ZoneTask(microTask, source, callback, data, customSchedule, void 0));\n }\n scheduleMacroTask(source, callback, data, customSchedule, customCancel) {\n return this.scheduleTask(new ZoneTask(macroTask, source, callback, data, customSchedule, customCancel));\n }\n scheduleEventTask(source, callback, data, customSchedule, customCancel) {\n return this.scheduleTask(new ZoneTask(eventTask, source, callback, data, customSchedule, customCancel));\n }\n cancelTask(task) {\n if (task.zone != this)\n throw new Error(\"A task can only be cancelled in the zone of creation! (Creation: \" + (task.zone || NO_ZONE).name + \"; Execution: \" + this.name + \")\");\n if (task.state !== scheduled && task.state !== running) {\n return;\n }\n task._transitionTo(canceling, scheduled, running);\n try {\n this._zoneDelegate.cancelTask(this, task);\n } catch (err) {\n task._transitionTo(unknown, canceling);\n this._zoneDelegate.handleError(this, err);\n throw err;\n }\n this._updateTaskCount(task, -1);\n task._transitionTo(notScheduled, canceling);\n task.runCount = -1;\n return task;\n }\n _updateTaskCount(task, count) {\n const zoneDelegates = task._zoneDelegates;\n if (count == -1) {\n task._zoneDelegates = null;\n }\n for (let i = 0; i < zoneDelegates.length; i++) {\n zoneDelegates[i]._updateTaskCount(task.type, count);\n }\n }\n };\n __publicField(_ZoneImpl, \"__symbol__\", __symbol__);\n let ZoneImpl = _ZoneImpl;\n const DELEGATE_ZS = {\n name: \"\",\n onHasTask: (delegate, _, target, hasTaskState) => delegate.hasTask(target, hasTaskState),\n onScheduleTask: (delegate, _, target, task) => delegate.scheduleTask(target, task),\n onInvokeTask: (delegate, _, target, task, applyThis, applyArgs) => delegate.invokeTask(target, task, applyThis, applyArgs),\n onCancelTask: (delegate, _, target, task) => delegate.cancelTask(target, task)\n };\n class _ZoneDelegate {\n constructor(zone, parentDelegate, zoneSpec) {\n __publicField(this, \"_zone\");\n __publicField(this, \"_taskCounts\", {\n \"microTask\": 0,\n \"macroTask\": 0,\n \"eventTask\": 0\n });\n __publicField(this, \"_forkDlgt\");\n __publicField(this, \"_forkZS\");\n __publicField(this, \"_forkCurrZone\");\n __publicField(this, \"_interceptDlgt\");\n __publicField(this, \"_interceptZS\");\n __publicField(this, \"_interceptCurrZone\");\n __publicField(this, \"_invokeDlgt\");\n __publicField(this, \"_invokeZS\");\n __publicField(this, \"_invokeCurrZone\");\n __publicField(this, \"_handleErrorDlgt\");\n __publicField(this, \"_handleErrorZS\");\n __publicField(this, \"_handleErrorCurrZone\");\n __publicField(this, \"_scheduleTaskDlgt\");\n __publicField(this, \"_scheduleTaskZS\");\n __publicField(this, \"_scheduleTaskCurrZone\");\n __publicField(this, \"_invokeTaskDlgt\");\n __publicField(this, \"_invokeTaskZS\");\n __publicField(this, \"_invokeTaskCurrZone\");\n __publicField(this, \"_cancelTaskDlgt\");\n __publicField(this, \"_cancelTaskZS\");\n __publicField(this, \"_cancelTaskCurrZone\");\n __publicField(this, \"_hasTaskDlgt\");\n __publicField(this, \"_hasTaskDlgtOwner\");\n __publicField(this, \"_hasTaskZS\");\n __publicField(this, \"_hasTaskCurrZone\");\n this._zone = zone;\n this._forkZS = zoneSpec && (zoneSpec && zoneSpec.onFork ? zoneSpec : parentDelegate._forkZS);\n this._forkDlgt = zoneSpec && (zoneSpec.onFork ? parentDelegate : parentDelegate._forkDlgt);\n this._forkCurrZone = zoneSpec && (zoneSpec.onFork ? this._zone : parentDelegate._forkCurrZone);\n this._interceptZS = zoneSpec && (zoneSpec.onIntercept ? zoneSpec : parentDelegate._interceptZS);\n this._interceptDlgt = zoneSpec && (zoneSpec.onIntercept ? parentDelegate : parentDelegate._interceptDlgt);\n this._interceptCurrZone = zoneSpec && (zoneSpec.onIntercept ? this._zone : parentDelegate._interceptCurrZone);\n this._invokeZS = zoneSpec && (zoneSpec.onInvoke ? zoneSpec : parentDelegate._invokeZS);\n this._invokeDlgt = zoneSpec && (zoneSpec.onInvoke ? parentDelegate : parentDelegate._invokeDlgt);\n this._invokeCurrZone = zoneSpec && (zoneSpec.onInvoke ? this._zone : parentDelegate._invokeCurrZone);\n this._handleErrorZS = zoneSpec && (zoneSpec.onHandleError ? zoneSpec : parentDelegate._handleErrorZS);\n this._handleErrorDlgt = zoneSpec && (zoneSpec.onHandleError ? parentDelegate : parentDelegate._handleErrorDlgt);\n this._handleErrorCurrZone = zoneSpec && (zoneSpec.onHandleError ? this._zone : parentDelegate._handleErrorCurrZone);\n this._scheduleTaskZS = zoneSpec && (zoneSpec.onScheduleTask ? zoneSpec : parentDelegate._scheduleTaskZS);\n this._scheduleTaskDlgt = zoneSpec && (zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);\n this._scheduleTaskCurrZone = zoneSpec && (zoneSpec.onScheduleTask ? this._zone : parentDelegate._scheduleTaskCurrZone);\n this._invokeTaskZS = zoneSpec && (zoneSpec.onInvokeTask ? zoneSpec : parentDelegate._invokeTaskZS);\n this._invokeTaskDlgt = zoneSpec && (zoneSpec.onInvokeTask ? parentDelegate : parentDelegate._invokeTaskDlgt);\n this._invokeTaskCurrZone = zoneSpec && (zoneSpec.onInvokeTask ? this._zone : parentDelegate._invokeTaskCurrZone);\n this._cancelTaskZS = zoneSpec && (zoneSpec.onCancelTask ? zoneSpec : parentDelegate._cancelTaskZS);\n this._cancelTaskDlgt = zoneSpec && (zoneSpec.onCancelTask ? parentDelegate : parentDelegate._cancelTaskDlgt);\n this._cancelTaskCurrZone = zoneSpec && (zoneSpec.onCancelTask ? this._zone : parentDelegate._cancelTaskCurrZone);\n this._hasTaskZS = null;\n this._hasTaskDlgt = null;\n this._hasTaskDlgtOwner = null;\n this._hasTaskCurrZone = null;\n const zoneSpecHasTask = zoneSpec && zoneSpec.onHasTask;\n const parentHasTask = parentDelegate && parentDelegate._hasTaskZS;\n if (zoneSpecHasTask || parentHasTask) {\n this._hasTaskZS = zoneSpecHasTask ? zoneSpec : DELEGATE_ZS;\n this._hasTaskDlgt = parentDelegate;\n this._hasTaskDlgtOwner = this;\n this._hasTaskCurrZone = this._zone;\n if (!zoneSpec.onScheduleTask) {\n this._scheduleTaskZS = DELEGATE_ZS;\n this._scheduleTaskDlgt = parentDelegate;\n this._scheduleTaskCurrZone = this._zone;\n }\n if (!zoneSpec.onInvokeTask) {\n this._invokeTaskZS = DELEGATE_ZS;\n this._invokeTaskDlgt = parentDelegate;\n this._invokeTaskCurrZone = this._zone;\n }\n if (!zoneSpec.onCancelTask) {\n this._cancelTaskZS = DELEGATE_ZS;\n this._cancelTaskDlgt = parentDelegate;\n this._cancelTaskCurrZone = this._zone;\n }\n }\n }\n get zone() {\n return this._zone;\n }\n fork(targetZone, zoneSpec) {\n return this._forkZS ? this._forkZS.onFork(this._forkDlgt, this.zone, targetZone, zoneSpec) : new ZoneImpl(targetZone, zoneSpec);\n }\n intercept(targetZone, callback, source) {\n return this._interceptZS ? this._interceptZS.onIntercept(this._interceptDlgt, this._interceptCurrZone, targetZone, callback, source) : callback;\n }\n invoke(targetZone, callback, applyThis, applyArgs, source) {\n return this._invokeZS ? this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) : callback.apply(applyThis, applyArgs);\n }\n handleError(targetZone, error) {\n return this._handleErrorZS ? this._handleErrorZS.onHandleError(this._handleErrorDlgt, this._handleErrorCurrZone, targetZone, error) : true;\n }\n scheduleTask(targetZone, task) {\n let returnTask = task;\n if (this._scheduleTaskZS) {\n if (this._hasTaskZS) {\n returnTask._zoneDelegates.push(this._hasTaskDlgtOwner);\n }\n returnTask = this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt, this._scheduleTaskCurrZone, targetZone, task);\n if (!returnTask)\n returnTask = task;\n } else {\n if (task.scheduleFn) {\n task.scheduleFn(task);\n } else if (task.type == microTask) {\n scheduleMicroTask(task);\n } else {\n throw new Error(\"Task is missing scheduleFn.\");\n }\n }\n return returnTask;\n }\n invokeTask(targetZone, task, applyThis, applyArgs) {\n return this._invokeTaskZS ? this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) : task.callback.apply(applyThis, applyArgs);\n }\n cancelTask(targetZone, task) {\n let value;\n if (this._cancelTaskZS) {\n value = this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt, this._cancelTaskCurrZone, targetZone, task);\n } else {\n if (!task.cancelFn) {\n throw Error(\"Task is not cancelable\");\n }\n value = task.cancelFn(task);\n }\n return value;\n }\n hasTask(targetZone, isEmpty) {\n try {\n this._hasTaskZS && this._hasTaskZS.onHasTask(this._hasTaskDlgt, this._hasTaskCurrZone, targetZone, isEmpty);\n } catch (err) {\n this.handleError(targetZone, err);\n }\n }\n _updateTaskCount(type, count) {\n const counts = this._taskCounts;\n const prev = counts[type];\n const next = counts[type] = prev + count;\n if (next < 0) {\n throw new Error(\"More tasks executed then were scheduled.\");\n }\n if (prev == 0 || next == 0) {\n const isEmpty = {\n microTask: counts[\"microTask\"] > 0,\n macroTask: counts[\"macroTask\"] > 0,\n eventTask: counts[\"eventTask\"] > 0,\n change: type\n };\n this.hasTask(this._zone, isEmpty);\n }\n }\n }\n class ZoneTask {\n constructor(type, source, callback, options, scheduleFn, cancelFn) {\n __publicField(this, \"type\");\n __publicField(this, \"source\");\n __publicField(this, \"invoke\");\n __publicField(this, \"callback\");\n __publicField(this, \"data\");\n __publicField(this, \"scheduleFn\");\n __publicField(this, \"cancelFn\");\n __publicField(this, \"_zone\", null);\n __publicField(this, \"runCount\", 0);\n __publicField(this, \"_zoneDelegates\", null);\n __publicField(this, \"_state\", \"notScheduled\");\n this.type = type;\n this.source = source;\n this.data = options;\n this.scheduleFn = scheduleFn;\n this.cancelFn = cancelFn;\n if (!callback) {\n throw new Error(\"callback is not defined\");\n }\n this.callback = callback;\n const self2 = this;\n if (type === eventTask && options && options.useG) {\n this.invoke = ZoneTask.invokeTask;\n } else {\n this.invoke = function() {\n return ZoneTask.invokeTask.call(global, self2, this, arguments);\n };\n }\n }\n static invokeTask(task, target, args) {\n if (!task) {\n task = this;\n }\n _numberOfNestedTaskFrames++;\n try {\n task.runCount++;\n return task.zone.runTask(task, target, args);\n } finally {\n if (_numberOfNestedTaskFrames === 1 && !global[enableNativeMicrotaskDraining]) {\n drainMicroTaskQueueSynchronously();\n }\n _numberOfNestedTaskFrames--;\n }\n }\n get zone() {\n return this._zone;\n }\n get state() {\n return this._state;\n }\n cancelScheduleRequest() {\n this._transitionTo(notScheduled, scheduling);\n }\n _transitionTo(toState, fromState1, fromState2) {\n if (this._state === fromState1 || this._state === fromState2) {\n this._state = toState;\n if (toState == notScheduled) {\n this._zoneDelegates = null;\n }\n } else {\n throw new Error(`${this.type} '${this.source}': can not transition to '${toState}', expecting state '${fromState1}'${fromState2 ? \" or '\" + fromState2 + \"'\" : \"\"}, was '${this._state}'.`);\n }\n }\n toString() {\n if (this.data && typeof this.data.handleId !== \"undefined\") {\n return this.data.handleId.toString();\n } else {\n return Object.prototype.toString.call(this);\n }\n }\n // add toJSON method to prevent cyclic error when\n // call JSON.stringify(zoneTask)\n toJSON() {\n return {\n type: this.type,\n state: this.state,\n source: this.source,\n zone: this.zone.name,\n runCount: this.runCount\n };\n }\n }\n const symbolSetTimeout = __symbol__(\"setTimeout\");\n const symbolPromise = __symbol__(\"Promise\");\n const symbolThen = __symbol__(\"then\");\n const enableNativeMicrotaskDraining = __symbol__(\"enable_native_microtask_draining\");\n let _microTaskQueue = [];\n let _isDrainingMicrotaskQueue = false;\n let nativeMicroTaskQueuePromise;\n function nativeScheduleMicroTask(func) {\n var _a;\n if (!nativeMicroTaskQueuePromise && global[symbolPromise]) {\n nativeMicroTaskQueuePromise = global[symbolPromise].resolve(0);\n }\n if (nativeMicroTaskQueuePromise) {\n const thenFn = (_a = nativeMicroTaskQueuePromise[symbolThen]) != null ? _a : nativeMicroTaskQueuePromise[\"then\"];\n thenFn.call(nativeMicroTaskQueuePromise, func);\n } else {\n global[symbolSetTimeout](func, 0);\n }\n }\n function scheduleMicroTask(task) {\n const isNativeDrainingEnabled = global[enableNativeMicrotaskDraining];\n const shouldDrainWithNative = isNativeDrainingEnabled && _microTaskQueue.length === 0 && !_isDrainingMicrotaskQueue;\n const shouldDrainWithoutNative = !isNativeDrainingEnabled && _numberOfNestedTaskFrames === 0 && _microTaskQueue.length === 0;\n if (shouldDrainWithNative || shouldDrainWithoutNative) {\n nativeScheduleMicroTask(drainMicroTaskQueueSynchronously);\n }\n if (task) {\n _microTaskQueue.push(task);\n }\n }\n function drainMicroTaskQueueSynchronously() {\n if (_isDrainingMicrotaskQueue) {\n return;\n }\n _isDrainingMicrotaskQueue = true;\n while (_microTaskQueue.length) {\n const queue = _microTaskQueue;\n _microTaskQueue = [];\n for (const task of queue) {\n try {\n task.zone.runTask(task, null, null);\n } catch (error) {\n _api.onUnhandledError(error);\n }\n }\n }\n if (global[enableNativeMicrotaskDraining]) {\n _isDrainingMicrotaskQueue = false;\n _api.microtaskDrainDone();\n } else {\n _api.microtaskDrainDone();\n _isDrainingMicrotaskQueue = false;\n }\n }\n const NO_ZONE = { name: \"NO ZONE\" };\n const notScheduled = \"notScheduled\", scheduling = \"scheduling\", scheduled = \"scheduled\", running = \"running\", canceling = \"canceling\", unknown = \"unknown\";\n const microTask = \"microTask\", macroTask = \"macroTask\", eventTask = \"eventTask\";\n const patches = {};\n const _api = {\n symbol: __symbol__,\n currentZoneFrame: () => _currentZoneFrame,\n onUnhandledError: noop,\n microtaskDrainDone: noop,\n scheduleMicroTask,\n showUncaughtError: () => !ZoneImpl[__symbol__(\"ignoreConsoleErrorUncaughtError\")],\n patchEventTarget: () => [],\n patchOnProperties: noop,\n patchMethod: () => noop,\n bindArguments: () => [],\n patchThen: () => noop,\n patchMacroTask: () => noop,\n patchEventPrototype: () => noop,\n getGlobalObjects: () => void 0,\n ObjectDefineProperty: () => noop,\n ObjectGetOwnPropertyDescriptor: () => void 0,\n ObjectCreate: () => void 0,\n ArraySlice: () => [],\n patchClass: () => noop,\n wrapWithCurrentZone: () => noop,\n filterProperties: () => [],\n attachOriginToPatched: () => noop,\n _redefineProperty: () => noop,\n patchCallbacks: () => noop,\n nativeScheduleMicroTask\n };\n let _currentZoneFrame = { parent: null, zone: new ZoneImpl(null, null) };\n let _currentTask = null;\n let _numberOfNestedTaskFrames = 0;\n function noop() {\n }\n performanceMeasure(\"Zone\", \"Zone\");\n return ZoneImpl;\n}\n\n// packages/zone.js/lib/zone.js\nfunction loadZone() {\n var _a;\n const global2 = globalThis;\n const checkDuplicate = global2[__symbol__(\"forceDuplicateZoneCheck\")] === true;\n if (global2[\"Zone\"] && (checkDuplicate || typeof global2[\"Zone\"].__symbol__ !== \"function\")) {\n throw new Error(\"Zone already loaded.\");\n }\n (_a = global2[\"Zone\"]) != null ? _a : global2[\"Zone\"] = initZone();\n return global2[\"Zone\"];\n}\n\n// packages/zone.js/lib/common/utils.js\nvar ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar ObjectDefineProperty = Object.defineProperty;\nvar ObjectGetPrototypeOf = Object.getPrototypeOf;\nvar ObjectCreate = Object.create;\nvar ArraySlice = Array.prototype.slice;\nvar ADD_EVENT_LISTENER_STR = \"addEventListener\";\nvar REMOVE_EVENT_LISTENER_STR = \"removeEventListener\";\nvar ZONE_SYMBOL_ADD_EVENT_LISTENER = __symbol__(ADD_EVENT_LISTENER_STR);\nvar ZONE_SYMBOL_REMOVE_EVENT_LISTENER = __symbol__(REMOVE_EVENT_LISTENER_STR);\nvar TRUE_STR = \"true\";\nvar FALSE_STR = \"false\";\nvar ZONE_SYMBOL_PREFIX = __symbol__(\"\");\nfunction wrapWithCurrentZone(callback, source) {\n return Zone.current.wrap(callback, source);\n}\nfunction scheduleMacroTaskWithCurrentZone(source, callback, data, customSchedule, customCancel) {\n return Zone.current.scheduleMacroTask(source, callback, data, customSchedule, customCancel);\n}\nvar zoneSymbol = __symbol__;\nvar isWindowExists = typeof window !== \"undefined\";\nvar internalWindow = isWindowExists ? window : void 0;\nvar _global = isWindowExists && internalWindow || globalThis;\nvar REMOVE_ATTRIBUTE = \"removeAttribute\";\nfunction bindArguments(args, source) {\n for (let i = args.length - 1; i >= 0; i--) {\n if (typeof args[i] === \"function\") {\n args[i] = wrapWithCurrentZone(args[i], source + \"_\" + i);\n }\n }\n return args;\n}\nfunction patchPrototype(prototype, fnNames) {\n const source = prototype.constructor[\"name\"];\n for (let i = 0; i < fnNames.length; i++) {\n const name = fnNames[i];\n const delegate = prototype[name];\n if (delegate) {\n const prototypeDesc = ObjectGetOwnPropertyDescriptor(prototype, name);\n if (!isPropertyWritable(prototypeDesc)) {\n continue;\n }\n prototype[name] = ((delegate2) => {\n const patched = function() {\n return delegate2.apply(this, bindArguments(arguments, source + \".\" + name));\n };\n attachOriginToPatched(patched, delegate2);\n return patched;\n })(delegate);\n }\n }\n}\nfunction isPropertyWritable(propertyDesc) {\n if (!propertyDesc) {\n return true;\n }\n if (propertyDesc.writable === false) {\n return false;\n }\n return !(typeof propertyDesc.get === \"function\" && typeof propertyDesc.set === \"undefined\");\n}\nvar isWebWorker = typeof WorkerGlobalScope !== \"undefined\" && self instanceof WorkerGlobalScope;\nvar isNode = !(\"nw\" in _global) && typeof _global.process !== \"undefined\" && _global.process.toString() === \"[object process]\";\nvar isBrowser = !isNode && !isWebWorker && !!(isWindowExists && internalWindow[\"HTMLElement\"]);\nvar isMix = typeof _global.process !== \"undefined\" && _global.process.toString() === \"[object process]\" && !isWebWorker && !!(isWindowExists && internalWindow[\"HTMLElement\"]);\nvar zoneSymbolEventNames = {};\nvar enableBeforeunloadSymbol = zoneSymbol(\"enable_beforeunload\");\nvar wrapFn = function(event) {\n event = event || _global.event;\n if (!event) {\n return;\n }\n let eventNameSymbol = zoneSymbolEventNames[event.type];\n if (!eventNameSymbol) {\n eventNameSymbol = zoneSymbolEventNames[event.type] = zoneSymbol(\"ON_PROPERTY\" + event.type);\n }\n const target = this || event.target || _global;\n const listener = target[eventNameSymbol];\n let result;\n if (isBrowser && target === internalWindow && event.type === \"error\") {\n const errorEvent = event;\n result = listener && listener.call(this, errorEvent.message, errorEvent.filename, errorEvent.lineno, errorEvent.colno, errorEvent.error);\n if (result === true) {\n event.preventDefault();\n }\n } else {\n result = listener && listener.apply(this, arguments);\n if (\n // https://github.com/angular/angular/issues/47579\n // https://www.w3.org/TR/2011/WD-html5-20110525/history.html#beforeunloadevent\n // This is the only specific case we should check for. The spec defines that the\n // `returnValue` attribute represents the message to show the user. When the event\n // is created, this attribute must be set to the empty string.\n event.type === \"beforeunload\" && // To prevent any breaking changes resulting from this change, given that\n // it was already causing a significant number of failures in G3, we have hidden\n // that behavior behind a global configuration flag. Consumers can enable this\n // flag explicitly if they want the `beforeunload` event to be handled as defined\n // in the specification.\n _global[enableBeforeunloadSymbol] && // The IDL event definition is `attribute DOMString returnValue`, so we check whether\n // `typeof result` is a string.\n typeof result === \"string\"\n ) {\n event.returnValue = result;\n } else if (result != void 0 && !result) {\n event.preventDefault();\n }\n }\n return result;\n};\nfunction patchProperty(obj, prop, prototype) {\n let desc = ObjectGetOwnPropertyDescriptor(obj, prop);\n if (!desc && prototype) {\n const prototypeDesc = ObjectGetOwnPropertyDescriptor(prototype, prop);\n if (prototypeDesc) {\n desc = { enumerable: true, configurable: true };\n }\n }\n if (!desc || !desc.configurable) {\n return;\n }\n const onPropPatchedSymbol = zoneSymbol(\"on\" + prop + \"patched\");\n if (obj.hasOwnProperty(onPropPatchedSymbol) && obj[onPropPatchedSymbol]) {\n return;\n }\n delete desc.writable;\n delete desc.value;\n const originalDescGet = desc.get;\n const originalDescSet = desc.set;\n const eventName = prop.slice(2);\n let eventNameSymbol = zoneSymbolEventNames[eventName];\n if (!eventNameSymbol) {\n eventNameSymbol = zoneSymbolEventNames[eventName] = zoneSymbol(\"ON_PROPERTY\" + eventName);\n }\n desc.set = function(newValue) {\n let target = this;\n if (!target && obj === _global) {\n target = _global;\n }\n if (!target) {\n return;\n }\n const previousValue = target[eventNameSymbol];\n if (typeof previousValue === \"function\") {\n target.removeEventListener(eventName, wrapFn);\n }\n originalDescSet == null ? void 0 : originalDescSet.call(target, null);\n target[eventNameSymbol] = newValue;\n if (typeof newValue === \"function\") {\n target.addEventListener(eventName, wrapFn, false);\n }\n };\n desc.get = function() {\n let target = this;\n if (!target && obj === _global) {\n target = _global;\n }\n if (!target) {\n return null;\n }\n const listener = target[eventNameSymbol];\n if (listener) {\n return listener;\n } else if (originalDescGet) {\n let value = originalDescGet.call(this);\n if (value) {\n desc.set.call(this, value);\n if (typeof target[REMOVE_ATTRIBUTE] === \"function\") {\n target.removeAttribute(prop);\n }\n return value;\n }\n }\n return null;\n };\n ObjectDefineProperty(obj, prop, desc);\n obj[onPropPatchedSymbol] = true;\n}\nfunction patchOnProperties(obj, properties, prototype) {\n if (properties) {\n for (let i = 0; i < properties.length; i++) {\n patchProperty(obj, \"on\" + properties[i], prototype);\n }\n } else {\n const onProperties = [];\n for (const prop in obj) {\n if (prop.slice(0, 2) == \"on\") {\n onProperties.push(prop);\n }\n }\n for (let j = 0; j < onProperties.length; j++) {\n patchProperty(obj, onProperties[j], prototype);\n }\n }\n}\nvar originalInstanceKey = zoneSymbol(\"originalInstance\");\nfunction patchClass(className) {\n const OriginalClass = _global[className];\n if (!OriginalClass)\n return;\n _global[zoneSymbol(className)] = OriginalClass;\n _global[className] = function() {\n const a = bindArguments(arguments, className);\n switch (a.length) {\n case 0:\n this[originalInstanceKey] = new OriginalClass();\n break;\n case 1:\n this[originalInstanceKey] = new OriginalClass(a[0]);\n break;\n case 2:\n this[originalInstanceKey] = new OriginalClass(a[0], a[1]);\n break;\n case 3:\n this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2]);\n break;\n case 4:\n this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2], a[3]);\n break;\n default:\n throw new Error(\"Arg list too long.\");\n }\n };\n attachOriginToPatched(_global[className], OriginalClass);\n const instance = new OriginalClass(function() {\n });\n let prop;\n for (prop in instance) {\n if (className === \"XMLHttpRequest\" && prop === \"responseBlob\")\n continue;\n (function(prop2) {\n if (typeof instance[prop2] === \"function\") {\n _global[className].prototype[prop2] = function() {\n return this[originalInstanceKey][prop2].apply(this[originalInstanceKey], arguments);\n };\n } else {\n ObjectDefineProperty(_global[className].prototype, prop2, {\n set: function(fn) {\n if (typeof fn === \"function\") {\n this[originalInstanceKey][prop2] = wrapWithCurrentZone(fn, className + \".\" + prop2);\n attachOriginToPatched(this[originalInstanceKey][prop2], fn);\n } else {\n this[originalInstanceKey][prop2] = fn;\n }\n },\n get: function() {\n return this[originalInstanceKey][prop2];\n }\n });\n }\n })(prop);\n }\n for (prop in OriginalClass) {\n if (prop !== \"prototype\" && OriginalClass.hasOwnProperty(prop)) {\n _global[className][prop] = OriginalClass[prop];\n }\n }\n}\nfunction copySymbolProperties(src, dest) {\n if (typeof Object.getOwnPropertySymbols !== \"function\") {\n return;\n }\n const symbols = Object.getOwnPropertySymbols(src);\n symbols.forEach((symbol) => {\n const desc = Object.getOwnPropertyDescriptor(src, symbol);\n Object.defineProperty(dest, symbol, {\n get: function() {\n return src[symbol];\n },\n set: function(value) {\n if (desc && (!desc.writable || typeof desc.set !== \"function\")) {\n return;\n }\n src[symbol] = value;\n },\n enumerable: desc ? desc.enumerable : true,\n configurable: desc ? desc.configurable : true\n });\n });\n}\nvar shouldCopySymbolProperties = false;\nfunction patchMethod(target, name, patchFn) {\n let proto = target;\n while (proto && !proto.hasOwnProperty(name)) {\n proto = ObjectGetPrototypeOf(proto);\n }\n if (!proto && target[name]) {\n proto = target;\n }\n const delegateName = zoneSymbol(name);\n let delegate = null;\n if (proto && (!(delegate = proto[delegateName]) || !proto.hasOwnProperty(delegateName))) {\n delegate = proto[delegateName] = proto[name];\n const desc = proto && ObjectGetOwnPropertyDescriptor(proto, name);\n if (isPropertyWritable(desc)) {\n const patchDelegate = patchFn(delegate, delegateName, name);\n proto[name] = function() {\n return patchDelegate(this, arguments);\n };\n attachOriginToPatched(proto[name], delegate);\n if (shouldCopySymbolProperties) {\n copySymbolProperties(delegate, proto[name]);\n }\n }\n }\n return delegate;\n}\nfunction patchMacroTask(obj, funcName, metaCreator) {\n let setNative = null;\n function scheduleTask(task) {\n const data = task.data;\n data.args[data.cbIdx] = function() {\n task.invoke.apply(this, arguments);\n };\n setNative.apply(data.target, data.args);\n return task;\n }\n setNative = patchMethod(obj, funcName, (delegate) => function(self2, args) {\n const meta = metaCreator(self2, args);\n if (meta.cbIdx >= 0 && typeof args[meta.cbIdx] === \"function\") {\n return scheduleMacroTaskWithCurrentZone(meta.name, args[meta.cbIdx], meta, scheduleTask);\n } else {\n return delegate.apply(self2, args);\n }\n });\n}\nfunction attachOriginToPatched(patched, original) {\n patched[zoneSymbol(\"OriginalDelegate\")] = original;\n}\nfunction isFunction(value) {\n return typeof value === \"function\";\n}\nfunction isNumber(value) {\n return typeof value === \"number\";\n}\n\n// packages/zone.js/lib/common/events.js\nvar OPTIMIZED_ZONE_EVENT_TASK_DATA = {\n useG: true\n};\nvar zoneSymbolEventNames2 = {};\nvar globalSources = {};\nvar EVENT_NAME_SYMBOL_REGX = new RegExp(\"^\" + ZONE_SYMBOL_PREFIX + \"(\\\\w+)(true|false)$\");\nvar IMMEDIATE_PROPAGATION_SYMBOL = zoneSymbol(\"propagationStopped\");\nfunction prepareEventNames(eventName, eventNameToString) {\n const falseEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + FALSE_STR;\n const trueEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + TRUE_STR;\n const symbol = ZONE_SYMBOL_PREFIX + falseEventName;\n const symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;\n zoneSymbolEventNames2[eventName] = {};\n zoneSymbolEventNames2[eventName][FALSE_STR] = symbol;\n zoneSymbolEventNames2[eventName][TRUE_STR] = symbolCapture;\n}\nfunction patchEventTarget(_global2, api, apis, patchOptions) {\n const ADD_EVENT_LISTENER = patchOptions && patchOptions.add || ADD_EVENT_LISTENER_STR;\n const REMOVE_EVENT_LISTENER = patchOptions && patchOptions.rm || REMOVE_EVENT_LISTENER_STR;\n const LISTENERS_EVENT_LISTENER = patchOptions && patchOptions.listeners || \"eventListeners\";\n const REMOVE_ALL_LISTENERS_EVENT_LISTENER = patchOptions && patchOptions.rmAll || \"removeAllListeners\";\n const zoneSymbolAddEventListener = zoneSymbol(ADD_EVENT_LISTENER);\n const ADD_EVENT_LISTENER_SOURCE = \".\" + ADD_EVENT_LISTENER + \":\";\n const PREPEND_EVENT_LISTENER = \"prependListener\";\n const PREPEND_EVENT_LISTENER_SOURCE = \".\" + PREPEND_EVENT_LISTENER + \":\";\n const invokeTask = function(task, target, event) {\n if (task.isRemoved) {\n return;\n }\n const delegate = task.callback;\n if (typeof delegate === \"object\" && delegate.handleEvent) {\n task.callback = (event2) => delegate.handleEvent(event2);\n task.originalDelegate = delegate;\n }\n let error;\n try {\n task.invoke(task, target, [event]);\n } catch (err) {\n error = err;\n }\n const options = task.options;\n if (options && typeof options === \"object\" && options.once) {\n const delegate2 = task.originalDelegate ? task.originalDelegate : task.callback;\n target[REMOVE_EVENT_LISTENER].call(target, event.type, delegate2, options);\n }\n return error;\n };\n function globalCallback(context, event, isCapture) {\n event = event || _global2.event;\n if (!event) {\n return;\n }\n const target = context || event.target || _global2;\n const tasks = target[zoneSymbolEventNames2[event.type][isCapture ? TRUE_STR : FALSE_STR]];\n if (tasks) {\n const errors = [];\n if (tasks.length === 1) {\n const err = invokeTask(tasks[0], target, event);\n err && errors.push(err);\n } else {\n const copyTasks = tasks.slice();\n for (let i = 0; i < copyTasks.length; i++) {\n if (event && event[IMMEDIATE_PROPAGATION_SYMBOL] === true) {\n break;\n }\n const err = invokeTask(copyTasks[i], target, event);\n err && errors.push(err);\n }\n }\n if (errors.length === 1) {\n throw errors[0];\n } else {\n for (let i = 0; i < errors.length; i++) {\n const err = errors[i];\n api.nativeScheduleMicroTask(() => {\n throw err;\n });\n }\n }\n }\n }\n const globalZoneAwareCallback = function(event) {\n return globalCallback(this, event, false);\n };\n const globalZoneAwareCaptureCallback = function(event) {\n return globalCallback(this, event, true);\n };\n function patchEventTargetMethods(obj, patchOptions2) {\n if (!obj) {\n return false;\n }\n let useGlobalCallback = true;\n if (patchOptions2 && patchOptions2.useG !== void 0) {\n useGlobalCallback = patchOptions2.useG;\n }\n const validateHandler = patchOptions2 && patchOptions2.vh;\n let checkDuplicate = true;\n if (patchOptions2 && patchOptions2.chkDup !== void 0) {\n checkDuplicate = patchOptions2.chkDup;\n }\n let returnTarget = false;\n if (patchOptions2 && patchOptions2.rt !== void 0) {\n returnTarget = patchOptions2.rt;\n }\n let proto = obj;\n while (proto && !proto.hasOwnProperty(ADD_EVENT_LISTENER)) {\n proto = ObjectGetPrototypeOf(proto);\n }\n if (!proto && obj[ADD_EVENT_LISTENER]) {\n proto = obj;\n }\n if (!proto) {\n return false;\n }\n if (proto[zoneSymbolAddEventListener]) {\n return false;\n }\n const eventNameToString = patchOptions2 && patchOptions2.eventNameToString;\n const taskData = {};\n const nativeAddEventListener = proto[zoneSymbolAddEventListener] = proto[ADD_EVENT_LISTENER];\n const nativeRemoveEventListener = proto[zoneSymbol(REMOVE_EVENT_LISTENER)] = proto[REMOVE_EVENT_LISTENER];\n const nativeListeners = proto[zoneSymbol(LISTENERS_EVENT_LISTENER)] = proto[LISTENERS_EVENT_LISTENER];\n const nativeRemoveAllListeners = proto[zoneSymbol(REMOVE_ALL_LISTENERS_EVENT_LISTENER)] = proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER];\n let nativePrependEventListener;\n if (patchOptions2 && patchOptions2.prepend) {\n nativePrependEventListener = proto[zoneSymbol(patchOptions2.prepend)] = proto[patchOptions2.prepend];\n }\n function buildEventListenerOptions(options, passive) {\n if (!passive) {\n return options;\n }\n if (typeof options === \"boolean\") {\n return { capture: options, passive: true };\n }\n if (!options) {\n return { passive: true };\n }\n if (typeof options === \"object\" && options.passive !== false) {\n return __spreadProps(__spreadValues({}, options), { passive: true });\n }\n return options;\n }\n const customScheduleGlobal = function(task) {\n if (taskData.isExisting) {\n return;\n }\n return nativeAddEventListener.call(taskData.target, taskData.eventName, taskData.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, taskData.options);\n };\n const customCancelGlobal = function(task) {\n if (!task.isRemoved) {\n const symbolEventNames = zoneSymbolEventNames2[task.eventName];\n let symbolEventName;\n if (symbolEventNames) {\n symbolEventName = symbolEventNames[task.capture ? TRUE_STR : FALSE_STR];\n }\n const existingTasks = symbolEventName && task.target[symbolEventName];\n if (existingTasks) {\n for (let i = 0; i < existingTasks.length; i++) {\n const existingTask = existingTasks[i];\n if (existingTask === task) {\n existingTasks.splice(i, 1);\n task.isRemoved = true;\n if (task.removeAbortListener) {\n task.removeAbortListener();\n task.removeAbortListener = null;\n }\n if (existingTasks.length === 0) {\n task.allRemoved = true;\n task.target[symbolEventName] = null;\n }\n break;\n }\n }\n }\n }\n if (!task.allRemoved) {\n return;\n }\n return nativeRemoveEventListener.call(task.target, task.eventName, task.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, task.options);\n };\n const customScheduleNonGlobal = function(task) {\n return nativeAddEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);\n };\n const customSchedulePrepend = function(task) {\n return nativePrependEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);\n };\n const customCancelNonGlobal = function(task) {\n return nativeRemoveEventListener.call(task.target, task.eventName, task.invoke, task.options);\n };\n const customSchedule = useGlobalCallback ? customScheduleGlobal : customScheduleNonGlobal;\n const customCancel = useGlobalCallback ? customCancelGlobal : customCancelNonGlobal;\n const compareTaskCallbackVsDelegate = function(task, delegate) {\n const typeOfDelegate = typeof delegate;\n return typeOfDelegate === \"function\" && task.callback === delegate || typeOfDelegate === \"object\" && task.originalDelegate === delegate;\n };\n const compare = (patchOptions2 == null ? void 0 : patchOptions2.diff) || compareTaskCallbackVsDelegate;\n const unpatchedEvents = Zone[zoneSymbol(\"UNPATCHED_EVENTS\")];\n const passiveEvents = _global2[zoneSymbol(\"PASSIVE_EVENTS\")];\n function copyEventListenerOptions(options) {\n if (typeof options === \"object\" && options !== null) {\n const newOptions = __spreadValues({}, options);\n if (options.signal) {\n newOptions.signal = options.signal;\n }\n return newOptions;\n }\n return options;\n }\n const makeAddListener = function(nativeListener, addSource, customScheduleFn, customCancelFn, returnTarget2 = false, prepend = false) {\n return function() {\n const target = this || _global2;\n let eventName = arguments[0];\n if (patchOptions2 && patchOptions2.transferEventName) {\n eventName = patchOptions2.transferEventName(eventName);\n }\n let delegate = arguments[1];\n if (!delegate) {\n return nativeListener.apply(this, arguments);\n }\n if (isNode && eventName === \"uncaughtException\") {\n return nativeListener.apply(this, arguments);\n }\n let isEventListenerObject = false;\n if (typeof delegate !== \"function\") {\n if (!delegate.handleEvent) {\n return nativeListener.apply(this, arguments);\n }\n isEventListenerObject = true;\n }\n if (validateHandler && !validateHandler(nativeListener, delegate, target, arguments)) {\n return;\n }\n const passive = !!passiveEvents && passiveEvents.indexOf(eventName) !== -1;\n const options = copyEventListenerOptions(buildEventListenerOptions(arguments[2], passive));\n const signal = options == null ? void 0 : options.signal;\n if (signal == null ? void 0 : signal.aborted) {\n return;\n }\n if (unpatchedEvents) {\n for (let i = 0; i < unpatchedEvents.length; i++) {\n if (eventName === unpatchedEvents[i]) {\n if (passive) {\n return nativeListener.call(target, eventName, delegate, options);\n } else {\n return nativeListener.apply(this, arguments);\n }\n }\n }\n }\n const capture = !options ? false : typeof options === \"boolean\" ? true : options.capture;\n const once = options && typeof options === \"object\" ? options.once : false;\n const zone = Zone.current;\n let symbolEventNames = zoneSymbolEventNames2[eventName];\n if (!symbolEventNames) {\n prepareEventNames(eventName, eventNameToString);\n symbolEventNames = zoneSymbolEventNames2[eventName];\n }\n const symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR];\n let existingTasks = target[symbolEventName];\n let isExisting = false;\n if (existingTasks) {\n isExisting = true;\n if (checkDuplicate) {\n for (let i = 0; i < existingTasks.length; i++) {\n if (compare(existingTasks[i], delegate)) {\n return;\n }\n }\n }\n } else {\n existingTasks = target[symbolEventName] = [];\n }\n let source;\n const constructorName = target.constructor[\"name\"];\n const targetSource = globalSources[constructorName];\n if (targetSource) {\n source = targetSource[eventName];\n }\n if (!source) {\n source = constructorName + addSource + (eventNameToString ? eventNameToString(eventName) : eventName);\n }\n taskData.options = options;\n if (once) {\n taskData.options.once = false;\n }\n taskData.target = target;\n taskData.capture = capture;\n taskData.eventName = eventName;\n taskData.isExisting = isExisting;\n const data = useGlobalCallback ? OPTIMIZED_ZONE_EVENT_TASK_DATA : void 0;\n if (data) {\n data.taskData = taskData;\n }\n if (signal) {\n taskData.options.signal = void 0;\n }\n const task = zone.scheduleEventTask(source, delegate, data, customScheduleFn, customCancelFn);\n if (signal) {\n taskData.options.signal = signal;\n const onAbort = () => task.zone.cancelTask(task);\n nativeListener.call(signal, \"abort\", onAbort, { once: true });\n task.removeAbortListener = () => signal.removeEventListener(\"abort\", onAbort);\n }\n taskData.target = null;\n if (data) {\n data.taskData = null;\n }\n if (once) {\n taskData.options.once = true;\n }\n if (typeof task.options !== \"boolean\") {\n task.options = options;\n }\n task.target = target;\n task.capture = capture;\n task.eventName = eventName;\n if (isEventListenerObject) {\n task.originalDelegate = delegate;\n }\n if (!prepend) {\n existingTasks.push(task);\n } else {\n existingTasks.unshift(task);\n }\n if (returnTarget2) {\n return target;\n }\n };\n };\n proto[ADD_EVENT_LISTENER] = makeAddListener(nativeAddEventListener, ADD_EVENT_LISTENER_SOURCE, customSchedule, customCancel, returnTarget);\n if (nativePrependEventListener) {\n proto[PREPEND_EVENT_LISTENER] = makeAddListener(nativePrependEventListener, PREPEND_EVENT_LISTENER_SOURCE, customSchedulePrepend, customCancel, returnTarget, true);\n }\n proto[REMOVE_EVENT_LISTENER] = function() {\n const target = this || _global2;\n let eventName = arguments[0];\n if (patchOptions2 && patchOptions2.transferEventName) {\n eventName = patchOptions2.transferEventName(eventName);\n }\n const options = arguments[2];\n const capture = !options ? false : typeof options === \"boolean\" ? true : options.capture;\n const delegate = arguments[1];\n if (!delegate) {\n return nativeRemoveEventListener.apply(this, arguments);\n }\n if (validateHandler && !validateHandler(nativeRemoveEventListener, delegate, target, arguments)) {\n return;\n }\n const symbolEventNames = zoneSymbolEventNames2[eventName];\n let symbolEventName;\n if (symbolEventNames) {\n symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR];\n }\n const existingTasks = symbolEventName && target[symbolEventName];\n if (existingTasks) {\n for (let i = 0; i < existingTasks.length; i++) {\n const existingTask = existingTasks[i];\n if (compare(existingTask, delegate)) {\n existingTasks.splice(i, 1);\n existingTask.isRemoved = true;\n if (existingTasks.length === 0) {\n existingTask.allRemoved = true;\n target[symbolEventName] = null;\n if (!capture && typeof eventName === \"string\") {\n const onPropertySymbol = ZONE_SYMBOL_PREFIX + \"ON_PROPERTY\" + eventName;\n target[onPropertySymbol] = null;\n }\n }\n existingTask.zone.cancelTask(existingTask);\n if (returnTarget) {\n return target;\n }\n return;\n }\n }\n }\n return nativeRemoveEventListener.apply(this, arguments);\n };\n proto[LISTENERS_EVENT_LISTENER] = function() {\n const target = this || _global2;\n let eventName = arguments[0];\n if (patchOptions2 && patchOptions2.transferEventName) {\n eventName = patchOptions2.transferEventName(eventName);\n }\n const listeners = [];\n const tasks = findEventTasks(target, eventNameToString ? eventNameToString(eventName) : eventName);\n for (let i = 0; i < tasks.length; i++) {\n const task = tasks[i];\n let delegate = task.originalDelegate ? task.originalDelegate : task.callback;\n listeners.push(delegate);\n }\n return listeners;\n };\n proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER] = function() {\n const target = this || _global2;\n let eventName = arguments[0];\n if (!eventName) {\n const keys = Object.keys(target);\n for (let i = 0; i < keys.length; i++) {\n const prop = keys[i];\n const match = EVENT_NAME_SYMBOL_REGX.exec(prop);\n let evtName = match && match[1];\n if (evtName && evtName !== \"removeListener\") {\n this[REMOVE_ALL_LISTENERS_EVENT_LISTENER].call(this, evtName);\n }\n }\n this[REMOVE_ALL_LISTENERS_EVENT_LISTENER].call(this, \"removeListener\");\n } else {\n if (patchOptions2 && patchOptions2.transferEventName) {\n eventName = patchOptions2.transferEventName(eventName);\n }\n const symbolEventNames = zoneSymbolEventNames2[eventName];\n if (symbolEventNames) {\n const symbolEventName = symbolEventNames[FALSE_STR];\n const symbolCaptureEventName = symbolEventNames[TRUE_STR];\n const tasks = target[symbolEventName];\n const captureTasks = target[symbolCaptureEventName];\n if (tasks) {\n const removeTasks = tasks.slice();\n for (let i = 0; i < removeTasks.length; i++) {\n const task = removeTasks[i];\n let delegate = task.originalDelegate ? task.originalDelegate : task.callback;\n this[REMOVE_EVENT_LISTENER].call(this, eventName, delegate, task.options);\n }\n }\n if (captureTasks) {\n const removeTasks = captureTasks.slice();\n for (let i = 0; i < removeTasks.length; i++) {\n const task = removeTasks[i];\n let delegate = task.originalDelegate ? task.originalDelegate : task.callback;\n this[REMOVE_EVENT_LISTENER].call(this, eventName, delegate, task.options);\n }\n }\n }\n }\n if (returnTarget) {\n return this;\n }\n };\n attachOriginToPatched(proto[ADD_EVENT_LISTENER], nativeAddEventListener);\n attachOriginToPatched(proto[REMOVE_EVENT_LISTENER], nativeRemoveEventListener);\n if (nativeRemoveAllListeners) {\n attachOriginToPatched(proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER], nativeRemoveAllListeners);\n }\n if (nativeListeners) {\n attachOriginToPatched(proto[LISTENERS_EVENT_LISTENER], nativeListeners);\n }\n return true;\n }\n let results = [];\n for (let i = 0; i < apis.length; i++) {\n results[i] = patchEventTargetMethods(apis[i], patchOptions);\n }\n return results;\n}\nfunction findEventTasks(target, eventName) {\n if (!eventName) {\n const foundTasks = [];\n for (let prop in target) {\n const match = EVENT_NAME_SYMBOL_REGX.exec(prop);\n let evtName = match && match[1];\n if (evtName && (!eventName || evtName === eventName)) {\n const tasks = target[prop];\n if (tasks) {\n for (let i = 0; i < tasks.length; i++) {\n foundTasks.push(tasks[i]);\n }\n }\n }\n }\n return foundTasks;\n }\n let symbolEventName = zoneSymbolEventNames2[eventName];\n if (!symbolEventName) {\n prepareEventNames(eventName);\n symbolEventName = zoneSymbolEventNames2[eventName];\n }\n const captureFalseTasks = target[symbolEventName[FALSE_STR]];\n const captureTrueTasks = target[symbolEventName[TRUE_STR]];\n if (!captureFalseTasks) {\n return captureTrueTasks ? captureTrueTasks.slice() : [];\n } else {\n return captureTrueTasks ? captureFalseTasks.concat(captureTrueTasks) : captureFalseTasks.slice();\n }\n}\nfunction patchEventPrototype(global2, api) {\n const Event = global2[\"Event\"];\n if (Event && Event.prototype) {\n api.patchMethod(Event.prototype, \"stopImmediatePropagation\", (delegate) => function(self2, args) {\n self2[IMMEDIATE_PROPAGATION_SYMBOL] = true;\n delegate && delegate.apply(self2, args);\n });\n }\n}\n\n// packages/zone.js/lib/common/queue-microtask.js\nfunction patchQueueMicrotask(global2, api) {\n api.patchMethod(global2, \"queueMicrotask\", (delegate) => {\n return function(self2, args) {\n Zone.current.scheduleMicroTask(\"queueMicrotask\", args[0]);\n };\n });\n}\n\n// packages/zone.js/lib/common/timers.js\nvar taskSymbol = zoneSymbol(\"zoneTask\");\nfunction patchTimer(window2, setName, cancelName, nameSuffix) {\n let setNative = null;\n let clearNative = null;\n setName += nameSuffix;\n cancelName += nameSuffix;\n const tasksByHandleId = {};\n function scheduleTask(task) {\n const data = task.data;\n data.args[0] = function() {\n return task.invoke.apply(this, arguments);\n };\n const handleOrId = setNative.apply(window2, data.args);\n if (isNumber(handleOrId)) {\n data.handleId = handleOrId;\n } else {\n data.handle = handleOrId;\n data.isRefreshable = isFunction(handleOrId.refresh);\n }\n return task;\n }\n function clearTask(task) {\n const { handle, handleId } = task.data;\n return clearNative.call(window2, handle != null ? handle : handleId);\n }\n setNative = patchMethod(window2, setName, (delegate) => function(self2, args) {\n var _a;\n if (isFunction(args[0])) {\n const options = {\n isRefreshable: false,\n isPeriodic: nameSuffix === \"Interval\",\n delay: nameSuffix === \"Timeout\" || nameSuffix === \"Interval\" ? args[1] || 0 : void 0,\n args\n };\n const callback = args[0];\n args[0] = function timer() {\n try {\n return callback.apply(this, arguments);\n } finally {\n const { handle: handle2, handleId: handleId2, isPeriodic: isPeriodic2, isRefreshable: isRefreshable2 } = options;\n if (!isPeriodic2 && !isRefreshable2) {\n if (handleId2) {\n delete tasksByHandleId[handleId2];\n } else if (handle2) {\n handle2[taskSymbol] = null;\n }\n }\n }\n };\n const task = scheduleMacroTaskWithCurrentZone(setName, args[0], options, scheduleTask, clearTask);\n if (!task) {\n return task;\n }\n const { handleId, handle, isRefreshable, isPeriodic } = task.data;\n if (handleId) {\n tasksByHandleId[handleId] = task;\n } else if (handle) {\n handle[taskSymbol] = task;\n if (isRefreshable && !isPeriodic) {\n const originalRefresh = handle.refresh;\n handle.refresh = function() {\n const { zone, state } = task;\n if (state === \"notScheduled\") {\n task._state = \"scheduled\";\n zone._updateTaskCount(task, 1);\n } else if (state === \"running\") {\n task._state = \"scheduling\";\n }\n return originalRefresh.call(this);\n };\n }\n }\n return (_a = handle != null ? handle : handleId) != null ? _a : task;\n } else {\n return delegate.apply(window2, args);\n }\n });\n clearNative = patchMethod(window2, cancelName, (delegate) => function(self2, args) {\n const id = args[0];\n let task;\n if (isNumber(id)) {\n task = tasksByHandleId[id];\n delete tasksByHandleId[id];\n } else {\n task = id == null ? void 0 : id[taskSymbol];\n if (task) {\n id[taskSymbol] = null;\n } else {\n task = id;\n }\n }\n if (task == null ? void 0 : task.type) {\n if (task.cancelFn) {\n task.zone.cancelTask(task);\n }\n } else {\n delegate.apply(window2, args);\n }\n });\n}\n\n// packages/zone.js/lib/browser/custom-elements.js\nfunction patchCustomElements(_global2, api) {\n const { isBrowser: isBrowser2, isMix: isMix2 } = api.getGlobalObjects();\n if (!isBrowser2 && !isMix2 || !_global2[\"customElements\"] || !(\"customElements\" in _global2)) {\n return;\n }\n const callbacks = [\n \"connectedCallback\",\n \"disconnectedCallback\",\n \"adoptedCallback\",\n \"attributeChangedCallback\",\n \"formAssociatedCallback\",\n \"formDisabledCallback\",\n \"formResetCallback\",\n \"formStateRestoreCallback\"\n ];\n api.patchCallbacks(api, _global2.customElements, \"customElements\", \"define\", callbacks);\n}\n\n// packages/zone.js/lib/browser/event-target.js\nfunction eventTargetPatch(_global2, api) {\n if (Zone[api.symbol(\"patchEventTarget\")]) {\n return;\n }\n const { eventNames, zoneSymbolEventNames: zoneSymbolEventNames3, TRUE_STR: TRUE_STR2, FALSE_STR: FALSE_STR2, ZONE_SYMBOL_PREFIX: ZONE_SYMBOL_PREFIX2 } = api.getGlobalObjects();\n for (let i = 0; i < eventNames.length; i++) {\n const eventName = eventNames[i];\n const falseEventName = eventName + FALSE_STR2;\n const trueEventName = eventName + TRUE_STR2;\n const symbol = ZONE_SYMBOL_PREFIX2 + falseEventName;\n const symbolCapture = ZONE_SYMBOL_PREFIX2 + trueEventName;\n zoneSymbolEventNames3[eventName] = {};\n zoneSymbolEventNames3[eventName][FALSE_STR2] = symbol;\n zoneSymbolEventNames3[eventName][TRUE_STR2] = symbolCapture;\n }\n const EVENT_TARGET = _global2[\"EventTarget\"];\n if (!EVENT_TARGET || !EVENT_TARGET.prototype) {\n return;\n }\n api.patchEventTarget(_global2, api, [EVENT_TARGET && EVENT_TARGET.prototype]);\n return true;\n}\nfunction patchEvent(global2, api) {\n api.patchEventPrototype(global2, api);\n}\n\n// packages/zone.js/lib/browser/property-descriptor.js\nfunction filterProperties(target, onProperties, ignoreProperties) {\n if (!ignoreProperties || ignoreProperties.length === 0) {\n return onProperties;\n }\n const tip = ignoreProperties.filter((ip) => ip.target === target);\n if (tip.length === 0) {\n return onProperties;\n }\n const targetIgnoreProperties = tip[0].ignoreProperties;\n return onProperties.filter((op) => targetIgnoreProperties.indexOf(op) === -1);\n}\nfunction patchFilteredProperties(target, onProperties, ignoreProperties, prototype) {\n if (!target) {\n return;\n }\n const filteredProperties = filterProperties(target, onProperties, ignoreProperties);\n patchOnProperties(target, filteredProperties, prototype);\n}\nfunction getOnEventNames(target) {\n return Object.getOwnPropertyNames(target).filter((name) => name.startsWith(\"on\") && name.length > 2).map((name) => name.substring(2));\n}\nfunction propertyDescriptorPatch(api, _global2) {\n if (isNode && !isMix) {\n return;\n }\n if (Zone[api.symbol(\"patchEvents\")]) {\n return;\n }\n const ignoreProperties = _global2[\"__Zone_ignore_on_properties\"];\n let patchTargets = [];\n if (isBrowser) {\n const internalWindow2 = window;\n patchTargets = patchTargets.concat([\n \"Document\",\n \"SVGElement\",\n \"Element\",\n \"HTMLElement\",\n \"HTMLBodyElement\",\n \"HTMLMediaElement\",\n \"HTMLFrameSetElement\",\n \"HTMLFrameElement\",\n \"HTMLIFrameElement\",\n \"HTMLMarqueeElement\",\n \"Worker\"\n ]);\n patchFilteredProperties(internalWindow2, getOnEventNames(internalWindow2), ignoreProperties, ObjectGetPrototypeOf(internalWindow2));\n }\n patchTargets = patchTargets.concat([\n \"XMLHttpRequest\",\n \"XMLHttpRequestEventTarget\",\n \"IDBIndex\",\n \"IDBRequest\",\n \"IDBOpenDBRequest\",\n \"IDBDatabase\",\n \"IDBTransaction\",\n \"IDBCursor\",\n \"WebSocket\"\n ]);\n for (let i = 0; i < patchTargets.length; i++) {\n const target = _global2[patchTargets[i]];\n (target == null ? void 0 : target.prototype) && patchFilteredProperties(target.prototype, getOnEventNames(target.prototype), ignoreProperties);\n }\n}\n\n// packages/zone.js/lib/browser/browser.js\nfunction patchBrowser(Zone3) {\n Zone3.__load_patch(\"timers\", (global2) => {\n const set = \"set\";\n const clear = \"clear\";\n patchTimer(global2, set, clear, \"Timeout\");\n patchTimer(global2, set, clear, \"Interval\");\n patchTimer(global2, set, clear, \"Immediate\");\n });\n Zone3.__load_patch(\"requestAnimationFrame\", (global2) => {\n patchTimer(global2, \"request\", \"cancel\", \"AnimationFrame\");\n patchTimer(global2, \"mozRequest\", \"mozCancel\", \"AnimationFrame\");\n patchTimer(global2, \"webkitRequest\", \"webkitCancel\", \"AnimationFrame\");\n });\n Zone3.__load_patch(\"blocking\", (global2, Zone4) => {\n const blockingMethods = [\"alert\", \"prompt\", \"confirm\"];\n for (let i = 0; i < blockingMethods.length; i++) {\n const name = blockingMethods[i];\n patchMethod(global2, name, (delegate, symbol, name2) => {\n return function(s, args) {\n return Zone4.current.run(delegate, global2, args, name2);\n };\n });\n }\n });\n Zone3.__load_patch(\"EventTarget\", (global2, Zone4, api) => {\n patchEvent(global2, api);\n eventTargetPatch(global2, api);\n const XMLHttpRequestEventTarget = global2[\"XMLHttpRequestEventTarget\"];\n if (XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype) {\n api.patchEventTarget(global2, api, [XMLHttpRequestEventTarget.prototype]);\n }\n });\n Zone3.__load_patch(\"MutationObserver\", (global2, Zone4, api) => {\n patchClass(\"MutationObserver\");\n patchClass(\"WebKitMutationObserver\");\n });\n Zone3.__load_patch(\"IntersectionObserver\", (global2, Zone4, api) => {\n patchClass(\"IntersectionObserver\");\n });\n Zone3.__load_patch(\"FileReader\", (global2, Zone4, api) => {\n patchClass(\"FileReader\");\n });\n Zone3.__load_patch(\"on_property\", (global2, Zone4, api) => {\n propertyDescriptorPatch(api, global2);\n });\n Zone3.__load_patch(\"customElements\", (global2, Zone4, api) => {\n patchCustomElements(global2, api);\n });\n Zone3.__load_patch(\"XHR\", (global2, Zone4) => {\n patchXHR(global2);\n const XHR_TASK = zoneSymbol(\"xhrTask\");\n const XHR_SYNC = zoneSymbol(\"xhrSync\");\n const XHR_LISTENER = zoneSymbol(\"xhrListener\");\n const XHR_SCHEDULED = zoneSymbol(\"xhrScheduled\");\n const XHR_URL = zoneSymbol(\"xhrURL\");\n const XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol(\"xhrErrorBeforeScheduled\");\n function patchXHR(window2) {\n const XMLHttpRequest = window2[\"XMLHttpRequest\"];\n if (!XMLHttpRequest) {\n return;\n }\n const XMLHttpRequestPrototype = XMLHttpRequest.prototype;\n function findPendingTask(target) {\n return target[XHR_TASK];\n }\n let oriAddListener = XMLHttpRequestPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];\n let oriRemoveListener = XMLHttpRequestPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];\n if (!oriAddListener) {\n const XMLHttpRequestEventTarget = window2[\"XMLHttpRequestEventTarget\"];\n if (XMLHttpRequestEventTarget) {\n const XMLHttpRequestEventTargetPrototype = XMLHttpRequestEventTarget.prototype;\n oriAddListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];\n oriRemoveListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];\n }\n }\n const READY_STATE_CHANGE = \"readystatechange\";\n const SCHEDULED = \"scheduled\";\n function scheduleTask(task) {\n const data = task.data;\n const target = data.target;\n target[XHR_SCHEDULED] = false;\n target[XHR_ERROR_BEFORE_SCHEDULED] = false;\n const listener = target[XHR_LISTENER];\n if (!oriAddListener) {\n oriAddListener = target[ZONE_SYMBOL_ADD_EVENT_LISTENER];\n oriRemoveListener = target[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];\n }\n if (listener) {\n oriRemoveListener.call(target, READY_STATE_CHANGE, listener);\n }\n const newListener = target[XHR_LISTENER] = () => {\n if (target.readyState === target.DONE) {\n if (!data.aborted && target[XHR_SCHEDULED] && task.state === SCHEDULED) {\n const loadTasks = target[Zone4.__symbol__(\"loadfalse\")];\n if (target.status !== 0 && loadTasks && loadTasks.length > 0) {\n const oriInvoke = task.invoke;\n task.invoke = function() {\n const loadTasks2 = target[Zone4.__symbol__(\"loadfalse\")];\n for (let i = 0; i < loadTasks2.length; i++) {\n if (loadTasks2[i] === task) {\n loadTasks2.splice(i, 1);\n }\n }\n if (!data.aborted && task.state === SCHEDULED) {\n oriInvoke.call(task);\n }\n };\n loadTasks.push(task);\n } else {\n task.invoke();\n }\n } else if (!data.aborted && target[XHR_SCHEDULED] === false) {\n target[XHR_ERROR_BEFORE_SCHEDULED] = true;\n }\n }\n };\n oriAddListener.call(target, READY_STATE_CHANGE, newListener);\n const storedTask = target[XHR_TASK];\n if (!storedTask) {\n target[XHR_TASK] = task;\n }\n sendNative.apply(target, data.args);\n target[XHR_SCHEDULED] = true;\n return task;\n }\n function placeholderCallback() {\n }\n function clearTask(task) {\n const data = task.data;\n data.aborted = true;\n return abortNative.apply(data.target, data.args);\n }\n const openNative = patchMethod(XMLHttpRequestPrototype, \"open\", () => function(self2, args) {\n self2[XHR_SYNC] = args[2] == false;\n self2[XHR_URL] = args[1];\n return openNative.apply(self2, args);\n });\n const XMLHTTPREQUEST_SOURCE = \"XMLHttpRequest.send\";\n const fetchTaskAborting = zoneSymbol(\"fetchTaskAborting\");\n const fetchTaskScheduling = zoneSymbol(\"fetchTaskScheduling\");\n const sendNative = patchMethod(XMLHttpRequestPrototype, \"send\", () => function(self2, args) {\n if (Zone4.current[fetchTaskScheduling] === true) {\n return sendNative.apply(self2, args);\n }\n if (self2[XHR_SYNC]) {\n return sendNative.apply(self2, args);\n } else {\n const options = {\n target: self2,\n url: self2[XHR_URL],\n isPeriodic: false,\n args,\n aborted: false\n };\n const task = scheduleMacroTaskWithCurrentZone(XMLHTTPREQUEST_SOURCE, placeholderCallback, options, scheduleTask, clearTask);\n if (self2 && self2[XHR_ERROR_BEFORE_SCHEDULED] === true && !options.aborted && task.state === SCHEDULED) {\n task.invoke();\n }\n }\n });\n const abortNative = patchMethod(XMLHttpRequestPrototype, \"abort\", () => function(self2, args) {\n const task = findPendingTask(self2);\n if (task && typeof task.type == \"string\") {\n if (task.cancelFn == null || task.data && task.data.aborted) {\n return;\n }\n task.zone.cancelTask(task);\n } else if (Zone4.current[fetchTaskAborting] === true) {\n return abortNative.apply(self2, args);\n }\n });\n }\n });\n Zone3.__load_patch(\"geolocation\", (global2) => {\n if (global2[\"navigator\"] && global2[\"navigator\"].geolocation) {\n patchPrototype(global2[\"navigator\"].geolocation, [\"getCurrentPosition\", \"watchPosition\"]);\n }\n });\n Zone3.__load_patch(\"PromiseRejectionEvent\", (global2, Zone4) => {\n function findPromiseRejectionHandler(evtName) {\n return function(e) {\n const eventTasks = findEventTasks(global2, evtName);\n eventTasks.forEach((eventTask) => {\n const PromiseRejectionEvent = global2[\"PromiseRejectionEvent\"];\n if (PromiseRejectionEvent) {\n const evt = new PromiseRejectionEvent(evtName, {\n promise: e.promise,\n reason: e.rejection\n });\n eventTask.invoke(evt);\n }\n });\n };\n }\n if (global2[\"PromiseRejectionEvent\"]) {\n Zone4[zoneSymbol(\"unhandledPromiseRejectionHandler\")] = findPromiseRejectionHandler(\"unhandledrejection\");\n Zone4[zoneSymbol(\"rejectionHandledHandler\")] = findPromiseRejectionHandler(\"rejectionhandled\");\n }\n });\n Zone3.__load_patch(\"queueMicrotask\", (global2, Zone4, api) => {\n patchQueueMicrotask(global2, api);\n });\n}\n\n// packages/zone.js/lib/common/promise.js\nfunction patchPromise(Zone3) {\n Zone3.__load_patch(\"ZoneAwarePromise\", (global2, Zone4, api) => {\n const ObjectGetOwnPropertyDescriptor2 = Object.getOwnPropertyDescriptor;\n const ObjectDefineProperty2 = Object.defineProperty;\n function readableObjectToString(obj) {\n if (obj && obj.toString === Object.prototype.toString) {\n const className = obj.constructor && obj.constructor.name;\n return (className ? className : \"\") + \": \" + JSON.stringify(obj);\n }\n return obj ? obj.toString() : Object.prototype.toString.call(obj);\n }\n const __symbol__2 = api.symbol;\n const _uncaughtPromiseErrors = [];\n const isDisableWrappingUncaughtPromiseRejection = global2[__symbol__2(\"DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION\")] !== false;\n const symbolPromise = __symbol__2(\"Promise\");\n const symbolThen = __symbol__2(\"then\");\n const creationTrace = \"__creationTrace__\";\n api.onUnhandledError = (e) => {\n if (api.showUncaughtError()) {\n const rejection = e && e.rejection;\n if (rejection) {\n console.error(\"Unhandled Promise rejection:\", rejection instanceof Error ? rejection.message : rejection, \"; Zone:\", e.zone.name, \"; Task:\", e.task && e.task.source, \"; Value:\", rejection, rejection instanceof Error ? rejection.stack : void 0);\n } else {\n console.error(e);\n }\n }\n };\n api.microtaskDrainDone = () => {\n while (_uncaughtPromiseErrors.length) {\n const uncaughtPromiseError = _uncaughtPromiseErrors.shift();\n try {\n uncaughtPromiseError.zone.runGuarded(() => {\n if (uncaughtPromiseError.throwOriginal) {\n throw uncaughtPromiseError.rejection;\n }\n throw uncaughtPromiseError;\n });\n } catch (error) {\n handleUnhandledRejection(error);\n }\n }\n };\n const UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL = __symbol__2(\"unhandledPromiseRejectionHandler\");\n function handleUnhandledRejection(e) {\n api.onUnhandledError(e);\n try {\n const handler = Zone4[UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL];\n if (typeof handler === \"function\") {\n handler.call(this, e);\n }\n } catch (err) {\n }\n }\n function isThenable(value) {\n return value && typeof value.then === \"function\";\n }\n function forwardResolution(value) {\n return value;\n }\n function forwardRejection(rejection) {\n return ZoneAwarePromise.reject(rejection);\n }\n const symbolState = __symbol__2(\"state\");\n const symbolValue = __symbol__2(\"value\");\n const symbolFinally = __symbol__2(\"finally\");\n const symbolParentPromiseValue = __symbol__2(\"parentPromiseValue\");\n const symbolParentPromiseState = __symbol__2(\"parentPromiseState\");\n const source = \"Promise.then\";\n const UNRESOLVED = null;\n const RESOLVED = true;\n const REJECTED = false;\n const REJECTED_NO_CATCH = 0;\n function makeResolver(promise, state) {\n return (v) => {\n try {\n resolvePromise(promise, state, v);\n } catch (err) {\n resolvePromise(promise, false, err);\n }\n };\n }\n const once = function() {\n let wasCalled = false;\n return function wrapper(wrappedFunction) {\n return function() {\n if (wasCalled) {\n return;\n }\n wasCalled = true;\n wrappedFunction.apply(null, arguments);\n };\n };\n };\n const TYPE_ERROR = \"Promise resolved with itself\";\n const CURRENT_TASK_TRACE_SYMBOL = __symbol__2(\"currentTaskTrace\");\n function resolvePromise(promise, state, value) {\n const onceWrapper = once();\n if (promise === value) {\n throw new TypeError(TYPE_ERROR);\n }\n if (promise[symbolState] === UNRESOLVED) {\n let then = null;\n try {\n if (typeof value === \"object\" || typeof value === \"function\") {\n then = value && value.then;\n }\n } catch (err) {\n onceWrapper(() => {\n resolvePromise(promise, false, err);\n })();\n return promise;\n }\n if (state !== REJECTED && value instanceof ZoneAwarePromise && value.hasOwnProperty(symbolState) && value.hasOwnProperty(symbolValue) && value[symbolState] !== UNRESOLVED) {\n clearRejectedNoCatch(value);\n resolvePromise(promise, value[symbolState], value[symbolValue]);\n } else if (state !== REJECTED && typeof then === \"function\") {\n try {\n then.call(value, onceWrapper(makeResolver(promise, state)), onceWrapper(makeResolver(promise, false)));\n } catch (err) {\n onceWrapper(() => {\n resolvePromise(promise, false, err);\n })();\n }\n } else {\n promise[symbolState] = state;\n const queue = promise[symbolValue];\n promise[symbolValue] = value;\n if (promise[symbolFinally] === symbolFinally) {\n if (state === RESOLVED) {\n promise[symbolState] = promise[symbolParentPromiseState];\n promise[symbolValue] = promise[symbolParentPromiseValue];\n }\n }\n if (state === REJECTED && value instanceof Error) {\n const trace = Zone4.currentTask && Zone4.currentTask.data && Zone4.currentTask.data[creationTrace];\n if (trace) {\n ObjectDefineProperty2(value, CURRENT_TASK_TRACE_SYMBOL, {\n configurable: true,\n enumerable: false,\n writable: true,\n value: trace\n });\n }\n }\n for (let i = 0; i < queue.length; ) {\n scheduleResolveOrReject(promise, queue[i++], queue[i++], queue[i++], queue[i++]);\n }\n if (queue.length == 0 && state == REJECTED) {\n promise[symbolState] = REJECTED_NO_CATCH;\n let uncaughtPromiseError = value;\n try {\n throw new Error(\"Uncaught (in promise): \" + readableObjectToString(value) + (value && value.stack ? \"\\n\" + value.stack : \"\"));\n } catch (err) {\n uncaughtPromiseError = err;\n }\n if (isDisableWrappingUncaughtPromiseRejection) {\n uncaughtPromiseError.throwOriginal = true;\n }\n uncaughtPromiseError.rejection = value;\n uncaughtPromiseError.promise = promise;\n uncaughtPromiseError.zone = Zone4.current;\n uncaughtPromiseError.task = Zone4.currentTask;\n _uncaughtPromiseErrors.push(uncaughtPromiseError);\n api.scheduleMicroTask();\n }\n }\n }\n return promise;\n }\n const REJECTION_HANDLED_HANDLER = __symbol__2(\"rejectionHandledHandler\");\n function clearRejectedNoCatch(promise) {\n if (promise[symbolState] === REJECTED_NO_CATCH) {\n try {\n const handler = Zone4[REJECTION_HANDLED_HANDLER];\n if (handler && typeof handler === \"function\") {\n handler.call(this, { rejection: promise[symbolValue], promise });\n }\n } catch (err) {\n }\n promise[symbolState] = REJECTED;\n for (let i = 0; i < _uncaughtPromiseErrors.length; i++) {\n if (promise === _uncaughtPromiseErrors[i].promise) {\n _uncaughtPromiseErrors.splice(i, 1);\n }\n }\n }\n }\n function scheduleResolveOrReject(promise, zone, chainPromise, onFulfilled, onRejected) {\n clearRejectedNoCatch(promise);\n const promiseState = promise[symbolState];\n const delegate = promiseState ? typeof onFulfilled === \"function\" ? onFulfilled : forwardResolution : typeof onRejected === \"function\" ? onRejected : forwardRejection;\n zone.scheduleMicroTask(source, () => {\n try {\n const parentPromiseValue = promise[symbolValue];\n const isFinallyPromise = !!chainPromise && symbolFinally === chainPromise[symbolFinally];\n if (isFinallyPromise) {\n chainPromise[symbolParentPromiseValue] = parentPromiseValue;\n chainPromise[symbolParentPromiseState] = promiseState;\n }\n const value = zone.run(delegate, void 0, isFinallyPromise && delegate !== forwardRejection && delegate !== forwardResolution ? [] : [parentPromiseValue]);\n resolvePromise(chainPromise, true, value);\n } catch (error) {\n resolvePromise(chainPromise, false, error);\n }\n }, chainPromise);\n }\n const ZONE_AWARE_PROMISE_TO_STRING = \"function ZoneAwarePromise() { [native code] }\";\n const noop = function() {\n };\n const AggregateError = global2.AggregateError;\n class ZoneAwarePromise {\n static toString() {\n return ZONE_AWARE_PROMISE_TO_STRING;\n }\n static resolve(value) {\n if (value instanceof ZoneAwarePromise) {\n return value;\n }\n return resolvePromise(new this(null), RESOLVED, value);\n }\n static reject(error) {\n return resolvePromise(new this(null), REJECTED, error);\n }\n static withResolvers() {\n const result = {};\n result.promise = new ZoneAwarePromise((res, rej) => {\n result.resolve = res;\n result.reject = rej;\n });\n return result;\n }\n static any(values) {\n if (!values || typeof values[Symbol.iterator] !== \"function\") {\n return Promise.reject(new AggregateError([], \"All promises were rejected\"));\n }\n const promises = [];\n let count = 0;\n try {\n for (let v of values) {\n count++;\n promises.push(ZoneAwarePromise.resolve(v));\n }\n } catch (err) {\n return Promise.reject(new AggregateError([], \"All promises were rejected\"));\n }\n if (count === 0) {\n return Promise.reject(new AggregateError([], \"All promises were rejected\"));\n }\n let finished = false;\n const errors = [];\n return new ZoneAwarePromise((resolve, reject) => {\n for (let i = 0; i < promises.length; i++) {\n promises[i].then((v) => {\n if (finished) {\n return;\n }\n finished = true;\n resolve(v);\n }, (err) => {\n errors.push(err);\n count--;\n if (count === 0) {\n finished = true;\n reject(new AggregateError(errors, \"All promises were rejected\"));\n }\n });\n }\n });\n }\n static race(values) {\n let resolve;\n let reject;\n let promise = new this((res, rej) => {\n resolve = res;\n reject = rej;\n });\n function onResolve(value) {\n resolve(value);\n }\n function onReject(error) {\n reject(error);\n }\n for (let value of values) {\n if (!isThenable(value)) {\n value = this.resolve(value);\n }\n value.then(onResolve, onReject);\n }\n return promise;\n }\n static all(values) {\n return ZoneAwarePromise.allWithCallback(values);\n }\n static allSettled(values) {\n const P = this && this.prototype instanceof ZoneAwarePromise ? this : ZoneAwarePromise;\n return P.allWithCallback(values, {\n thenCallback: (value) => ({ status: \"fulfilled\", value }),\n errorCallback: (err) => ({ status: \"rejected\", reason: err })\n });\n }\n static allWithCallback(values, callback) {\n let resolve;\n let reject;\n let promise = new this((res, rej) => {\n resolve = res;\n reject = rej;\n });\n let unresolvedCount = 2;\n let valueIndex = 0;\n const resolvedValues = [];\n for (let value of values) {\n if (!isThenable(value)) {\n value = this.resolve(value);\n }\n const curValueIndex = valueIndex;\n try {\n value.then((value2) => {\n resolvedValues[curValueIndex] = callback ? callback.thenCallback(value2) : value2;\n unresolvedCount--;\n if (unresolvedCount === 0) {\n resolve(resolvedValues);\n }\n }, (err) => {\n if (!callback) {\n reject(err);\n } else {\n resolvedValues[curValueIndex] = callback.errorCallback(err);\n unresolvedCount--;\n if (unresolvedCount === 0) {\n resolve(resolvedValues);\n }\n }\n });\n } catch (thenErr) {\n reject(thenErr);\n }\n unresolvedCount++;\n valueIndex++;\n }\n unresolvedCount -= 2;\n if (unresolvedCount === 0) {\n resolve(resolvedValues);\n }\n return promise;\n }\n constructor(executor) {\n const promise = this;\n if (!(promise instanceof ZoneAwarePromise)) {\n throw new Error(\"Must be an instanceof Promise.\");\n }\n promise[symbolState] = UNRESOLVED;\n promise[symbolValue] = [];\n try {\n const onceWrapper = once();\n executor && executor(onceWrapper(makeResolver(promise, RESOLVED)), onceWrapper(makeResolver(promise, REJECTED)));\n } catch (error) {\n resolvePromise(promise, false, error);\n }\n }\n get [Symbol.toStringTag]() {\n return \"Promise\";\n }\n get [Symbol.species]() {\n return ZoneAwarePromise;\n }\n then(onFulfilled, onRejected) {\n var _a;\n let C = (_a = this.constructor) == null ? void 0 : _a[Symbol.species];\n if (!C || typeof C !== \"function\") {\n C = this.constructor || ZoneAwarePromise;\n }\n const chainPromise = new C(noop);\n const zone = Zone4.current;\n if (this[symbolState] == UNRESOLVED) {\n this[symbolValue].push(zone, chainPromise, onFulfilled, onRejected);\n } else {\n scheduleResolveOrReject(this, zone, chainPromise, onFulfilled, onRejected);\n }\n return chainPromise;\n }\n catch(onRejected) {\n return this.then(null, onRejected);\n }\n finally(onFinally) {\n var _a;\n let C = (_a = this.constructor) == null ? void 0 : _a[Symbol.species];\n if (!C || typeof C !== \"function\") {\n C = ZoneAwarePromise;\n }\n const chainPromise = new C(noop);\n chainPromise[symbolFinally] = symbolFinally;\n const zone = Zone4.current;\n if (this[symbolState] == UNRESOLVED) {\n this[symbolValue].push(zone, chainPromise, onFinally, onFinally);\n } else {\n scheduleResolveOrReject(this, zone, chainPromise, onFinally, onFinally);\n }\n return chainPromise;\n }\n }\n ZoneAwarePromise[\"resolve\"] = ZoneAwarePromise.resolve;\n ZoneAwarePromise[\"reject\"] = ZoneAwarePromise.reject;\n ZoneAwarePromise[\"race\"] = ZoneAwarePromise.race;\n ZoneAwarePromise[\"all\"] = ZoneAwarePromise.all;\n const NativePromise = global2[symbolPromise] = global2[\"Promise\"];\n global2[\"Promise\"] = ZoneAwarePromise;\n const symbolThenPatched = __symbol__2(\"thenPatched\");\n function patchThen(Ctor) {\n const proto = Ctor.prototype;\n const prop = ObjectGetOwnPropertyDescriptor2(proto, \"then\");\n if (prop && (prop.writable === false || !prop.configurable)) {\n return;\n }\n const originalThen = proto.then;\n proto[symbolThen] = originalThen;\n Ctor.prototype.then = function(onResolve, onReject) {\n const wrapped = new ZoneAwarePromise((resolve, reject) => {\n originalThen.call(this, resolve, reject);\n });\n return wrapped.then(onResolve, onReject);\n };\n Ctor[symbolThenPatched] = true;\n }\n api.patchThen = patchThen;\n function zoneify(fn) {\n return function(self2, args) {\n let resultPromise = fn.apply(self2, args);\n if (resultPromise instanceof ZoneAwarePromise) {\n return resultPromise;\n }\n let ctor = resultPromise.constructor;\n if (!ctor[symbolThenPatched]) {\n patchThen(ctor);\n }\n return resultPromise;\n };\n }\n if (NativePromise) {\n patchThen(NativePromise);\n const nativeTry = NativePromise[\"try\"];\n if (nativeTry && typeof nativeTry === \"function\") {\n ZoneAwarePromise[\"try\"] = nativeTry;\n }\n patchMethod(global2, \"fetch\", (delegate) => zoneify(delegate));\n }\n Promise[Zone4.__symbol__(\"uncaughtPromiseErrors\")] = _uncaughtPromiseErrors;\n return ZoneAwarePromise;\n });\n}\n\n// packages/zone.js/lib/common/to-string.js\nfunction patchToString(Zone3) {\n Zone3.__load_patch(\"toString\", (global2) => {\n const originalFunctionToString = Function.prototype.toString;\n const ORIGINAL_DELEGATE_SYMBOL = zoneSymbol(\"OriginalDelegate\");\n const PROMISE_SYMBOL = zoneSymbol(\"Promise\");\n const ERROR_SYMBOL = zoneSymbol(\"Error\");\n const newFunctionToString = function toString() {\n if (typeof this === \"function\") {\n const originalDelegate = this[ORIGINAL_DELEGATE_SYMBOL];\n if (originalDelegate) {\n if (typeof originalDelegate === \"function\") {\n return originalFunctionToString.call(originalDelegate);\n } else {\n return Object.prototype.toString.call(originalDelegate);\n }\n }\n if (this === Promise) {\n const nativePromise = global2[PROMISE_SYMBOL];\n if (nativePromise) {\n return originalFunctionToString.call(nativePromise);\n }\n }\n if (this === Error) {\n const nativeError = global2[ERROR_SYMBOL];\n if (nativeError) {\n return originalFunctionToString.call(nativeError);\n }\n }\n }\n return originalFunctionToString.call(this);\n };\n newFunctionToString[ORIGINAL_DELEGATE_SYMBOL] = originalFunctionToString;\n Function.prototype.toString = newFunctionToString;\n const originalObjectToString = Object.prototype.toString;\n const PROMISE_OBJECT_TO_STRING = \"[object Promise]\";\n Object.prototype.toString = function() {\n if (typeof Promise === \"function\" && this instanceof Promise) {\n return PROMISE_OBJECT_TO_STRING;\n }\n return originalObjectToString.call(this);\n };\n });\n}\n\n// packages/zone.js/lib/browser/browser-util.js\nfunction patchCallbacks(api, target, targetName, method, callbacks) {\n const symbol = Zone.__symbol__(method);\n if (target[symbol]) {\n return;\n }\n const nativeDelegate = target[symbol] = target[method];\n target[method] = function(name, opts, options) {\n if (opts && opts.prototype) {\n callbacks.forEach(function(callback) {\n const source = `${targetName}.${method}::` + callback;\n const prototype = opts.prototype;\n try {\n if (prototype.hasOwnProperty(callback)) {\n const descriptor = api.ObjectGetOwnPropertyDescriptor(prototype, callback);\n if (descriptor && descriptor.value) {\n descriptor.value = api.wrapWithCurrentZone(descriptor.value, source);\n api._redefineProperty(opts.prototype, callback, descriptor);\n } else if (prototype[callback]) {\n prototype[callback] = api.wrapWithCurrentZone(prototype[callback], source);\n }\n } else if (prototype[callback]) {\n prototype[callback] = api.wrapWithCurrentZone(prototype[callback], source);\n }\n } catch (e) {\n }\n });\n }\n return nativeDelegate.call(target, name, opts, options);\n };\n api.attachOriginToPatched(target[method], nativeDelegate);\n}\n\n// packages/zone.js/lib/browser/api-util.js\nfunction patchUtil(Zone3) {\n Zone3.__load_patch(\"util\", (global2, Zone4, api) => {\n const eventNames = getOnEventNames(global2);\n api.patchOnProperties = patchOnProperties;\n api.patchMethod = patchMethod;\n api.bindArguments = bindArguments;\n api.patchMacroTask = patchMacroTask;\n const SYMBOL_BLACK_LISTED_EVENTS = Zone4.__symbol__(\"BLACK_LISTED_EVENTS\");\n const SYMBOL_UNPATCHED_EVENTS = Zone4.__symbol__(\"UNPATCHED_EVENTS\");\n if (global2[SYMBOL_UNPATCHED_EVENTS]) {\n global2[SYMBOL_BLACK_LISTED_EVENTS] = global2[SYMBOL_UNPATCHED_EVENTS];\n }\n if (global2[SYMBOL_BLACK_LISTED_EVENTS]) {\n Zone4[SYMBOL_BLACK_LISTED_EVENTS] = Zone4[SYMBOL_UNPATCHED_EVENTS] = global2[SYMBOL_BLACK_LISTED_EVENTS];\n }\n api.patchEventPrototype = patchEventPrototype;\n api.patchEventTarget = patchEventTarget;\n api.ObjectDefineProperty = ObjectDefineProperty;\n api.ObjectGetOwnPropertyDescriptor = ObjectGetOwnPropertyDescriptor;\n api.ObjectCreate = ObjectCreate;\n api.ArraySlice = ArraySlice;\n api.patchClass = patchClass;\n api.wrapWithCurrentZone = wrapWithCurrentZone;\n api.filterProperties = filterProperties;\n api.attachOriginToPatched = attachOriginToPatched;\n api._redefineProperty = Object.defineProperty;\n api.patchCallbacks = patchCallbacks;\n api.getGlobalObjects = () => ({\n globalSources,\n zoneSymbolEventNames: zoneSymbolEventNames2,\n eventNames,\n isBrowser,\n isMix,\n isNode,\n TRUE_STR,\n FALSE_STR,\n ZONE_SYMBOL_PREFIX,\n ADD_EVENT_LISTENER_STR,\n REMOVE_EVENT_LISTENER_STR\n });\n });\n}\n\n// packages/zone.js/lib/browser/rollup-common.js\nfunction patchCommon(Zone3) {\n patchPromise(Zone3);\n patchToString(Zone3);\n patchUtil(Zone3);\n}\n\n// packages/zone.js/lib/browser/rollup-main.js\nvar Zone2 = loadZone();\npatchCommon(Zone2);\npatchBrowser(Zone2);\n","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { createContextKey } from '@opentelemetry/api';\nconst SUPPRESS_TRACING_KEY = createContextKey('OpenTelemetry SDK Context Key SUPPRESS_TRACING');\nexport function suppressTracing(context) {\n return context.setValue(SUPPRESS_TRACING_KEY, true);\n}\nexport function unsuppressTracing(context) {\n return context.deleteValue(SUPPRESS_TRACING_KEY);\n}\nexport function isTracingSuppressed(context) {\n return context.getValue(SUPPRESS_TRACING_KEY) === true;\n}\n//# sourceMappingURL=suppress-tracing.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport const BAGGAGE_KEY_PAIR_SEPARATOR = '=';\nexport const BAGGAGE_PROPERTIES_SEPARATOR = ';';\nexport const BAGGAGE_ITEMS_SEPARATOR = ',';\n// Name of the http header used to propagate the baggage\nexport const BAGGAGE_HEADER = 'baggage';\n// Maximum number of name-value pairs allowed by w3c spec\nexport const BAGGAGE_MAX_NAME_VALUE_PAIRS = 180;\n// Maximum number of bytes per a single name-value pair allowed by w3c spec\nexport const BAGGAGE_MAX_PER_NAME_VALUE_PAIRS = 4096;\n// Maximum total length of all name-value pairs allowed by w3c spec\nexport const BAGGAGE_MAX_TOTAL_LENGTH = 8192;\n//# sourceMappingURL=constants.js.map","import { baggageEntryMetadataFromString } from '@opentelemetry/api';\nimport { BAGGAGE_ITEMS_SEPARATOR, BAGGAGE_PROPERTIES_SEPARATOR, BAGGAGE_KEY_PAIR_SEPARATOR, BAGGAGE_MAX_TOTAL_LENGTH, } from './constants';\nexport function serializeKeyPairs(keyPairs) {\n return keyPairs.reduce((hValue, current) => {\n const value = `${hValue}${hValue !== '' ? BAGGAGE_ITEMS_SEPARATOR : ''}${current}`;\n return value.length > BAGGAGE_MAX_TOTAL_LENGTH ? hValue : value;\n }, '');\n}\nexport function getKeyPairs(baggage) {\n return baggage.getAllEntries().map(([key, value]) => {\n let entry = `${encodeURIComponent(key)}=${encodeURIComponent(value.value)}`;\n // include opaque metadata if provided\n // NOTE: we intentionally don't URI-encode the metadata - that responsibility falls on the metadata implementation\n if (value.metadata !== undefined) {\n entry += BAGGAGE_PROPERTIES_SEPARATOR + value.metadata.toString();\n }\n return entry;\n });\n}\nexport function parsePairKeyValue(entry) {\n if (!entry)\n return;\n const metadataSeparatorIndex = entry.indexOf(BAGGAGE_PROPERTIES_SEPARATOR);\n const keyPairPart = metadataSeparatorIndex === -1\n ? entry\n : entry.substring(0, metadataSeparatorIndex);\n const separatorIndex = keyPairPart.indexOf(BAGGAGE_KEY_PAIR_SEPARATOR);\n if (separatorIndex <= 0)\n return;\n const rawKey = keyPairPart.substring(0, separatorIndex).trim();\n const rawValue = keyPairPart.substring(separatorIndex + 1).trim();\n if (!rawKey || !rawValue)\n return;\n let key;\n let value;\n try {\n key = decodeURIComponent(rawKey);\n value = decodeURIComponent(rawValue);\n }\n catch {\n return;\n }\n let metadata;\n if (metadataSeparatorIndex !== -1 &&\n metadataSeparatorIndex < entry.length - 1) {\n const metadataString = entry.substring(metadataSeparatorIndex + 1);\n metadata = baggageEntryMetadataFromString(metadataString);\n }\n return { key, value, metadata };\n}\n/**\n * Parse a string serialized in the baggage HTTP Format (without metadata):\n * https://github.com/w3c/baggage/blob/master/baggage/HTTP_HEADER_FORMAT.md\n */\nexport function parseKeyPairsIntoRecord(value) {\n const result = {};\n if (typeof value === 'string' && value.length > 0) {\n value.split(BAGGAGE_ITEMS_SEPARATOR).forEach(entry => {\n const keyPair = parsePairKeyValue(entry);\n if (keyPair !== undefined && keyPair.value.length > 0) {\n result[keyPair.key] = keyPair.value;\n }\n });\n }\n return result;\n}\n//# sourceMappingURL=utils.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { propagation } from '@opentelemetry/api';\nimport { isTracingSuppressed } from '../../trace/suppress-tracing';\nimport { BAGGAGE_HEADER, BAGGAGE_ITEMS_SEPARATOR, BAGGAGE_MAX_NAME_VALUE_PAIRS, BAGGAGE_MAX_PER_NAME_VALUE_PAIRS, } from '../constants';\nimport { getKeyPairs, parsePairKeyValue, serializeKeyPairs } from '../utils';\n/**\n * Propagates {@link Baggage} through Context format propagation.\n *\n * Based on the Baggage specification:\n * https://w3c.github.io/baggage/\n */\nexport class W3CBaggagePropagator {\n inject(context, carrier, setter) {\n const baggage = propagation.getBaggage(context);\n if (!baggage || isTracingSuppressed(context))\n return;\n const keyPairs = getKeyPairs(baggage)\n .filter((pair) => {\n return pair.length <= BAGGAGE_MAX_PER_NAME_VALUE_PAIRS;\n })\n .slice(0, BAGGAGE_MAX_NAME_VALUE_PAIRS);\n const headerValue = serializeKeyPairs(keyPairs);\n if (headerValue.length > 0) {\n setter.set(carrier, BAGGAGE_HEADER, headerValue);\n }\n }\n extract(context, carrier, getter) {\n const headerValue = getter.get(carrier, BAGGAGE_HEADER);\n const baggageString = Array.isArray(headerValue)\n ? headerValue.join(BAGGAGE_ITEMS_SEPARATOR)\n : headerValue;\n if (!baggageString)\n return context;\n const baggage = {};\n if (baggageString.length === 0) {\n return context;\n }\n const pairs = baggageString.split(BAGGAGE_ITEMS_SEPARATOR);\n pairs.forEach(entry => {\n const keyPair = parsePairKeyValue(entry);\n if (keyPair) {\n const baggageEntry = { value: keyPair.value };\n if (keyPair.metadata) {\n baggageEntry.metadata = keyPair.metadata;\n }\n baggage[keyPair.key] = baggageEntry;\n }\n });\n if (Object.entries(baggage).length === 0) {\n return context;\n }\n return propagation.setBaggage(context, propagation.createBaggage(baggage));\n }\n fields() {\n return [BAGGAGE_HEADER];\n }\n}\n//# sourceMappingURL=W3CBaggagePropagator.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\nexport function sanitizeAttributes(attributes) {\n const out = {};\n if (typeof attributes !== 'object' || attributes == null) {\n return out;\n }\n for (const key in attributes) {\n if (!Object.prototype.hasOwnProperty.call(attributes, key)) {\n continue;\n }\n if (!isAttributeKey(key)) {\n diag.warn(`Invalid attribute key: ${key}`);\n continue;\n }\n const val = attributes[key];\n if (!isAttributeValue(val)) {\n diag.warn(`Invalid attribute value set for key: ${key}`);\n continue;\n }\n if (Array.isArray(val)) {\n out[key] = val.slice();\n }\n else {\n out[key] = val;\n }\n }\n return out;\n}\nexport function isAttributeKey(key) {\n return typeof key === 'string' && key !== '';\n}\nexport function isAttributeValue(val) {\n if (val == null) {\n return true;\n }\n if (Array.isArray(val)) {\n return isHomogeneousAttributeValueArray(val);\n }\n return isValidPrimitiveAttributeValueType(typeof val);\n}\nfunction isHomogeneousAttributeValueArray(arr) {\n let type;\n for (const element of arr) {\n // null/undefined elements are allowed\n if (element == null)\n continue;\n const elementType = typeof element;\n if (elementType === type) {\n continue;\n }\n if (!type) {\n if (isValidPrimitiveAttributeValueType(elementType)) {\n type = elementType;\n continue;\n }\n // encountered an invalid primitive\n return false;\n }\n return false;\n }\n return true;\n}\nfunction isValidPrimitiveAttributeValueType(valType) {\n switch (valType) {\n case 'number':\n case 'boolean':\n case 'string':\n return true;\n }\n return false;\n}\n//# sourceMappingURL=attributes.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\n/**\n * Returns a function that logs an error using the provided logger, or a\n * console logger if one was not provided.\n */\nexport function loggingErrorHandler() {\n return (ex) => {\n diag.error(stringifyException(ex));\n };\n}\n/**\n * Converts an exception into a string representation\n * @param {Exception} ex\n */\nfunction stringifyException(ex) {\n if (typeof ex === 'string') {\n return ex;\n }\n else {\n return JSON.stringify(flattenException(ex));\n }\n}\n/**\n * Flattens an exception into key-value pairs by traversing the prototype chain\n * and coercing values to strings. Duplicate properties will not be overwritten;\n * the first insert wins.\n */\nfunction flattenException(ex) {\n const result = {};\n let current = ex;\n while (current !== null) {\n Object.getOwnPropertyNames(current).forEach(propertyName => {\n if (result[propertyName])\n return;\n const value = current[propertyName];\n if (value) {\n result[propertyName] = String(value);\n }\n });\n current = Object.getPrototypeOf(current);\n }\n return result;\n}\n//# sourceMappingURL=logging-error-handler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { loggingErrorHandler } from './logging-error-handler';\n/** The global error handler delegate */\nlet delegateHandler = loggingErrorHandler();\n/**\n * Set the global error handler\n * @param {ErrorHandler} handler\n */\nexport function setGlobalErrorHandler(handler) {\n delegateHandler = handler;\n}\n/**\n * Return the global error handler\n * @param {Exception} ex\n */\nexport function globalErrorHandler(ex) {\n try {\n delegateHandler(ex);\n }\n catch { } // eslint-disable-line no-empty\n}\n//# sourceMappingURL=global-error-handler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport function getStringFromEnv(_) {\n return undefined;\n}\nexport function getBooleanFromEnv(_) {\n return undefined;\n}\nexport function getNumberFromEnv(_) {\n return undefined;\n}\nexport function getStringListFromEnv(_) {\n return undefined;\n}\n//# sourceMappingURL=environment.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '2.7.1';\n//# sourceMappingURL=version.js.map","/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//----------------------------------------------------------------------------------------------------------\n// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates/registry/stable/attributes.ts.j2\n//----------------------------------------------------------------------------------------------------------\n/**\n * ASP.NET Core exception middleware handling result.\n *\n * @example handled\n * @example unhandled\n */\nexport const ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT = 'aspnetcore.diagnostics.exception.result';\n/**\n * Enum value \"aborted\" for attribute {@link ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT}.\n *\n * Exception handling didn't run because the request was aborted.\n */\nexport const ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED = \"aborted\";\n/**\n * Enum value \"handled\" for attribute {@link ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT}.\n *\n * Exception was handled by the exception handling middleware.\n */\nexport const ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED = \"handled\";\n/**\n * Enum value \"skipped\" for attribute {@link ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT}.\n *\n * Exception handling was skipped because the response had started.\n */\nexport const ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED = \"skipped\";\n/**\n * Enum value \"unhandled\" for attribute {@link ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT}.\n *\n * Exception was not handled by the exception handling middleware.\n */\nexport const ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED = \"unhandled\";\n/**\n * Full type name of the [`IExceptionHandler`](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) implementation that handled the exception.\n *\n * @example Contoso.MyHandler\n */\nexport const ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE = 'aspnetcore.diagnostics.handler.type';\n/**\n * Rate limiting policy name.\n *\n * @example fixed\n * @example sliding\n * @example token\n */\nexport const ATTR_ASPNETCORE_RATE_LIMITING_POLICY = 'aspnetcore.rate_limiting.policy';\n/**\n * Rate-limiting result, shows whether the lease was acquired or contains a rejection reason\n *\n * @example acquired\n * @example request_canceled\n */\nexport const ATTR_ASPNETCORE_RATE_LIMITING_RESULT = 'aspnetcore.rate_limiting.result';\n/**\n * Enum value \"acquired\" for attribute {@link ATTR_ASPNETCORE_RATE_LIMITING_RESULT}.\n *\n * Lease was acquired\n */\nexport const ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED = \"acquired\";\n/**\n * Enum value \"endpoint_limiter\" for attribute {@link ATTR_ASPNETCORE_RATE_LIMITING_RESULT}.\n *\n * Lease request was rejected by the endpoint limiter\n */\nexport const ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER = \"endpoint_limiter\";\n/**\n * Enum value \"global_limiter\" for attribute {@link ATTR_ASPNETCORE_RATE_LIMITING_RESULT}.\n *\n * Lease request was rejected by the global limiter\n */\nexport const ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER = \"global_limiter\";\n/**\n * Enum value \"request_canceled\" for attribute {@link ATTR_ASPNETCORE_RATE_LIMITING_RESULT}.\n *\n * Lease request was canceled\n */\nexport const ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED = \"request_canceled\";\n/**\n * Flag indicating if request was handled by the application pipeline.\n *\n * @example true\n */\nexport const ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED = 'aspnetcore.request.is_unhandled';\n/**\n * A value that indicates whether the matched route is a fallback route.\n *\n * @example true\n */\nexport const ATTR_ASPNETCORE_ROUTING_IS_FALLBACK = 'aspnetcore.routing.is_fallback';\n/**\n * Match result - success or failure\n *\n * @example success\n * @example failure\n */\nexport const ATTR_ASPNETCORE_ROUTING_MATCH_STATUS = 'aspnetcore.routing.match_status';\n/**\n * Enum value \"failure\" for attribute {@link ATTR_ASPNETCORE_ROUTING_MATCH_STATUS}.\n *\n * Match failed\n */\nexport const ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE = \"failure\";\n/**\n * Enum value \"success\" for attribute {@link ATTR_ASPNETCORE_ROUTING_MATCH_STATUS}.\n *\n * Match succeeded\n */\nexport const ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS = \"success\";\n/**\n * A value that indicates whether the user is authenticated.\n *\n * @example true\n */\nexport const ATTR_ASPNETCORE_USER_IS_AUTHENTICATED = 'aspnetcore.user.is_authenticated';\n/**\n * Client address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.\n *\n * @example client.example.com\n * @example 10.1.2.80\n * @example /tmp/my.sock\n *\n * @note When observed from the server side, and when communicating through an intermediary, `client.address` **SHOULD** represent the client address behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_CLIENT_ADDRESS = 'client.address';\n/**\n * Client port number.\n *\n * @example 65123\n *\n * @note When observed from the server side, and when communicating through an intermediary, `client.port` **SHOULD** represent the client port behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_CLIENT_PORT = 'client.port';\n/**\n * The column number in `code.file.path` best representing the operation. It **SHOULD** point within the code unit named in `code.function.name`. This attribute **MUST NOT** be used on the Profile signal since the data is already captured in 'message Line'. This constraint is imposed to prevent redundancy and maintain data integrity.\n *\n * @example 16\n */\nexport const ATTR_CODE_COLUMN_NUMBER = 'code.column.number';\n/**\n * The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path). This attribute **MUST NOT** be used on the Profile signal since the data is already captured in 'message Function'. This constraint is imposed to prevent redundancy and maintain data integrity.\n *\n * @example \"/usr/local/MyApplication/content_root/app/index.php\"\n */\nexport const ATTR_CODE_FILE_PATH = 'code.file.path';\n/**\n * The method or function fully-qualified name without arguments. The value should fit the natural representation of the language runtime, which is also likely the same used within `code.stacktrace` attribute value. This attribute **MUST NOT** be used on the Profile signal since the data is already captured in 'message Function'. This constraint is imposed to prevent redundancy and maintain data integrity.\n *\n * @example com.example.MyHttpService.serveRequest\n * @example GuzzleHttp\\\\Client::transfer\n * @example fopen\n *\n * @note Values and format depends on each language runtime, thus it is impossible to provide an exhaustive list of examples.\n * The values are usually the same (or prefixes of) the ones found in native stack trace representation stored in\n * `code.stacktrace` without information on arguments.\n *\n * Examples:\n *\n * - Java method: `com.example.MyHttpService.serveRequest`\n * - Java anonymous class method: `com.mycompany.Main$1.myMethod`\n * - Java lambda method: `com.mycompany.Main$$Lambda/0x0000748ae4149c00.myMethod`\n * - PHP function: `GuzzleHttp\\Client::transfer`\n * - Go function: `github.com/my/repo/pkg.foo.func5`\n * - Elixir: `OpenTelemetry.Ctx.new`\n * - Erlang: `opentelemetry_ctx:new`\n * - Rust: `playground::my_module::my_cool_func`\n * - C function: `fopen`\n */\nexport const ATTR_CODE_FUNCTION_NAME = 'code.function.name';\n/**\n * The line number in `code.file.path` best representing the operation. It **SHOULD** point within the code unit named in `code.function.name`. This attribute **MUST NOT** be used on the Profile signal since the data is already captured in 'message Line'. This constraint is imposed to prevent redundancy and maintain data integrity.\n *\n * @example 42\n */\nexport const ATTR_CODE_LINE_NUMBER = 'code.line.number';\n/**\n * A stacktrace as a string in the natural representation for the language runtime. The representation is identical to [`exception.stacktrace`](/docs/exceptions/exceptions-spans.md#stacktrace-representation). This attribute **MUST NOT** be used on the Profile signal since the data is already captured in 'message Location'. This constraint is imposed to prevent redundancy and maintain data integrity.\n *\n * @example \"at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\\\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\\\n at com.example.GenerateTrace.main(GenerateTrace.java:5)\\\\n\"\n */\nexport const ATTR_CODE_STACKTRACE = 'code.stacktrace';\n/**\n * The name of a collection (table, container) within the database.\n *\n * @example public.users\n * @example customers\n *\n * @note It is **RECOMMENDED** to capture the value as provided by the application\n * without attempting to do any case normalization.\n *\n * The collection name **SHOULD NOT** be extracted from `db.query.text`,\n * when the database system supports query text with multiple collections\n * in non-batch operations.\n *\n * For batch operations, if the individual operations are known to have the same\n * collection name then that collection name **SHOULD** be used.\n */\nexport const ATTR_DB_COLLECTION_NAME = 'db.collection.name';\n/**\n * The name of the database, fully qualified within the server address and port.\n *\n * @example customers\n * @example test.users\n *\n * @note If a database system has multiple namespace components, they **SHOULD** be concatenated from the most general to the most specific namespace component, using `|` as a separator between the components. Any missing components (and their associated separators) **SHOULD** be omitted.\n * Semantic conventions for individual database systems **SHOULD** document what `db.namespace` means in the context of that system.\n * It is **RECOMMENDED** to capture the value as provided by the application without attempting to do any case normalization.\n */\nexport const ATTR_DB_NAMESPACE = 'db.namespace';\n/**\n * The number of queries included in a batch operation.\n *\n * @example 2\n * @example 3\n * @example 4\n *\n * @note Operations are only considered batches when they contain two or more operations, and so `db.operation.batch.size` **SHOULD** never be `1`.\n */\nexport const ATTR_DB_OPERATION_BATCH_SIZE = 'db.operation.batch.size';\n/**\n * The name of the operation or command being executed.\n *\n * @example findAndModify\n * @example HMSET\n * @example SELECT\n *\n * @note It is **RECOMMENDED** to capture the value as provided by the application\n * without attempting to do any case normalization.\n *\n * The operation name **SHOULD NOT** be extracted from `db.query.text`,\n * when the database system supports query text with multiple operations\n * in non-batch operations.\n *\n * If spaces can occur in the operation name, multiple consecutive spaces\n * **SHOULD** be normalized to a single space.\n *\n * For batch operations, if the individual operations are known to have the same operation name\n * then that operation name **SHOULD** be used prepended by `BATCH `,\n * otherwise `db.operation.name` **SHOULD** be `BATCH` or some other database\n * system specific term if more applicable.\n */\nexport const ATTR_DB_OPERATION_NAME = 'db.operation.name';\n/**\n * Low cardinality summary of a database query.\n *\n * @example SELECT wuser_table\n * @example INSERT shipping_details SELECT orders\n * @example get user by id\n *\n * @note The query summary describes a class of database queries and is useful\n * as a grouping key, especially when analyzing telemetry for database\n * calls involving complex queries.\n *\n * Summary may be available to the instrumentation through\n * instrumentation hooks or other means. If it is not available, instrumentations\n * that support query parsing **SHOULD** generate a summary following\n * [Generating query summary](/docs/db/database-spans.md#generating-a-summary-of-the-query)\n * section.\n *\n * For batch operations, if the individual operations are known to have the same query summary\n * then that query summary **SHOULD** be used prepended by `BATCH `,\n * otherwise `db.query.summary` **SHOULD** be `BATCH` or some other database\n * system specific term if more applicable.\n */\nexport const ATTR_DB_QUERY_SUMMARY = 'db.query.summary';\n/**\n * The database query being executed.\n *\n * @example SELECT * FROM wuser_table where username = ?\n * @example SET mykey ?\n *\n * @note For sanitization see [Sanitization of `db.query.text`](/docs/db/database-spans.md#sanitization-of-dbquerytext).\n * For batch operations, if the individual operations are known to have the same query text then that query text **SHOULD** be used, otherwise all of the individual query texts **SHOULD** be concatenated with separator `; ` or some other database system specific separator if more applicable.\n * Parameterized query text **SHOULD NOT** be sanitized. Even though parameterized query text can potentially have sensitive data, by using a parameterized query the user is giving a strong signal that any sensitive data will be passed as parameter values, and the benefit to observability of capturing the static part of the query text by default outweighs the risk.\n */\nexport const ATTR_DB_QUERY_TEXT = 'db.query.text';\n/**\n * Database response status code.\n *\n * @example 102\n * @example ORA-17002\n * @example 08P01\n * @example 404\n *\n * @note The status code returned by the database. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes.\n * Semantic conventions for individual database systems **SHOULD** document what `db.response.status_code` means in the context of that system.\n */\nexport const ATTR_DB_RESPONSE_STATUS_CODE = 'db.response.status_code';\n/**\n * The name of a stored procedure within the database.\n *\n * @example GetCustomer\n *\n * @note It is **RECOMMENDED** to capture the value as provided by the application\n * without attempting to do any case normalization.\n *\n * For batch operations, if the individual operations are known to have the same\n * stored procedure name then that stored procedure name **SHOULD** be used.\n */\nexport const ATTR_DB_STORED_PROCEDURE_NAME = 'db.stored_procedure.name';\n/**\n * The database management system (DBMS) product as identified by the client instrumentation.\n *\n * @note The actual DBMS may differ from the one identified by the client. For example, when using PostgreSQL client libraries to connect to a CockroachDB, the `db.system.name` is set to `postgresql` based on the instrumentation's best knowledge.\n */\nexport const ATTR_DB_SYSTEM_NAME = 'db.system.name';\n/**\n * Enum value \"mariadb\" for attribute {@link ATTR_DB_SYSTEM_NAME}.\n *\n * [MariaDB](https://mariadb.org/)\n */\nexport const DB_SYSTEM_NAME_VALUE_MARIADB = \"mariadb\";\n/**\n * Enum value \"microsoft.sql_server\" for attribute {@link ATTR_DB_SYSTEM_NAME}.\n *\n * [Microsoft SQL Server](https://www.microsoft.com/sql-server)\n */\nexport const DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER = \"microsoft.sql_server\";\n/**\n * Enum value \"mysql\" for attribute {@link ATTR_DB_SYSTEM_NAME}.\n *\n * [MySQL](https://www.mysql.com/)\n */\nexport const DB_SYSTEM_NAME_VALUE_MYSQL = \"mysql\";\n/**\n * Enum value \"postgresql\" for attribute {@link ATTR_DB_SYSTEM_NAME}.\n *\n * [PostgreSQL](https://www.postgresql.org/)\n */\nexport const DB_SYSTEM_NAME_VALUE_POSTGRESQL = \"postgresql\";\n/**\n * Name of the garbage collector managed heap generation.\n *\n * @example gen0\n * @example gen1\n * @example gen2\n */\nexport const ATTR_DOTNET_GC_HEAP_GENERATION = 'dotnet.gc.heap.generation';\n/**\n * Enum value \"gen0\" for attribute {@link ATTR_DOTNET_GC_HEAP_GENERATION}.\n *\n * Generation 0\n */\nexport const DOTNET_GC_HEAP_GENERATION_VALUE_GEN0 = \"gen0\";\n/**\n * Enum value \"gen1\" for attribute {@link ATTR_DOTNET_GC_HEAP_GENERATION}.\n *\n * Generation 1\n */\nexport const DOTNET_GC_HEAP_GENERATION_VALUE_GEN1 = \"gen1\";\n/**\n * Enum value \"gen2\" for attribute {@link ATTR_DOTNET_GC_HEAP_GENERATION}.\n *\n * Generation 2\n */\nexport const DOTNET_GC_HEAP_GENERATION_VALUE_GEN2 = \"gen2\";\n/**\n * Enum value \"loh\" for attribute {@link ATTR_DOTNET_GC_HEAP_GENERATION}.\n *\n * Large Object Heap\n */\nexport const DOTNET_GC_HEAP_GENERATION_VALUE_LOH = \"loh\";\n/**\n * Enum value \"poh\" for attribute {@link ATTR_DOTNET_GC_HEAP_GENERATION}.\n *\n * Pinned Object Heap\n */\nexport const DOTNET_GC_HEAP_GENERATION_VALUE_POH = \"poh\";\n/**\n * Describes a class of error the operation ended with.\n *\n * @example timeout\n * @example java.net.UnknownHostException\n * @example server_certificate_invalid\n * @example 500\n *\n * @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality.\n *\n * When `error.type` is set to a type (e.g., an exception type), its\n * canonical class name identifying the type within the artifact **SHOULD** be used.\n *\n * Instrumentations **SHOULD** document the list of errors they report.\n *\n * The cardinality of `error.type` within one instrumentation library **SHOULD** be low.\n * Telemetry consumers that aggregate data from multiple instrumentation libraries and applications\n * should be prepared for `error.type` to have high cardinality at query time when no\n * additional filters are applied.\n *\n * If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`.\n *\n * If a specific domain defines its own set of error identifiers (such as HTTP or RPC status codes),\n * it's **RECOMMENDED** to:\n *\n * - Use a domain-specific attribute\n * - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.\n */\nexport const ATTR_ERROR_TYPE = 'error.type';\n/**\n * Enum value \"_OTHER\" for attribute {@link ATTR_ERROR_TYPE}.\n *\n * A fallback error value to be used when the instrumentation doesn't define a custom value.\n */\nexport const ERROR_TYPE_VALUE_OTHER = \"_OTHER\";\n/**\n * Indicates that the exception is escaping the scope of the span.\n *\n * @deprecated It's no longer recommended to record exceptions that are handled and do not escape the scope of a span.\n */\nexport const ATTR_EXCEPTION_ESCAPED = 'exception.escaped';\n/**\n * The exception message.\n *\n * @example Division by zero\n * @example Can't convert 'int' object to str implicitly\n *\n * @note > [!WARNING]\n *\n * > This attribute may contain sensitive information.\n */\nexport const ATTR_EXCEPTION_MESSAGE = 'exception.message';\n/**\n * A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG.\n *\n * @example \"Exception in thread \"main\" java.lang.RuntimeException: Test exception\\\\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\\\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\\\n at com.example.GenerateTrace.main(GenerateTrace.java:5)\\\\n\"\n */\nexport const ATTR_EXCEPTION_STACKTRACE = 'exception.stacktrace';\n/**\n * The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it.\n *\n * @example java.net.ConnectException\n * @example OSError\n */\nexport const ATTR_EXCEPTION_TYPE = 'exception.type';\n/**\n * HTTP request headers, `<key>` being the normalized HTTP Header name (lowercase), the value being the header values.\n *\n * @example [\"application/json\"]\n * @example [\"1.2.3.4\", \"1.2.3.5\"]\n *\n * @note Instrumentations **SHOULD** require an explicit configuration of which headers are to be captured.\n * Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\n *\n * The `User-Agent` header is already captured in the `user_agent.original` attribute.\n * Users **MAY** explicitly configure instrumentations to capture them even though it is not recommended.\n *\n * The attribute value **MUST** consist of either multiple header values as an array of strings\n * or a single-item array containing a possibly comma-concatenated string, depending on the way\n * the HTTP library provides access to headers.\n *\n * Examples:\n *\n * - A header `Content-Type: application/json` **SHOULD** be recorded as the `http.request.header.content-type`\n * attribute with value `[\"application/json\"]`.\n * - A header `X-Forwarded-For: 1.2.3.4, 1.2.3.5` **SHOULD** be recorded as the `http.request.header.x-forwarded-for`\n * attribute with value `[\"1.2.3.4\", \"1.2.3.5\"]` or `[\"1.2.3.4, 1.2.3.5\"]` depending on the HTTP library.\n */\nexport const ATTR_HTTP_REQUEST_HEADER = (key) => `http.request.header.${key}`;\n/**\n * HTTP request method.\n *\n * @example GET\n * @example POST\n * @example HEAD\n *\n * @note HTTP request method value **SHOULD** be \"known\" to the instrumentation.\n * By default, this convention defines \"known\" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods),\n * the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html)\n * and the QUERY method defined in [httpbis-safe-method-w-body](https://datatracker.ietf.org/doc/draft-ietf-httpbis-safe-method-w-body/?include_text=1).\n *\n * If the HTTP request method is not known to instrumentation, it **MUST** set the `http.request.method` attribute to `_OTHER`.\n *\n * If the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it **MUST** provide a way to override\n * the list of known HTTP methods. If this override is done via environment variable, then the environment variable **MUST** be named\n * OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods.\n *\n *\n * If this override is done via declarative configuration, then the list **MUST** be configurable via the `known_methods` property\n * (an array of case-sensitive strings with minimum items 0) under `.instrumentation/development.general.http.client` and/or\n * `.instrumentation/development.general.http.server`.\n *\n * In either case, this list **MUST** be a full override of the default known methods,\n * it is not a list of known methods in addition to the defaults.\n *\n * HTTP method names are case-sensitive and `http.request.method` attribute value **MUST** match a known HTTP method name exactly.\n * Instrumentations for specific web frameworks that consider HTTP methods to be case insensitive, **SHOULD** populate a canonical equivalent.\n * Tracing instrumentations that do so, **MUST** also set `http.request.method_original` to the original value.\n */\nexport const ATTR_HTTP_REQUEST_METHOD = 'http.request.method';\n/**\n * Enum value \"_OTHER\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * Any HTTP method that the instrumentation has no prior knowledge of.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_OTHER = \"_OTHER\";\n/**\n * Enum value \"CONNECT\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * CONNECT method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_CONNECT = \"CONNECT\";\n/**\n * Enum value \"DELETE\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * DELETE method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_DELETE = \"DELETE\";\n/**\n * Enum value \"GET\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * GET method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_GET = \"GET\";\n/**\n * Enum value \"HEAD\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * HEAD method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_HEAD = \"HEAD\";\n/**\n * Enum value \"OPTIONS\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * OPTIONS method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_OPTIONS = \"OPTIONS\";\n/**\n * Enum value \"PATCH\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * PATCH method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_PATCH = \"PATCH\";\n/**\n * Enum value \"POST\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * POST method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_POST = \"POST\";\n/**\n * Enum value \"PUT\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * PUT method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_PUT = \"PUT\";\n/**\n * Enum value \"TRACE\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * TRACE method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_TRACE = \"TRACE\";\n/**\n * Original HTTP method sent by the client in the request line.\n *\n * @example GeT\n * @example ACL\n * @example foo\n */\nexport const ATTR_HTTP_REQUEST_METHOD_ORIGINAL = 'http.request.method_original';\n/**\n * The ordinal number of request resending attempt (for any reason, including redirects).\n *\n * @example 3\n *\n * @note The resend count **SHOULD** be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other).\n */\nexport const ATTR_HTTP_REQUEST_RESEND_COUNT = 'http.request.resend_count';\n/**\n * HTTP response headers, `<key>` being the normalized HTTP Header name (lowercase), the value being the header values.\n *\n * @example [\"application/json\"]\n * @example [\"abc\", \"def\"]\n *\n * @note Instrumentations **SHOULD** require an explicit configuration of which headers are to be captured.\n * Including all response headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\n *\n * Users **MAY** explicitly configure instrumentations to capture them even though it is not recommended.\n *\n * The attribute value **MUST** consist of either multiple header values as an array of strings\n * or a single-item array containing a possibly comma-concatenated string, depending on the way\n * the HTTP library provides access to headers.\n *\n * Examples:\n *\n * - A header `Content-Type: application/json` header **SHOULD** be recorded as the `http.request.response.content-type`\n * attribute with value `[\"application/json\"]`.\n * - A header `My-custom-header: abc, def` header **SHOULD** be recorded as the `http.response.header.my-custom-header`\n * attribute with value `[\"abc\", \"def\"]` or `[\"abc, def\"]` depending on the HTTP library.\n */\nexport const ATTR_HTTP_RESPONSE_HEADER = (key) => `http.response.header.${key}`;\n/**\n * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).\n *\n * @example 200\n */\nexport const ATTR_HTTP_RESPONSE_STATUS_CODE = 'http.response.status_code';\n/**\n * The matched route template for the request. This **MUST** be low-cardinality and include all static path segments, with dynamic path segments represented with placeholders.\n *\n * @example /users/:userID?\n * @example my-controller/my-action/{id?}\n *\n * @note **MUST NOT** be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it.\n * **SHOULD** include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one.\n *\n * A static path segment is a part of the route template with a fixed, low-cardinality value. This includes literal strings like `/users/` and placeholders that\n * are constrained to a finite, predefined set of values, e.g. `{controller}` or `{action}`.\n *\n * A dynamic path segment is a placeholder for a value that can have high cardinality and is not constrained to a predefined list like static path segments.\n *\n * Instrumentations **SHOULD** use routing information provided by the corresponding web framework. They **SHOULD** pick the most precise source of routing information and **MAY**\n * support custom route formatting. Instrumentations **SHOULD** document the format and the API used to obtain the route string.\n */\nexport const ATTR_HTTP_ROUTE = 'http.route';\n/**\n * Name of the garbage collector action.\n *\n * @example end of minor GC\n * @example end of major GC\n *\n * @note Garbage collector action is generally obtained via [GarbageCollectionNotificationInfo#getGcAction()](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/GarbageCollectionNotificationInfo.html#getGcAction()).\n */\nexport const ATTR_JVM_GC_ACTION = 'jvm.gc.action';\n/**\n * Name of the garbage collector.\n *\n * @example G1 Young Generation\n * @example G1 Old Generation\n *\n * @note Garbage collector name is generally obtained via [GarbageCollectionNotificationInfo#getGcName()](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/GarbageCollectionNotificationInfo.html#getGcName()).\n */\nexport const ATTR_JVM_GC_NAME = 'jvm.gc.name';\n/**\n * Name of the memory pool.\n *\n * @example G1 Old Gen\n * @example G1 Eden space\n * @example G1 Survivor Space\n *\n * @note Pool names are generally obtained via [MemoryPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html#getName()).\n */\nexport const ATTR_JVM_MEMORY_POOL_NAME = 'jvm.memory.pool.name';\n/**\n * The type of memory.\n *\n * @example heap\n * @example non_heap\n */\nexport const ATTR_JVM_MEMORY_TYPE = 'jvm.memory.type';\n/**\n * Enum value \"heap\" for attribute {@link ATTR_JVM_MEMORY_TYPE}.\n *\n * Heap memory.\n */\nexport const JVM_MEMORY_TYPE_VALUE_HEAP = \"heap\";\n/**\n * Enum value \"non_heap\" for attribute {@link ATTR_JVM_MEMORY_TYPE}.\n *\n * Non-heap memory\n */\nexport const JVM_MEMORY_TYPE_VALUE_NON_HEAP = \"non_heap\";\n/**\n * Whether the thread is daemon or not.\n */\nexport const ATTR_JVM_THREAD_DAEMON = 'jvm.thread.daemon';\n/**\n * State of the thread.\n *\n * @example runnable\n * @example blocked\n */\nexport const ATTR_JVM_THREAD_STATE = 'jvm.thread.state';\n/**\n * Enum value \"blocked\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread that is blocked waiting for a monitor lock is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_BLOCKED = \"blocked\";\n/**\n * Enum value \"new\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread that has not yet started is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_NEW = \"new\";\n/**\n * Enum value \"runnable\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread executing in the Java virtual machine is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_RUNNABLE = \"runnable\";\n/**\n * Enum value \"terminated\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread that has exited is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_TERMINATED = \"terminated\";\n/**\n * Enum value \"timed_waiting\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_TIMED_WAITING = \"timed_waiting\";\n/**\n * Enum value \"waiting\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread that is waiting indefinitely for another thread to perform a particular action is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_WAITING = \"waiting\";\n/**\n * Local address of the network connection - IP address or Unix domain socket name.\n *\n * @example 10.1.2.80\n * @example /tmp/my.sock\n */\nexport const ATTR_NETWORK_LOCAL_ADDRESS = 'network.local.address';\n/**\n * Local port number of the network connection.\n *\n * @example 65123\n */\nexport const ATTR_NETWORK_LOCAL_PORT = 'network.local.port';\n/**\n * Peer address of the network connection - IP address or Unix domain socket name.\n *\n * @example 10.1.2.80\n * @example /tmp/my.sock\n */\nexport const ATTR_NETWORK_PEER_ADDRESS = 'network.peer.address';\n/**\n * Peer port number of the network connection.\n *\n * @example 65123\n */\nexport const ATTR_NETWORK_PEER_PORT = 'network.peer.port';\n/**\n * [OSI application layer](https://wikipedia.org/wiki/Application_layer) or non-OSI equivalent.\n *\n * @example amqp\n * @example http\n * @example mqtt\n *\n * @note The value **SHOULD** be normalized to lowercase.\n */\nexport const ATTR_NETWORK_PROTOCOL_NAME = 'network.protocol.name';\n/**\n * The actual version of the protocol used for network communication.\n *\n * @example 1.1\n * @example 2\n *\n * @note If protocol version is subject to negotiation (for example using [ALPN](https://www.rfc-editor.org/rfc/rfc7301.html)), this attribute **SHOULD** be set to the negotiated version. If the actual protocol version is not known, this attribute **SHOULD NOT** be set.\n */\nexport const ATTR_NETWORK_PROTOCOL_VERSION = 'network.protocol.version';\n/**\n * [OSI transport layer](https://wikipedia.org/wiki/Transport_layer) or [inter-process communication method](https://wikipedia.org/wiki/Inter-process_communication).\n *\n * @example tcp\n * @example udp\n *\n * @note The value **SHOULD** be normalized to lowercase.\n *\n * Consider always setting the transport when setting a port number, since\n * a port number is ambiguous without knowing the transport. For example\n * different processes could be listening on TCP port 12345 and UDP port 12345.\n */\nexport const ATTR_NETWORK_TRANSPORT = 'network.transport';\n/**\n * Enum value \"pipe\" for attribute {@link ATTR_NETWORK_TRANSPORT}.\n *\n * Named or anonymous pipe.\n */\nexport const NETWORK_TRANSPORT_VALUE_PIPE = \"pipe\";\n/**\n * Enum value \"quic\" for attribute {@link ATTR_NETWORK_TRANSPORT}.\n *\n * QUIC\n */\nexport const NETWORK_TRANSPORT_VALUE_QUIC = \"quic\";\n/**\n * Enum value \"tcp\" for attribute {@link ATTR_NETWORK_TRANSPORT}.\n *\n * TCP\n */\nexport const NETWORK_TRANSPORT_VALUE_TCP = \"tcp\";\n/**\n * Enum value \"udp\" for attribute {@link ATTR_NETWORK_TRANSPORT}.\n *\n * UDP\n */\nexport const NETWORK_TRANSPORT_VALUE_UDP = \"udp\";\n/**\n * Enum value \"unix\" for attribute {@link ATTR_NETWORK_TRANSPORT}.\n *\n * Unix domain socket\n */\nexport const NETWORK_TRANSPORT_VALUE_UNIX = \"unix\";\n/**\n * [OSI network layer](https://wikipedia.org/wiki/Network_layer) or non-OSI equivalent.\n *\n * @example ipv4\n * @example ipv6\n *\n * @note The value **SHOULD** be normalized to lowercase.\n */\nexport const ATTR_NETWORK_TYPE = 'network.type';\n/**\n * Enum value \"ipv4\" for attribute {@link ATTR_NETWORK_TYPE}.\n *\n * IPv4\n */\nexport const NETWORK_TYPE_VALUE_IPV4 = \"ipv4\";\n/**\n * Enum value \"ipv6\" for attribute {@link ATTR_NETWORK_TYPE}.\n *\n * IPv6\n */\nexport const NETWORK_TYPE_VALUE_IPV6 = \"ipv6\";\n/**\n * The name of the instrumentation scope - (`InstrumentationScope.Name` in OTLP).\n *\n * @example io.opentelemetry.contrib.mongodb\n */\nexport const ATTR_OTEL_SCOPE_NAME = 'otel.scope.name';\n/**\n * The version of the instrumentation scope - (`InstrumentationScope.Version` in OTLP).\n *\n * @example 1.0.0\n */\nexport const ATTR_OTEL_SCOPE_VERSION = 'otel.scope.version';\n/**\n * Name of the code, either \"OK\" or \"ERROR\". **MUST NOT** be set if the status code is UNSET.\n */\nexport const ATTR_OTEL_STATUS_CODE = 'otel.status_code';\n/**\n * Enum value \"ERROR\" for attribute {@link ATTR_OTEL_STATUS_CODE}.\n *\n * The operation contains an error.\n */\nexport const OTEL_STATUS_CODE_VALUE_ERROR = \"ERROR\";\n/**\n * Enum value \"OK\" for attribute {@link ATTR_OTEL_STATUS_CODE}.\n *\n * The operation has been validated by an Application developer or Operator to have completed successfully.\n */\nexport const OTEL_STATUS_CODE_VALUE_OK = \"OK\";\n/**\n * Description of the Status if it has a value, otherwise not set.\n *\n * @example resource not found\n */\nexport const ATTR_OTEL_STATUS_DESCRIPTION = 'otel.status_description';\n/**\n * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.\n *\n * @example example.com\n * @example 10.1.2.80\n * @example /tmp/my.sock\n *\n * @note When observed from the client side, and when communicating through an intermediary, `server.address` **SHOULD** represent the server address behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_SERVER_ADDRESS = 'server.address';\n/**\n * Server port number.\n *\n * @example 80\n * @example 8080\n * @example 443\n *\n * @note When observed from the client side, and when communicating through an intermediary, `server.port` **SHOULD** represent the server port behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_SERVER_PORT = 'server.port';\n/**\n * The string ID of the service instance.\n *\n * @example 627cc493-f310-47de-96bd-71410b7dec09\n *\n * @note **MUST** be unique for each instance of the same `service.namespace,service.name` pair (in other words\n * `service.namespace,service.name,service.instance.id` triplet **MUST** be globally unique). The ID helps to\n * distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled\n * service).\n *\n * Implementations, such as SDKs, are recommended to generate a random Version 1 or Version 4 [RFC\n * 4122](https://www.ietf.org/rfc/rfc4122.txt) UUID, but are free to use an inherent unique ID as the source of\n * this value if stability is desirable. In that case, the ID **SHOULD** be used as source of a UUID Version 5 and\n * **SHOULD** use the following UUID as the namespace: `4d63009a-8d0f-11ee-aad7-4c796ed8e320`.\n *\n * UUIDs are typically recommended, as only an opaque value for the purposes of identifying a service instance is\n * needed. Similar to what can be seen in the man page for the\n * [`/etc/machine-id`](https://www.freedesktop.org/software/systemd/man/latest/machine-id.html) file, the underlying\n * data, such as pod name and namespace should be treated as confidential, being the user's choice to expose it\n * or not via another resource attribute.\n *\n * For applications running behind an application server (like unicorn), we do not recommend using one identifier\n * for all processes participating in the application. Instead, it's recommended each division (e.g. a worker\n * thread in unicorn) to have its own instance.id.\n *\n * It's not recommended for a Collector to set `service.instance.id` if it can't unambiguously determine the\n * service instance that is generating that telemetry. For instance, creating an UUID based on `pod.name` will\n * likely be wrong, as the Collector might not know from which container within that pod the telemetry originated.\n * However, Collectors can set the `service.instance.id` if they can unambiguously determine the service instance\n * for that telemetry. This is typically the case for scraping receivers, as they know the target address and\n * port.\n */\nexport const ATTR_SERVICE_INSTANCE_ID = 'service.instance.id';\n/**\n * Logical name of the service.\n *\n * @example shoppingcart\n *\n * @note **MUST** be the same for all instances of horizontally scaled services. If the value was not specified, SDKs **MUST** fallback to `unknown_service:` concatenated with [`process.executable.name`](process.md), e.g. `unknown_service:bash`. If `process.executable.name` is not available, the value **MUST** be set to `unknown_service`.\n */\nexport const ATTR_SERVICE_NAME = 'service.name';\n/**\n * A namespace for `service.name`.\n *\n * @example Shop\n *\n * @note A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. `service.name` is expected to be unique within the same namespace. If `service.namespace` is not specified in the Resource then `service.name` is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace.\n */\nexport const ATTR_SERVICE_NAMESPACE = 'service.namespace';\n/**\n * The version string of the service component. The format is not defined by these conventions.\n *\n * @example 2.0.0\n * @example a01dbef8a\n */\nexport const ATTR_SERVICE_VERSION = 'service.version';\n/**\n * SignalR HTTP connection closure status.\n *\n * @example app_shutdown\n * @example timeout\n */\nexport const ATTR_SIGNALR_CONNECTION_STATUS = 'signalr.connection.status';\n/**\n * Enum value \"app_shutdown\" for attribute {@link ATTR_SIGNALR_CONNECTION_STATUS}.\n *\n * The connection was closed because the app is shutting down.\n */\nexport const SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN = \"app_shutdown\";\n/**\n * Enum value \"normal_closure\" for attribute {@link ATTR_SIGNALR_CONNECTION_STATUS}.\n *\n * The connection was closed normally.\n */\nexport const SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE = \"normal_closure\";\n/**\n * Enum value \"timeout\" for attribute {@link ATTR_SIGNALR_CONNECTION_STATUS}.\n *\n * The connection was closed due to a timeout.\n */\nexport const SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT = \"timeout\";\n/**\n * [SignalR transport type](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md)\n *\n * @example web_sockets\n * @example long_polling\n */\nexport const ATTR_SIGNALR_TRANSPORT = 'signalr.transport';\n/**\n * Enum value \"long_polling\" for attribute {@link ATTR_SIGNALR_TRANSPORT}.\n *\n * LongPolling protocol\n */\nexport const SIGNALR_TRANSPORT_VALUE_LONG_POLLING = \"long_polling\";\n/**\n * Enum value \"server_sent_events\" for attribute {@link ATTR_SIGNALR_TRANSPORT}.\n *\n * ServerSentEvents protocol\n */\nexport const SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS = \"server_sent_events\";\n/**\n * Enum value \"web_sockets\" for attribute {@link ATTR_SIGNALR_TRANSPORT}.\n *\n * WebSockets protocol\n */\nexport const SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS = \"web_sockets\";\n/**\n * The language of the telemetry SDK.\n */\nexport const ATTR_TELEMETRY_SDK_LANGUAGE = 'telemetry.sdk.language';\n/**\n * Enum value \"cpp\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_CPP = \"cpp\";\n/**\n * Enum value \"dotnet\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET = \"dotnet\";\n/**\n * Enum value \"erlang\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG = \"erlang\";\n/**\n * Enum value \"go\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_GO = \"go\";\n/**\n * Enum value \"java\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_JAVA = \"java\";\n/**\n * Enum value \"nodejs\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS = \"nodejs\";\n/**\n * Enum value \"php\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_PHP = \"php\";\n/**\n * Enum value \"python\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON = \"python\";\n/**\n * Enum value \"ruby\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_RUBY = \"ruby\";\n/**\n * Enum value \"rust\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_RUST = \"rust\";\n/**\n * Enum value \"swift\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT = \"swift\";\n/**\n * Enum value \"webjs\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS = \"webjs\";\n/**\n * The name of the telemetry SDK as defined above.\n *\n * @example opentelemetry\n *\n * @note The OpenTelemetry SDK **MUST** set the `telemetry.sdk.name` attribute to `opentelemetry`.\n * If another SDK, like a fork or a vendor-provided implementation, is used, this SDK **MUST** set the\n * `telemetry.sdk.name` attribute to the fully-qualified class or module name of this SDK's main entry point\n * or another suitable identifier depending on the language.\n * The identifier `opentelemetry` is reserved and **MUST NOT** be used in this case.\n * All custom identifiers **SHOULD** be stable across different versions of an implementation.\n */\nexport const ATTR_TELEMETRY_SDK_NAME = 'telemetry.sdk.name';\n/**\n * The version string of the telemetry SDK.\n *\n * @example 1.2.3\n */\nexport const ATTR_TELEMETRY_SDK_VERSION = 'telemetry.sdk.version';\n/**\n * The [URI fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component\n *\n * @example SemConv\n */\nexport const ATTR_URL_FRAGMENT = 'url.fragment';\n/**\n * Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986)\n *\n * @example https://www.foo.bar/search?q=OpenTelemetry#SemConv\n * @example //localhost\n *\n * @note For network calls, URL usually has `scheme://host[:port][path][?query][#fragment]` format, where the fragment\n * is not transmitted over HTTP, but if it is known, it **SHOULD** be included nevertheless.\n *\n * `url.full` **MUST NOT** contain credentials passed via URL in form of `https://username:password@www.example.com/`.\n * In such case username and password **SHOULD** be redacted and attribute's value **SHOULD** be `https://REDACTED:REDACTED@www.example.com/`.\n *\n * `url.full` **SHOULD** capture the absolute URL when it is available (or can be reconstructed).\n *\n * Sensitive content provided in `url.full` **SHOULD** be scrubbed when instrumentations can identify it.\n *\n *\n * Query string values for the following keys **SHOULD** be redacted by default and replaced by the\n * value `REDACTED`:\n *\n * - [`AWSAccessKeyId`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)\n * - [`Signature`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)\n * - [`sig`](https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token)\n * - [`X-Goog-Signature`](https://cloud.google.com/storage/docs/access-control/signed-urls)\n *\n * This list is subject to change over time.\n *\n * Matching of query parameter keys against the sensitive list **SHOULD** be case-sensitive.\n *\n *\n * Instrumentation **MAY** provide a way to override this list via declarative configuration.\n * If so, it **SHOULD** use the `sensitive_query_parameters` property\n * (an array of case-sensitive strings with minimum items 0) under\n * `.instrumentation/development.general.sanitization.url`.\n * This list is a full override of the default sensitive query parameter keys,\n * it is not a list of keys in addition to the defaults.\n *\n * When a query string value is redacted, the query string key **SHOULD** still be preserved, e.g.\n * `https://www.example.com/path?color=blue&sig=REDACTED`.\n */\nexport const ATTR_URL_FULL = 'url.full';\n/**\n * The [URI path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component\n *\n * @example /search\n *\n * @note Sensitive content provided in `url.path` **SHOULD** be scrubbed when instrumentations can identify it.\n */\nexport const ATTR_URL_PATH = 'url.path';\n/**\n * The [URI query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component\n *\n * @example q=OpenTelemetry\n *\n * @note Sensitive content provided in `url.query` **SHOULD** be scrubbed when instrumentations can identify it.\n *\n *\n * Query string values for the following keys **SHOULD** be redacted by default and replaced by the value `REDACTED`:\n *\n * - [`AWSAccessKeyId`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)\n * - [`Signature`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)\n * - [`sig`](https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token)\n * - [`X-Goog-Signature`](https://cloud.google.com/storage/docs/access-control/signed-urls)\n *\n * This list is subject to change over time.\n *\n * Matching of query parameter keys against the sensitive list **SHOULD** be case-sensitive.\n *\n * Instrumentation **MAY** provide a way to override this list via declarative configuration.\n * If so, it **SHOULD** use the `sensitive_query_parameters` property\n * (an array of case-sensitive strings with minimum items 0) under\n * `.instrumentation/development.general.sanitization.url`.\n * This list is a full override of the default sensitive query parameter keys,\n * it is not a list of keys in addition to the defaults.\n *\n * When a query string value is redacted, the query string key **SHOULD** still be preserved, e.g.\n * `q=OpenTelemetry&sig=REDACTED`.\n */\nexport const ATTR_URL_QUERY = 'url.query';\n/**\n * The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol.\n *\n * @example https\n * @example ftp\n * @example telnet\n */\nexport const ATTR_URL_SCHEME = 'url.scheme';\n/**\n * Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client.\n *\n * @example CERN-LineMode/2.15 libwww/2.17b3\n * @example Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1\n * @example YourApp/1.0.0 grpc-java-okhttp/1.27.2\n */\nexport const ATTR_USER_AGENT_ORIGINAL = 'user_agent.original';\n//# sourceMappingURL=stable_attributes.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n/**\n * The name of the runtime of this process.\n *\n * @example OpenJDK Runtime Environment\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_PROCESS_RUNTIME_NAME = 'process.runtime.name';\n//# sourceMappingURL=semconv.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { VERSION } from '../../version';\nimport { ATTR_TELEMETRY_SDK_NAME, ATTR_TELEMETRY_SDK_LANGUAGE, TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS, ATTR_TELEMETRY_SDK_VERSION, } from '@opentelemetry/semantic-conventions';\nimport { ATTR_PROCESS_RUNTIME_NAME } from '../../semconv';\n/** Constants describing the SDK in use */\nexport const SDK_INFO = {\n [ATTR_TELEMETRY_SDK_NAME]: 'opentelemetry',\n [ATTR_PROCESS_RUNTIME_NAME]: 'browser',\n [ATTR_TELEMETRY_SDK_LANGUAGE]: TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS,\n [ATTR_TELEMETRY_SDK_VERSION]: VERSION,\n};\n//# sourceMappingURL=sdk-info.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport { getStringFromEnv, getBooleanFromEnv, getNumberFromEnv, getStringListFromEnv, } from './environment';\nexport { _globalThis } from '../../common/globalThis';\nexport { SDK_INFO } from './sdk-info';\n/**\n * @deprecated Use performance directly.\n */\nexport const otperformance = performance;\n//# sourceMappingURL=index.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { otperformance as performance } from '../platform';\nconst NANOSECOND_DIGITS = 9;\nconst NANOSECOND_DIGITS_IN_MILLIS = 6;\nconst MILLISECONDS_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS_IN_MILLIS);\nconst SECOND_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS);\n/**\n * Converts a number of milliseconds from epoch to HrTime([seconds, remainder in nanoseconds]).\n * @param epochMillis\n */\nexport function millisToHrTime(epochMillis) {\n const epochSeconds = epochMillis / 1000;\n // Decimals only.\n const seconds = Math.trunc(epochSeconds);\n // Round sub-nanosecond accuracy to nanosecond.\n const nanos = Math.round((epochMillis % 1000) * MILLISECONDS_TO_NANOSECONDS);\n return [seconds, nanos];\n}\n/**\n * @deprecated Use `performance.timeOrigin` directly.\n */\nexport function getTimeOrigin() {\n return performance.timeOrigin;\n}\n/**\n * Returns an hrtime calculated via performance component.\n * @param performanceNow\n */\nexport function hrTime(performanceNow) {\n const timeOrigin = millisToHrTime(performance.timeOrigin);\n const now = millisToHrTime(typeof performanceNow === 'number' ? performanceNow : performance.now());\n return addHrTimes(timeOrigin, now);\n}\n/**\n *\n * Converts a TimeInput to an HrTime, defaults to _hrtime().\n * @param time\n */\nexport function timeInputToHrTime(time) {\n // process.hrtime\n if (isTimeInputHrTime(time)) {\n return time;\n }\n else if (typeof time === 'number') {\n // Must be a performance.now() if it's smaller than process start time.\n if (time < performance.timeOrigin) {\n return hrTime(time);\n }\n else {\n // epoch milliseconds or performance.timeOrigin\n return millisToHrTime(time);\n }\n }\n else if (time instanceof Date) {\n return millisToHrTime(time.getTime());\n }\n else {\n throw TypeError('Invalid input type');\n }\n}\n/**\n * Returns a duration of two hrTime.\n * @param startTime\n * @param endTime\n */\nexport function hrTimeDuration(startTime, endTime) {\n let seconds = endTime[0] - startTime[0];\n let nanos = endTime[1] - startTime[1];\n // overflow\n if (nanos < 0) {\n seconds -= 1;\n // negate\n nanos += SECOND_TO_NANOSECONDS;\n }\n return [seconds, nanos];\n}\n/**\n * Convert hrTime to timestamp, for example \"2019-05-14T17:00:00.000123456Z\"\n * @param time\n */\nexport function hrTimeToTimeStamp(time) {\n const precision = NANOSECOND_DIGITS;\n const tmp = `${'0'.repeat(precision)}${time[1]}Z`;\n const nanoString = tmp.substring(tmp.length - precision - 1);\n const date = new Date(time[0] * 1000).toISOString();\n return date.replace('000Z', nanoString);\n}\n/**\n * Convert hrTime to nanoseconds.\n * @param time\n */\nexport function hrTimeToNanoseconds(time) {\n return time[0] * SECOND_TO_NANOSECONDS + time[1];\n}\n/**\n * Convert hrTime to milliseconds.\n * @param time\n */\nexport function hrTimeToMilliseconds(time) {\n return time[0] * 1e3 + time[1] / 1e6;\n}\n/**\n * Convert hrTime to microseconds.\n * @param time\n */\nexport function hrTimeToMicroseconds(time) {\n return time[0] * 1e6 + time[1] / 1e3;\n}\n/**\n * check if time is HrTime\n * @param value\n */\nexport function isTimeInputHrTime(value) {\n return (Array.isArray(value) &&\n value.length === 2 &&\n typeof value[0] === 'number' &&\n typeof value[1] === 'number');\n}\n/**\n * check if input value is a correct types.TimeInput\n * @param value\n */\nexport function isTimeInput(value) {\n return (isTimeInputHrTime(value) ||\n typeof value === 'number' ||\n value instanceof Date);\n}\n/**\n * Given 2 HrTime formatted times, return their sum as an HrTime.\n */\nexport function addHrTimes(time1, time2) {\n const out = [time1[0] + time2[0], time1[1] + time2[1]];\n // Nanoseconds\n if (out[1] >= SECOND_TO_NANOSECONDS) {\n out[1] -= SECOND_TO_NANOSECONDS;\n out[0] += 1;\n }\n return out;\n}\n//# sourceMappingURL=time.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport var ExportResultCode;\n(function (ExportResultCode) {\n ExportResultCode[ExportResultCode[\"SUCCESS\"] = 0] = \"SUCCESS\";\n ExportResultCode[ExportResultCode[\"FAILED\"] = 1] = \"FAILED\";\n})(ExportResultCode || (ExportResultCode = {}));\n//# sourceMappingURL=ExportResult.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\n/** Combines multiple propagators into a single propagator. */\nexport class CompositePropagator {\n _propagators;\n _fields;\n /**\n * Construct a composite propagator from a list of propagators.\n *\n * @param [config] Configuration object for composite propagator\n */\n constructor(config = {}) {\n this._propagators = config.propagators ?? [];\n const fields = new Set();\n for (const propagator of this._propagators) {\n // older propagators may not have fields function, null check to be sure\n const propagatorFields = typeof propagator.fields === 'function' ? propagator.fields() : [];\n for (const field of propagatorFields) {\n fields.add(field);\n }\n }\n this._fields = Array.from(fields);\n }\n /**\n * Run each of the configured propagators with the given context and carrier.\n * Propagators are run in the order they are configured, so if multiple\n * propagators write the same carrier key, the propagator later in the list\n * will \"win\".\n *\n * @param context Context to inject\n * @param carrier Carrier into which context will be injected\n */\n inject(context, carrier, setter) {\n for (const propagator of this._propagators) {\n try {\n propagator.inject(context, carrier, setter);\n }\n catch (err) {\n diag.warn(`Failed to inject with ${propagator.constructor.name}. Err: ${err.message}`);\n }\n }\n }\n /**\n * Run each of the configured propagators with the given context and carrier.\n * Propagators are run in the order they are configured, so if multiple\n * propagators write the same context key, the propagator later in the list\n * will \"win\".\n *\n * @param context Context to add values to\n * @param carrier Carrier from which to extract context\n */\n extract(context, carrier, getter) {\n return this._propagators.reduce((ctx, propagator) => {\n try {\n return propagator.extract(ctx, carrier, getter);\n }\n catch (err) {\n diag.warn(`Failed to extract with ${propagator.constructor.name}. Err: ${err.message}`);\n }\n return ctx;\n }, context);\n }\n fields() {\n // return a new array so our fields cannot be modified\n return this._fields.slice();\n }\n}\n//# sourceMappingURL=composite.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nconst VALID_KEY_CHAR_RANGE = '[_0-9a-z-*/]';\nconst VALID_KEY = `[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`;\nconst VALID_VENDOR_KEY = `[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`;\nconst VALID_KEY_REGEX = new RegExp(`^(?:${VALID_KEY}|${VALID_VENDOR_KEY})$`);\nconst VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/;\nconst INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/;\n/**\n * Key is opaque string up to 256 characters printable. It MUST begin with a\n * lowercase letter, and can only contain lowercase letters a-z, digits 0-9,\n * underscores _, dashes -, asterisks *, and forward slashes /.\n * For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the\n * vendor name. Vendors SHOULD set the tenant ID at the beginning of the key.\n * see https://www.w3.org/TR/trace-context/#key\n */\nexport function validateKey(key) {\n return VALID_KEY_REGEX.test(key);\n}\n/**\n * Value is opaque string up to 256 characters printable ASCII RFC0020\n * characters (i.e., the range 0x20 to 0x7E) except comma , and =.\n */\nexport function validateValue(value) {\n return (VALID_VALUE_BASE_REGEX.test(value) &&\n !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value));\n}\n//# sourceMappingURL=validators.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { validateKey, validateValue } from '../internal/validators';\nconst MAX_TRACE_STATE_ITEMS = 32;\nconst MAX_TRACE_STATE_LEN = 512;\nconst LIST_MEMBERS_SEPARATOR = ',';\nconst LIST_MEMBER_KEY_VALUE_SPLITTER = '=';\n/**\n * TraceState must be a class and not a simple object type because of the spec\n * requirement (https://www.w3.org/TR/trace-context/#tracestate-field).\n *\n * Here is the list of allowed mutations:\n * - New key-value pair should be added into the beginning of the list\n * - The value of any key can be updated. Modified keys MUST be moved to the\n * beginning of the list.\n */\nexport class TraceState {\n _length;\n _rawTraceState;\n _internalState;\n constructor(rawTraceState) {\n this._rawTraceState =\n typeof rawTraceState === 'string' ? rawTraceState : '';\n this._length = this._rawTraceState.length;\n }\n set(key, value) {\n if (!validateKey(key) || !validateValue(value)) {\n return this;\n }\n const currState = this._getState();\n const currValue = currState.get(key);\n // Get the new length depending if we already have a value or not\n // - for existing keys we add the difference between the length of the values\n // - for new keys is the key & value lenght plus\n // - +1 for the key/value splitter\n // - +1 for the separator if there are other keys\n let newLength = this._length;\n if (typeof currValue === 'string') {\n newLength += value.length - currValue.length;\n }\n else {\n newLength += key.length + value.length + (currState.size > 0 ? 2 : 1);\n }\n if (newLength > MAX_TRACE_STATE_LEN) {\n return this;\n }\n const newState = new Map(currState);\n newState.delete(key);\n newState.set(key, value);\n return this._fromState(newState, newLength);\n }\n unset(key) {\n const currState = this._getState();\n const currValue = currState.get(key);\n // No need to create a new instance if the key does not exist\n if (typeof currValue !== 'string') {\n return this;\n }\n // Get the new length depending if we already have a value or not\n // - for existing keys we substract key and value length plus\n // - +1 for the key/value splitter\n // - +1 for the separator if there are other keys\n let newLength = this._length - (key.length + currValue.length + 1);\n if (currState.size > 1) {\n // remove separator from length if there's no key or only one.\n newLength = newLength - 1;\n }\n const newState = new Map(currState);\n newState.delete(key);\n return this._fromState(newState, newLength);\n }\n get(key) {\n const currState = this._getState();\n return currState.get(key);\n }\n serialize() {\n // Maps put new entries at the end. We prepend the seralized entry\n // to get the right order according to the spec (updated members go 1st)\n let serialized = '';\n let index = 0;\n for (const entry of this._getState()) {\n if (index > 0) {\n serialized = LIST_MEMBERS_SEPARATOR + serialized;\n }\n serialized =\n `${entry[0]}${LIST_MEMBER_KEY_VALUE_SPLITTER}${entry[1]}` + serialized;\n index++;\n }\n return serialized;\n }\n _getState() {\n if (this._internalState) {\n return this._internalState;\n }\n // Not parsed yet, lets do it\n const vendorMembers = this._rawTraceState.split(LIST_MEMBERS_SEPARATOR);\n // This Map will have the order reversed\n const vendorEntries = new Map();\n let currentLength = 0;\n for (const member of vendorMembers) {\n const m = member.trim();\n const idx = m.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);\n if (idx === -1) {\n continue;\n }\n const key = m.slice(0, idx);\n const value = m.slice(idx + 1);\n if (!validateKey(key) || !validateValue(value)) {\n continue;\n }\n // Skip if adding the new member exceeds the length\n const futureLength = currentLength + m.length + (vendorEntries.size > 0 ? 1 : 0);\n if (futureLength > MAX_TRACE_STATE_LEN) {\n continue;\n }\n // All good, add it\n vendorEntries.set(key, value);\n currentLength = futureLength;\n // Check if we reached the max items\n if (vendorEntries.size >= MAX_TRACE_STATE_ITEMS) {\n break;\n }\n }\n // Now we set the length & the Map in the right order\n this._length = currentLength;\n this._internalState = new Map(Array.from(vendorEntries.entries()).reverse());\n return this._internalState;\n }\n _fromState(state, length) {\n const traceState = Object.create(TraceState.prototype);\n traceState._internalState = state;\n traceState._length = length;\n return traceState;\n }\n}\n//# sourceMappingURL=TraceState.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { isSpanContextValid, trace, TraceFlags } from '@opentelemetry/api';\nimport { isTracingSuppressed } from './suppress-tracing';\nimport { TraceState } from './TraceState';\nexport const TRACE_PARENT_HEADER = 'traceparent';\nexport const TRACE_STATE_HEADER = 'tracestate';\nconst VERSION = '00';\nconst VERSION_PART = '(?!ff)[\\\\da-f]{2}';\nconst TRACE_ID_PART = '(?![0]{32})[\\\\da-f]{32}';\nconst PARENT_ID_PART = '(?![0]{16})[\\\\da-f]{16}';\nconst FLAGS_PART = '[\\\\da-f]{2}';\nconst TRACE_PARENT_REGEX = new RegExp(`^\\\\s?(${VERSION_PART})-(${TRACE_ID_PART})-(${PARENT_ID_PART})-(${FLAGS_PART})(-.*)?\\\\s?$`);\n/**\n * Parses information from the [traceparent] span tag and converts it into {@link SpanContext}\n * @param traceParent - A meta property that comes from server.\n * It should be dynamically generated server side to have the server's request trace Id,\n * a parent span Id that was set on the server's request span,\n * and the trace flags to indicate the server's sampling decision\n * (01 = sampled, 00 = not sampled).\n * for example: '{version}-{traceId}-{spanId}-{sampleDecision}'\n * For more information see {@link https://www.w3.org/TR/trace-context/}\n */\nexport function parseTraceParent(traceParent) {\n const match = TRACE_PARENT_REGEX.exec(traceParent);\n if (!match)\n return null;\n // According to the specification the implementation should be compatible\n // with future versions. If there are more parts, we only reject it if it's using version 00\n // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent\n if (match[1] === '00' && match[5])\n return null;\n return {\n traceId: match[2],\n spanId: match[3],\n traceFlags: parseInt(match[4], 16),\n };\n}\n/**\n * Propagates {@link SpanContext} through Trace Context format propagation.\n *\n * Based on the Trace Context specification:\n * https://www.w3.org/TR/trace-context/\n */\nexport class W3CTraceContextPropagator {\n inject(context, carrier, setter) {\n const spanContext = trace.getSpanContext(context);\n if (!spanContext ||\n isTracingSuppressed(context) ||\n !isSpanContextValid(spanContext))\n return;\n const traceParent = `${VERSION}-${spanContext.traceId}-${spanContext.spanId}-0${Number(spanContext.traceFlags || TraceFlags.NONE).toString(16)}`;\n setter.set(carrier, TRACE_PARENT_HEADER, traceParent);\n if (spanContext.traceState) {\n setter.set(carrier, TRACE_STATE_HEADER, spanContext.traceState.serialize());\n }\n }\n extract(context, carrier, getter) {\n const traceParentHeader = getter.get(carrier, TRACE_PARENT_HEADER);\n if (!traceParentHeader)\n return context;\n const traceParent = Array.isArray(traceParentHeader)\n ? traceParentHeader[0]\n : traceParentHeader;\n if (typeof traceParent !== 'string')\n return context;\n const spanContext = parseTraceParent(traceParent);\n if (!spanContext)\n return context;\n spanContext.isRemote = true;\n const traceStateHeader = getter.get(carrier, TRACE_STATE_HEADER);\n if (traceStateHeader) {\n // If more than one `tracestate` header is found, we merge them into a\n // single header.\n const state = Array.isArray(traceStateHeader)\n ? traceStateHeader.join(',')\n : traceStateHeader;\n spanContext.traceState = new TraceState(typeof state === 'string' ? state : undefined);\n }\n return trace.setSpanContext(context, spanContext);\n }\n fields() {\n return [TRACE_PARENT_HEADER, TRACE_STATE_HEADER];\n }\n}\n//# sourceMappingURL=W3CTraceContextPropagator.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * based on lodash in order to support esm builds without esModuleInterop.\n * lodash is using MIT License.\n **/\nconst objectTag = '[object Object]';\nconst nullTag = '[object Null]';\nconst undefinedTag = '[object Undefined]';\nconst funcProto = Function.prototype;\nconst funcToString = funcProto.toString;\nconst objectCtorString = funcToString.call(Object);\nconst getPrototypeOf = Object.getPrototypeOf;\nconst objectProto = Object.prototype;\nconst hasOwnProperty = objectProto.hasOwnProperty;\nconst symToStringTag = Symbol ? Symbol.toStringTag : undefined;\nconst nativeObjectToString = objectProto.toString;\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nexport function isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) !== objectTag) {\n return false;\n }\n const proto = getPrototypeOf(value);\n if (proto === null) {\n return true;\n }\n const Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return (typeof Ctor == 'function' &&\n Ctor instanceof Ctor &&\n funcToString.call(Ctor) === objectCtorString);\n}\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return symToStringTag && symToStringTag in Object(value)\n ? getRawTag(value)\n : objectToString(value);\n}\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n const isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];\n let unmasked = false;\n try {\n value[symToStringTag] = undefined;\n unmasked = true;\n }\n catch {\n // silence\n }\n const result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n }\n else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n//# sourceMappingURL=lodash.merge.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { isPlainObject } from './lodash.merge';\nconst MAX_LEVEL = 20;\n/**\n * Merges objects together\n * @param args - objects / values to be merged\n */\nexport function merge(...args) {\n let result = args.shift();\n const objects = new WeakMap();\n while (args.length > 0) {\n result = mergeTwoObjects(result, args.shift(), 0, objects);\n }\n return result;\n}\nfunction takeValue(value) {\n if (isArray(value)) {\n return value.slice();\n }\n return value;\n}\n/**\n * Merges two objects\n * @param one - first object\n * @param two - second object\n * @param level - current deep level\n * @param objects - objects holder that has been already referenced - to prevent\n * cyclic dependency\n */\nfunction mergeTwoObjects(one, two, level = 0, objects) {\n let result;\n if (level > MAX_LEVEL) {\n return undefined;\n }\n level++;\n if (isPrimitive(one) || isPrimitive(two) || isFunction(two)) {\n result = takeValue(two);\n }\n else if (isArray(one)) {\n result = one.slice();\n if (isArray(two)) {\n for (let i = 0, j = two.length; i < j; i++) {\n result.push(takeValue(two[i]));\n }\n }\n else if (isObject(two)) {\n const keys = Object.keys(two);\n for (let i = 0, j = keys.length; i < j; i++) {\n const key = keys[i];\n if (key === '__proto__' ||\n key === 'constructor' ||\n key === 'prototype') {\n continue;\n }\n result[key] = takeValue(two[key]);\n }\n }\n }\n else if (isObject(one)) {\n if (isObject(two)) {\n if (!shouldMerge(one, two)) {\n return two;\n }\n result = Object.assign({}, one);\n const keys = Object.keys(two);\n for (let i = 0, j = keys.length; i < j; i++) {\n const key = keys[i];\n if (key === '__proto__' ||\n key === 'constructor' ||\n key === 'prototype') {\n continue;\n }\n const twoValue = two[key];\n if (isPrimitive(twoValue)) {\n if (typeof twoValue === 'undefined') {\n delete result[key];\n }\n else {\n // result[key] = takeValue(twoValue);\n result[key] = twoValue;\n }\n }\n else {\n const obj1 = result[key];\n const obj2 = twoValue;\n if (wasObjectReferenced(one, key, objects) ||\n wasObjectReferenced(two, key, objects)) {\n delete result[key];\n }\n else {\n if (isObject(obj1) && isObject(obj2)) {\n const arr1 = objects.get(obj1) || [];\n const arr2 = objects.get(obj2) || [];\n arr1.push({ obj: one, key });\n arr2.push({ obj: two, key });\n objects.set(obj1, arr1);\n objects.set(obj2, arr2);\n }\n result[key] = mergeTwoObjects(result[key], twoValue, level, objects);\n }\n }\n }\n }\n else {\n result = two;\n }\n }\n return result;\n}\n/**\n * Function to check if object has been already reference\n * @param obj\n * @param key\n * @param objects\n */\nfunction wasObjectReferenced(obj, key, objects) {\n const arr = objects.get(obj[key]) || [];\n for (let i = 0, j = arr.length; i < j; i++) {\n const info = arr[i];\n if (info.key === key && info.obj === obj) {\n return true;\n }\n }\n return false;\n}\nfunction isArray(value) {\n return Array.isArray(value);\n}\nfunction isFunction(value) {\n return typeof value === 'function';\n}\nfunction isObject(value) {\n return (!isPrimitive(value) &&\n !isArray(value) &&\n !isFunction(value) &&\n typeof value === 'object');\n}\nfunction isPrimitive(value) {\n return (typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n typeof value === 'undefined' ||\n value instanceof Date ||\n value instanceof RegExp ||\n value === null);\n}\nfunction shouldMerge(one, two) {\n if (!isPlainObject(one) || !isPlainObject(two)) {\n return false;\n }\n return true;\n}\n//# sourceMappingURL=merge.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport class Deferred {\n _promise;\n _resolve;\n _reject;\n constructor() {\n this._promise = new Promise((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n }\n get promise() {\n return this._promise;\n }\n resolve(val) {\n this._resolve(val);\n }\n reject(err) {\n this._reject(err);\n }\n}\n//# sourceMappingURL=promise.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { Deferred } from './promise';\n/**\n * Bind the callback and only invoke the callback once regardless how many times `BindOnceFuture.call` is invoked.\n */\nexport class BindOnceFuture {\n _isCalled = false;\n _deferred = new Deferred();\n _callback;\n _that;\n constructor(callback, that) {\n this._callback = callback;\n this._that = that;\n }\n get isCalled() {\n return this._isCalled;\n }\n get promise() {\n return this._deferred.promise;\n }\n call(...args) {\n if (!this._isCalled) {\n this._isCalled = true;\n try {\n Promise.resolve(this._callback.call(this._that, ...args)).then(val => this._deferred.resolve(val), err => this._deferred.reject(err));\n }\n catch (err) {\n this._deferred.reject(err);\n }\n }\n return this._deferred.promise;\n }\n}\n//# sourceMappingURL=callback.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { context } from '@opentelemetry/api';\nimport { suppressTracing } from '../trace/suppress-tracing';\n/**\n * @internal\n * Shared functionality used by Exporters while exporting data, including suppression of Traces.\n */\nexport function _export(exporter, arg) {\n return new Promise(resolve => {\n // prevent downstream exporter calls from generating spans\n context.with(suppressTracing(context.active()), () => {\n exporter.export(arg, resolve);\n });\n });\n}\n//# sourceMappingURL=exporter.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport { W3CBaggagePropagator } from './baggage/propagation/W3CBaggagePropagator';\nexport { AnchoredClock } from './common/anchored-clock';\nexport { isAttributeValue, sanitizeAttributes } from './common/attributes';\nexport { globalErrorHandler, setGlobalErrorHandler, } from './common/global-error-handler';\nexport { loggingErrorHandler } from './common/logging-error-handler';\nexport { addHrTimes, getTimeOrigin, hrTime, hrTimeDuration, hrTimeToMicroseconds, hrTimeToMilliseconds, hrTimeToNanoseconds, hrTimeToTimeStamp, isTimeInput, isTimeInputHrTime, millisToHrTime, timeInputToHrTime, } from './common/time';\nexport { unrefTimer } from './common/timer-util';\nexport { ExportResultCode } from './ExportResult';\nexport { parseKeyPairsIntoRecord } from './baggage/utils';\nexport { SDK_INFO, _globalThis, getStringFromEnv, getBooleanFromEnv, getNumberFromEnv, getStringListFromEnv, otperformance, } from './platform';\nexport { CompositePropagator } from './propagation/composite';\nexport { TRACE_PARENT_HEADER, TRACE_STATE_HEADER, W3CTraceContextPropagator, parseTraceParent, } from './trace/W3CTraceContextPropagator';\nexport { RPCType, deleteRPCMetadata, getRPCMetadata, setRPCMetadata, } from './trace/rpc-metadata';\nexport { isTracingSuppressed, suppressTracing, unsuppressTracing, } from './trace/suppress-tracing';\nexport { TraceState } from './trace/TraceState';\nexport { merge } from './utils/merge';\nexport { TimeoutError, callWithTimeout } from './utils/timeout';\nexport { isUrlIgnored, urlMatches } from './utils/url';\nexport { BindOnceFuture } from './utils/callback';\nexport { diagLogLevelFromString } from './utils/configuration';\nimport { _export } from './internal/exporter';\nexport const internal = {\n _export,\n};\n//# sourceMappingURL=index.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport class OTLPExporterBase {\n _delegate;\n constructor(delegate) {\n this._delegate = delegate;\n }\n /**\n * Export items.\n * @param items\n * @param resultCallback\n */\n export(items, resultCallback) {\n this._delegate.export(items, resultCallback);\n }\n forceFlush() {\n return this._delegate.forceFlush();\n }\n shutdown() {\n return this._delegate.shutdown();\n }\n}\n//# sourceMappingURL=OTLPExporterBase.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * Interface for handling error\n */\nexport class OTLPExporterError extends Error {\n code;\n name = 'OTLPExporterError';\n data;\n constructor(message, code, data) {\n super(message);\n this.data = data;\n this.code = code;\n }\n}\n//# sourceMappingURL=types.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport function validateTimeoutMillis(timeoutMillis) {\n if (Number.isFinite(timeoutMillis) && timeoutMillis > 0) {\n return timeoutMillis;\n }\n throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${timeoutMillis}')`);\n}\nexport function wrapStaticHeadersInFunction(headers) {\n if (headers == null) {\n return undefined;\n }\n return async () => headers;\n}\n/**\n * @param userProvidedConfiguration Configuration options provided by the user in code.\n * @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.\n * @param defaultConfiguration The defaults as defined by the exporter specification\n */\nexport function mergeOtlpSharedConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration) {\n return {\n timeoutMillis: validateTimeoutMillis(userProvidedConfiguration.timeoutMillis ??\n fallbackConfiguration.timeoutMillis ??\n defaultConfiguration.timeoutMillis),\n concurrencyLimit: userProvidedConfiguration.concurrencyLimit ??\n fallbackConfiguration.concurrencyLimit ??\n defaultConfiguration.concurrencyLimit,\n compression: userProvidedConfiguration.compression ??\n fallbackConfiguration.compression ??\n defaultConfiguration.compression,\n };\n}\nexport function getSharedConfigurationDefaults() {\n return {\n timeoutMillis: 10000,\n concurrencyLimit: 30,\n compression: 'none',\n };\n}\n//# sourceMappingURL=shared-configuration.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nclass BoundedQueueExportPromiseHandler {\n _concurrencyLimit;\n _sendingPromises = [];\n /**\n * @param concurrencyLimit maximum promises allowed in a queue at the same time.\n */\n constructor(concurrencyLimit) {\n this._concurrencyLimit = concurrencyLimit;\n }\n pushPromise(promise) {\n if (this.hasReachedLimit()) {\n throw new Error('Concurrency Limit reached');\n }\n this._sendingPromises.push(promise);\n const popPromise = () => {\n const index = this._sendingPromises.indexOf(promise);\n void this._sendingPromises.splice(index, 1);\n };\n promise.then(popPromise, popPromise);\n }\n hasReachedLimit() {\n return this._sendingPromises.length >= this._concurrencyLimit;\n }\n async awaitAll() {\n await Promise.all(this._sendingPromises);\n }\n}\n/**\n * Promise queue for keeping track of export promises. Finished promises will be auto-dequeued.\n * Allows for awaiting all promises in the queue.\n */\nexport function createBoundedQueueExportPromiseHandler(options) {\n return new BoundedQueueExportPromiseHandler(options.concurrencyLimit);\n}\n//# sourceMappingURL=bounded-queue-export-promise-handler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\nfunction isPartialSuccessResponse(response) {\n return Object.prototype.hasOwnProperty.call(response, 'partialSuccess');\n}\n/**\n * Default response handler that logs a partial success to the console.\n */\nexport function createLoggingPartialSuccessResponseHandler() {\n return {\n handleResponse(response) {\n // Partial success MUST never be an empty object according the specification\n // see https://opentelemetry.io/docs/specs/otlp/#partial-success\n if (response == null ||\n !isPartialSuccessResponse(response) ||\n response.partialSuccess == null ||\n Object.keys(response.partialSuccess).length === 0) {\n return;\n }\n diag.warn('Received Partial Success response:', JSON.stringify(response.partialSuccess));\n },\n };\n}\n//# sourceMappingURL=logging-response-handler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ExportResultCode } from '@opentelemetry/core';\nimport { OTLPExporterError } from './types';\nimport { createLoggingPartialSuccessResponseHandler } from './logging-response-handler';\nimport { diag } from '@opentelemetry/api';\nclass OTLPExportDelegate {\n _diagLogger;\n _transport;\n _serializer;\n _responseHandler;\n _promiseQueue;\n _timeout;\n constructor(transport, serializer, responseHandler, promiseQueue, timeout) {\n this._transport = transport;\n this._serializer = serializer;\n this._responseHandler = responseHandler;\n this._promiseQueue = promiseQueue;\n this._timeout = timeout;\n this._diagLogger = diag.createComponentLogger({\n namespace: 'OTLPExportDelegate',\n });\n }\n export(internalRepresentation, resultCallback) {\n this._diagLogger.debug('items to be sent', internalRepresentation);\n // don't do any work if too many exports are in progress.\n if (this._promiseQueue.hasReachedLimit()) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Concurrent export limit reached'),\n });\n return;\n }\n const serializedRequest = this._serializer.serializeRequest(internalRepresentation);\n if (serializedRequest == null) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Nothing to send'),\n });\n return;\n }\n this._promiseQueue.pushPromise(this._transport.send(serializedRequest, this._timeout).then(response => {\n if (response.status === 'success') {\n if (response.data != null) {\n try {\n this._responseHandler.handleResponse(this._serializer.deserializeResponse(response.data));\n }\n catch (e) {\n this._diagLogger.warn('Export succeeded but could not deserialize response - is the response specification compliant?', e, response.data);\n }\n }\n // No matter the response, we can consider the export still successful.\n resultCallback({\n code: ExportResultCode.SUCCESS,\n });\n return;\n }\n else if (response.status === 'failure' && response.error) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: response.error,\n });\n return;\n }\n else if (response.status === 'retryable') {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: response.error ??\n new OTLPExporterError('Export failed with retryable status'),\n });\n }\n else {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new OTLPExporterError('Export failed with unknown error'),\n });\n }\n }, reason => resultCallback({\n code: ExportResultCode.FAILED,\n error: reason,\n })));\n }\n forceFlush() {\n return this._promiseQueue.awaitAll();\n }\n async shutdown() {\n this._diagLogger.debug('shutdown started');\n await this.forceFlush();\n this._transport.shutdown();\n }\n}\n/**\n * Creates a generic delegate for OTLP exports which only contains parts of the OTLP export that are shared across all\n * signals.\n */\nexport function createOtlpExportDelegate(components, settings) {\n return new OTLPExportDelegate(components.transport, components.serializer, createLoggingPartialSuccessResponseHandler(), components.promiseHandler, settings.timeout);\n}\n//# sourceMappingURL=otlp-export-delegate.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { createBoundedQueueExportPromiseHandler } from './bounded-queue-export-promise-handler';\nimport { createOtlpExportDelegate } from './otlp-export-delegate';\nexport function createOtlpNetworkExportDelegate(options, serializer, transport) {\n return createOtlpExportDelegate({\n transport: transport,\n serializer,\n promiseHandler: createBoundedQueueExportPromiseHandler(options),\n }, { timeout: options.timeoutMillis });\n}\n//# sourceMappingURL=otlp-network-export-delegate.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nlet serviceName;\n/**\n * Returns the default service name for OpenTelemetry resources.\n * In Node.js environments, returns \"unknown_service:<process.argv0>\".\n * In browser/edge environments, returns \"unknown_service\".\n */\nexport function defaultServiceName() {\n if (serviceName === undefined) {\n try {\n const argv0 = globalThis.process.argv0;\n serviceName = argv0 ? `unknown_service:${argv0}` : 'unknown_service';\n }\n catch {\n serviceName = 'unknown_service';\n }\n }\n return serviceName;\n}\n/** @internal For testing purposes only */\nexport function _clearDefaultServiceNameCache() {\n serviceName = undefined;\n}\n//# sourceMappingURL=default-service-name.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport const isPromiseLike = (val) => {\n return (val !== null &&\n typeof val === 'object' &&\n typeof val.then === 'function');\n};\n//# sourceMappingURL=utils.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\nimport { SDK_INFO } from '@opentelemetry/core';\nimport { ATTR_SERVICE_NAME, ATTR_TELEMETRY_SDK_LANGUAGE, ATTR_TELEMETRY_SDK_NAME, ATTR_TELEMETRY_SDK_VERSION, } from '@opentelemetry/semantic-conventions';\nimport { defaultServiceName } from './default-service-name';\nimport { isPromiseLike } from './utils';\nclass ResourceImpl {\n _rawAttributes;\n _asyncAttributesPending = false;\n _schemaUrl;\n _memoizedAttributes;\n static FromAttributeList(attributes, options) {\n const res = new ResourceImpl({}, options);\n res._rawAttributes = guardedRawAttributes(attributes);\n res._asyncAttributesPending =\n attributes.filter(([_, val]) => isPromiseLike(val)).length > 0;\n return res;\n }\n constructor(\n /**\n * A dictionary of attributes with string keys and values that provide\n * information about the entity as numbers, strings or booleans\n * TODO: Consider to add check/validation on attributes.\n */\n resource, options) {\n const attributes = resource.attributes ?? {};\n this._rawAttributes = Object.entries(attributes).map(([k, v]) => {\n if (isPromiseLike(v)) {\n // side-effect\n this._asyncAttributesPending = true;\n }\n return [k, v];\n });\n this._rawAttributes = guardedRawAttributes(this._rawAttributes);\n this._schemaUrl = validateSchemaUrl(options?.schemaUrl);\n }\n get asyncAttributesPending() {\n return this._asyncAttributesPending;\n }\n async waitForAsyncAttributes() {\n if (!this.asyncAttributesPending) {\n return;\n }\n for (let i = 0; i < this._rawAttributes.length; i++) {\n const [k, v] = this._rawAttributes[i];\n this._rawAttributes[i] = [k, isPromiseLike(v) ? await v : v];\n }\n this._asyncAttributesPending = false;\n }\n get attributes() {\n if (this.asyncAttributesPending) {\n diag.error('Accessing resource attributes before async attributes settled');\n }\n if (this._memoizedAttributes) {\n return this._memoizedAttributes;\n }\n const attrs = {};\n for (const [k, v] of this._rawAttributes) {\n if (isPromiseLike(v)) {\n diag.debug(`Unsettled resource attribute ${k} skipped`);\n continue;\n }\n if (v != null) {\n attrs[k] ??= v;\n }\n }\n // only memoize output if all attributes are settled\n if (!this._asyncAttributesPending) {\n this._memoizedAttributes = attrs;\n }\n return attrs;\n }\n getRawAttributes() {\n return this._rawAttributes;\n }\n get schemaUrl() {\n return this._schemaUrl;\n }\n merge(resource) {\n if (resource == null)\n return this;\n // Order is important\n // Spec states incoming attributes override existing attributes\n const mergedSchemaUrl = mergeSchemaUrl(this, resource);\n const mergedOptions = mergedSchemaUrl\n ? { schemaUrl: mergedSchemaUrl }\n : undefined;\n return ResourceImpl.FromAttributeList([...resource.getRawAttributes(), ...this.getRawAttributes()], mergedOptions);\n }\n}\nexport function resourceFromAttributes(attributes, options) {\n return ResourceImpl.FromAttributeList(Object.entries(attributes), options);\n}\nexport function resourceFromDetectedResource(detectedResource, options) {\n return new ResourceImpl(detectedResource, options);\n}\nexport function emptyResource() {\n return resourceFromAttributes({});\n}\nexport function defaultResource() {\n return resourceFromAttributes({\n [ATTR_SERVICE_NAME]: defaultServiceName(),\n [ATTR_TELEMETRY_SDK_LANGUAGE]: SDK_INFO[ATTR_TELEMETRY_SDK_LANGUAGE],\n [ATTR_TELEMETRY_SDK_NAME]: SDK_INFO[ATTR_TELEMETRY_SDK_NAME],\n [ATTR_TELEMETRY_SDK_VERSION]: SDK_INFO[ATTR_TELEMETRY_SDK_VERSION],\n });\n}\nfunction guardedRawAttributes(attributes) {\n return attributes.map(([k, v]) => {\n if (isPromiseLike(v)) {\n return [\n k,\n v.catch(err => {\n diag.debug('promise rejection for resource attribute: %s - %s', k, err);\n return undefined;\n }),\n ];\n }\n return [k, v];\n });\n}\nfunction validateSchemaUrl(schemaUrl) {\n if (typeof schemaUrl === 'string' || schemaUrl === undefined) {\n return schemaUrl;\n }\n diag.warn('Schema URL must be string or undefined, got %s. Schema URL will be ignored.', schemaUrl);\n return undefined;\n}\nfunction mergeSchemaUrl(old, updating) {\n const oldSchemaUrl = old?.schemaUrl;\n const updatingSchemaUrl = updating?.schemaUrl;\n const isOldEmpty = oldSchemaUrl === undefined || oldSchemaUrl === '';\n const isUpdatingEmpty = updatingSchemaUrl === undefined || updatingSchemaUrl === '';\n if (isOldEmpty) {\n return updatingSchemaUrl;\n }\n if (isUpdatingEmpty) {\n return oldSchemaUrl;\n }\n if (oldSchemaUrl === updatingSchemaUrl) {\n return oldSchemaUrl;\n }\n diag.warn('Schema URL merge conflict: old resource has \"%s\", updating resource has \"%s\". Resulting resource will have undefined Schema URL.', oldSchemaUrl, updatingSchemaUrl);\n return undefined;\n}\n//# sourceMappingURL=ResourceImpl.js.map","export function createResource(resource, encoder) {\n const result = {\n attributes: toAttributes(resource.attributes, encoder),\n droppedAttributesCount: 0,\n };\n const schemaUrl = resource.schemaUrl;\n if (schemaUrl && schemaUrl !== '')\n result.schemaUrl = schemaUrl;\n return result;\n}\nexport function createInstrumentationScope(scope) {\n return {\n name: scope.name,\n version: scope.version,\n };\n}\nexport function toAttributes(attributes, encoder) {\n return Object.keys(attributes).map(key => toKeyValue(key, attributes[key], encoder));\n}\nexport function toKeyValue(key, value, encoder) {\n return {\n key: key,\n value: toAnyValue(value, encoder),\n };\n}\nexport function toAnyValue(value, encoder) {\n const t = typeof value;\n if (t === 'string')\n return { stringValue: value };\n if (t === 'number') {\n if (!Number.isInteger(value))\n return { doubleValue: value };\n return { intValue: value };\n }\n if (t === 'boolean')\n return { boolValue: value };\n if (value instanceof Uint8Array)\n return { bytesValue: encoder.encodeUint8Array(value) };\n if (Array.isArray(value)) {\n const values = new Array(value.length);\n for (let i = 0; i < value.length; i++) {\n values[i] = toAnyValue(value[i], encoder);\n }\n return { arrayValue: { values } };\n }\n if (t === 'object' && value != null) {\n const keys = Object.keys(value);\n const values = new Array(keys.length);\n for (let i = 0; i < keys.length; i++) {\n values[i] = {\n key: keys[i],\n value: toAnyValue(value[keys[i]], encoder),\n };\n }\n return { kvlistValue: { values } };\n }\n return {};\n}\n//# sourceMappingURL=internal.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { hrTimeToNanoseconds } from '@opentelemetry/core';\nimport { hexToBinary } from './hex-to-binary';\nexport function hrTimeToNanos(hrTime) {\n const NANOSECONDS = BigInt(1000000000);\n return (BigInt(Math.trunc(hrTime[0])) * NANOSECONDS + BigInt(Math.trunc(hrTime[1])));\n}\nexport function toLongBits(value) {\n const low = Number(BigInt.asUintN(32, value));\n const high = Number(BigInt.asUintN(32, value >> BigInt(32)));\n return { low, high };\n}\nexport function encodeAsLongBits(hrTime) {\n const nanos = hrTimeToNanos(hrTime);\n return toLongBits(nanos);\n}\nexport function encodeAsString(hrTime) {\n const nanos = hrTimeToNanos(hrTime);\n return nanos.toString();\n}\nconst encodeTimestamp = typeof BigInt !== 'undefined' ? encodeAsString : hrTimeToNanoseconds;\nfunction identity(value) {\n return value;\n}\nfunction optionalHexToBinary(str) {\n if (str === undefined)\n return undefined;\n return hexToBinary(str);\n}\n/**\n * Encoder for protobuf format.\n * Uses { high, low } timestamps and binary for span/trace IDs, leaves Uint8Array attributes as-is.\n */\nexport const PROTOBUF_ENCODER = {\n encodeHrTime: encodeAsLongBits,\n encodeSpanContext: hexToBinary,\n encodeOptionalSpanContext: optionalHexToBinary,\n encodeUint8Array: identity,\n};\n/**\n * Encoder for JSON format.\n * Uses string timestamps, hex for span/trace IDs, and base64 for Uint8Array.\n */\nexport const JSON_ENCODER = {\n encodeHrTime: encodeTimestamp,\n encodeSpanContext: identity,\n encodeOptionalSpanContext: identity,\n encodeUint8Array: (bytes) => {\n if (typeof Buffer !== 'undefined') {\n return Buffer.from(bytes).toString('base64');\n }\n // implementation note: not using spread operator and passing to\n // btoa to avoid stack overflow on large Uint8Arrays\n const chars = new Array(bytes.length);\n for (let i = 0; i < bytes.length; i++) {\n chars[i] = String.fromCharCode(bytes[i]);\n }\n return btoa(chars.join(''));\n },\n};\n//# sourceMappingURL=utils.js.map","import { createInstrumentationScope, createResource, toAttributes, } from '../common/internal';\n// Span flags constants matching the OTLP specification\nconst SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 0x100;\nconst SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 0x200;\n/**\n * Builds the 32-bit span flags value combining the low 8-bit W3C TraceFlags\n * with the HAS_IS_REMOTE and IS_REMOTE bits according to the OTLP spec.\n */\nfunction buildSpanFlagsFrom(traceFlags, isRemote) {\n // low 8 bits are W3C TraceFlags (e.g., sampled)\n let flags = (traceFlags & 0xff) | SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK;\n if (isRemote) {\n flags |= SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK;\n }\n return flags;\n}\nexport function sdkSpanToOtlpSpan(span, encoder) {\n const ctx = span.spanContext();\n const status = span.status;\n const parentSpanId = span.parentSpanContext?.spanId\n ? encoder.encodeSpanContext(span.parentSpanContext?.spanId)\n : undefined;\n return {\n traceId: encoder.encodeSpanContext(ctx.traceId),\n spanId: encoder.encodeSpanContext(ctx.spanId),\n parentSpanId: parentSpanId,\n traceState: ctx.traceState?.serialize(),\n name: span.name,\n // Span kind is offset by 1 because the API does not define a value for unset\n kind: span.kind == null ? 0 : span.kind + 1,\n startTimeUnixNano: encoder.encodeHrTime(span.startTime),\n endTimeUnixNano: encoder.encodeHrTime(span.endTime),\n attributes: toAttributes(span.attributes, encoder),\n droppedAttributesCount: span.droppedAttributesCount,\n events: span.events.map(event => toOtlpSpanEvent(event, encoder)),\n droppedEventsCount: span.droppedEventsCount,\n status: {\n // API and proto enums share the same values\n code: status.code,\n message: status.message,\n },\n links: span.links.map(link => toOtlpLink(link, encoder)),\n droppedLinksCount: span.droppedLinksCount,\n flags: buildSpanFlagsFrom(ctx.traceFlags, span.parentSpanContext?.isRemote),\n };\n}\nexport function toOtlpLink(link, encoder) {\n return {\n attributes: link.attributes ? toAttributes(link.attributes, encoder) : [],\n spanId: encoder.encodeSpanContext(link.context.spanId),\n traceId: encoder.encodeSpanContext(link.context.traceId),\n traceState: link.context.traceState?.serialize(),\n droppedAttributesCount: link.droppedAttributesCount || 0,\n flags: buildSpanFlagsFrom(link.context.traceFlags, link.context.isRemote),\n };\n}\nexport function toOtlpSpanEvent(timedEvent, encoder) {\n return {\n attributes: timedEvent.attributes\n ? toAttributes(timedEvent.attributes, encoder)\n : [],\n name: timedEvent.name,\n timeUnixNano: encoder.encodeHrTime(timedEvent.time),\n droppedAttributesCount: timedEvent.droppedAttributesCount || 0,\n };\n}\nexport function createExportTraceServiceRequest(spans, encoder) {\n return {\n resourceSpans: spanRecordsToResourceSpans(spans, encoder),\n };\n}\nfunction createResourceMap(readableSpans) {\n const resourceMap = new Map();\n for (const record of readableSpans) {\n let ilsMap = resourceMap.get(record.resource);\n if (!ilsMap) {\n ilsMap = new Map();\n resourceMap.set(record.resource, ilsMap);\n }\n // TODO this is duplicated in basic tracer. Consolidate on a common helper in core\n const instrumentationScopeKey = `${record.instrumentationScope.name}@${record.instrumentationScope.version || ''}:${record.instrumentationScope.schemaUrl || ''}`;\n let records = ilsMap.get(instrumentationScopeKey);\n if (!records) {\n records = [];\n ilsMap.set(instrumentationScopeKey, records);\n }\n records.push(record);\n }\n return resourceMap;\n}\nfunction spanRecordsToResourceSpans(readableSpans, encoder) {\n const resourceMap = createResourceMap(readableSpans);\n const out = [];\n const entryIterator = resourceMap.entries();\n let entry = entryIterator.next();\n while (!entry.done) {\n const [resource, ilmMap] = entry.value;\n const scopeResourceSpans = [];\n const ilmIterator = ilmMap.values();\n let ilmEntry = ilmIterator.next();\n while (!ilmEntry.done) {\n const scopeSpans = ilmEntry.value;\n if (scopeSpans.length > 0) {\n const spans = scopeSpans.map(readableSpan => sdkSpanToOtlpSpan(readableSpan, encoder));\n scopeResourceSpans.push({\n scope: createInstrumentationScope(scopeSpans[0].instrumentationScope),\n spans: spans,\n schemaUrl: scopeSpans[0].instrumentationScope.schemaUrl,\n });\n }\n ilmEntry = ilmIterator.next();\n }\n const processedResource = createResource(resource, encoder);\n const transformedSpans = {\n resource: processedResource,\n scopeSpans: scopeResourceSpans,\n schemaUrl: processedResource.schemaUrl,\n };\n out.push(transformedSpans);\n entry = entryIterator.next();\n }\n return out;\n}\n//# sourceMappingURL=internal.js.map","import { createExportTraceServiceRequest } from '../internal';\nimport { JSON_ENCODER } from '../../common/utils';\nimport { diag } from '@opentelemetry/api';\nexport const JsonTraceSerializer = {\n serializeRequest: (arg) => {\n const request = createExportTraceServiceRequest(arg, JSON_ENCODER);\n const encoder = new TextEncoder();\n return encoder.encode(JSON.stringify(request));\n },\n deserializeResponse: (arg) => {\n if (arg.length === 0) {\n return {};\n }\n const decoder = new TextDecoder();\n try {\n return JSON.parse(decoder.decode(arg));\n }\n catch (err) {\n diag.warn(`Failed to parse trace export response: ${err.message}. Returning empty response`);\n return {};\n }\n },\n};\n//# sourceMappingURL=trace.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\nconst MAX_ATTEMPTS = 5;\nconst INITIAL_BACKOFF = 1000;\nconst MAX_BACKOFF = 5000;\nconst BACKOFF_MULTIPLIER = 1.5;\nconst JITTER = 0.2;\n/**\n * Get a pseudo-random jitter that falls in the range of [-JITTER, +JITTER]\n */\nfunction getJitter() {\n return Math.random() * (2 * JITTER) - JITTER;\n}\nclass RetryingTransport {\n _transport;\n constructor(transport) {\n this._transport = transport;\n }\n retry(data, timeoutMillis, inMillis) {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n this._transport.send(data, timeoutMillis).then(resolve, reject);\n }, inMillis);\n });\n }\n async send(data, timeoutMillis) {\n let attempts = MAX_ATTEMPTS;\n let nextBackoff = INITIAL_BACKOFF;\n const deadline = Date.now() + timeoutMillis;\n let result = await this._transport.send(data, timeoutMillis);\n while (result.status === 'retryable' && attempts > 0) {\n attempts--;\n // use maximum of computed backoff and 0 to avoid negative timeouts\n const backoff = Math.max(Math.min(nextBackoff * (1 + getJitter()), MAX_BACKOFF), 0);\n nextBackoff = nextBackoff * BACKOFF_MULTIPLIER;\n const retryInMillis = result.retryInMillis ?? backoff;\n // return when expected retry time is after the export deadline.\n const remainingTimeoutMillis = deadline - Date.now();\n if (retryInMillis > remainingTimeoutMillis) {\n diag.info(`Export retry time ${Math.round(retryInMillis)}ms exceeds remaining timeout ${Math.round(remainingTimeoutMillis)}ms, not retrying further.`);\n return result;\n }\n diag.verbose(`Scheduling export retry in ${Math.round(retryInMillis)}ms`);\n result = await this.retry(data, remainingTimeoutMillis, retryInMillis);\n }\n if (result.status === 'success') {\n diag.verbose(`Export succeeded after ${MAX_ATTEMPTS - attempts} retry attempts.`);\n }\n else if (result.status === 'retryable') {\n diag.info(`Export failed after maximum retry attempts (${MAX_ATTEMPTS}).`);\n }\n else {\n diag.info(`Export failed with non-retryable error: ${result.error}`);\n }\n return result;\n }\n shutdown() {\n return this._transport.shutdown();\n }\n}\n/**\n * Creates an Exporter Transport that retries on 'retryable' response.\n */\nexport function createRetryingTransport(options) {\n return new RetryingTransport(options.transport);\n}\n//# sourceMappingURL=retrying-transport.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport function isExportHTTPErrorRetryable(statusCode) {\n return (statusCode === 429 ||\n statusCode === 502 ||\n statusCode === 503 ||\n statusCode === 504);\n}\nexport function parseRetryAfterToMills(retryAfter) {\n if (retryAfter == null) {\n return undefined;\n }\n const seconds = Number.parseInt(retryAfter, 10);\n if (Number.isInteger(seconds)) {\n return seconds > 0 ? seconds * 1000 : -1;\n }\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After#directives\n const delay = new Date(retryAfter).getTime() - Date.now();\n if (delay >= 0) {\n return delay;\n }\n return 0;\n}\n//# sourceMappingURL=is-export-retryable.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\nimport { isExportHTTPErrorRetryable, parseRetryAfterToMills, } from '../is-export-retryable';\n/**\n * Maximum total body size for concurrent keepalive requests.\n * Browsers enforce a 64KiB cumulative limit across all pending keepalive requests.\n * We use 60KB to leave headroom for headers.\n * @see https://github.com/whatwg/fetch/issues/679\n * @see https://blog.huli.tw/2025/01/06/en/navigator-sendbeacon-64kib-and-source-code/\n */\nconst MAX_KEEPALIVE_BODY_SIZE = 60 * 1024;\n/**\n * Maximum concurrent keepalive requests.\n * Chrome enforces 9 concurrent keepalive fetch requests per renderer process.\n * @see https://github.com/whatwg/fetch/issues/679\n * Quote: \"If the renderer process is processing more than 9 requests with keepalive set, we reject a new request\"\n */\nconst MAX_KEEPALIVE_REQUESTS = 9;\n/**\n * Track cumulative pending body size across all in-flight keepalive requests.\n * This is necessary because the 64KiB limit is cumulative, not per-request.\n */\nlet pendingBodySize = 0;\n/**\n * Track number of pending keepalive requests.\n */\nlet pendingKeepaliveCount = 0;\nclass FetchTransport {\n _parameters;\n constructor(parameters) {\n this._parameters = parameters;\n }\n async send(data, timeoutMillis) {\n const abortController = new AbortController();\n const timeout = setTimeout(() => abortController.abort(), timeoutMillis);\n // Fetch API may be wrapped by an instrumentation like `@opentelemetry/instrumentation-fetch`.\n // In that case the instrumentation would create a new Span for this request\n // because the context manager cannot keep the context after `await` calls.\n // This creates an indirect endless loop Export -> Span -> Export\n // By using the `__original` function the instrumentation can't intercept the call\n // and no Span will be created breaking the vicious cycle\n let fetchApi = globalThis.fetch;\n // @ts-expect-error -- fetch could be wrapped\n if (typeof fetchApi.__original === 'function') {\n // @ts-expect-error -- fetch could be wrapped\n fetchApi = fetchApi.__original;\n }\n const requestSize = data.byteLength;\n // Determine if we can use keepalive based on cumulative browser limits.\n // We must check BEFORE adding to pending totals to avoid exceeding limits.\n const wouldExceedSize = pendingBodySize + requestSize > MAX_KEEPALIVE_BODY_SIZE;\n const wouldExceedCount = pendingKeepaliveCount >= MAX_KEEPALIVE_REQUESTS;\n const useKeepalive = !wouldExceedSize && !wouldExceedCount;\n if (useKeepalive) {\n pendingBodySize += requestSize;\n pendingKeepaliveCount++;\n }\n else {\n const reason = wouldExceedSize ? 'size limit' : 'count limit';\n diag.debug(`keepalive disabled: ${(requestSize / 1024).toFixed(1)}KB payload, ${pendingKeepaliveCount} pending (${reason})`);\n }\n try {\n const url = new URL(this._parameters.url);\n const response = await fetchApi(url.href, {\n method: 'POST',\n headers: await this._parameters.headers(),\n body: data,\n signal: abortController.signal,\n keepalive: useKeepalive,\n mode: globalThis.location\n ? globalThis.location.origin === url.origin\n ? 'same-origin'\n : 'cors'\n : 'no-cors',\n });\n if (response.status >= 200 && response.status <= 299) {\n diag.debug(`export response success (status: ${response.status})`);\n return { status: 'success' };\n }\n else if (isExportHTTPErrorRetryable(response.status)) {\n diag.warn(`export response retryable (status: ${response.status})`);\n const retryAfter = response.headers.get('Retry-After');\n const retryInMillis = parseRetryAfterToMills(retryAfter);\n return { status: 'retryable', retryInMillis };\n }\n diag.error(`export response failure (status: ${response.status})`);\n return {\n status: 'failure',\n error: new Error(`Fetch request failed with non-retryable status ${response.status}`),\n };\n }\n catch (error) {\n if (isFetchNetworkErrorRetryable(error)) {\n diag.warn(`export request retryable (network error: ${error})`);\n return {\n status: 'retryable',\n error: new Error('Fetch request encountered a network error', {\n cause: error,\n }),\n };\n }\n diag.error(`export request failure (error: ${error})`);\n return {\n status: 'failure',\n error: new Error('Fetch request errored', { cause: error }),\n };\n }\n finally {\n clearTimeout(timeout);\n if (useKeepalive) {\n pendingBodySize -= requestSize;\n pendingKeepaliveCount--;\n }\n }\n }\n shutdown() {\n // Intentionally left empty, nothing to do.\n }\n}\n/**\n * Creates an exporter transport that uses `fetch` to send the data\n * @param parameters applied to each request made by transport\n */\nexport function createFetchTransport(parameters) {\n return new FetchTransport(parameters);\n}\nfunction isFetchNetworkErrorRetryable(error) {\n return error instanceof TypeError && !error.cause;\n}\n//# sourceMappingURL=fetch-transport.js.map","import { createRetryingTransport } from './retrying-transport';\nimport { createOtlpNetworkExportDelegate } from './otlp-network-export-delegate';\nimport { createFetchTransport } from './transport/fetch-transport';\nexport function createOtlpFetchExportDelegate(options, serializer) {\n return createOtlpNetworkExportDelegate(options, serializer, createRetryingTransport({\n transport: createFetchTransport(options),\n }));\n}\n/**\n * @deprecated Use {@link createOtlpFetchExportDelegate} instead. Modern browsers use `fetch` with `keepAlive: true` when `sendBeacon` is used. Use a `fetch` polyfill that mimics this behavior to keep using `sendBeacon`.\n */\nexport function createOtlpSendBeaconExportDelegate(options, serializer) {\n return createOtlpFetchExportDelegate(options, serializer);\n}\n//# sourceMappingURL=otlp-browser-http-export-delegate.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\n/**\n * Parses headers from config leaving only those that have defined values\n * @param partialHeaders\n */\nexport function validateAndNormalizeHeaders(partialHeaders) {\n const headers = {};\n Object.entries(partialHeaders ?? {}).forEach(([key, value]) => {\n if (typeof value !== 'undefined') {\n headers[key] = String(value);\n }\n else {\n diag.warn(`Header \"${key}\" has invalid value (${value}) and will be ignored`);\n }\n });\n return headers;\n}\n//# sourceMappingURL=util.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { getSharedConfigurationDefaults, mergeOtlpSharedConfigurationWithDefaults, } from './shared-configuration';\nimport { validateAndNormalizeHeaders } from '../util';\nfunction mergeHeaders(userProvidedHeaders, fallbackHeaders, defaultHeaders) {\n return async () => {\n const requiredHeaders = {\n ...(await defaultHeaders()),\n };\n const headers = {};\n // add fallback ones first\n if (fallbackHeaders != null) {\n Object.assign(headers, await fallbackHeaders());\n }\n // override with user-provided ones\n if (userProvidedHeaders != null) {\n Object.assign(headers, validateAndNormalizeHeaders(await userProvidedHeaders()));\n }\n // override required ones.\n return Object.assign(headers, requiredHeaders);\n };\n}\nfunction validateUserProvidedUrl(url) {\n if (url == null) {\n return undefined;\n }\n try {\n // NOTE: In non-browser environments, `globalThis.location` will be `undefined`.\n const base = globalThis.location?.href;\n return new URL(url, base).href;\n }\n catch {\n throw new Error(`Configuration: Could not parse user-provided export URL: '${url}'`);\n }\n}\n/**\n * @param userProvidedConfiguration Configuration options provided by the user in code.\n * @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.\n * @param defaultConfiguration The defaults as defined by the exporter specification\n */\nexport function mergeOtlpHttpConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration) {\n return {\n ...mergeOtlpSharedConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration),\n headers: mergeHeaders(userProvidedConfiguration.headers, fallbackConfiguration.headers, defaultConfiguration.headers),\n url: validateUserProvidedUrl(userProvidedConfiguration.url) ??\n fallbackConfiguration.url ??\n defaultConfiguration.url,\n };\n}\nexport function getHttpConfigurationDefaults(requiredHeaders, signalResourcePath) {\n return {\n ...getSharedConfigurationDefaults(),\n headers: async () => requiredHeaders,\n url: 'http://localhost:4318/' + signalResourcePath,\n };\n}\n//# sourceMappingURL=otlp-http-configuration.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { wrapStaticHeadersInFunction } from './shared-configuration';\nexport function convertLegacyHeaders(config) {\n if (typeof config.headers === 'function') {\n return config.headers;\n }\n return wrapStaticHeadersInFunction(config.headers);\n}\n//# sourceMappingURL=convert-legacy-http-options.js.map","import { getHttpConfigurationDefaults, mergeOtlpHttpConfigurationWithDefaults, } from './otlp-http-configuration';\nimport { convertLegacyHeaders } from './convert-legacy-http-options';\n/**\n * @deprecated this will be removed in 2.0\n *\n * @param config\n * @param signalResourcePath\n * @param requiredHeaders\n */\nexport function convertLegacyBrowserHttpOptions(config, signalResourcePath, requiredHeaders) {\n return mergeOtlpHttpConfigurationWithDefaults({\n url: config.url,\n timeoutMillis: config.timeoutMillis,\n headers: convertLegacyHeaders(config),\n concurrencyLimit: config.concurrencyLimit,\n }, {}, // no fallback for browser case\n getHttpConfigurationDefaults(requiredHeaders, signalResourcePath));\n}\n//# sourceMappingURL=convert-legacy-browser-http-options.js.map","import { createOtlpFetchExportDelegate } from '../otlp-browser-http-export-delegate';\nimport { convertLegacyBrowserHttpOptions } from './convert-legacy-browser-http-options';\n/**\n * @deprecated\n * @param config\n * @param serializer\n * @param signalResourcePath\n * @param requiredHeaders\n */\nexport function createLegacyOtlpBrowserExportDelegate(config, serializer, signalResourcePath, requiredHeaders) {\n const options = convertLegacyBrowserHttpOptions(config, signalResourcePath, requiredHeaders);\n return createOtlpFetchExportDelegate(options, serializer);\n}\n//# sourceMappingURL=create-legacy-browser-delegate.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base';\nimport { JsonTraceSerializer } from '@opentelemetry/otlp-transformer';\nimport { createLegacyOtlpBrowserExportDelegate } from '@opentelemetry/otlp-exporter-base/browser-http';\n/**\n * Collector Trace Exporter for Web\n */\nexport class OTLPTraceExporter extends OTLPExporterBase {\n constructor(config = {}) {\n super(createLegacyOtlpBrowserExportDelegate(config, JsonTraceSerializer, 'v1/traces', { 'Content-Type': 'application/json' }));\n }\n}\n//# sourceMappingURL=OTLPTraceExporter.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n// Event name definitions\nexport const ExceptionEventName = 'exception';\n//# sourceMappingURL=enums.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag, SpanStatusCode } from '@opentelemetry/api';\nimport { addHrTimes, millisToHrTime, hrTime, hrTimeDuration, isAttributeValue, isTimeInput, isTimeInputHrTime, otperformance, sanitizeAttributes, } from '@opentelemetry/core';\nimport { ATTR_EXCEPTION_MESSAGE, ATTR_EXCEPTION_STACKTRACE, ATTR_EXCEPTION_TYPE, } from '@opentelemetry/semantic-conventions';\nimport { ExceptionEventName } from './enums';\n/**\n * This class represents a span.\n */\nexport class SpanImpl {\n // Below properties are included to implement ReadableSpan for export\n // purposes but are not intended to be written-to directly.\n _spanContext;\n kind;\n parentSpanContext;\n attributes = {};\n links = [];\n events = [];\n startTime;\n resource;\n instrumentationScope;\n _droppedAttributesCount = 0;\n _droppedEventsCount = 0;\n _droppedLinksCount = 0;\n _attributesCount = 0;\n name;\n status = {\n code: SpanStatusCode.UNSET,\n };\n endTime = [0, 0];\n _ended = false;\n _duration = [-1, -1];\n _spanProcessor;\n _spanLimits;\n _attributeValueLengthLimit;\n _recordEndMetrics;\n _performanceStartTime;\n _performanceOffset;\n _startTimeProvided;\n /**\n * Constructs a new SpanImpl instance.\n */\n constructor(opts) {\n const now = Date.now();\n this._spanContext = opts.spanContext;\n this._performanceStartTime = otperformance.now();\n this._performanceOffset =\n now - (this._performanceStartTime + otperformance.timeOrigin);\n this._startTimeProvided = opts.startTime != null;\n this._spanLimits = opts.spanLimits;\n this._attributeValueLengthLimit =\n this._spanLimits.attributeValueLengthLimit ?? 0;\n this._spanProcessor = opts.spanProcessor;\n this.name = opts.name;\n this.parentSpanContext = opts.parentSpanContext;\n this.kind = opts.kind;\n if (opts.links) {\n for (const link of opts.links) {\n this.addLink(link);\n }\n }\n this.startTime = this._getTime(opts.startTime ?? now);\n this.resource = opts.resource;\n this.instrumentationScope = opts.scope;\n this._recordEndMetrics = opts.recordEndMetrics;\n if (opts.attributes != null) {\n this.setAttributes(opts.attributes);\n }\n this._spanProcessor.onStart(this, opts.context);\n }\n spanContext() {\n return this._spanContext;\n }\n setAttribute(key, value) {\n if (value == null || this._isSpanEnded())\n return this;\n if (key.length === 0) {\n diag.warn(`Invalid attribute key: ${key}`);\n return this;\n }\n if (!isAttributeValue(value)) {\n diag.warn(`Invalid attribute value set for key: ${key}`);\n return this;\n }\n const { attributeCountLimit } = this._spanLimits;\n const isNewKey = !Object.prototype.hasOwnProperty.call(this.attributes, key);\n if (attributeCountLimit !== undefined &&\n this._attributesCount >= attributeCountLimit &&\n isNewKey) {\n this._droppedAttributesCount++;\n return this;\n }\n this.attributes[key] = this._truncateToSize(value);\n if (isNewKey) {\n this._attributesCount++;\n }\n return this;\n }\n setAttributes(attributes) {\n for (const key in attributes) {\n if (Object.prototype.hasOwnProperty.call(attributes, key)) {\n this.setAttribute(key, attributes[key]);\n }\n }\n return this;\n }\n /**\n *\n * @param name Span Name\n * @param [attributesOrStartTime] Span attributes or start time\n * if type is {@type TimeInput} and 3rd param is undefined\n * @param [timeStamp] Specified time stamp for the event\n */\n addEvent(name, attributesOrStartTime, timeStamp) {\n if (this._isSpanEnded())\n return this;\n const { eventCountLimit } = this._spanLimits;\n if (eventCountLimit === 0) {\n diag.warn('No events allowed.');\n this._droppedEventsCount++;\n return this;\n }\n if (eventCountLimit !== undefined &&\n this.events.length >= eventCountLimit) {\n if (this._droppedEventsCount === 0) {\n diag.debug('Dropping extra events.');\n }\n this.events.shift();\n this._droppedEventsCount++;\n }\n if (isTimeInput(attributesOrStartTime)) {\n if (!isTimeInput(timeStamp)) {\n timeStamp = attributesOrStartTime;\n }\n attributesOrStartTime = undefined;\n }\n const sanitized = sanitizeAttributes(attributesOrStartTime);\n const { attributePerEventCountLimit } = this._spanLimits;\n const attributes = {};\n let droppedAttributesCount = 0;\n let eventAttributesCount = 0;\n for (const attr in sanitized) {\n if (!Object.prototype.hasOwnProperty.call(sanitized, attr)) {\n continue;\n }\n const attrVal = sanitized[attr];\n if (attributePerEventCountLimit !== undefined &&\n eventAttributesCount >= attributePerEventCountLimit) {\n droppedAttributesCount++;\n continue;\n }\n attributes[attr] = this._truncateToSize(attrVal);\n eventAttributesCount++;\n }\n this.events.push({\n name,\n attributes,\n time: this._getTime(timeStamp),\n droppedAttributesCount,\n });\n return this;\n }\n addLink(link) {\n if (this._isSpanEnded())\n return this;\n const { linkCountLimit } = this._spanLimits;\n if (linkCountLimit === 0) {\n this._droppedLinksCount++;\n return this;\n }\n if (linkCountLimit !== undefined && this.links.length >= linkCountLimit) {\n if (this._droppedLinksCount === 0) {\n diag.debug('Dropping extra links.');\n }\n this.links.shift();\n this._droppedLinksCount++;\n }\n const { attributePerLinkCountLimit } = this._spanLimits;\n const sanitized = sanitizeAttributes(link.attributes);\n const attributes = {};\n let droppedAttributesCount = 0;\n let linkAttributesCount = 0;\n for (const attr in sanitized) {\n if (!Object.prototype.hasOwnProperty.call(sanitized, attr)) {\n continue;\n }\n const attrVal = sanitized[attr];\n if (attributePerLinkCountLimit !== undefined &&\n linkAttributesCount >= attributePerLinkCountLimit) {\n droppedAttributesCount++;\n continue;\n }\n attributes[attr] = this._truncateToSize(attrVal);\n linkAttributesCount++;\n }\n const processedLink = { context: link.context };\n if (linkAttributesCount > 0) {\n processedLink.attributes = attributes;\n }\n if (droppedAttributesCount > 0) {\n processedLink.droppedAttributesCount = droppedAttributesCount;\n }\n this.links.push(processedLink);\n return this;\n }\n addLinks(links) {\n for (const link of links) {\n this.addLink(link);\n }\n return this;\n }\n setStatus(status) {\n if (this._isSpanEnded())\n return this;\n if (status.code === SpanStatusCode.UNSET)\n return this;\n if (this.status.code === SpanStatusCode.OK)\n return this;\n const newStatus = { code: status.code };\n // When using try-catch, the caught \"error\" is of type `any`. When then assigning `any` to `status.message`,\n // TypeScript will not error. While this can happen during use of any API, it is more common on Span#setStatus()\n // as it's likely used in a catch-block. Therefore, we validate if `status.message` is actually a string, null, or\n // undefined to avoid an incorrect type causing issues downstream.\n if (status.code === SpanStatusCode.ERROR) {\n if (typeof status.message === 'string') {\n newStatus.message = status.message;\n }\n else if (status.message != null) {\n diag.warn(`Dropping invalid status.message of type '${typeof status.message}', expected 'string'`);\n }\n }\n this.status = newStatus;\n return this;\n }\n updateName(name) {\n if (this._isSpanEnded())\n return this;\n this.name = name;\n return this;\n }\n end(endTime) {\n if (this._isSpanEnded()) {\n diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);\n return;\n }\n this.endTime = this._getTime(endTime);\n this._duration = hrTimeDuration(this.startTime, this.endTime);\n if (this._duration[0] < 0) {\n diag.warn('Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.', this.startTime, this.endTime);\n this.endTime = this.startTime.slice();\n this._duration = [0, 0];\n }\n if (this._droppedEventsCount > 0) {\n diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`);\n }\n if (this._droppedLinksCount > 0) {\n diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`);\n }\n if (this._spanProcessor.onEnding) {\n this._spanProcessor.onEnding(this);\n }\n this._recordEndMetrics?.();\n this._ended = true;\n this._spanProcessor.onEnd(this);\n }\n _getTime(inp) {\n if (typeof inp === 'number' && inp <= otperformance.now()) {\n // must be a performance timestamp\n // apply correction and convert to hrtime\n return hrTime(inp + this._performanceOffset);\n }\n if (typeof inp === 'number') {\n return millisToHrTime(inp);\n }\n if (inp instanceof Date) {\n return millisToHrTime(inp.getTime());\n }\n if (isTimeInputHrTime(inp)) {\n return inp;\n }\n if (this._startTimeProvided) {\n // if user provided a time for the start manually\n // we can't use duration to calculate event/end times\n return millisToHrTime(Date.now());\n }\n const msDuration = otperformance.now() - this._performanceStartTime;\n return addHrTimes(this.startTime, millisToHrTime(msDuration));\n }\n isRecording() {\n return this._ended === false;\n }\n recordException(exception, time) {\n const attributes = {};\n if (typeof exception === 'string') {\n attributes[ATTR_EXCEPTION_MESSAGE] = exception;\n }\n else if (exception) {\n if (exception.code) {\n attributes[ATTR_EXCEPTION_TYPE] = exception.code.toString();\n }\n else if (exception.name) {\n attributes[ATTR_EXCEPTION_TYPE] = exception.name;\n }\n if (exception.message) {\n attributes[ATTR_EXCEPTION_MESSAGE] = exception.message;\n }\n if (exception.stack) {\n attributes[ATTR_EXCEPTION_STACKTRACE] = exception.stack;\n }\n }\n // these are minimum requirements from spec\n if (attributes[ATTR_EXCEPTION_TYPE] || attributes[ATTR_EXCEPTION_MESSAGE]) {\n this.addEvent(ExceptionEventName, attributes, time);\n }\n else {\n diag.warn(`Failed to record an exception ${exception}`);\n }\n }\n get duration() {\n return this._duration;\n }\n get ended() {\n return this._ended;\n }\n get droppedAttributesCount() {\n return this._droppedAttributesCount;\n }\n get droppedEventsCount() {\n return this._droppedEventsCount;\n }\n get droppedLinksCount() {\n return this._droppedLinksCount;\n }\n _isSpanEnded() {\n if (this._ended) {\n const error = new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);\n diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`, error);\n }\n return this._ended;\n }\n // Utility function to truncate given value within size\n // for value type of string, will truncate to given limit\n // for type of non-string, will return same value\n _truncateToLimitUtil(value, limit) {\n if (value.length <= limit) {\n return value;\n }\n return value.substring(0, limit);\n }\n /**\n * If the given attribute value is of type string and has more characters than given {@code attributeValueLengthLimit} then\n * return string with truncated to {@code attributeValueLengthLimit} characters\n *\n * If the given attribute value is array of strings then\n * return new array of strings with each element truncated to {@code attributeValueLengthLimit} characters\n *\n * Otherwise return same Attribute {@code value}\n *\n * @param value Attribute value\n * @returns truncated attribute value if required, otherwise same value\n */\n _truncateToSize(value) {\n const limit = this._attributeValueLengthLimit;\n // Check limit\n if (limit <= 0) {\n // Negative values are invalid, so do not truncate\n diag.warn(`Attribute value limit must be positive, got ${limit}`);\n return value;\n }\n // String\n if (typeof value === 'string') {\n return this._truncateToLimitUtil(value, limit);\n }\n // Array of strings\n if (Array.isArray(value)) {\n return value.map(val => typeof val === 'string' ? this._truncateToLimitUtil(val, limit) : val);\n }\n // Other types, no need to apply value length limit\n return value;\n }\n}\n//# sourceMappingURL=Span.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * A sampling decision that determines how a {@link Span} will be recorded\n * and collected.\n */\nexport var SamplingDecision;\n(function (SamplingDecision) {\n /**\n * `Span.isRecording() === false`, span will not be recorded and all events\n * and attributes will be dropped.\n */\n SamplingDecision[SamplingDecision[\"NOT_RECORD\"] = 0] = \"NOT_RECORD\";\n /**\n * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags}\n * MUST NOT be set.\n */\n SamplingDecision[SamplingDecision[\"RECORD\"] = 1] = \"RECORD\";\n /**\n * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags}\n * MUST be set.\n */\n SamplingDecision[SamplingDecision[\"RECORD_AND_SAMPLED\"] = 2] = \"RECORD_AND_SAMPLED\";\n})(SamplingDecision || (SamplingDecision = {}));\n//# sourceMappingURL=Sampler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { SamplingDecision } from '../Sampler';\n/** Sampler that samples no traces. */\nexport class AlwaysOffSampler {\n shouldSample() {\n return {\n decision: SamplingDecision.NOT_RECORD,\n };\n }\n toString() {\n return 'AlwaysOffSampler';\n }\n}\n//# sourceMappingURL=AlwaysOffSampler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { SamplingDecision } from '../Sampler';\n/** Sampler that samples all traces. */\nexport class AlwaysOnSampler {\n shouldSample() {\n return {\n decision: SamplingDecision.RECORD_AND_SAMPLED,\n };\n }\n toString() {\n return 'AlwaysOnSampler';\n }\n}\n//# sourceMappingURL=AlwaysOnSampler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { isSpanContextValid, TraceFlags, trace } from '@opentelemetry/api';\nimport { globalErrorHandler } from '@opentelemetry/core';\nimport { AlwaysOffSampler } from './AlwaysOffSampler';\nimport { AlwaysOnSampler } from './AlwaysOnSampler';\n/**\n * A composite sampler that either respects the parent span's sampling decision\n * or delegates to `delegateSampler` for root spans.\n */\nexport class ParentBasedSampler {\n _root;\n _remoteParentSampled;\n _remoteParentNotSampled;\n _localParentSampled;\n _localParentNotSampled;\n constructor(config) {\n this._root = config.root;\n if (!this._root) {\n globalErrorHandler(new Error('ParentBasedSampler must have a root sampler configured'));\n this._root = new AlwaysOnSampler();\n }\n this._remoteParentSampled =\n config.remoteParentSampled ?? new AlwaysOnSampler();\n this._remoteParentNotSampled =\n config.remoteParentNotSampled ?? new AlwaysOffSampler();\n this._localParentSampled =\n config.localParentSampled ?? new AlwaysOnSampler();\n this._localParentNotSampled =\n config.localParentNotSampled ?? new AlwaysOffSampler();\n }\n shouldSample(context, traceId, spanName, spanKind, attributes, links) {\n const parentContext = trace.getSpanContext(context);\n if (!parentContext || !isSpanContextValid(parentContext)) {\n return this._root.shouldSample(context, traceId, spanName, spanKind, attributes, links);\n }\n if (parentContext.isRemote) {\n if (parentContext.traceFlags & TraceFlags.SAMPLED) {\n return this._remoteParentSampled.shouldSample(context, traceId, spanName, spanKind, attributes, links);\n }\n return this._remoteParentNotSampled.shouldSample(context, traceId, spanName, spanKind, attributes, links);\n }\n if (parentContext.traceFlags & TraceFlags.SAMPLED) {\n return this._localParentSampled.shouldSample(context, traceId, spanName, spanKind, attributes, links);\n }\n return this._localParentNotSampled.shouldSample(context, traceId, spanName, spanKind, attributes, links);\n }\n toString() {\n return `ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`;\n }\n}\n//# sourceMappingURL=ParentBasedSampler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { isValidTraceId } from '@opentelemetry/api';\nimport { SamplingDecision } from '../Sampler';\n/** Sampler that samples a given fraction of traces based of trace id deterministically. */\nexport class TraceIdRatioBasedSampler {\n _ratio;\n _upperBound;\n constructor(ratio = 0) {\n this._ratio = this._normalize(ratio);\n this._upperBound = Math.floor(this._ratio * 0xffffffff);\n }\n shouldSample(context, traceId) {\n return {\n decision: isValidTraceId(traceId) && this._accumulate(traceId) < this._upperBound\n ? SamplingDecision.RECORD_AND_SAMPLED\n : SamplingDecision.NOT_RECORD,\n };\n }\n toString() {\n return `TraceIdRatioBased{${this._ratio}}`;\n }\n _normalize(ratio) {\n if (typeof ratio !== 'number' || isNaN(ratio))\n return 0;\n return ratio >= 1 ? 1 : ratio <= 0 ? 0 : ratio;\n }\n _accumulate(traceId) {\n let accumulation = 0;\n for (let i = 0; i < 32; i += 8) {\n let part = 0;\n for (let j = 0; j < 8; j++) {\n const c = traceId.charCodeAt(i + j);\n // Convert hex char code to value: '0'-'9' -> 0-9, 'a'-'f' -> 10-15, 'A'-'F' -> 10-15\n const v = c < 58 ? c - 48 : c < 71 ? c - 55 : c - 87;\n part = (part << 4) | v;\n }\n accumulation = (accumulation ^ part) >>> 0;\n }\n return accumulation;\n }\n}\n//# sourceMappingURL=TraceIdRatioBasedSampler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\nimport { getNumberFromEnv, getStringFromEnv } from '@opentelemetry/core';\nimport { AlwaysOffSampler } from './sampler/AlwaysOffSampler';\nimport { AlwaysOnSampler } from './sampler/AlwaysOnSampler';\nimport { ParentBasedSampler } from './sampler/ParentBasedSampler';\nimport { TraceIdRatioBasedSampler } from './sampler/TraceIdRatioBasedSampler';\nvar TracesSamplerValues;\n(function (TracesSamplerValues) {\n TracesSamplerValues[\"AlwaysOff\"] = \"always_off\";\n TracesSamplerValues[\"AlwaysOn\"] = \"always_on\";\n TracesSamplerValues[\"ParentBasedAlwaysOff\"] = \"parentbased_always_off\";\n TracesSamplerValues[\"ParentBasedAlwaysOn\"] = \"parentbased_always_on\";\n TracesSamplerValues[\"ParentBasedTraceIdRatio\"] = \"parentbased_traceidratio\";\n TracesSamplerValues[\"TraceIdRatio\"] = \"traceidratio\";\n})(TracesSamplerValues || (TracesSamplerValues = {}));\nconst DEFAULT_RATIO = 1;\n/**\n * Load default configuration. For fields with primitive values, any user-provided\n * value will override the corresponding default value. For fields with\n * non-primitive values (like `spanLimits`), the user-provided value will be\n * used to extend the default value.\n */\n// object needs to be wrapped in this function and called when needed otherwise\n// envs are parsed before tests are ran - causes tests using these envs to fail\nexport function loadDefaultConfig() {\n return {\n sampler: buildSamplerFromEnv(),\n forceFlushTimeoutMillis: 30000,\n generalLimits: {\n attributeValueLengthLimit: getNumberFromEnv('OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT') ?? Infinity,\n attributeCountLimit: getNumberFromEnv('OTEL_ATTRIBUTE_COUNT_LIMIT') ?? 128,\n },\n spanLimits: {\n attributeValueLengthLimit: getNumberFromEnv('OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT') ?? Infinity,\n attributeCountLimit: getNumberFromEnv('OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT') ?? 128,\n linkCountLimit: getNumberFromEnv('OTEL_SPAN_LINK_COUNT_LIMIT') ?? 128,\n eventCountLimit: getNumberFromEnv('OTEL_SPAN_EVENT_COUNT_LIMIT') ?? 128,\n attributePerEventCountLimit: getNumberFromEnv('OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT') ?? 128,\n attributePerLinkCountLimit: getNumberFromEnv('OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT') ?? 128,\n },\n };\n}\n/**\n * Based on environment, builds a sampler, complies with specification.\n */\nexport function buildSamplerFromEnv() {\n const sampler = getStringFromEnv('OTEL_TRACES_SAMPLER') ??\n TracesSamplerValues.ParentBasedAlwaysOn;\n switch (sampler) {\n case TracesSamplerValues.AlwaysOn:\n return new AlwaysOnSampler();\n case TracesSamplerValues.AlwaysOff:\n return new AlwaysOffSampler();\n case TracesSamplerValues.ParentBasedAlwaysOn:\n return new ParentBasedSampler({\n root: new AlwaysOnSampler(),\n });\n case TracesSamplerValues.ParentBasedAlwaysOff:\n return new ParentBasedSampler({\n root: new AlwaysOffSampler(),\n });\n case TracesSamplerValues.TraceIdRatio:\n return new TraceIdRatioBasedSampler(getSamplerProbabilityFromEnv());\n case TracesSamplerValues.ParentBasedTraceIdRatio:\n return new ParentBasedSampler({\n root: new TraceIdRatioBasedSampler(getSamplerProbabilityFromEnv()),\n });\n default:\n diag.error(`OTEL_TRACES_SAMPLER value \"${sampler}\" invalid, defaulting to \"${TracesSamplerValues.ParentBasedAlwaysOn}\".`);\n return new ParentBasedSampler({\n root: new AlwaysOnSampler(),\n });\n }\n}\nfunction getSamplerProbabilityFromEnv() {\n const probability = getNumberFromEnv('OTEL_TRACES_SAMPLER_ARG');\n if (probability == null) {\n diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${DEFAULT_RATIO}.`);\n return DEFAULT_RATIO;\n }\n if (probability < 0 || probability > 1) {\n diag.error(`OTEL_TRACES_SAMPLER_ARG=${probability} was given, but it is out of range ([0..1]), defaulting to ${DEFAULT_RATIO}.`);\n return DEFAULT_RATIO;\n }\n return probability;\n}\n//# sourceMappingURL=config.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { buildSamplerFromEnv, loadDefaultConfig } from './config';\nimport { getNumberFromEnv } from '@opentelemetry/core';\nexport const DEFAULT_ATTRIBUTE_COUNT_LIMIT = 128;\nexport const DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT = Infinity;\n/**\n * Function to merge Default configuration (as specified in './config') with\n * user provided configurations.\n */\nexport function mergeConfig(userConfig) {\n const perInstanceDefaults = {\n sampler: buildSamplerFromEnv(),\n };\n const DEFAULT_CONFIG = loadDefaultConfig();\n const target = Object.assign({}, DEFAULT_CONFIG, perInstanceDefaults, userConfig);\n target.generalLimits = Object.assign({}, DEFAULT_CONFIG.generalLimits, userConfig.generalLimits || {});\n target.spanLimits = Object.assign({}, DEFAULT_CONFIG.spanLimits, userConfig.spanLimits || {});\n return target;\n}\n/**\n * When general limits are provided and model specific limits are not,\n * configures the model specific limits by using the values from the general ones.\n * @param userConfig User provided tracer configuration\n */\nexport function reconfigureLimits(userConfig) {\n const spanLimits = Object.assign({}, userConfig.spanLimits);\n /**\n * Reassign span attribute count limit to use first non null value defined by user or use default value\n */\n spanLimits.attributeCountLimit =\n userConfig.spanLimits?.attributeCountLimit ??\n userConfig.generalLimits?.attributeCountLimit ??\n getNumberFromEnv('OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT') ??\n getNumberFromEnv('OTEL_ATTRIBUTE_COUNT_LIMIT') ??\n DEFAULT_ATTRIBUTE_COUNT_LIMIT;\n /**\n * Reassign span attribute value length limit to use first non null value defined by user or use default value\n */\n spanLimits.attributeValueLengthLimit =\n userConfig.spanLimits?.attributeValueLengthLimit ??\n userConfig.generalLimits?.attributeValueLengthLimit ??\n getNumberFromEnv('OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT') ??\n getNumberFromEnv('OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT') ??\n DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT;\n return Object.assign({}, userConfig, { spanLimits });\n}\n//# sourceMappingURL=utility.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { context, diag, TraceFlags } from '@opentelemetry/api';\nimport { BindOnceFuture, ExportResultCode, getNumberFromEnv, globalErrorHandler, suppressTracing, } from '@opentelemetry/core';\n/**\n * Implementation of the {@link SpanProcessor} that batches spans exported by\n * the SDK then pushes them to the exporter pipeline.\n */\nexport class BatchSpanProcessorBase {\n _maxExportBatchSize;\n _maxQueueSize;\n _scheduledDelayMillis;\n _exportTimeoutMillis;\n _exporter;\n _isExporting = false;\n _finishedSpans = [];\n _timer;\n _shutdownOnce;\n _droppedSpansCount = 0;\n constructor(exporter, config) {\n this._exporter = exporter;\n this._maxExportBatchSize =\n typeof config?.maxExportBatchSize === 'number'\n ? config.maxExportBatchSize\n : (getNumberFromEnv('OTEL_BSP_MAX_EXPORT_BATCH_SIZE') ?? 512);\n this._maxQueueSize =\n typeof config?.maxQueueSize === 'number'\n ? config.maxQueueSize\n : (getNumberFromEnv('OTEL_BSP_MAX_QUEUE_SIZE') ?? 2048);\n this._scheduledDelayMillis =\n typeof config?.scheduledDelayMillis === 'number'\n ? config.scheduledDelayMillis\n : (getNumberFromEnv('OTEL_BSP_SCHEDULE_DELAY') ?? 5000);\n this._exportTimeoutMillis =\n typeof config?.exportTimeoutMillis === 'number'\n ? config.exportTimeoutMillis\n : (getNumberFromEnv('OTEL_BSP_EXPORT_TIMEOUT') ?? 30000);\n this._shutdownOnce = new BindOnceFuture(this._shutdown, this);\n if (this._maxExportBatchSize > this._maxQueueSize) {\n diag.warn('BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize');\n this._maxExportBatchSize = this._maxQueueSize;\n }\n }\n forceFlush() {\n if (this._shutdownOnce.isCalled) {\n return this._shutdownOnce.promise;\n }\n return this._flushAll();\n }\n // does nothing.\n onStart(_span, _parentContext) { }\n onEnd(span) {\n if (this._shutdownOnce.isCalled) {\n return;\n }\n if ((span.spanContext().traceFlags & TraceFlags.SAMPLED) === 0) {\n return;\n }\n this._addToBuffer(span);\n }\n shutdown() {\n return this._shutdownOnce.call();\n }\n _shutdown() {\n return Promise.resolve()\n .then(() => {\n return this.onShutdown();\n })\n .then(() => {\n return this._flushAll();\n })\n .then(() => {\n return this._exporter.shutdown();\n });\n }\n /** Add a span in the buffer. */\n _addToBuffer(span) {\n if (this._finishedSpans.length >= this._maxQueueSize) {\n // limit reached, drop span\n if (this._droppedSpansCount === 0) {\n diag.debug('maxQueueSize reached, dropping spans');\n }\n this._droppedSpansCount++;\n return;\n }\n if (this._droppedSpansCount > 0) {\n // some spans were dropped, log once with count of spans dropped\n diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`);\n this._droppedSpansCount = 0;\n }\n this._finishedSpans.push(span);\n this._maybeStartTimer();\n }\n /**\n * Send all spans to the exporter respecting the batch size limit\n * This function is used only on forceFlush or shutdown,\n * for all other cases _flush should be used\n * */\n _flushAll() {\n return new Promise((resolve, reject) => {\n const promises = [];\n // calculate number of batches\n const count = Math.ceil(this._finishedSpans.length / this._maxExportBatchSize);\n for (let i = 0, j = count; i < j; i++) {\n promises.push(this._flushOneBatch());\n }\n Promise.all(promises)\n .then(() => {\n resolve();\n })\n .catch(reject);\n });\n }\n _flushOneBatch() {\n this._clearTimer();\n if (this._finishedSpans.length === 0) {\n return Promise.resolve();\n }\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => {\n // don't wait anymore for export, this way the next batch can start\n reject(new Error('Timeout'));\n }, this._exportTimeoutMillis);\n // prevent downstream exporter calls from generating spans\n context.with(suppressTracing(context.active()), () => {\n // Reset the finished spans buffer here because the next invocations of the _flush method\n // could pass the same finished spans to the exporter if the buffer is cleared\n // outside the execution of this callback.\n let spans;\n if (this._finishedSpans.length <= this._maxExportBatchSize) {\n spans = this._finishedSpans;\n this._finishedSpans = [];\n }\n else {\n spans = this._finishedSpans.splice(0, this._maxExportBatchSize);\n }\n const doExport = () => this._exporter.export(spans, result => {\n clearTimeout(timer);\n if (result.code === ExportResultCode.SUCCESS) {\n resolve();\n }\n else {\n reject(result.error ??\n new Error('BatchSpanProcessor: span export failed'));\n }\n });\n let pendingResources = null;\n for (let i = 0, len = spans.length; i < len; i++) {\n const span = spans[i];\n if (span.resource.asyncAttributesPending &&\n span.resource.waitForAsyncAttributes) {\n pendingResources ??= [];\n pendingResources.push(span.resource.waitForAsyncAttributes());\n }\n }\n // Avoid scheduling a promise to make the behavior more predictable and easier to test\n if (pendingResources === null) {\n doExport();\n }\n else {\n Promise.all(pendingResources).then(doExport, err => {\n globalErrorHandler(err);\n reject(err);\n });\n }\n });\n });\n }\n _maybeStartTimer() {\n if (this._isExporting)\n return;\n const flush = () => {\n this._isExporting = true;\n this._flushOneBatch()\n .finally(() => {\n this._isExporting = false;\n if (this._finishedSpans.length > 0) {\n this._clearTimer();\n this._maybeStartTimer();\n }\n })\n .catch(e => {\n this._isExporting = false;\n globalErrorHandler(e);\n });\n };\n // we only wait if the queue doesn't have enough elements yet\n if (this._finishedSpans.length >= this._maxExportBatchSize) {\n return flush();\n }\n if (this._timer !== undefined)\n return;\n this._timer = setTimeout(() => flush(), this._scheduledDelayMillis);\n // depending on runtime, this may be a 'number' or NodeJS.Timeout\n if (typeof this._timer !== 'number') {\n this._timer.unref();\n }\n }\n _clearTimer() {\n if (this._timer !== undefined) {\n clearTimeout(this._timer);\n this._timer = undefined;\n }\n }\n}\n//# sourceMappingURL=BatchSpanProcessorBase.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { BatchSpanProcessorBase } from '../../../export/BatchSpanProcessorBase';\nimport { globalErrorHandler } from '@opentelemetry/core';\nexport class BatchSpanProcessor extends BatchSpanProcessorBase {\n _visibilityChangeListener;\n _pageHideListener;\n constructor(_exporter, config) {\n super(_exporter, config);\n this.onInit(config);\n }\n onInit(config) {\n if (config?.disableAutoFlushOnDocumentHide !== true &&\n typeof document !== 'undefined') {\n this._visibilityChangeListener = () => {\n if (document.visibilityState === 'hidden') {\n this.forceFlush().catch(error => {\n globalErrorHandler(error);\n });\n }\n };\n this._pageHideListener = () => {\n this.forceFlush().catch(error => {\n globalErrorHandler(error);\n });\n };\n document.addEventListener('visibilitychange', this._visibilityChangeListener);\n // use 'pagehide' event as a fallback for Safari; see https://bugs.webkit.org/show_bug.cgi?id=116769\n document.addEventListener('pagehide', this._pageHideListener);\n }\n }\n onShutdown() {\n if (typeof document !== 'undefined') {\n if (this._visibilityChangeListener) {\n document.removeEventListener('visibilitychange', this._visibilityChangeListener);\n }\n if (this._pageHideListener) {\n document.removeEventListener('pagehide', this._pageHideListener);\n }\n }\n }\n}\n//# sourceMappingURL=BatchSpanProcessor.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nconst TRACE_ID_BYTES = 16;\nconst SPAN_ID_BYTES = 8;\nconst TRACE_BUFFER = new Uint8Array(TRACE_ID_BYTES);\nconst SPAN_BUFFER = new Uint8Array(SPAN_ID_BYTES);\n// Byte-to-hex lookup is faster than toString(16) in browsers\nconst HEX = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * Fills buffer with random bytes, ensuring at least one is non-zero\n * per W3C Trace Context spec.\n */\nfunction randomFill(buf) {\n for (let i = 0; i < buf.length; i++) {\n buf[i] = (Math.random() * 256) >>> 0;\n }\n // Ensure non-zero\n for (let i = 0; i < buf.length; i++) {\n if (buf[i] > 0)\n return;\n }\n buf[buf.length - 1] = 1;\n}\nfunction toHex(buf) {\n let hex = '';\n for (let i = 0; i < buf.length; i++) {\n hex += HEX[buf[i]];\n }\n return hex;\n}\nexport class RandomIdGenerator {\n /**\n * Returns a random 16-byte trace ID formatted/encoded as a 32 lowercase hex\n * characters corresponding to 128 bits.\n */\n generateTraceId() {\n randomFill(TRACE_BUFFER);\n return toHex(TRACE_BUFFER);\n }\n /**\n * Returns a random 8-byte span ID formatted/encoded as a 16 lowercase hex\n * characters corresponding to 64 bits.\n */\n generateSpanId() {\n randomFill(SPAN_BUFFER);\n return toHex(SPAN_BUFFER);\n }\n}\n//# sourceMappingURL=RandomIdGenerator.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n/**\n * Determines whether the span has a parent span, and if so, [whether it is a remote parent](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote)\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_OTEL_SPAN_PARENT_ORIGIN = 'otel.span.parent.origin';\n/**\n * The result value of the sampler for this span\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_OTEL_SPAN_SAMPLING_RESULT = 'otel.span.sampling_result';\n/**\n * The number of created spans with `recording=true` for which the end operation has not been called yet.\n *\n * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const METRIC_OTEL_SDK_SPAN_LIVE = 'otel.sdk.span.live';\n/**\n * The number of created spans.\n *\n * @note Implementations **MUST** record this metric for all spans, even for non-recording ones.\n *\n * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const METRIC_OTEL_SDK_SPAN_STARTED = 'otel.sdk.span.started';\n//# sourceMappingURL=semconv.js.map","import { SamplingDecision } from './Sampler';\nimport { ATTR_OTEL_SPAN_PARENT_ORIGIN, ATTR_OTEL_SPAN_SAMPLING_RESULT, METRIC_OTEL_SDK_SPAN_LIVE, METRIC_OTEL_SDK_SPAN_STARTED, } from './semconv';\n/**\n * Generates `otel.sdk.span.*` metrics.\n * https://opentelemetry.io/docs/specs/semconv/otel/sdk-metrics/#span-metrics\n */\nexport class TracerMetrics {\n startedSpans;\n liveSpans;\n constructor(meter) {\n this.startedSpans = meter.createCounter(METRIC_OTEL_SDK_SPAN_STARTED, {\n unit: '{span}',\n description: 'The number of created spans.',\n });\n this.liveSpans = meter.createUpDownCounter(METRIC_OTEL_SDK_SPAN_LIVE, {\n unit: '{span}',\n description: 'The number of currently live spans.',\n });\n }\n startSpan(parentSpanCtx, samplingDecision) {\n const samplingDecisionStr = samplingDecisionToString(samplingDecision);\n this.startedSpans.add(1, {\n [ATTR_OTEL_SPAN_PARENT_ORIGIN]: parentOrigin(parentSpanCtx),\n [ATTR_OTEL_SPAN_SAMPLING_RESULT]: samplingDecisionStr,\n });\n if (samplingDecision === SamplingDecision.NOT_RECORD) {\n return () => { };\n }\n const liveSpanAttributes = {\n [ATTR_OTEL_SPAN_SAMPLING_RESULT]: samplingDecisionStr,\n };\n this.liveSpans.add(1, liveSpanAttributes);\n return () => {\n this.liveSpans.add(-1, liveSpanAttributes);\n };\n }\n}\nfunction parentOrigin(parentSpanContext) {\n if (!parentSpanContext) {\n return 'none';\n }\n if (parentSpanContext.isRemote) {\n return 'remote';\n }\n return 'local';\n}\nfunction samplingDecisionToString(decision) {\n switch (decision) {\n case SamplingDecision.RECORD_AND_SAMPLED:\n return 'RECORD_AND_SAMPLE';\n case SamplingDecision.RECORD:\n return 'RECORD_ONLY';\n case SamplingDecision.NOT_RECORD:\n return 'DROP';\n }\n}\n//# sourceMappingURL=TracerMetrics.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '2.7.1';\n//# sourceMappingURL=version.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport * as api from '@opentelemetry/api';\nimport { sanitizeAttributes, isTracingSuppressed } from '@opentelemetry/core';\nimport { SpanImpl } from './Span';\nimport { mergeConfig } from './utility';\nimport { RandomIdGenerator } from './platform';\nimport { TracerMetrics } from './TracerMetrics';\nimport { VERSION } from './version';\n/**\n * This class represents a basic tracer.\n */\nexport class Tracer {\n _sampler;\n _generalLimits;\n _spanLimits;\n _idGenerator;\n instrumentationScope;\n _resource;\n _spanProcessor;\n _tracerMetrics;\n /**\n * Constructs a new Tracer instance.\n */\n constructor(instrumentationScope, config, resource, spanProcessor) {\n const localConfig = mergeConfig(config);\n this._sampler = localConfig.sampler;\n this._generalLimits = localConfig.generalLimits;\n this._spanLimits = localConfig.spanLimits;\n this._idGenerator = config.idGenerator || new RandomIdGenerator();\n this._resource = resource;\n this._spanProcessor = spanProcessor;\n this.instrumentationScope = instrumentationScope;\n const meter = localConfig.meterProvider\n ? localConfig.meterProvider.getMeter('@opentelemetry/sdk-trace', VERSION)\n : api.createNoopMeter();\n this._tracerMetrics = new TracerMetrics(meter);\n }\n /**\n * Starts a new Span or returns the default NoopSpan based on the sampling\n * decision.\n */\n startSpan(name, options = {}, context = api.context.active()) {\n // remove span from context in case a root span is requested via options\n if (options.root) {\n context = api.trace.deleteSpan(context);\n }\n const parentSpan = api.trace.getSpan(context);\n if (isTracingSuppressed(context)) {\n api.diag.debug('Instrumentation suppressed, returning Noop Span');\n const nonRecordingSpan = api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT);\n return nonRecordingSpan;\n }\n const parentSpanContext = parentSpan?.spanContext();\n const spanId = this._idGenerator.generateSpanId();\n let validParentSpanContext;\n let traceId;\n let traceState;\n if (!parentSpanContext ||\n !api.trace.isSpanContextValid(parentSpanContext)) {\n // New root span.\n traceId = this._idGenerator.generateTraceId();\n }\n else {\n // New child span.\n traceId = parentSpanContext.traceId;\n traceState = parentSpanContext.traceState;\n validParentSpanContext = parentSpanContext;\n }\n const spanKind = options.kind ?? api.SpanKind.INTERNAL;\n const links = (options.links ?? []).map(link => {\n return {\n context: link.context,\n attributes: sanitizeAttributes(link.attributes),\n };\n });\n const attributes = sanitizeAttributes(options.attributes);\n // make sampling decision\n const samplingResult = this._sampler.shouldSample(context, traceId, name, spanKind, attributes, links);\n const recordEndMetrics = this._tracerMetrics.startSpan(parentSpanContext, samplingResult.decision);\n traceState = samplingResult.traceState ?? traceState;\n const traceFlags = samplingResult.decision === api.SamplingDecision.RECORD_AND_SAMPLED\n ? api.TraceFlags.SAMPLED\n : api.TraceFlags.NONE;\n const spanContext = { traceId, spanId, traceFlags, traceState };\n if (samplingResult.decision === api.SamplingDecision.NOT_RECORD) {\n api.diag.debug('Recording is off, propagating context in a non-recording span');\n const nonRecordingSpan = api.trace.wrapSpanContext(spanContext);\n return nonRecordingSpan;\n }\n // Set initial span attributes. The attributes object may have been mutated\n // by the sampler, so we sanitize the merged attributes before setting them.\n const initAttributes = sanitizeAttributes(Object.assign(attributes, samplingResult.attributes));\n const span = new SpanImpl({\n resource: this._resource,\n scope: this.instrumentationScope,\n context,\n spanContext,\n name,\n kind: spanKind,\n links,\n parentSpanContext: validParentSpanContext,\n attributes: initAttributes,\n startTime: options.startTime,\n spanProcessor: this._spanProcessor,\n spanLimits: this._spanLimits,\n recordEndMetrics,\n });\n return span;\n }\n startActiveSpan(name, arg2, arg3, arg4) {\n let opts;\n let ctx;\n let fn;\n if (arguments.length < 2) {\n return;\n }\n else if (arguments.length === 2) {\n fn = arg2;\n }\n else if (arguments.length === 3) {\n opts = arg2;\n fn = arg3;\n }\n else {\n opts = arg2;\n ctx = arg3;\n fn = arg4;\n }\n const parentContext = ctx ?? api.context.active();\n const span = this.startSpan(name, opts, parentContext);\n const contextWithSpanSet = api.trace.setSpan(parentContext, span);\n return api.context.with(contextWithSpanSet, fn, undefined, span);\n }\n /** Returns the active {@link GeneralLimits}. */\n getGeneralLimits() {\n return this._generalLimits;\n }\n /** Returns the active {@link SpanLimits}. */\n getSpanLimits() {\n return this._spanLimits;\n }\n}\n//# sourceMappingURL=Tracer.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { globalErrorHandler } from '@opentelemetry/core';\n/**\n * Implementation of the {@link SpanProcessor} that simply forwards all\n * received events to a list of {@link SpanProcessor}s.\n */\nexport class MultiSpanProcessor {\n _spanProcessors;\n constructor(spanProcessors) {\n this._spanProcessors = spanProcessors;\n }\n forceFlush() {\n const promises = [];\n for (const spanProcessor of this._spanProcessors) {\n promises.push(spanProcessor.forceFlush());\n }\n return new Promise(resolve => {\n Promise.all(promises)\n .then(() => {\n resolve();\n })\n .catch(error => {\n globalErrorHandler(error || new Error('MultiSpanProcessor: forceFlush failed'));\n resolve();\n });\n });\n }\n onStart(span, context) {\n for (const spanProcessor of this._spanProcessors) {\n spanProcessor.onStart(span, context);\n }\n }\n onEnding(span) {\n for (const spanProcessor of this._spanProcessors) {\n if (spanProcessor.onEnding) {\n spanProcessor.onEnding(span);\n }\n }\n }\n onEnd(span) {\n for (const spanProcessor of this._spanProcessors) {\n spanProcessor.onEnd(span);\n }\n }\n shutdown() {\n const promises = [];\n for (const spanProcessor of this._spanProcessors) {\n promises.push(spanProcessor.shutdown());\n }\n return new Promise((resolve, reject) => {\n Promise.all(promises).then(() => {\n resolve();\n }, reject);\n });\n }\n}\n//# sourceMappingURL=MultiSpanProcessor.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { merge } from '@opentelemetry/core';\nimport { defaultResource } from '@opentelemetry/resources';\nimport { Tracer } from './Tracer';\nimport { loadDefaultConfig } from './config';\nimport { MultiSpanProcessor } from './MultiSpanProcessor';\nimport { reconfigureLimits } from './utility';\nexport var ForceFlushState;\n(function (ForceFlushState) {\n ForceFlushState[ForceFlushState[\"resolved\"] = 0] = \"resolved\";\n ForceFlushState[ForceFlushState[\"timeout\"] = 1] = \"timeout\";\n ForceFlushState[ForceFlushState[\"error\"] = 2] = \"error\";\n ForceFlushState[ForceFlushState[\"unresolved\"] = 3] = \"unresolved\";\n})(ForceFlushState || (ForceFlushState = {}));\n/**\n * This class represents a basic tracer provider which platform libraries can extend\n */\nexport class BasicTracerProvider {\n _config;\n _tracers = new Map();\n _resource;\n _activeSpanProcessor;\n constructor(config = {}) {\n const mergedConfig = merge({}, loadDefaultConfig(), reconfigureLimits(config));\n this._resource = mergedConfig.resource ?? defaultResource();\n this._config = Object.assign({}, mergedConfig, {\n resource: this._resource,\n });\n const spanProcessors = [];\n if (config.spanProcessors?.length) {\n spanProcessors.push(...config.spanProcessors);\n }\n this._activeSpanProcessor = new MultiSpanProcessor(spanProcessors);\n }\n getTracer(name, version, options) {\n const key = `${name}@${version || ''}:${options?.schemaUrl || ''}`;\n if (!this._tracers.has(key)) {\n this._tracers.set(key, new Tracer({ name, version, schemaUrl: options?.schemaUrl }, this._config, this._resource, this._activeSpanProcessor));\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._tracers.get(key);\n }\n forceFlush() {\n const timeout = this._config.forceFlushTimeoutMillis;\n const promises = this._activeSpanProcessor['_spanProcessors'].map((spanProcessor) => {\n return new Promise(resolve => {\n let state;\n const timeoutInterval = setTimeout(() => {\n resolve(new Error(`Span processor did not completed within timeout period of ${timeout} ms`));\n state = ForceFlushState.timeout;\n }, timeout);\n spanProcessor\n .forceFlush()\n .then(() => {\n clearTimeout(timeoutInterval);\n if (state !== ForceFlushState.timeout) {\n state = ForceFlushState.resolved;\n resolve(state);\n }\n })\n .catch(error => {\n clearTimeout(timeoutInterval);\n state = ForceFlushState.error;\n resolve(error);\n });\n });\n });\n return new Promise((resolve, reject) => {\n Promise.all(promises)\n .then(results => {\n const errors = results.filter(result => result !== ForceFlushState.resolved);\n if (errors.length > 0) {\n reject(errors);\n }\n else {\n resolve();\n }\n })\n .catch(error => reject([error]));\n });\n }\n shutdown() {\n return this._activeSpanProcessor.shutdown();\n }\n}\n//# sourceMappingURL=BasicTracerProvider.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { TraceFlags } from '@opentelemetry/api';\nimport { internal, ExportResultCode, globalErrorHandler, BindOnceFuture, } from '@opentelemetry/core';\n/**\n * An implementation of the {@link SpanProcessor} that converts the {@link Span}\n * to {@link ReadableSpan} and passes it to the configured exporter.\n *\n * Only spans that are sampled are converted.\n *\n * NOTE: This {@link SpanProcessor} exports every ended span individually instead of batching spans together, which causes significant performance overhead with most exporters. For production use, please consider using the {@link BatchSpanProcessor} instead.\n */\nexport class SimpleSpanProcessor {\n _exporter;\n _shutdownOnce;\n _pendingExports;\n constructor(exporter) {\n this._exporter = exporter;\n this._shutdownOnce = new BindOnceFuture(this._shutdown, this);\n this._pendingExports = new Set();\n }\n async forceFlush() {\n await Promise.all(Array.from(this._pendingExports));\n if (this._exporter.forceFlush) {\n await this._exporter.forceFlush();\n }\n }\n onStart(_span, _parentContext) { }\n onEnd(span) {\n if (this._shutdownOnce.isCalled) {\n return;\n }\n if ((span.spanContext().traceFlags & TraceFlags.SAMPLED) === 0) {\n return;\n }\n const pendingExport = this._doExport(span).catch(err => globalErrorHandler(err));\n // Enqueue this export to the pending list so it can be flushed by the user.\n this._pendingExports.add(pendingExport);\n void pendingExport.finally(() => this._pendingExports.delete(pendingExport));\n }\n async _doExport(span) {\n if (span.resource.asyncAttributesPending) {\n // Ensure resource is fully resolved before exporting.\n await span.resource.waitForAsyncAttributes?.();\n }\n const result = await internal._export(this._exporter, [span]);\n if (result.code !== ExportResultCode.SUCCESS) {\n throw (result.error ??\n new Error(`SimpleSpanProcessor: span export failed (status ${result})`));\n }\n }\n shutdown() {\n return this._shutdownOnce.call();\n }\n _shutdown() {\n return this._exporter.shutdown();\n }\n}\n//# sourceMappingURL=SimpleSpanProcessor.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ROOT_CONTEXT } from '@opentelemetry/api';\n/**\n * Stack Context Manager for managing the state in web\n * it doesn't fully support the async calls though\n */\nexport class StackContextManager {\n /**\n * whether the context manager is enabled or not\n */\n _enabled = false;\n /**\n * Keeps the reference to current context\n */\n _currentContext = ROOT_CONTEXT;\n /**\n *\n * @param context\n * @param target Function to be executed within the context\n */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n _bindFunction(context = ROOT_CONTEXT, target) {\n const manager = this;\n const contextWrapper = function (...args) {\n return manager.with(context, () => target.apply(this, args));\n };\n Object.defineProperty(contextWrapper, 'length', {\n enumerable: false,\n configurable: true,\n writable: false,\n value: target.length,\n });\n return contextWrapper;\n }\n /**\n * Returns the active context\n */\n active() {\n return this._currentContext;\n }\n /**\n * Binds a the certain context or the active one to the target function and then returns the target\n * @param context A context (span) to be bind to target\n * @param target a function or event emitter. When target or one of its callbacks is called,\n * the provided context will be used as the active context for the duration of the call.\n */\n bind(context, target) {\n // if no specific context to propagate is given, we use the current one\n if (context === undefined) {\n context = this.active();\n }\n if (typeof target === 'function') {\n return this._bindFunction(context, target);\n }\n return target;\n }\n /**\n * Disable the context manager (clears the current context)\n */\n disable() {\n this._currentContext = ROOT_CONTEXT;\n this._enabled = false;\n return this;\n }\n /**\n * Enables the context manager and creates a default(root) context\n */\n enable() {\n if (this._enabled) {\n return this;\n }\n this._enabled = true;\n this._currentContext = ROOT_CONTEXT;\n return this;\n }\n /**\n * Calls the callback function [fn] with the provided [context]. If [context] is undefined then it will use the window.\n * The context will be set as active\n * @param context\n * @param fn Callback function\n * @param thisArg optional receiver to be used for calling fn\n * @param args optional arguments forwarded to fn\n */\n with(context, fn, thisArg, ...args) {\n const previousContext = this._currentContext;\n this._currentContext = context || ROOT_CONTEXT;\n try {\n return fn.call(thisArg, ...args);\n }\n finally {\n this._currentContext = previousContext;\n }\n }\n}\n//# sourceMappingURL=StackContextManager.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { BasicTracerProvider } from '@opentelemetry/sdk-trace-base';\nimport { StackContextManager } from './StackContextManager';\nimport { trace, context, propagation } from '@opentelemetry/api';\nimport { CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator, } from '@opentelemetry/core';\nfunction setupContextManager(contextManager) {\n // null means 'do not register'\n if (contextManager === null) {\n return;\n }\n // undefined means 'register default'\n if (contextManager === undefined) {\n const defaultContextManager = new StackContextManager();\n defaultContextManager.enable();\n context.setGlobalContextManager(defaultContextManager);\n return;\n }\n contextManager.enable();\n context.setGlobalContextManager(contextManager);\n}\nfunction setupPropagator(propagator) {\n // null means 'do not register'\n if (propagator === null) {\n return;\n }\n // undefined means 'register default'\n if (propagator === undefined) {\n propagation.setGlobalPropagator(new CompositePropagator({\n propagators: [\n new W3CTraceContextPropagator(),\n new W3CBaggagePropagator(),\n ],\n }));\n return;\n }\n propagation.setGlobalPropagator(propagator);\n}\n/**\n * This class represents a web tracer with {@link StackContextManager}\n */\nexport class WebTracerProvider extends BasicTracerProvider {\n /**\n * Constructs a new Tracer instance.\n * @param config Web Tracer config\n */\n constructor(config = {}) {\n super(config);\n }\n /**\n * Register this TracerProvider for use with the OpenTelemetry API.\n * Undefined values may be replaced with defaults, and\n * null values will be skipped.\n *\n * @param config Configuration object for SDK registration\n */\n register(config = {}) {\n trace.setGlobalTracerProvider(this);\n setupPropagator(config.propagator);\n setupContextManager(config.contextManager);\n }\n}\n//# sourceMappingURL=WebTracerProvider.js.map","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n/**\n * 生成随机 ID。优先用 `crypto.randomUUID`(standards-compliant UUID v4),不可用时回退到\n * `${prefix}-${timestamp}-${rand}` 形式。\n *\n * 注意:fallback 实现使用 Math.random,**不是密码学安全**,仅适用于设备/会话/事件标识等场景,\n * 不要复用此函数生成 token、CSRF 防护等安全相关的值。\n */\nexport const createRandomId = (prefix: string) => {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n return crypto.randomUUID();\n }\n return `${prefix}-${Date.now()}-${Math.random().toString(16).slice(2)}`;\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport type { BkOTUrlMatcher, ResolvedBkOTConfig } from './config';\n\nconst getBaseUrl = () => (typeof window === 'undefined' ? 'http://localhost' : window.location.origin);\n\nexport const toAbsoluteUrl = (url: string) => {\n try {\n return new URL(url, getBaseUrl()).href;\n } catch {\n return url;\n }\n};\n\nconst DYNAMIC_PATH_SEGMENT = /^(?:\\d+|[0-9a-f]{8}-[0-9a-f-]{27,}|[0-9a-f]{16,})$/i;\n\n/**\n * 常见数字 ID、UUID 和长十六进制段统一折叠为 :id,便于服务端按路由聚合。\n * 同时服务 `view.url_template`(页面路由)与 `url.template`(请求路径)两个维度。\n */\nexport const normalizeUrlPathTemplate = (pathGroup: string) => {\n const path = pathGroup.split(/[?#]/, 1)[0];\n return path\n .split('/')\n .map(segment => (DYNAMIC_PATH_SEGMENT.test(segment) ? ':id' : segment))\n .join('/');\n};\n\n// 去掉 trailing slash,便于 path 边界对齐比较\nconst stripTrailingSlash = (value: string) => (value.length > 1 ? value.replace(/\\/+$/, '') : value);\n\n// 比较两个 URL 是否指向同一资源(忽略 query/fragment 与末尾斜杠)\nconst isSameResource = (left: string, right: string) => {\n const stripped = (value: string) => stripTrailingSlash(value.replace(/[?#].*$/, ''));\n return stripped(left) === stripped(right);\n};\n\nexport const isBkOTEndpoint = (config: ResolvedBkOTConfig, url: string) => {\n const targetUrl = toAbsoluteUrl(url);\n return isSameResource(targetUrl, toAbsoluteUrl(config.transport.endpoint));\n};\n\nexport const shouldIgnoreUrl = (config: ResolvedBkOTConfig, url: string) => isBkOTEndpoint(config, url);\n\nconst matchesUrl = (matcher: BkOTUrlMatcher, url: string) => {\n if (typeof matcher === 'function') return matcher(url);\n if (typeof matcher === 'string') return url.includes(matcher);\n matcher.lastIndex = 0;\n return matcher.test(url);\n};\n\nexport const matchesUrlList = (matchers: BkOTUrlMatcher | BkOTUrlMatcher[] | undefined, url: string) =>\n (Array.isArray(matchers) ? matchers : matchers ? [matchers] : []).some(matcher => matchesUrl(matcher, url));\n\nconst getRequestConfig = (config: ResolvedBkOTConfig) =>\n typeof config.tracking.request === 'object' ? config.tracking.request : undefined;\n\nexport const shouldIgnoreRequest = (config: ResolvedBkOTConfig, url: string) =>\n shouldIgnoreUrl(config, url) || matchesUrlList(getRequestConfig(config)?.excludedUrls, toAbsoluteUrl(url));\n\n// Trace Header 仅向显式白名单注入,避免同源第三方路径被无意注入以及跨域 CORS 预检。\nexport const shouldPropagateTraceHeader = (config: ResolvedBkOTConfig, url: string) =>\n matchesUrlList(getRequestConfig(config)?.allowedTracingUrls, toAbsoluteUrl(url));\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n/**\n * RUM 上报字段 key 集中定义。\n *\n * 插件里不要散落硬编码字符串,后续字段命名调整只改这里,避免采集端与字段文档逐步漂移。\n */\nexport const RUM_ATTRIBUTES = {\n actionFrustrationType: 'action.frustration.type',\n actionId: 'action.id',\n actionName: 'action.name',\n actionTargetName: 'action.target.name',\n actionTargetTag: 'action.target.tag',\n actionType: 'action.type',\n deploymentEnvironmentName: 'deployment.environment.name',\n cacheHit: 'resource.cache.hit',\n deviceType: 'device.type',\n longTaskBlockingDuration: 'long_task.blocking_duration',\n longTaskEntryType: 'long_task.entry_type',\n longTaskId: 'long_task.id',\n networkEffectiveType: 'network.effective_type',\n networkStatus: 'network.status',\n nextHopProtocol: 'resource.protocol',\n outcomeType: 'outcome.type',\n serviceName: 'service.name',\n serviceVersion: 'service.version',\n sessionHasReplay: 'session.has_replay',\n sessionId: 'session.id',\n sessionSampleRate: 'session.sample_rate',\n sessionPhase: 'session.phase',\n sessionType: 'session.type',\n spanType: 'span_type',\n userId: 'user.id',\n userAgentName: 'user_agent.name',\n userAgentOsName: 'user_agent.os.name',\n userAgentVersion: 'user_agent.version',\n vitalMetric: 'vital.metric',\n vitalValue: 'vital.value',\n viewDomComplete: 'view.dom_complete',\n viewDomContentLoaded: 'view.dom_content_loaded',\n viewDomInteractive: 'view.dom_interactive',\n viewFirstByte: 'view.first_byte',\n viewId: 'view.id',\n viewLoadEvent: 'view.load_event',\n viewLoadingTime: 'view.loading_time',\n viewLoadingTimeSource: 'view.loading_time_source',\n viewLoadingType: 'view.loading_type',\n viewName: 'view.name',\n viewPhase: 'view.phase',\n viewPrevious: 'view.previous',\n viewPreviousUrlTemplate: 'view.previous_url_template',\n viewReferrer: 'view.referrer',\n viewStartedAt: 'view.started_at',\n viewUrl: 'view.url',\n viewUrlTemplate: 'view.url_template',\n viewVersion: 'view.version',\n websocketPhase: 'websocket.phase',\n} as const;\n\nexport type RumAttributeKey = (typeof RUM_ATTRIBUTES)[keyof typeof RUM_ATTRIBUTES];\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\nimport { RUM_ATTRIBUTES } from './attributes';\n\nimport type { Attributes } from '@opentelemetry/api';\n\n// 所有插件通过同一分类模型生成检索字段,保证错误、资源、Action 等信号可按统一维度聚合。\nexport const RUM_SPAN_OUTCOME = {\n abort: 'abort',\n error: 'error',\n success: 'success',\n timeout: 'timeout',\n warning: 'warning',\n} as const;\n\nexport const RUM_SPAN_TYPE = {\n action: 'action',\n custom: 'custom',\n error: 'error',\n longTask: 'long_task',\n resource: 'resource',\n session: 'session',\n vital: 'vital',\n view: 'view',\n websocket: 'websocket',\n} as const;\n\nexport type RumRequestOutcome =\n | { error?: unknown; type: 'network_error' }\n | { error?: unknown; type: 'timeout' }\n | { statusCode?: number; type: 'response' }\n | { type: 'abort' };\n\nexport interface RumResourceSpanInput {\n initiatorType?: string;\n method?: string;\n outcome?: RumRequestOutcome;\n url: string;\n}\n\nexport interface RumSpanClassification {\n outcome?: RumSpanOutcome;\n spanType: RumSpanType;\n}\n\ninterface RumSpanNameInput {\n attributes: Attributes;\n nameHint?: string;\n spanType: RumSpanType;\n}\n\nexport type RumSpanOutcome = (typeof RUM_SPAN_OUTCOME)[keyof typeof RUM_SPAN_OUTCOME];\n\nexport type RumSpanType = (typeof RUM_SPAN_TYPE)[keyof typeof RUM_SPAN_TYPE];\n\nconst getStringAttribute = (attributes: Attributes, key: string) => {\n const value = attributes[key];\n return typeof value === 'string' && value.trim() ? value.trim() : undefined;\n};\n\n/**\n * 使用稳定的领域字段生成可读 Span 名称。唯一 ID、完整 URL、错误消息和数值不参与命名,避免抬高基数。\n */\nexport const buildRumSpanName = ({ attributes, nameHint, spanType }: RumSpanNameInput): string => {\n if (spanType === RUM_SPAN_TYPE.session) {\n const phase = getStringAttribute(attributes, RUM_ATTRIBUTES.sessionPhase);\n return phase ? `session.${phase}` : 'session';\n }\n if (spanType === RUM_SPAN_TYPE.view) {\n return (\n getStringAttribute(attributes, RUM_ATTRIBUTES.viewName) ??\n getStringAttribute(attributes, RUM_ATTRIBUTES.viewUrlTemplate) ??\n 'view'\n );\n }\n if (spanType === RUM_SPAN_TYPE.resource) {\n const method = getStringAttribute(attributes, 'http.request.method')?.toUpperCase();\n const urlTemplate = getStringAttribute(attributes, 'url.template');\n if (method && urlTemplate) return `${method} ${urlTemplate}`;\n const resourceType = getStringAttribute(attributes, 'resource.type');\n return resourceType ? `resource.${resourceType}` : 'resource';\n }\n if (spanType === RUM_SPAN_TYPE.action) {\n return (\n getStringAttribute(attributes, RUM_ATTRIBUTES.actionName) ??\n getStringAttribute(attributes, RUM_ATTRIBUTES.actionType) ??\n 'action'\n );\n }\n if (spanType === RUM_SPAN_TYPE.error) {\n const blankScreenReason = getStringAttribute(attributes, 'blank_screen.reason');\n if (blankScreenReason) return `blank_screen.${blankScreenReason}`;\n const cspDirective = getStringAttribute(attributes, 'csp.effective_directive');\n if (cspDirective) return `csp.${cspDirective}`;\n return nameHint?.trim() || getStringAttribute(attributes, 'error.source') || 'error';\n }\n if (spanType === RUM_SPAN_TYPE.vital) {\n return getStringAttribute(attributes, RUM_ATTRIBUTES.vitalMetric)?.toUpperCase() ?? 'vital';\n }\n if (spanType === RUM_SPAN_TYPE.longTask) {\n return getStringAttribute(attributes, RUM_ATTRIBUTES.longTaskEntryType) ?? 'long-task';\n }\n if (spanType === RUM_SPAN_TYPE.websocket) {\n const phase = getStringAttribute(attributes, RUM_ATTRIBUTES.websocketPhase);\n return phase ? `websocket.${phase}` : 'websocket';\n }\n if (spanType === RUM_SPAN_TYPE.custom) {\n return nameHint === undefined ? 'custom' : `custom.${nameHint}`;\n }\n return spanType;\n};\n\nexport interface RumUrlTarget {\n serverAddress?: string;\n serverPort?: number;\n}\n\nexport const getHttpOutcome = (statusCode: number | undefined): RumSpanOutcome => {\n if (statusCode === 408 || statusCode === 504) return RUM_SPAN_OUTCOME.timeout;\n if (typeof statusCode === 'number' && statusCode >= 400) return RUM_SPAN_OUTCOME.error;\n return RUM_SPAN_OUTCOME.success;\n};\n\nexport const getVitalOutcome = (rating: string | undefined): RumSpanOutcome =>\n rating === 'good' ? RUM_SPAN_OUTCOME.success : RUM_SPAN_OUTCOME.warning;\n\nexport const getUrlTarget = (url: string | undefined): RumUrlTarget => {\n if (!url) {\n return {};\n }\n try {\n const parsed = new URL(url, typeof location === 'undefined' ? 'http://localhost' : location.href);\n return {\n serverAddress: parsed.hostname,\n serverPort: parsed.port ? Number(parsed.port) : undefined,\n };\n } catch {\n return {};\n }\n};\n\nexport const buildRumSpanAttributes = ({\n outcome = RUM_SPAN_OUTCOME.success,\n spanType,\n}: RumSpanClassification): Attributes => ({\n [RUM_ATTRIBUTES.spanType]: spanType,\n [RUM_ATTRIBUTES.outcomeType]: outcome,\n});\n\nexport const buildRumResourceSpanAttributes = ({\n initiatorType = 'other',\n method,\n outcome,\n url,\n}: RumResourceSpanInput): Attributes => {\n const target = getUrlTarget(url);\n const responseStatus =\n outcome?.type === 'response' && typeof outcome.statusCode === 'number' && outcome.statusCode > 0\n ? outcome.statusCode\n : undefined;\n const outcomeType =\n outcome?.type === 'abort'\n ? RUM_SPAN_OUTCOME.abort\n : outcome?.type === 'timeout'\n ? RUM_SPAN_OUTCOME.timeout\n : outcome?.type === 'network_error'\n ? RUM_SPAN_OUTCOME.error\n : typeof responseStatus === 'number'\n ? getHttpOutcome(responseStatus)\n : RUM_SPAN_OUTCOME.success;\n const normalizedMethod = method?.toUpperCase();\n return {\n ...buildRumSpanAttributes({\n outcome: outcomeType,\n spanType: RUM_SPAN_TYPE.resource,\n }),\n ...(target.serverAddress ? { 'server.address': target.serverAddress } : {}),\n ...(target.serverPort !== undefined ? { 'server.port': target.serverPort } : {}),\n 'resource.type': initiatorType,\n ...(normalizedMethod ? { 'http.request.method': normalizedMethod } : {}),\n ...(typeof responseStatus === 'number' ? { 'http.response.status_code': responseStatus } : {}),\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { createRandomId } from '../core/id';\nimport { matchesUrlList } from '../core/url';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_OUTCOME, RUM_SPAN_TYPE } from '../schema/span';\n\nimport type { BkOTActivityEvent } from '../core/action-activity';\nimport type { BkOTPlugin, BkOTRuntimeContext } from '../core/plugin';\nimport type { Attributes } from '@opentelemetry/api';\n\n/**\n * 用户点击采集以“点击后产生的副作用”为 Action 生命周期:关联请求、资源、长任务、DOM 变化和错误,\n * 在活动安静后结束。完成后的 Action 暂缓至连击窗口结束再上报,以便把三次相近点击合并为一次 rage click。\n */\nconst ACTION_VALIDATION_DELAY = 100;\nconst ACTION_END_DELAY = 100;\nconst CLICK_CHAIN_DURATION = 1_000;\nconst CLICK_CHAIN_MAX_DISTANCE = 100;\nconst DEFAULT_ACTION_MAX_DURATION = 10_000;\nconst DEFAULT_ACTION_NAME_ATTRIBUTE = 'data-bk-action-name';\nconst MAX_NAME_LENGTH = 100;\nconst MAX_PARENTS_TO_CONSIDER = 10;\n\nexport interface BkOTActionPluginOptions {\n actionNameAttribute?: string;\n maxDuration?: number;\n /** 默认仅采集显式 data 属性;设为 text 才会读取可访问名称和 DOM 文本。 */\n nameCollection?: 'explicit' | 'text';\n}\n\ntype ActionFrustrationType = 'dead_click' | 'error_click' | 'rage_click';\n\ninterface ActiveAction {\n completed?: { endTime: number; hasLoadingTime: boolean };\n frustrations: Set<ActionFrustrationType>;\n hadActivity: boolean;\n hadError: boolean;\n id: string;\n lastActivityTime: number;\n maxDurationTimer: ReturnType<typeof setTimeout>;\n pendingRequests: Set<string>;\n quietTimer?: ReturnType<typeof setTimeout>;\n reportTimer?: ReturnType<typeof setTimeout>;\n runtimeAttributes: Attributes;\n startTime: number;\n target: Element;\n targetName: string;\n targetTag: string;\n userActivity: { input: boolean; scroll: boolean; selection: boolean };\n validationTimer: ReturnType<typeof setTimeout>;\n}\n\ninterface RecentClick {\n action: ActiveAction;\n target: Element;\n x: number;\n y: number;\n}\n\nconst normalizeText = (value: string) => value.replace(/\\s+/g, ' ').trim().slice(0, MAX_NAME_LENGTH);\n\nconst getParentElement = (element: Element) => {\n if (element.parentElement) {\n return element.parentElement;\n }\n const root = element.getRootNode?.();\n return typeof ShadowRoot !== 'undefined' && root instanceof ShadowRoot ? root.host : null;\n};\n\nconst findAttributeOnAncestors = (element: Element, attribute: string) => {\n let current: Element | null = element;\n while (current) {\n const value = current.getAttribute(attribute);\n if (value) {\n return normalizeText(value);\n }\n current = getParentElement(current);\n }\n return undefined;\n};\n\nconst getElementText = (element: Element) =>\n (element as HTMLElement).isContentEditable ? '' : normalizeText(element.textContent ?? '');\n\nconst getPriorityName = (element: Element) => {\n const formElement = element as Element & {\n labels?: HTMLLabelElement[] | NodeListOf<HTMLLabelElement>;\n value?: string;\n };\n const label = formElement.labels?.[0];\n if (label) {\n const labelText = getElementText(label);\n if (labelText) return labelText;\n }\n\n const tagName = element.tagName.toLowerCase();\n const inputType = element.getAttribute('type')?.toLowerCase();\n if (tagName === 'input' && ['button', 'reset', 'submit'].includes(inputType ?? '')) {\n const value = normalizeText(formElement.value ?? '');\n if (value) return value;\n }\n\n if (tagName === 'button' || tagName === 'label' || element.getAttribute('role') === 'button') {\n const text = getElementText(element);\n if (text) return text;\n }\n\n for (const attribute of ['aria-label', 'alt', 'name', 'title', 'placeholder']) {\n const value = normalizeText(element.getAttribute(attribute) ?? '');\n if (value) return value;\n }\n\n return undefined;\n};\n\nexport const getActionNameFromElement = (\n target: Element,\n actionNameAttribute = DEFAULT_ACTION_NAME_ATTRIBUTE,\n includeText = false,\n): string => {\n const explicitName = findAttributeOnAncestors(target, actionNameAttribute);\n if (explicitName) {\n return explicitName;\n }\n if (!includeText) return target.tagName.toLowerCase();\n\n let current: Element | null = target;\n let parentCount = 0;\n while (current && parentCount <= MAX_PARENTS_TO_CONSIDER) {\n const tagName = current.tagName.toLowerCase();\n if (tagName === 'body' || tagName === 'html' || tagName === 'head') break;\n const priorityName = getPriorityName(current);\n if (priorityName) return priorityName;\n if (tagName === 'form') break;\n current = getParentElement(current);\n parentCount += 1;\n }\n\n current = target;\n parentCount = 0;\n while (current && parentCount <= MAX_PARENTS_TO_CONSIDER) {\n const tagName = current.tagName.toLowerCase();\n if (tagName === 'body' || tagName === 'html' || tagName === 'head') break;\n const text = getElementText(current);\n if (text) return text;\n if (tagName === 'form') break;\n current = getParentElement(current);\n parentCount += 1;\n }\n\n return target.tagName.toLowerCase();\n};\n\nconst getElement = (event: Event) => {\n const composedTarget = event.composedPath?.()[0];\n if (composedTarget instanceof Element) return composedTarget;\n return event.target instanceof Element ? event.target : undefined;\n};\n\nconst toEpochTime = (event: Event) => {\n const eventTime = event.timeStamp;\n if (!Number.isFinite(eventTime) || eventTime <= 0) return Date.now();\n if (eventTime > 1_000_000_000_000) return eventTime;\n return typeof performance === 'undefined' ? Date.now() : performance.timeOrigin + eventTime;\n};\n\nconst positiveNumber = (value: number | undefined, fallback: number) =>\n typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : fallback;\n\nexport const isDeadClickExcluded = (target: Element) => {\n let current: Element | null = target;\n if (current.tagName.toLowerCase() === 'label' && current.hasAttribute('for')) {\n current = document.getElementById(current.getAttribute('for') ?? '');\n }\n\n while (current) {\n const tagName = current.tagName.toLowerCase();\n if (\n current.hasAttribute('contenteditable') ||\n tagName === 'canvas' ||\n tagName === 'select' ||\n tagName === 'textarea'\n ) {\n return true;\n }\n if (tagName === 'a' && current.hasAttribute('href')) return true;\n if (tagName === 'input') {\n return !['button', 'checkbox', 'radio', 'range', 'reset', 'submit'].includes(\n current.getAttribute('type')?.toLowerCase() ?? 'text',\n );\n }\n current = getParentElement(current);\n }\n return false;\n};\n\nexport const createActionPlugin = (options: BkOTActionPluginOptions = {}): BkOTPlugin => {\n const teardownCallbacks: Array<() => void> = [];\n const activeActions = new Map<string, ActiveAction>();\n const pendingActions = new Set<ActiveAction>();\n const actionNameAttribute = options.actionNameAttribute || DEFAULT_ACTION_NAME_ATTRIBUTE;\n const maxDuration = positiveNumber(options.maxDuration, DEFAULT_ACTION_MAX_DURATION);\n let recentClicks: RecentClick[] = [];\n let runtimeContext: BkOTRuntimeContext | undefined;\n\n const updateRuntimeActionId = () => {\n runtimeContext?.setRuntimeAttributes({\n // 重叠窗口只暴露最近一次 Action,保证 action.id 始终是字符串。\n [RUM_ATTRIBUTES.actionId]: [...activeActions.keys()].at(-1),\n });\n };\n\n const isDeadAction = (action: ActiveAction) =>\n !action.hadActivity &&\n !action.userActivity.input &&\n !action.userActivity.scroll &&\n !action.userActivity.selection &&\n !isDeadClickExcluded(action.target);\n\n const reportAction = (action: ActiveAction) => {\n if (!pendingActions.delete(action) || !runtimeContext || !action.completed) return;\n clearTimeout(action.reportTimer);\n if (action.hadError) action.frustrations.add('error_click');\n if (isDeadAction(action)) action.frustrations.add('dead_click');\n const frustrationTypes = ['rage_click', 'dead_click', 'error_click'].filter(type =>\n action.frustrations.has(type as ActionFrustrationType),\n ) as ActionFrustrationType[];\n const { endTime, hasLoadingTime } = action.completed;\n const hasWarning = action.hadError || frustrationTypes.length > 0;\n const actionName = `click ${action.targetName}`;\n const attributes = {\n ...runtimeContext.config.hooks.getPageAttributes(),\n ...buildRumSpanAttributes({\n outcome: hasWarning ? RUM_SPAN_OUTCOME.warning : RUM_SPAN_OUTCOME.success,\n spanType: RUM_SPAN_TYPE.action,\n }),\n ...action.runtimeAttributes,\n [RUM_ATTRIBUTES.actionId]: action.id,\n [RUM_ATTRIBUTES.actionName]: actionName,\n [RUM_ATTRIBUTES.actionType]: 'click',\n [RUM_ATTRIBUTES.actionTargetName]: action.targetName,\n [RUM_ATTRIBUTES.actionTargetTag]: action.targetTag,\n ...(frustrationTypes.length ? { [RUM_ATTRIBUTES.actionFrustrationType]: frustrationTypes } : {}),\n };\n const span = runtimeContext.startSpan(\n buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.action }),\n attributes,\n { rumSpanType: RUM_SPAN_TYPE.action, startTime: action.startTime },\n );\n span.end(hasLoadingTime ? endTime : action.startTime);\n };\n\n const finishAction = (action: ActiveAction, endTime: number, hasLoadingTime: boolean) => {\n if (!activeActions.delete(action.id) || !runtimeContext) return;\n clearTimeout(action.validationTimer);\n clearTimeout(action.quietTimer);\n clearTimeout(action.maxDurationTimer);\n updateRuntimeActionId();\n action.completed = { endTime, hasLoadingTime };\n pendingActions.add(action);\n // 等待连击窗口关闭后再落数,否则前两次点击已上报便无法合并为 rage click。\n const reportDelay = Math.max(0, action.startTime + CLICK_CHAIN_DURATION - Date.now());\n action.reportTimer = setTimeout(() => reportAction(action), reportDelay);\n };\n\n const flushPendingActions = () => {\n [...pendingActions].forEach(reportAction);\n };\n\n const scheduleActionEnd = (action: ActiveAction) => {\n clearTimeout(action.quietTimer);\n if (!action.hadActivity || action.pendingRequests.size) return;\n const delay = Math.max(0, action.lastActivityTime + ACTION_END_DELAY - Date.now());\n action.quietTimer = setTimeout(() => finishAction(action, action.lastActivityTime, true), delay);\n };\n\n const markActivity = (action: ActiveAction, time: number) => {\n action.hadActivity = true;\n action.lastActivityTime = Math.max(action.lastActivityTime, time);\n scheduleActionEnd(action);\n };\n\n const isInActionWindow = (action: ActiveAction, time: number) =>\n time >= action.startTime && time <= action.startTime + maxDuration;\n\n const onActivity = (event: BkOTActivityEvent) => {\n for (const action of activeActions.values()) {\n if (event.type === 'request_start') {\n if (event.url && matchesUrlList(runtimeContext?.config.view?.excludedActivityUrls, event.url)) continue;\n if (!isInActionWindow(action, event.time)) continue;\n action.pendingRequests.add(event.id);\n markActivity(action, event.time);\n continue;\n }\n if (event.type === 'request_end') {\n if (!action.pendingRequests.delete(event.id)) continue;\n markActivity(action, event.time);\n continue;\n }\n if (event.type === 'long_task' || event.type === 'resource') {\n if (\n event.type === 'resource' &&\n event.url &&\n matchesUrlList(runtimeContext?.config.view?.excludedActivityUrls, event.url)\n ) {\n continue;\n }\n if (\n event.startTime > action.startTime + maxDuration ||\n (event.type === 'resource' ? event.startTime < action.startTime : event.endTime < action.startTime)\n ) {\n continue;\n }\n markActivity(action, event.endTime);\n continue;\n }\n if (event.type === 'dom_mutation' || event.type === 'window_open') {\n if (isInActionWindow(action, event.time)) markActivity(action, event.time);\n continue;\n }\n if (event.type !== 'error') continue;\n if (!isInActionWindow(action, event.time)) continue;\n action.hadError = true;\n markActivity(action, event.time);\n }\n };\n\n const finishActiveActions = (endTime = Date.now()) => {\n [...activeActions.values()].forEach(action => finishAction(action, endTime, action.hadActivity));\n };\n\n const registerClick = (action: ActiveAction, event: Event) => {\n const x = 'clientX' in event && typeof event.clientX === 'number' ? event.clientX : 0;\n const y = 'clientY' in event && typeof event.clientY === 'number' ? event.clientY : 0;\n recentClicks = recentClicks.filter(click => action.startTime - click.action.startTime <= CLICK_CHAIN_DURATION);\n const lastClick = recentClicks.at(-1);\n const hasInterruptedChain = recentClicks.some(\n click => click.action.userActivity.scroll || click.action.userActivity.selection,\n );\n // 只有同一目标附近、未被滚动或选中文本打断的连续点击才视为同一连击链。\n const isSimilar =\n lastClick?.target === action.target && Math.hypot(lastClick.x - x, lastClick.y - y) <= CLICK_CHAIN_MAX_DISTANCE;\n if (hasInterruptedChain || (lastClick && !isSimilar)) recentClicks = [];\n recentClicks.push({ action, target: action.target, x, y });\n if (\n recentClicks.length >= 3 &&\n action.startTime - recentClicks[recentClicks.length - 3].action.startTime <= CLICK_CHAIN_DURATION\n ) {\n const rageSources = recentClicks.slice(-3).map(click => click.action);\n rageSources.forEach(source => source.frustrations.add('rage_click'));\n recentClicks = [];\n }\n };\n\n return {\n name: 'action',\n init(context) {\n if (typeof window === 'undefined' || typeof document === 'undefined') {\n return;\n }\n runtimeContext = context;\n\n const listenerOptions: AddEventListenerOptions = { capture: true, passive: true };\n\n const startAction = (event: Event) => {\n if (!context.isSampled()) return;\n if ('button' in event && typeof event.button === 'number' && event.button !== 0) return;\n const element = getElement(event);\n if (!element) return;\n const startTime = toEpochTime(event);\n const id = createRandomId('action');\n const action: ActiveAction = {\n frustrations: new Set(),\n hadActivity: false,\n hadError: false,\n id,\n lastActivityTime: startTime,\n maxDurationTimer: setTimeout(() => finishAction(action, startTime + maxDuration, true), maxDuration),\n pendingRequests: new Set(),\n runtimeAttributes: context.getRuntimeAttributes(),\n startTime,\n target: element,\n targetName: getActionNameFromElement(element, actionNameAttribute, options.nameCollection === 'text'),\n targetTag: element.tagName.toLowerCase(),\n userActivity: { input: false, scroll: false, selection: false },\n validationTimer: setTimeout(() => {\n if (!action.hadActivity) finishAction(action, action.startTime, false);\n }, ACTION_VALIDATION_DELAY),\n };\n activeActions.set(id, action);\n registerClick(action, event);\n updateRuntimeActionId();\n };\n\n window.addEventListener('click', startAction, listenerOptions);\n teardownCallbacks.push(() => window.removeEventListener('click', startAction, listenerOptions));\n\n const unsubscribeActivity = context.onActivity(onActivity);\n const unsubscribeSession = context.onSessionLifecycle(event => {\n if (event.type !== 'expired') return;\n finishActiveActions(event.expiredAt);\n flushPendingActions();\n });\n teardownCallbacks.push(unsubscribeActivity, unsubscribeSession);\n\n const finishOnHidden = () => {\n if (document.visibilityState === 'hidden') {\n finishActiveActions();\n flushPendingActions();\n }\n };\n const finishOnPageHide = () => {\n finishActiveActions();\n flushPendingActions();\n };\n window.addEventListener('pagehide', finishOnPageHide);\n document.addEventListener('visibilitychange', finishOnHidden);\n teardownCallbacks.push(\n () => window.removeEventListener('pagehide', finishOnPageHide),\n () => document.removeEventListener('visibilitychange', finishOnHidden),\n );\n\n const markUserActivity = (type: keyof ActiveAction['userActivity']) => {\n const actions = new Set([\n ...activeActions.values(),\n ...pendingActions,\n ...recentClicks.map(click => click.action),\n ]);\n actions.forEach(action => {\n action.userActivity[type] = true;\n // 滚动/选择表明用户仍在正常交互,撤销尚未上报的 rage click 判定。\n if (type !== 'input') action.frustrations.delete('rage_click');\n });\n };\n const onInput = () => markUserActivity('input');\n const onScroll = () => markUserActivity('scroll');\n const onSelectionChange = () => markUserActivity('selection');\n window.addEventListener('input', onInput, listenerOptions);\n window.addEventListener('scroll', onScroll, listenerOptions);\n document.addEventListener('selectionchange', onSelectionChange, listenerOptions);\n teardownCallbacks.push(\n () => window.removeEventListener('input', onInput, listenerOptions),\n () => window.removeEventListener('scroll', onScroll, listenerOptions),\n () => document.removeEventListener('selectionchange', onSelectionChange, listenerOptions),\n );\n },\n shutdown() {\n finishActiveActions();\n flushPendingActions();\n while (teardownCallbacks.length) {\n teardownCallbacks.pop()?.();\n }\n recentClicks = [];\n runtimeContext = undefined;\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\nimport type { BkOTPlugin } from '../core/plugin';\n\nexport const EXCLUDED_ACTIVITY_MUTATIONS_ATTRIBUTE = 'data-bk-excluded-activity-mutations';\n\nconst isExcludedMutation = (mutation: MutationRecord) => {\n const target = mutation.type === 'characterData' ? mutation.target.parentElement : mutation.target;\n return target instanceof Element && Boolean(target.closest(`[${EXCLUDED_ACTIVITY_MUTATIONS_ATTRIBUTE}]`));\n};\n\n/**\n * 页面级 DOM 活动只观察一次,再通过运行时活动总线分发给 View、Action 和白屏检测。\n */\nexport const createActivityPlugin = (): BkOTPlugin => {\n let mutationObserver: MutationObserver | undefined;\n const teardownCallbacks: Array<() => void> = [];\n\n return {\n name: 'activity',\n init(context) {\n if (typeof document !== 'undefined' && typeof MutationObserver !== 'undefined') {\n mutationObserver = new MutationObserver(mutations => {\n if (mutations.length && !mutations.every(isExcludedMutation)) {\n context.notifyActivity({ time: Date.now(), type: 'dom_mutation' });\n }\n });\n mutationObserver.observe(document, { attributes: true, characterData: true, childList: true, subtree: true });\n }\n\n if (typeof window === 'undefined') return;\n\n if (typeof window.open === 'function') {\n const originalOpen = window.open;\n const patchedOpen = ((...args: Parameters<typeof window.open>) => {\n context.notifyActivity({ time: Date.now(), type: 'window_open' });\n return Reflect.apply(originalOpen, window, args);\n }) as typeof window.open;\n window.open = patchedOpen;\n teardownCallbacks.push(() => {\n if (window.open === patchedOpen) window.open = originalOpen;\n });\n }\n\n },\n shutdown() {\n mutationObserver?.disconnect();\n mutationObserver = undefined;\n while (teardownCallbacks.length) teardownCallbacks.pop()?.();\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\nimport { matchesUrlList } from './url';\n\nimport type { BkOTActivityEvent } from './action-activity';\nimport type { BkOTRuntimeContext } from './plugin';\n\nexport const PAGE_ACTIVITY_VALIDATION_DELAY = 100;\nexport const PAGE_ACTIVITY_END_DELAY = 100;\n\nexport type PageActivityEnd = { endTime: number; hadActivity: true } | { hadActivity: false };\n\nconst isActivityUrlExcluded = (context: BkOTRuntimeContext, url: string | undefined) =>\n Boolean(url && matchesUrlList(context.config.view.excludedActivityUrls, url));\n\n/**\n * 等待 View/Action 启动后的请求、静态资源和 DOM 变更全部安静 100ms。\n * 请求用 id 精确配对,避免并发请求提前结束等待。\n */\nexport const waitForPageActivityEnd = (\n context: BkOTRuntimeContext,\n startTime: number,\n callback: (result: PageActivityEnd) => void,\n) => {\n const pendingRequests = new Set<string>();\n let completed = false;\n let hadActivity = false;\n let lastActivityTime = startTime;\n let quietTimer: ReturnType<typeof setTimeout> | undefined;\n\n const complete = (result: PageActivityEnd) => {\n if (completed) return;\n completed = true;\n clearTimeout(validationTimer);\n clearTimeout(quietTimer);\n unsubscribe();\n callback(result);\n };\n\n const scheduleEnd = () => {\n clearTimeout(quietTimer);\n if (!hadActivity || pendingRequests.size) return;\n quietTimer = setTimeout(\n () => complete({ endTime: lastActivityTime, hadActivity: true }),\n Math.max(0, lastActivityTime + PAGE_ACTIVITY_END_DELAY - Date.now()),\n );\n };\n\n const markActivity = (time: number) => {\n hadActivity = true;\n lastActivityTime = Math.max(lastActivityTime, time);\n scheduleEnd();\n };\n\n const onActivity = (event: BkOTActivityEvent) => {\n if (event.type === 'error' || event.type === 'long_task') return;\n if (event.type === 'request_start') {\n if (event.time < startTime || isActivityUrlExcluded(context, event.url)) return;\n pendingRequests.add(event.id);\n markActivity(event.time);\n return;\n }\n if (event.type === 'request_end') {\n if (!pendingRequests.delete(event.id)) return;\n markActivity(event.time);\n return;\n }\n if (event.type === 'resource') {\n if (event.endTime < startTime || isActivityUrlExcluded(context, event.url)) return;\n markActivity(event.endTime);\n return;\n }\n if (event.time >= startTime) markActivity(event.time);\n };\n\n const unsubscribe = context.onActivity(onActivity);\n const validationTimer = setTimeout(() => {\n if (!hadActivity) complete({ hadActivity: false });\n }, PAGE_ACTIVITY_VALIDATION_DELAY);\n\n return () => {\n if (completed) return;\n completed = true;\n clearTimeout(validationTimer);\n clearTimeout(quietTimer);\n unsubscribe();\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\nimport { waitForPageActivityEnd } from '../core/page-activity';\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_OUTCOME, RUM_SPAN_TYPE } from '../schema/span';\n\nimport type { BkOTPlugin } from '../core/plugin';\n\n/**\n * 通过视口九宫格采样估算空白比例,并在页面稳定后连续确认两次。每个 View 最多上报一次,\n * 避免首屏渲染、路由切换和 loading 状态造成瞬时误报。\n */\nexport interface BkOTBlankScreenPluginOptions {\n /** 页面活动稳定后首次检查的延迟,默认 1000ms。 */\n checkDelay?: number;\n /** 两次空白结果之间的确认间隔,默认 200ms。 */\n confirmationDelay?: number;\n /** loading、骨架屏等不参与空白比例计算的元素。 */\n ignoreSelectors?: string[];\n /** 应用挂载根节点,默认 body。根节点不存在时回退到 body 检测。 */\n rootSelector?: string;\n /** 空白采样点比例阈值,默认 0.8。 */\n threshold?: number;\n}\n\ninterface DetectionResult {\n emptyCount: number;\n ignoredCount: number;\n reason: 'empty_viewport' | 'missing_root';\n score: number;\n validCount: number;\n}\n\nconst DEFAULT_CHECK_DELAY = 1000;\nconst DEFAULT_CONFIRMATION_DELAY = 200;\nconst DEFAULT_ROOT_SELECTOR = 'body';\nconst DEFAULT_THRESHOLD = 0.8;\nconst DEFAULT_IGNORED_SELECTORS = [\n '[data-loading=\"true\"]',\n '[aria-busy=\"true\"]',\n '.loading',\n '.is-loading',\n '.spinner',\n '.skeleton',\n '.bk-loading',\n];\n\nconst SAMPLE_POINTS: ReadonlyArray<readonly [number, number]> = [\n [0.2, 0.2],\n [0.5, 0.2],\n [0.8, 0.2],\n [0.2, 0.5],\n [0.5, 0.5],\n [0.8, 0.5],\n [0.2, 0.8],\n [0.5, 0.8],\n [0.8, 0.8],\n];\n\nconst nonNegativeNumber = (value: number | undefined, fallback: number) =>\n typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : fallback;\n\nconst boundedRatio = (value: number | undefined, fallback: number) =>\n typeof value === 'number' && Number.isFinite(value) ? Math.max(0, Math.min(1, value)) : fallback;\n\nconst matchesAny = (element: Element, selectors: string[]) =>\n selectors.some(selector => {\n try {\n return element.matches(selector) || Boolean(element.closest(selector));\n } catch {\n return false;\n }\n });\n\nconst isVisuallyPresent = (element: Element) => {\n if (typeof getComputedStyle !== 'function') return true;\n const style = getComputedStyle(element);\n return style.display !== 'none' && style.visibility !== 'hidden' && Number(style.opacity || 1) > 0;\n};\n\nconst getElementsAtPoint = (x: number, y: number): Element[] => {\n if (typeof document.elementsFromPoint === 'function') return document.elementsFromPoint(x, y);\n const element = document.elementFromPoint(x, y);\n return element ? [element] : [];\n};\n\nexport const detectBlankScreen = (rootSelector: string, ignoredSelectors: string[]): DetectionResult => {\n const configuredRoot = document.querySelector(rootSelector);\n const root = configuredRoot ?? document.body ?? document.documentElement;\n\n let emptyCount = 0;\n let ignoredCount = 0;\n // 采样视口九宫格而非遍历 DOM,检测成本固定;被 loading/骨架屏覆盖的点不进入分母。\n for (const [xRatio, yRatio] of SAMPLE_POINTS) {\n const layers = getElementsAtPoint(window.innerWidth * xRatio, window.innerHeight * yRatio);\n if (layers.some(element => matchesAny(element, ignoredSelectors))) {\n ignoredCount += 1;\n continue;\n }\n const hasContent = layers.some(\n element =>\n element !== root &&\n element !== document.body &&\n element !== document.documentElement &&\n root.contains(element) &&\n isVisuallyPresent(element),\n );\n if (!hasContent) emptyCount += 1;\n }\n\n const validCount = SAMPLE_POINTS.length - ignoredCount;\n return {\n emptyCount,\n ignoredCount,\n reason: configuredRoot ? 'empty_viewport' : 'missing_root',\n score: validCount ? emptyCount / validCount : 0,\n validCount,\n };\n};\n\nexport const createBlankScreenPlugin = (options: BkOTBlankScreenPluginOptions = {}): BkOTPlugin => {\n const checkDelay = nonNegativeNumber(options.checkDelay, DEFAULT_CHECK_DELAY);\n const confirmationDelay = nonNegativeNumber(options.confirmationDelay, DEFAULT_CONFIRMATION_DELAY);\n const rootSelector = options.rootSelector || DEFAULT_ROOT_SELECTOR;\n const threshold = boundedRatio(options.threshold, DEFAULT_THRESHOLD);\n const ignoredSelectors = [...DEFAULT_IGNORED_SELECTORS, ...(options.ignoreSelectors ?? [])];\n let activeViewId: string | undefined;\n let reportedViewId: string | undefined;\n let stopActivityTracking: (() => void) | undefined;\n let timer: ReturnType<typeof setTimeout> | undefined;\n let unsubscribeView = () => {};\n let visibilityListener: (() => void) | undefined;\n\n return {\n name: 'blank-screen',\n init(context) {\n if (typeof window === 'undefined' || typeof document === 'undefined') return;\n const clearTimer = () => {\n clearTimeout(timer);\n timer = undefined;\n };\n\n const report = (viewId: string, result: DetectionResult) => {\n if (activeViewId !== viewId || reportedViewId === viewId) return;\n if (!context.isSampled()) return;\n reportedViewId = viewId;\n const occurredAt = Date.now();\n const attributes = {\n ...buildRumSpanAttributes({\n outcome: RUM_SPAN_OUTCOME.error,\n spanType: RUM_SPAN_TYPE.error,\n }),\n 'blank_screen.empty_ratio': result.score,\n 'blank_screen.empty_sample_count': result.emptyCount,\n 'blank_screen.reason': result.reason,\n };\n const span = context.startSpan(buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.error }), attributes, {\n startTime: occurredAt,\n });\n span.end(occurredAt);\n };\n\n const detectAndConfirm = (viewId: string) => {\n if (activeViewId !== viewId || reportedViewId === viewId) return;\n if (document.visibilityState === 'hidden') return;\n let first: DetectionResult;\n try {\n first = detectBlankScreen(rootSelector, ignoredSelectors);\n } catch (error) {\n if (context.config.debug) globalThis.console?.warn('[bk-ot][blank-screen] detection failed:', error);\n return;\n }\n if (!first.validCount || first.score < threshold) return;\n timer = setTimeout(() => {\n if (activeViewId !== viewId || document.visibilityState === 'hidden') return;\n let confirmed: DetectionResult;\n try {\n confirmed = detectBlankScreen(rootSelector, ignoredSelectors);\n } catch (error) {\n if (context.config.debug) globalThis.console?.warn('[bk-ot][blank-screen] confirmation failed:', error);\n return;\n }\n if (confirmed.validCount && confirmed.score >= threshold) report(viewId, confirmed);\n }, confirmationDelay);\n };\n\n const schedule = (viewId: string) => {\n clearTimer();\n if (document.visibilityState === 'hidden' || !context.isSampled()) return;\n timer = setTimeout(() => detectAndConfirm(viewId), checkDelay);\n };\n\n unsubscribeView = context.onViewChange(view => {\n if (view.id === activeViewId) return;\n clearTimer();\n stopActivityTracking?.();\n stopActivityTracking = undefined;\n activeViewId = view.id;\n reportedViewId = undefined;\n if (view.id) {\n const viewId = view.id;\n // 页面活动结束后再延迟检测,避免把正常渲染过程中的短暂空白误报为白屏。\n stopActivityTracking = waitForPageActivityEnd(context, Date.now(), () => {\n stopActivityTracking = undefined;\n schedule(viewId);\n });\n }\n });\n const onVisibilityChange = () => {\n if (document.visibilityState === 'hidden') {\n clearTimer();\n } else if (activeViewId && reportedViewId !== activeViewId) {\n schedule(activeViewId);\n }\n };\n document.addEventListener('visibilitychange', onVisibilityChange);\n visibilityListener = () => document.removeEventListener('visibilitychange', onVisibilityChange);\n },\n shutdown() {\n clearTimeout(timer);\n timer = undefined;\n unsubscribeView();\n stopActivityTracking?.();\n stopActivityTracking = undefined;\n visibilityListener?.();\n visibilityListener = undefined;\n activeViewId = undefined;\n reportedViewId = undefined;\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { RUM_SPAN_TYPE } from '../schema/span';\nimport { isBkOTEndpoint } from './url';\n\nimport type { ResolvedBkOTConfig } from './config';\nimport type { Attributes, Context, Span as ApiSpan } from '@opentelemetry/api';\nimport type { ReadableSpan, Span, SpanProcessor } from '@opentelemetry/sdk-trace-base';\n\nconst SELF_TELEMETRY_URL_KEYS = ['http.url', 'url.full'];\nconst discardedSpans = new WeakSet<object>();\n\nexport const markSpanDiscarded = (span: ApiSpan) => {\n discardedSpans.add(span);\n};\n\nconst getSpanUrl = (span: ReadableSpan): string | undefined => {\n for (const key of SELF_TELEMETRY_URL_KEYS) {\n const value = span.attributes?.[key];\n if (typeof value === 'string') {\n return value;\n }\n }\n return undefined;\n};\n\nconst hasSessionId = (attributes: Record<string, unknown> | undefined) => {\n const sessionId = attributes?.[RUM_ATTRIBUTES.sessionId];\n return typeof sessionId === 'string' && sessionId.length > 0;\n};\n\nconst hasViewId = (attributes: Record<string, unknown> | undefined) => {\n const viewId = attributes?.[RUM_ATTRIBUTES.viewId];\n return typeof viewId === 'string' && viewId.length > 0;\n};\n\nconst hasRumContext = (attributes: Record<string, unknown> | undefined) =>\n hasSessionId(attributes) && hasViewId(attributes);\n\nconst isSessionSpan = (attributes: Record<string, unknown> | undefined) =>\n attributes?.[RUM_ATTRIBUTES.spanType] === RUM_SPAN_TYPE.session;\n\n/**\n * 给所有 span 固化创建时的运行时上下文,并在 onEnd 阶段过滤自身上报请求和无 RUM 上下文 span。\n */\nexport class FilteringSpanProcessor implements SpanProcessor {\n public constructor(\n private readonly inner: SpanProcessor,\n private readonly config: ResolvedBkOTConfig,\n private readonly getRuntimeAttributes: () => Attributes,\n ) {}\n\n public forceFlush(): Promise<void> {\n return this.inner.forceFlush();\n }\n\n public onEnd(span: ReadableSpan): void {\n const url = getSpanUrl(span);\n if (\n discardedSpans.delete(span) ||\n (url && isBkOTEndpoint(this.config, url)) ||\n (!hasRumContext(span.attributes) && !(isSessionSpan(span.attributes) && hasSessionId(span.attributes)))\n ) {\n return;\n }\n try {\n if (\n this.config.hooks?.beforeSend?.({\n attributes: span.attributes,\n name: span.name,\n signal: 'span',\n }) === false\n ) {\n return;\n }\n } catch (error) {\n if (this.config.debug) globalThis.console?.warn('[bk-ot] tracking.beforeSend failed:', error);\n }\n this.inner.onEnd(span);\n }\n\n public onStart(span: Span, parentContext: Context): void {\n const existingAttributes = (span as Span & { attributes?: Attributes }).attributes ?? {};\n const missingRuntimeAttributes: Attributes = {};\n // instrumentation 显式写入的属性优先,只补齐创建时缺失的运行时上下文。\n for (const [key, value] of Object.entries(this.getRuntimeAttributes())) {\n if (existingAttributes[key] === undefined && value !== undefined) missingRuntimeAttributes[key] = value;\n }\n span.setAttributes(missingRuntimeAttributes);\n this.inner.onStart(span, parentContext);\n }\n\n public shutdown(): Promise<void> {\n return this.inner.shutdown();\n }\n}\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\ninterface PendingRequestTiming {\n entry?: PerformanceResourceTiming;\n startTime: number;\n timer?: ReturnType<typeof setTimeout>;\n url: string;\n callback?: (entry?: PerformanceResourceTiming) => void;\n}\n\nconst MAX_PENDING_REQUESTS = 100;\nconst RESOURCE_TIMING_WAIT_MS = 200;\nconst pendingRequests: PendingRequestTiming[] = [];\n\nconst normalizeUrl = (url: string) => url.replace(/#.*$/, '');\n\nconst removePending = (pending: PendingRequestTiming) => {\n const index = pendingRequests.indexOf(pending);\n if (index >= 0) pendingRequests.splice(index, 1);\n if (pending.timer !== undefined) clearTimeout(pending.timer);\n};\n\nconst finishPending = (pending: PendingRequestTiming, entry?: PerformanceResourceTiming) => {\n const callback = pending.callback;\n removePending(pending);\n pending.callback = undefined;\n callback?.(entry);\n};\n\nexport const notifyRequestTiming = (entry: PerformanceResourceTiming) => {\n const entryStartTime = performance.timeOrigin + entry.startTime;\n // 同 URL 并发时选择起始时间最接近的请求;50ms 容差覆盖 JS 调用与浏览器创建 timing entry 的偏差。\n const candidate = pendingRequests\n .filter(\n pending =>\n !pending.entry &&\n normalizeUrl(pending.url) === normalizeUrl(entry.name) &&\n entryStartTime >= pending.startTime - 50,\n )\n .sort((left, right) => Math.abs(left.startTime - entryStartTime) - Math.abs(right.startTime - entryStartTime))[0];\n if (!candidate) return;\n candidate.entry = entry;\n if (candidate.callback) finishPending(candidate, entry);\n};\n\nexport const trackRequestTiming = (url: string, startTime = Date.now()) => {\n const pending: PendingRequestTiming = { startTime, url };\n pendingRequests.push(pending);\n if (pendingRequests.length > MAX_PENDING_REQUESTS) finishPending(pendingRequests[0]);\n return {\n cancel: () => finishPending(pending),\n complete: (callback: (entry?: PerformanceResourceTiming) => void) => {\n pending.callback = callback;\n if (pending.entry) {\n finishPending(pending, pending.entry);\n return;\n }\n // XHR 终止事件/Fetch settle 通常早于 ResourceTiming 回调,短暂等待以补齐 DNS、连接和下载阶段。\n pending.timer = setTimeout(() => finishPending(pending), RESOURCE_TIMING_WAIT_MS);\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n/**\n * 被观测请求的 Trace Context 规划。\n *\n * 后端 APM 只解析 W3C `traceparent`,并且要求一个后端 trace 只对应一个 API 请求,因此这里不复用\n * RUM Span 自身的 trace context,而是为每个命中白名单的请求生成独立的 trace-id/span-id,再通过\n * Span Link 把后端 trace 关联回 RUM Span。\n *\n * 如果业务已经自行设置了 trace header(`traceparent`、`sentry-trace`、b3、Datadog、sw8),则完全\n * 不注入,避免破坏业务既有的传播方式,只把已有链路建成 Link。\n *\n * Link 结构恒定:`context` 承载 trace-id/span-id,`attributes` 记录命中的格式与原始 header。\n * sw8 这类无法映射为合法 OTel id 的格式会补一对占位 id,让 Link 结构保持统一。\n */\n\nimport { TraceFlags } from '@opentelemetry/api';\n\nimport type { Attributes, Link } from '@opentelemetry/api';\n\n/** 大小写不敏感地读取一个请求 header */\nexport type BkOTHeaderReader = (name: string) => string | undefined;\n\nexport interface BkOTRequestTracePlan {\n /** 关联后端 trace 的 Span Link,恒为一条 */\n links: Link[];\n /** 需要注入的 traceparent;业务已有 trace header 时为 undefined */\n traceparent?: string;\n}\n\nexport type BkOTUpstreamTraceFormat = 'b3' | 'b3-multi' | 'datadog' | 'sentry-trace' | 'sw8' | 'traceparent';\n\nexport const TRACEPARENT_HEADER = 'traceparent';\n\nconst TRACE_ID_LENGTH = 32;\nconst SPAN_ID_LENGTH = 16;\n\nconst HEX_DIGITS = '0123456789abcdef';\nconst HEX_PATTERN = /^[\\da-f]+$/;\nconst ZERO_PATTERN = /^0+$/;\nconst DECIMAL_PATTERN = /^\\d+$/;\n\n// 00-{trace-id}-{parent-id}-{trace-flags};允许未来版本追加字段,但 ff 是规范保留值\nconst TRACEPARENT_PATTERN = /^([\\da-f]{2})-([\\da-f]{32})-([\\da-f]{16})-([\\da-f]{2})(?:-.*)?$/;\nconst SENTRY_TRACE_PATTERN = /^([\\da-f]{32})-([\\da-f]{16})(?:-([01]))?$/;\n// Datadog 128 位 trace-id 的高 64 位放在 x-datadog-tags 的 _dd.p.tid 里\nconst DATADOG_TRACE_ID_HIGH_PATTERN = /(?:^|,)_dd\\.p\\.tid=([\\da-f]{16})(?:,|$)/;\nconst DATADOG_TRACE_ID_HIGH_DEFAULT = '0000000000000000';\n\n/** OTel 要求 id 为定长小写 hex 且不能全零 */\nconst isValidHexId = (value: string, length: number) =>\n value.length === length && HEX_PATTERN.test(value) && !ZERO_PATTERN.test(value);\n\n// b3 与 Datadog 允许 64 位 trace-id,映射到 OTel 的 128 位时按规范左侧补零\nconst normalizeTraceId = (value: string) => {\n const lower = value.toLowerCase();\n if (isValidHexId(lower, TRACE_ID_LENGTH)) return lower;\n return isValidHexId(lower, SPAN_ID_LENGTH) ? lower.padStart(TRACE_ID_LENGTH, '0') : undefined;\n};\n\nconst normalizeSpanId = (value: string) => {\n const lower = value.toLowerCase();\n return isValidHexId(lower, SPAN_ID_LENGTH) ? lower : undefined;\n};\n\nconst createRandomHexId = (length: number) => {\n const bytes = new Uint8Array(length / 2);\n if (typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function') {\n crypto.getRandomValues(bytes);\n } else {\n for (let index = 0; index < bytes.length; index += 1) bytes[index] = Math.floor(Math.random() * 256);\n }\n let hex = '';\n for (const byte of bytes) {\n hex += HEX_DIGITS[byte >> 4] + HEX_DIGITS[byte & 15];\n }\n // 全零是 OTel 的非法 id,概率极低但必须排除\n return ZERO_PATTERN.test(hex) ? `${hex.slice(1)}1` : hex;\n};\n\n/**\n * Datadog 用十进制字符串传 64 位 id。构建目标是 es2015,不能依赖 BigInt,\n * 这里用逐位进位的方式把十进制换算成 16 位 hex。\n */\nconst decimalToHexId = (value: string) => {\n if (!DECIMAL_PATTERN.test(value)) return undefined;\n const nibbles: number[] = [];\n for (let index = 0; index < value.length; index += 1) {\n let carry = value.charCodeAt(index) - 48;\n for (let position = 0; position < nibbles.length; position += 1) {\n const product = nibbles[position] * 10 + carry;\n nibbles[position] = product % 16;\n carry = (product - (product % 16)) / 16;\n }\n while (carry > 0) {\n nibbles.push(carry % 16);\n carry = (carry - (carry % 16)) / 16;\n }\n }\n if (nibbles.length > SPAN_ID_LENGTH) return undefined;\n let hex = '';\n for (let position = nibbles.length - 1; position >= 0; position -= 1) hex += HEX_DIGITS[nibbles[position]];\n return hex.padStart(SPAN_ID_LENGTH, '0');\n};\n\ninterface UpstreamTrace {\n format: BkOTUpstreamTraceFormat;\n /** 命中格式的原始 header,原样写入 Link Attributes */\n headers: Attributes;\n sampled?: boolean;\n /** 规范化后的合法 OTel id;无法映射时两者同时缺失 */\n spanId?: string;\n traceId?: string;\n}\n\n/** 按 header 原名收集实际存在的取值,缺失的不写入 */\nconst collectHeaders = (getHeader: BkOTHeaderReader, names: string[]) => {\n const headers: Attributes = {};\n for (const name of names) {\n const value = getHeader(name)?.trim();\n if (value) headers[name] = value;\n }\n return headers;\n};\n\n/**\n * `traceparent` 与 SDK 注入的是同一个 header,因此格式非法时视作没有既有链路:\n * 这种值后端同样无法接续,覆盖注入比保留它更有价值。\n */\nconst parseTraceparent = (getHeader: BkOTHeaderReader): undefined | UpstreamTrace => {\n const value = getHeader(TRACEPARENT_HEADER)?.trim().toLowerCase();\n if (!value) return undefined;\n const matched = TRACEPARENT_PATTERN.exec(value);\n if (!matched || matched[1] === 'ff') return undefined;\n const [, , traceId, spanId, flags] = matched;\n if (!isValidHexId(traceId, TRACE_ID_LENGTH) || !isValidHexId(spanId, SPAN_ID_LENGTH)) return undefined;\n return {\n format: 'traceparent',\n headers: collectHeaders(getHeader, [TRACEPARENT_HEADER]),\n sampled: (Number.parseInt(flags, 16) & 1) === 1,\n spanId,\n traceId,\n };\n};\n\nconst parseSentryTrace = (getHeader: BkOTHeaderReader): undefined | UpstreamTrace => {\n const value = getHeader('sentry-trace')?.trim().toLowerCase();\n if (!value) return undefined;\n const headers = collectHeaders(getHeader, ['sentry-trace']);\n const matched = SENTRY_TRACE_PATTERN.exec(value);\n if (!matched) return { format: 'sentry-trace', headers };\n const [, traceId, spanId, sampled] = matched;\n return {\n format: 'sentry-trace',\n headers,\n ...(sampled === undefined ? {} : { sampled: sampled === '1' }),\n ...(isValidHexId(traceId, TRACE_ID_LENGTH) && isValidHexId(spanId, SPAN_ID_LENGTH) ? { spanId, traceId } : {}),\n };\n};\n\n// b3 单头:{trace-id}-{span-id}[-{sampling-state}[-{parent-span-id}]],也允许只有 0 / 1 / d\nconst parseB3Single = (getHeader: BkOTHeaderReader): undefined | UpstreamTrace => {\n const value = getHeader('b3')?.trim().toLowerCase();\n if (!value) return undefined;\n const [rawTraceId, rawSpanId, samplingState] = value.split('-');\n const traceId = rawTraceId ? normalizeTraceId(rawTraceId) : undefined;\n const spanId = rawSpanId ? normalizeSpanId(rawSpanId) : undefined;\n return {\n format: 'b3',\n headers: collectHeaders(getHeader, ['b3']),\n ...(traceId && spanId ? { spanId, traceId } : {}),\n ...(samplingState ? { sampled: samplingState === '1' || samplingState === 'd' } : {}),\n };\n};\n\nconst parseB3Multi = (getHeader: BkOTHeaderReader): undefined | UpstreamTrace => {\n const rawTraceId = getHeader('x-b3-traceid')?.trim().toLowerCase();\n const rawSpanId = getHeader('x-b3-spanid')?.trim().toLowerCase();\n const samplingState = getHeader('x-b3-sampled')?.trim().toLowerCase();\n if (!rawTraceId && !rawSpanId && !samplingState) return undefined;\n const traceId = rawTraceId ? normalizeTraceId(rawTraceId) : undefined;\n const spanId = rawSpanId ? normalizeSpanId(rawSpanId) : undefined;\n return {\n format: 'b3-multi',\n headers: collectHeaders(getHeader, [\n 'x-b3-traceid',\n 'x-b3-spanid',\n 'x-b3-parentspanid',\n 'x-b3-sampled',\n 'x-b3-flags',\n ]),\n ...(traceId && spanId ? { spanId, traceId } : {}),\n ...(samplingState ? { sampled: samplingState === '1' || samplingState === 'd' } : {}),\n };\n};\n\nconst parseDatadog = (getHeader: BkOTHeaderReader): undefined | UpstreamTrace => {\n const rawTraceId = getHeader('x-datadog-trace-id')?.trim();\n const rawSpanId = getHeader('x-datadog-parent-id')?.trim();\n const samplingPriority = getHeader('x-datadog-sampling-priority')?.trim();\n if (!rawTraceId && !rawSpanId && !samplingPriority) return undefined;\n const tags = getHeader('x-datadog-tags')?.trim().toLowerCase();\n const traceIdHigh =\n (tags ? DATADOG_TRACE_ID_HIGH_PATTERN.exec(tags)?.[1] : undefined) ?? DATADOG_TRACE_ID_HIGH_DEFAULT;\n const traceIdLow = rawTraceId ? decimalToHexId(rawTraceId) : undefined;\n const traceId = traceIdLow ? normalizeTraceId(`${traceIdHigh}${traceIdLow}`) : undefined;\n const spanIdHex = rawSpanId ? decimalToHexId(rawSpanId) : undefined;\n const spanId = spanIdHex ? normalizeSpanId(spanIdHex) : undefined;\n return {\n format: 'datadog',\n headers: collectHeaders(getHeader, [\n 'x-datadog-trace-id',\n 'x-datadog-parent-id',\n 'x-datadog-sampling-priority',\n 'x-datadog-origin',\n 'x-datadog-tags',\n ]),\n ...(traceId && spanId ? { spanId, traceId } : {}),\n ...(samplingPriority ? { sampled: Number(samplingPriority) > 0 } : {}),\n };\n};\n\n/**\n * sw8:{sample}-{trace-id}-{segment-id}-{span-id}-{service}-{instance}-{endpoint}-{peer},\n * 其中 trace-id 与 segment-id 是 base64 后的 SkyWalking id。它们不是 16 字节 hex,无法映射为\n * 合法的 OTel SpanContext,因此不产出 traceId/spanId,由调用方补占位 id。\n */\nconst parseSw8 = (getHeader: BkOTHeaderReader): undefined | UpstreamTrace => {\n const value = getHeader('sw8')?.trim();\n if (!value) return undefined;\n const samplingState = value.split('-')[0];\n return {\n format: 'sw8',\n headers: collectHeaders(getHeader, ['sw8']),\n ...(samplingState ? { sampled: samplingState === '1' } : {}),\n };\n};\n\n// 按格式明确度排序:先看与 SDK 同名的 traceparent,再看其他厂商格式\nconst UPSTREAM_PARSERS = [parseTraceparent, parseSentryTrace, parseB3Single, parseB3Multi, parseDatadog, parseSw8];\n\nexport const detectUpstreamTrace = (getHeader: BkOTHeaderReader) => {\n for (const parse of UPSTREAM_PARSERS) {\n const upstream = parse(getHeader);\n if (upstream) return upstream;\n }\n return undefined;\n};\n\nconst toLink = (traceId: string, spanId: string, attributes: Attributes, sampled?: boolean): Link => ({\n attributes,\n context: {\n spanId,\n traceFlags: sampled === false ? TraceFlags.NONE : TraceFlags.SAMPLED,\n traceId,\n },\n});\n\nexport const planRequestTrace = (getHeader: BkOTHeaderReader): BkOTRequestTracePlan => {\n const upstream = detectUpstreamTrace(getHeader);\n if (!upstream) {\n // 与 RUM Span 无关的独立 trace,保证后端按 trace-id 检索时只命中这一个 API 请求\n const traceId = createRandomHexId(TRACE_ID_LENGTH);\n const spanId = createRandomHexId(SPAN_ID_LENGTH);\n const traceparent = `00-${traceId}-${spanId}-01`;\n return {\n links: [toLink(traceId, spanId, { format: 'traceparent', injected: true, [TRACEPARENT_HEADER]: traceparent })],\n traceparent,\n };\n }\n // sw8 等格式解析不出合法 OTel id,补占位 id 让 Link 结构统一;此时不注入,后端不会有对应 trace\n return {\n links: [\n toLink(\n upstream.traceId ?? createRandomHexId(TRACE_ID_LENGTH),\n upstream.spanId ?? createRandomHexId(SPAN_ID_LENGTH),\n // injected 恒定写出:业务自带的合法 traceparent 与 SDK 注入的 format 同值,只靠 format 无法区分\n { format: upstream.format, injected: false, ...upstream.headers },\n upstream.sampled,\n ),\n ],\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { SpanKind } from '@opentelemetry/api';\n\nimport { notifyRequestTiming } from '../core/request-timing';\nimport { shouldIgnoreUrl } from '../core/url';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { buildRumResourceSpanAttributes, buildRumSpanName, RUM_SPAN_TYPE } from '../schema/span';\n\nimport type { BkOTPlugin } from '../core/plugin';\n\n/**\n * Resource Timing 的统一消费端:静态资源按配置生成 span;Fetch/XHR timing 转交 request 插件,\n * 与其已创建的请求 span 合并,避免同一次网络请求重复计数。\n */\ntype ResourceTimingWithStatus = PerformanceResourceTiming & {\n deliveryType?: string;\n renderBlockingStatus?: string;\n responseStatus?: number;\n};\n\nconst getCacheHit = (entry: ResourceTimingWithStatus) =>\n entry.deliveryType === 'cache' || (entry.transferSize === 0 && entry.decodedBodySize > 0) ? true : undefined;\n\nconst hasUnavailableResourceDetails = (entry: ResourceTimingWithStatus) =>\n entry.transferSize === 0 &&\n entry.encodedBodySize === 0 &&\n entry.decodedBodySize === 0 &&\n entry.requestStart === 0 &&\n entry.responseStart === 0 &&\n !entry.nextHopProtocol;\n\nconst areInOrder = (...values: number[]) => values.every((value, index) => index === 0 || values[index - 1] <= value);\n\nconst setTiming = (attributes: Record<string, number>, name: string, origin: number, start: number, end: number) => {\n if (!areInOrder(origin, start, end)) return;\n attributes[`resource.${name}.start`] = start - origin;\n attributes[`resource.${name}.duration`] = end - start;\n};\n\nexport const getResourceTimingAttributes = (entry: ResourceTimingWithStatus) => {\n const attributes: Record<string, number> = {};\n const commonTimings = [\n entry.startTime,\n entry.fetchStart,\n entry.domainLookupStart,\n entry.domainLookupEnd,\n entry.connectStart,\n entry.connectEnd,\n entry.requestStart,\n entry.responseStart,\n entry.responseEnd,\n ];\n // 浏览器因 TAO 或实现差异可能返回缺失/乱序时间点;整组校验可避免产生负 duration。\n if (!commonTimings.every(Number.isFinite) || !areInOrder(...commonTimings)) return attributes;\n\n setTiming(attributes, 'first_byte', entry.startTime, entry.requestStart, entry.responseStart);\n setTiming(attributes, 'download', entry.startTime, entry.responseStart, entry.responseEnd);\n if (entry.workerStart > 0 && entry.workerStart < entry.fetchStart) {\n setTiming(attributes, 'worker', entry.startTime, entry.workerStart, entry.fetchStart);\n }\n if (entry.fetchStart < entry.domainLookupEnd) {\n setTiming(attributes, 'dns', entry.startTime, entry.domainLookupStart, entry.domainLookupEnd);\n }\n if (entry.fetchStart < entry.connectEnd) {\n setTiming(attributes, 'connect', entry.startTime, entry.connectStart, entry.connectEnd);\n if (entry.connectStart <= entry.secureConnectionStart && entry.secureConnectionStart <= entry.connectEnd) {\n setTiming(attributes, 'ssl', entry.startTime, entry.secureConnectionStart, entry.connectEnd);\n }\n }\n if (\n entry.redirectEnd > entry.startTime &&\n areInOrder(entry.startTime, entry.redirectStart, entry.redirectEnd, entry.fetchStart)\n ) {\n setTiming(attributes, 'redirect', entry.startTime, entry.redirectStart, entry.redirectEnd);\n }\n return attributes;\n};\n\nexport const getResourceDuration = (entry: ResourceTimingWithStatus) =>\n entry.duration === 0 && entry.responseEnd > entry.startTime ? entry.responseEnd - entry.startTime : entry.duration;\n\nexport const getResourcePerformanceAttributes = (entry: ResourceTimingWithStatus) => {\n const detailsUnavailable = hasUnavailableResourceDetails(entry);\n const deliveryType = typeof entry.deliveryType === 'string' && entry.deliveryType ? entry.deliveryType : undefined;\n return {\n [RUM_ATTRIBUTES.cacheHit]: getCacheHit(entry),\n ...(entry.nextHopProtocol ? { [RUM_ATTRIBUTES.nextHopProtocol]: entry.nextHopProtocol } : {}),\n ...getResourceTimingAttributes(entry),\n ...(deliveryType ? { 'resource.delivery_type': deliveryType } : {}),\n ...(entry.renderBlockingStatus ? { 'resource.render_blocking_status': entry.renderBlockingStatus } : {}),\n ...(detailsUnavailable\n ? {}\n : {\n // 对齐 Datadog:resource.size 取解压后 body 体积,缓存命中也能反映真实大小;\n // 网络传输量单独用 resource.transfer_size 表达(受缓存/TAO 影响可能为 0)。\n 'resource.size': entry.decodedBodySize,\n 'resource.encoded_body_size': entry.encodedBodySize,\n 'resource.decoded_body_size': entry.decodedBodySize,\n 'resource.transfer_size': entry.transferSize,\n }),\n };\n};\n\nexport const createResourcePlugin = (emitResourceSpans = true): BkOTPlugin => {\n let observer: PerformanceObserver | undefined;\n\n return {\n name: 'resource',\n init(context) {\n if (typeof PerformanceObserver === 'undefined') {\n return;\n }\n if (!PerformanceObserver.supportedEntryTypes?.includes('resource')) {\n return;\n }\n\n const emitEntry = (entry: ResourceTimingWithStatus) => {\n if (!context.isSampled()) return;\n if (!entry.name || shouldIgnoreUrl(context.config, entry.name)) {\n return;\n }\n if (entry.initiatorType === 'fetch' || entry.initiatorType === 'xmlhttprequest') {\n // Fetch/XHR 已由 request 插件建 span;这里只把 ResourceTiming 回传补齐网络阶段,避免重复上报。\n notifyRequestTiming(entry);\n return;\n }\n if (entry.duration < 0) return;\n const redactedUrl = context.config.hooks.redactUrl(entry.name);\n const duration = getResourceDuration(entry);\n const startTime = performance.timeOrigin + entry.startTime;\n const endTime = startTime + duration;\n if (emitResourceSpans && context.isSampled()) {\n const attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...buildRumResourceSpanAttributes({\n initiatorType: entry.initiatorType || 'other',\n method: 'GET',\n outcome:\n typeof entry.responseStatus === 'number'\n ? { statusCode: entry.responseStatus, type: 'response' as const }\n : undefined,\n url: redactedUrl,\n }),\n 'url.full': redactedUrl,\n 'url.template': context.config.hooks.getRequestUrlTemplate(redactedUrl),\n ...getResourcePerformanceAttributes(entry),\n };\n const span = context.startSpan(\n buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.resource }),\n attributes,\n { kind: SpanKind.CLIENT, rumSpanType: RUM_SPAN_TYPE.resource, startTime },\n );\n span.end(endTime);\n }\n context.notifyActivity({ endTime, startTime, type: 'resource', url: entry.name });\n };\n\n try {\n observer = new PerformanceObserver(list => {\n for (const entry of list.getEntries() as ResourceTimingWithStatus[]) {\n emitEntry(entry);\n }\n });\n observer.observe({ type: 'resource', buffered: true });\n } catch {\n observer = undefined;\n }\n },\n shutdown() {\n observer?.disconnect();\n observer = undefined;\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\n/**\n * Fetch/XHR 请求统一采集入口。\n *\n * 同一层 patch 负责请求 span、Trace Header、页面活动与 beforeSend,避免多套 patch\n * 重复计数,也不依赖 OpenTelemetry instrumentation 的私有方法。\n */\n\nimport { SpanKind, SpanStatusCode } from '@opentelemetry/api';\n\nimport { createRandomId } from '../core/id';\nimport { markSpanDiscarded } from '../core/processor';\nimport { trackRequestTiming } from '../core/request-timing';\nimport { planRequestTrace, TRACEPARENT_HEADER } from '../core/trace-context';\nimport {\n matchesUrlList,\n shouldIgnoreRequest,\n shouldIgnoreUrl,\n shouldPropagateTraceHeader,\n toAbsoluteUrl,\n} from '../core/url';\nimport { buildRumResourceSpanAttributes, buildRumSpanName, RUM_SPAN_TYPE } from '../schema/span';\nimport { getResourceDuration, getResourcePerformanceAttributes } from './resource';\n\nimport type { BkOTRequestConfig, BkOTRequestContext, BkOTRequestOutcome } from '../core/config';\nimport type { BkOTPlugin, BkOTRuntimeContext } from '../core/plugin';\nimport type { BkOTHeaderReader, BkOTRequestTracePlan } from '../core/trace-context';\nimport type { Attributes, Span } from '@opentelemetry/api';\n\ninterface RequestDetails {\n method?: string;\n startedAt?: number;\n url?: string;\n}\n\nconst getRequestOptions = (context: BkOTRuntimeContext) =>\n typeof context.config.tracking.request === 'object' ? context.config.tracking.request : undefined;\n\n// 没有白名单时不会注入任何 header,也就不需要为探测既有 trace header 付出 patch 成本。\nconst hasTracingAllowlist = (context: BkOTRuntimeContext) => {\n const allowed = getRequestOptions(context)?.allowedTracingUrls;\n return Array.isArray(allowed) ? allowed.length > 0 : allowed !== undefined;\n};\n\nconst getErrorName = (error: unknown) =>\n typeof error === 'object' && error && 'name' in error && typeof error.name === 'string' ? error.name : '';\n\nconst getFetchFailureOutcome = (requestContext: Request | RequestInit, error: unknown): BkOTRequestOutcome => {\n const signal = requestContext.signal;\n if (getErrorName(signal?.reason) === 'TimeoutError' || getErrorName(error) === 'TimeoutError') {\n return { error, type: 'timeout' };\n }\n if (signal?.aborted || getErrorName(error) === 'AbortError') return { type: 'abort' };\n return { error, type: 'network_error' };\n};\n\nconst getXhrOutcome = (\n completionType: 'abort' | 'error' | 'load' | 'timeout',\n xhr: XMLHttpRequest,\n): BkOTRequestOutcome => {\n if (completionType === 'abort') return { type: 'abort' };\n if (completionType === 'timeout') return { type: 'timeout' };\n if (completionType === 'error' || xhr.status === 0) return { type: 'network_error' };\n return { statusCode: xhr.status, type: 'response' };\n};\n\nconst isErrorOutcome = (outcome: BkOTRequestOutcome) =>\n outcome.type === 'network_error' ||\n outcome.type === 'timeout' ||\n (outcome.type === 'response' && typeof outcome.statusCode === 'number' && outcome.statusCode >= 400);\n\nconst getFetchUrl = (input: RequestInfo | URL) => {\n if (typeof input === 'string' || input instanceof URL) return toAbsoluteUrl(String(input));\n return toAbsoluteUrl(input.url);\n};\n\nconst getFetchMethod = (input: RequestInfo | URL, init?: RequestInit) =>\n (init?.method ?? (typeof Request !== 'undefined' && input instanceof Request ? input.method : 'GET')).toUpperCase();\n\nconst getFetchRequestContext = (input: RequestInfo | URL, init?: RequestInit): Request | RequestInit =>\n typeof Request !== 'undefined' && input instanceof Request ? input : (init ?? {});\n\n/** 取本次请求最终会发出的 header 集合:init.headers 一旦存在就会整体覆盖 Request 上的 header。 */\nconst getFetchRequestHeaders = (input: RequestInfo | URL, init: RequestInit | undefined) => {\n const requestHeaders = typeof Request !== 'undefined' && input instanceof Request ? input.headers : undefined;\n return new Headers(init?.headers ?? requestHeaders);\n};\n\nconst applyFetchTracePlan = (init: RequestInit | undefined, headers: Headers, plan: BkOTRequestTracePlan) => {\n if (!plan.traceparent) return init;\n headers.set(TRACEPARENT_HEADER, plan.traceparent);\n return { ...init, headers };\n};\n\nconst createHeaderReader =\n (headers: Record<string, string> | undefined): BkOTHeaderReader =>\n name =>\n headers?.[name.toLowerCase()];\n\nconst isActivityExcluded = (context: BkOTRuntimeContext, url: string) =>\n shouldIgnoreUrl(context.config, url) || matchesUrlList(context.config.view.excludedActivityUrls, url);\n\nconst startRequestActivity = (context: BkOTRuntimeContext, url: string) => {\n if (isActivityExcluded(context, url)) return () => {};\n const id = createRandomId('request');\n context.notifyActivity({ id, time: Date.now(), type: 'request_start', url });\n let ended = false;\n return () => {\n if (ended) return;\n ended = true;\n context.notifyActivity({ id, time: Date.now(), type: 'request_end' });\n };\n};\n\nconst trackRequestSpanTiming = (context: BkOTRuntimeContext, url: string) =>\n !context.isSampled()\n ? {\n cancel() {},\n complete(callback: (entry?: PerformanceResourceTiming) => void) {\n callback();\n },\n }\n : trackRequestTiming(url);\n\nconst startRequestSpan = (\n context: BkOTRuntimeContext,\n subtype: 'fetch' | 'xhr',\n details: RequestDetails,\n tracePlan?: BkOTRequestTracePlan,\n) => {\n const startedAt = details.startedAt ?? Date.now();\n const attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...buildRumResourceSpanAttributes({\n initiatorType: subtype,\n method: details.method,\n url: details.url ?? '',\n }),\n ...(details.url\n ? {\n 'url.full': context.config.hooks.redactUrl(details.url),\n 'url.template': context.config.hooks.getRequestUrlTemplate(details.url),\n }\n : {}),\n };\n return context.startSpan(buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.resource }), attributes, {\n kind: SpanKind.CLIENT,\n rumSpanType: RUM_SPAN_TYPE.resource,\n startTime: startedAt,\n ...(tracePlan ? { links: tracePlan.links } : {}),\n });\n};\n\nexport const decorateRequestSpan = (\n context: BkOTRuntimeContext,\n span: Span,\n subtype: 'fetch' | 'xhr',\n domainContext: BkOTRequestContext,\n outcome: BkOTRequestOutcome,\n details: RequestDetails = {},\n) => {\n const sourceUrl = details.url;\n const redactedUrl = sourceUrl ? context.config.hooks.redactUrl(sourceUrl) : undefined;\n const method = details.method;\n const attributes: Attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...buildRumResourceSpanAttributes({\n initiatorType: subtype,\n method,\n outcome,\n url: redactedUrl ?? '',\n }),\n ...(redactedUrl ? { 'url.full': redactedUrl } : {}),\n // 模板由原始 URL 推导:Hook 可能需要 query 才能判断路由,产出的模板本身是低基数的\n ...(sourceUrl ? { 'url.template': context.config.hooks.getRequestUrlTemplate(sourceUrl) } : {}),\n };\n\n const event = {\n attributes,\n resource: {\n method,\n outcome,\n transport: subtype,\n url: redactedUrl,\n },\n type: 'resource' as const,\n };\n let shouldSend: boolean | void = true;\n try {\n shouldSend = getRequestOptions(context)?.beforeSend?.(event, domainContext);\n } catch (error) {\n if (context.config.debug) globalThis.console?.warn('[bk-ot] request.beforeSend failed:', error);\n }\n const redactedAttributes = context.applyRedact(event.attributes);\n span.setAttributes(redactedAttributes);\n span.updateName(buildRumSpanName({ attributes: redactedAttributes, spanType: RUM_SPAN_TYPE.resource }));\n if (shouldSend === false) {\n // SpanProcessor 在 onEnd 统一识别内部状态,避免这里绕过正常的 span 结束流程。\n markSpanDiscarded(span);\n return;\n }\n if (isErrorOutcome(outcome)) span.setStatus({ code: SpanStatusCode.ERROR });\n};\n\nexport const createCommonInstrumentationsPlugin = (option: BkOTRequestConfig | boolean | undefined): BkOTPlugin => {\n const teardownCallbacks: Array<() => void> = [];\n const activeRequestEnds = new Set<() => void>();\n\n return {\n name: 'request',\n enabled: option !== false,\n init(context) {\n if (typeof window === 'undefined') return;\n\n if (typeof window.fetch === 'function') {\n const originalFetch = window.fetch;\n const patchedFetch: typeof window.fetch = async function (this: Window, input, init) {\n const url = getFetchUrl(input);\n if (!context.isSampled() || shouldIgnoreRequest(context.config, url))\n return originalFetch.call(this, input, init);\n const method = getFetchMethod(input, init);\n const details = { method, startedAt: Date.now(), url };\n // Span Link 必须在创建 span 时给出,因此先规划 trace context 再建 span。\n const headers = shouldPropagateTraceHeader(context.config, url)\n ? getFetchRequestHeaders(input, init)\n : undefined;\n const tracePlan = headers ? planRequestTrace(name => headers.get(name) ?? undefined) : undefined;\n const span = startRequestSpan(context, 'fetch', details, tracePlan);\n const timing = trackRequestSpanTiming(context, url);\n const endActivity = startRequestActivity(context, url);\n const requestContext = getFetchRequestContext(input, init);\n const requestInit = headers && tracePlan ? applyFetchTracePlan(init, headers, tracePlan) : init;\n let ended = false;\n const endSpan = (entry?: PerformanceResourceTiming, fallbackEndTime = Date.now()) => {\n if (ended) return;\n ended = true;\n activeRequestEnds.delete(forceEnd);\n if (entry) {\n span.setAttributes(context.applyRedact(getResourcePerformanceAttributes(entry)));\n span.end(performance.timeOrigin + entry.startTime + getResourceDuration(entry));\n return;\n }\n span.end(fallbackEndTime);\n };\n const forceEnd = () => {\n // shutdown 不再等待异步 ResourceTiming,立即结束仍在飞行中的 span。\n timing.cancel();\n endSpan();\n };\n activeRequestEnds.add(forceEnd);\n try {\n const response = await originalFetch.call(this, input, requestInit);\n const outcome: BkOTRequestOutcome = {\n ...(response.status > 0 ? { statusCode: response.status } : {}),\n type: 'response',\n };\n decorateRequestSpan(\n context,\n span,\n 'fetch',\n { request: requestContext, response, type: 'fetch' },\n outcome,\n details,\n );\n const completedAt = Date.now();\n timing.complete(entry => endSpan(entry, completedAt));\n return response;\n } catch (error) {\n const outcome = getFetchFailureOutcome(requestContext, error);\n decorateRequestSpan(\n context,\n span,\n 'fetch',\n { error, request: requestContext, type: 'fetch' },\n outcome,\n details,\n );\n if (outcome.type !== 'abort' && error instanceof Error) span.recordException(error);\n const completedAt = Date.now();\n timing.complete(entry => endSpan(entry, completedAt));\n throw error;\n } finally {\n endActivity();\n }\n };\n window.fetch = patchedFetch;\n teardownCallbacks.push(() => {\n if (window.fetch === patchedFetch) window.fetch = originalFetch;\n });\n }\n\n if (typeof XMLHttpRequest !== 'undefined') {\n const requests = new WeakMap<XMLHttpRequest, RequestDetails>();\n // 浏览器不提供读取 XHR 请求头的 API,只能自己快照业务设置的 header 以便探测既有链路。\n const authorHeaders = new WeakMap<XMLHttpRequest, Record<string, string>>();\n const originalOpen = XMLHttpRequest.prototype.open;\n const originalSend = XMLHttpRequest.prototype.send;\n const patchedOpen: typeof XMLHttpRequest.prototype.open = function (\n this: XMLHttpRequest,\n method: string,\n url: string | URL,\n async = true,\n username?: null | string,\n password?: null | string,\n ) {\n requests.set(this, { method: method.toUpperCase(), url: toAbsoluteUrl(String(url)) });\n // open() 会清空已设置的请求头,快照必须同步失效。\n authorHeaders.delete(this);\n return originalOpen.call(this, method, String(url), async, username, password);\n };\n const patchedSend: typeof XMLHttpRequest.prototype.send = function (this: XMLHttpRequest, body) {\n const details = requests.get(this) ?? {};\n if (!context.isSampled() || !details.url || shouldIgnoreRequest(context.config, details.url))\n return originalSend.call(this, body);\n details.startedAt = Date.now();\n const tracePlan = shouldPropagateTraceHeader(context.config, details.url)\n ? planRequestTrace(createHeaderReader(authorHeaders.get(this)))\n : undefined;\n const span = startRequestSpan(context, 'xhr', details, tracePlan);\n const timing = trackRequestSpanTiming(context, details.url);\n const endActivity = startRequestActivity(context, details.url);\n if (tracePlan?.traceparent) this.setRequestHeader(TRACEPARENT_HEADER, tracePlan.traceparent);\n let finishing = false;\n let ended = false;\n let removeTerminalListeners = () => {};\n const forceEnd = () => {\n // XHR 可能永不触发终止事件;SDK 停止时必须清理活动计数并结束 span。\n removeTerminalListeners();\n timing.cancel();\n if (ended) return;\n ended = true;\n activeRequestEnds.delete(forceEnd);\n endActivity();\n span.end();\n };\n activeRequestEnds.add(forceEnd);\n const complete = (completionType: 'abort' | 'error' | 'load' | 'timeout') => {\n if (finishing || ended) return;\n finishing = true;\n removeTerminalListeners();\n const outcome = getXhrOutcome(completionType, this);\n decorateRequestSpan(context, span, 'xhr', { type: 'xhr', xhr: this }, outcome, details);\n endActivity();\n const completedAt = Date.now();\n timing.complete(entry => {\n if (ended) return;\n ended = true;\n activeRequestEnds.delete(forceEnd);\n if (entry) {\n span.setAttributes(context.applyRedact(getResourcePerformanceAttributes(entry)));\n span.end(performance.timeOrigin + entry.startTime + getResourceDuration(entry));\n return;\n }\n span.end(completedAt);\n });\n };\n const onAbort = () => complete('abort');\n const onError = () => complete('error');\n const onLoad = () => complete('load');\n const onTimeout = () => complete('timeout');\n removeTerminalListeners = () => {\n this.removeEventListener('abort', onAbort);\n this.removeEventListener('error', onError);\n this.removeEventListener('load', onLoad);\n this.removeEventListener('timeout', onTimeout);\n };\n this.addEventListener('abort', onAbort, { once: true });\n this.addEventListener('error', onError, { once: true });\n this.addEventListener('load', onLoad, { once: true });\n this.addEventListener('timeout', onTimeout, { once: true });\n try {\n return originalSend.call(this, body);\n } catch (error) {\n if (error instanceof Error) span.recordException(error);\n complete('error');\n throw error;\n }\n };\n XMLHttpRequest.prototype.open = patchedOpen;\n XMLHttpRequest.prototype.send = patchedSend;\n teardownCallbacks.push(() => {\n if (XMLHttpRequest.prototype.open === patchedOpen) XMLHttpRequest.prototype.open = originalOpen;\n if (XMLHttpRequest.prototype.send === patchedSend) XMLHttpRequest.prototype.send = originalSend;\n });\n\n if (hasTracingAllowlist(context) && typeof XMLHttpRequest.prototype.setRequestHeader === 'function') {\n const originalSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader;\n const patchedSetRequestHeader: typeof XMLHttpRequest.prototype.setRequestHeader = function (\n this: XMLHttpRequest,\n name: string,\n value: string,\n ) {\n const key = name.toLowerCase();\n const headers = authorHeaders.get(this) ?? {};\n // 浏览器对重复设置的同名 header 做 \", \" 合并,快照保持一致才能正确解析。\n headers[key] = key in headers ? `${headers[key]}, ${value}` : value;\n authorHeaders.set(this, headers);\n return originalSetRequestHeader.call(this, name, value);\n };\n XMLHttpRequest.prototype.setRequestHeader = patchedSetRequestHeader;\n teardownCallbacks.push(() => {\n if (XMLHttpRequest.prototype.setRequestHeader === patchedSetRequestHeader)\n XMLHttpRequest.prototype.setRequestHeader = originalSetRequestHeader;\n });\n }\n }\n },\n shutdown() {\n for (const end of [...activeRequestEnds]) end();\n while (teardownCallbacks.length) teardownCallbacks.pop()?.();\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_OUTCOME, RUM_SPAN_TYPE } from '../schema/span';\n\nimport type { BkOTPlugin } from '../core/plugin';\n\n// blockedURI 除了 URL 还可能是 'inline' / 'eval' / 'wasm-eval' / 'self' 等关键字(CSP spec),\n// 这些不是 URL,不应该走 redactUrl\nconst URL_LIKE_BLOCKED_URI = /^https?:|^\\/\\//i;\n\nconst redactBlockedUri = (redactUrl: (url: string) => string, blockedURI: string | undefined) => {\n if (!blockedURI) return undefined;\n return URL_LIKE_BLOCKED_URI.test(blockedURI) ? redactUrl(blockedURI) : blockedURI;\n};\n\n/**\n * CSP 违规事件采集插件,通过监听 `securitypolicyviolation` 事件捕获被 CSP 策略拦截的脚本/资源,\n * 以 error span 上报,进入统一错误分析口径。\n *\n * URL 处理:\n * - `blockedURI` / `sourceFile` 中的 URL 类值会经 `redactUrl` 脱敏。\n * - `blockedURI` 是 'inline' / 'eval' 等 CSP 关键字时直接保留,不调用 redactUrl。\n */\nexport const createCspViolationPlugin = (): BkOTPlugin => {\n let teardown: (() => void) | undefined;\n\n return {\n name: 'csp-violation',\n init(context) {\n if (typeof window === 'undefined' || typeof document === 'undefined') {\n return;\n }\n\n const handler = (event: SecurityPolicyViolationEvent) => {\n if (!context.isSampled()) return;\n const occurredAt = Date.now();\n const blockedUri = redactBlockedUri(context.config.hooks.redactUrl, event.blockedURI);\n const sourceFile = event.sourceFile ? context.config.hooks.redactUrl(event.sourceFile) : undefined;\n const attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...buildRumSpanAttributes({\n outcome: RUM_SPAN_OUTCOME.error,\n spanType: RUM_SPAN_TYPE.error,\n }),\n 'csp.blocked_uri': blockedUri,\n 'csp.violated_directive': event.violatedDirective,\n 'csp.effective_directive': event.effectiveDirective,\n 'csp.disposition': event.disposition,\n 'csp.source_file': sourceFile,\n 'csp.line_number': event.lineNumber,\n 'csp.column_number': event.columnNumber,\n 'csp.status_code': event.statusCode,\n 'csp.original_policy': event.originalPolicy,\n 'error.source': 'csp',\n };\n const span = context.startSpan(buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.error }), attributes, {\n startTime: occurredAt,\n });\n span.end(occurredAt);\n };\n\n document.addEventListener('securitypolicyviolation', handler);\n teardown = () => document.removeEventListener('securitypolicyviolation', handler);\n },\n shutdown() {\n teardown?.();\n teardown = undefined;\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\n/** 非密码学稳定 hash,仅用于生成浏览器本地 storage key。 */\nexport const hashString = (input: string): string => {\n let hash = 5381;\n for (let index = 0; index < input.length; index++) {\n hash = (hash * 33) ^ input.charCodeAt(index);\n }\n return (hash >>> 0).toString(36);\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { hashString } from '../core/hash';\nimport { createRandomId } from '../core/id';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\n\nimport type { BkOTPlugin } from '../core/plugin';\nimport type { Attributes } from '@opentelemetry/api';\n\nexport interface BkOTDevicePluginOptions {\n /** 是否跨页面持久化匿名设备 ID,默认 false。 */\n persistentId?: boolean;\n storageKey?: string;\n}\n\nconst DEFAULT_DEVICE_STORAGE_KEY = 'BK_RUM_DEVICE_ID';\n// 用户拖窗口时 resize 高频触发,debounce 静默期内只在最后一次更新,避免无谓的 setRuntimeAttributes 风暴\nconst VIEWPORT_DEBOUNCE_MS = 250;\n\ninterface NetworkInformationLike {\n effectiveType?: string;\n type?: string;\n addEventListener?: (type: 'change', listener: () => void) => void;\n removeEventListener?: (type: 'change', listener: () => void) => void;\n}\n\ninterface UserAgentDataLike {\n mobile?: boolean;\n platform?: string;\n}\n\nconst getConnection = (): NetworkInformationLike | undefined =>\n (\n navigator as Navigator & {\n connection?: NetworkInformationLike;\n }\n ).connection;\n\nconst getUserAgentData = (): undefined | UserAgentDataLike =>\n (\n navigator as Navigator & {\n userAgentData?: UserAgentDataLike;\n }\n ).userAgentData;\n\nconst getBrowserInfo = (ua: string) => {\n const matchers: Array<[string, RegExp]> = [\n ['Edge', /Edg\\/([\\d.]+)/],\n ['Chrome', /Chrome\\/([\\d.]+)/],\n ['Firefox', /Firefox\\/([\\d.]+)/],\n ['Safari', /Version\\/([\\d.]+).*Safari/],\n ];\n for (const [name, pattern] of matchers) {\n const matched = ua.match(pattern);\n if (matched?.[1]) {\n return { name, version: matched[1].split('.')[0] };\n }\n }\n return { name: 'Other', version: undefined };\n};\n\nconst getOsName = (ua: string, platform?: string) => {\n const value = `${platform ?? ''} ${ua}`;\n if (/iphone|ipad|ipod/i.test(value)) return 'iOS';\n if (/android/i.test(value)) return 'Android';\n if (/mac/i.test(value)) return 'macOS';\n if (/win/i.test(value)) return 'Windows';\n if (/linux/i.test(value)) return 'Linux';\n return 'Other';\n};\n\nconst readDeviceId = (storageKey: string) => {\n let existed: null | string = null;\n try {\n existed = window.localStorage.getItem(storageKey);\n } catch {\n /* localStorage 不可用(隐私模式 / sandbox iframe),下面会创建一个 in-memory id */\n }\n if (existed) {\n return existed;\n }\n const deviceId = createRandomId('device');\n try {\n window.localStorage.setItem(storageKey, deviceId);\n } catch {\n /* 写不进去也行,至少本次 SDK 生命周期内 deviceId 仍然稳定 */\n }\n return deviceId;\n};\n\n// 视口尺寸:随窗口大小 / 屏幕旋转变化,需要在 resize / orientationchange 时刷新\nconst getViewportAttributes = (): Attributes => {\n if (typeof window === 'undefined') {\n return {};\n }\n return {\n 'browser.viewport.width': window.innerWidth,\n 'browser.viewport.height': window.innerHeight,\n 'browser.screen.width': window.screen?.width,\n 'browser.screen.height': window.screen?.height,\n };\n};\n\n// 网络信息:随 online / offline / connection.change 变化\nconst getNetworkAttributes = (): Attributes => {\n if (typeof navigator === 'undefined') {\n return {};\n }\n const connection = getConnection();\n return {\n [RUM_ATTRIBUTES.networkStatus]: navigator.onLine ? 'connected' : 'not_connected',\n 'network.effective_type': connection?.effectiveType,\n 'network.connection.type': connection?.type,\n };\n};\n\n// 设备与 User Agent 信息:进入页面时一次性读取,运行期不会变化,适合作为 Resource 公共属性。\nexport const getDeviceResourceAttributes = (): Attributes => {\n if (typeof navigator === 'undefined') {\n return {};\n }\n const uaData = getUserAgentData();\n const ua = navigator.userAgent;\n const browser = getBrowserInfo(ua);\n const osName = getOsName(ua, uaData?.platform);\n const deviceType = uaData?.mobile || /mobi|android|iphone|ipad|ipod/i.test(ua) ? 'mobile' : 'desktop';\n return {\n [RUM_ATTRIBUTES.deviceType]: deviceType,\n [RUM_ATTRIBUTES.userAgentName]: browser.name,\n [RUM_ATTRIBUTES.userAgentVersion]: browser.version,\n [RUM_ATTRIBUTES.userAgentOsName]: osName,\n };\n};\n\n// trailing debounce:windowMs 静默期内的多次触发只执行最后一次。\n// 适合 resize 这类\"用户停下来后才需要拿到最终值\"的场景。\nconst createDebounce = (fn: () => void, windowMs: number) => {\n let timer: number | undefined;\n return () => {\n if (timer !== undefined) {\n window.clearTimeout(timer);\n }\n timer = window.setTimeout(() => {\n timer = undefined;\n fn();\n }, windowMs);\n };\n};\n\n/**\n * 设备元数据采集插件。稳定的设备能力由 SDK 写入 Resource;这里只维护设备 ID 和运行期动态属性。\n *\n * 上报字段:\n * - `device.id`:设备级永久标识,存于 localStorage(默认 key 复用旧 session 插件以保留现网用户)。\n * - `user_agent.name` / `user_agent.version` / `user_agent.os.name`:User Agent 信息,写入 Resource。\n * - `browser.viewport.*` / `browser.screen.*`:视口与屏幕尺寸。\n * - `network.status` / `network.effective_type` / `network.connection.type`:网络信息。\n *\n * 实时更新:\n * - viewport 监听 `resize` / `orientationchange`,并经 250ms debounce 合并,避免拖窗口时高频触发;\n * 静默期结束后用最终值刷新 runtimeAttributes。\n * - network 监听 `online` / `offline` / `connection.change`(本身低频,不需要 throttle)。\n * - 二者只更新 in-memory 的 runtimeAttributes,不会主动产生新的 Span;\n * 更新后续生成的 Span 会带最新值。\n *\n * 与 session 插件的关系:device 跨会话持久(终身),session 有过期与续期(连续访问语义)。\n */\nexport const createDevicePlugin = (options: BkOTDevicePluginOptions = {}): BkOTPlugin => {\n const teardownCallbacks: Array<() => void> = [];\n return {\n name: 'device',\n init(context) {\n const storageKey =\n options.storageKey ?? `${DEFAULT_DEVICE_STORAGE_KEY}_${hashString(context.config.application.name)}`;\n const deviceId =\n typeof window === 'undefined' || options.persistentId !== true\n ? createRandomId('device')\n : readDeviceId(storageKey);\n\n context.setRuntimeAttributes({\n 'device.id': deviceId,\n // createDevicePlugin 作为扩展单独启用时,Resource 没有设备字段,仍回退到原有 runtime attributes 行为。\n ...(context.config.tracking.device === false ? getDeviceResourceAttributes() : {}),\n ...getViewportAttributes(),\n ...getNetworkAttributes(),\n });\n\n if (typeof window === 'undefined') {\n return;\n }\n\n const refreshViewport = createDebounce(() => {\n context.setRuntimeAttributes(getViewportAttributes());\n }, VIEWPORT_DEBOUNCE_MS);\n window.addEventListener('resize', refreshViewport);\n window.addEventListener('orientationchange', refreshViewport);\n teardownCallbacks.push(\n () => window.removeEventListener('resize', refreshViewport),\n () => window.removeEventListener('orientationchange', refreshViewport),\n );\n\n const refreshNetwork = () => {\n context.setRuntimeAttributes(getNetworkAttributes());\n };\n window.addEventListener('online', refreshNetwork);\n window.addEventListener('offline', refreshNetwork);\n teardownCallbacks.push(\n () => window.removeEventListener('online', refreshNetwork),\n () => window.removeEventListener('offline', refreshNetwork),\n );\n\n const connection = getConnection();\n // NetworkInformation 实现了 EventTarget;旧浏览器或某些 polyfill 可能没有 addEventListener,做能力检测\n if (connection && typeof connection.addEventListener === 'function') {\n connection.addEventListener('change', refreshNetwork);\n teardownCallbacks.push(() => {\n connection.removeEventListener?.('change', refreshNetwork);\n });\n }\n },\n shutdown() {\n while (teardownCallbacks.length) {\n teardownCallbacks.pop()?.();\n }\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n/**\n * 浏览器错误采集插件,负责捕获 JS 运行时错误、未处理的 Promise rejection、资源加载失败三类错误。\n *\n * 上报策略:\n * - 错误分析主数据统一使用 `span_type=error` 的 error span。\n * - 每个浏览器错误只生成一条原始 error Span,错误分组和风暴控制由服务端完成。\n *\n * 关键 attribute:\n * - `error.source`:错误来源,取值 `window.error` / `unhandledrejection` / `resource`。\n * - 资源错误额外带 `url.full`(经 redactUrl 脱敏)。\n * - JS 错误额外带 `code.filepath` / `code.lineno` / `code.column`。\n */\n\nimport { SpanStatusCode } from '@opentelemetry/api';\n\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_OUTCOME, RUM_SPAN_TYPE } from '../schema/span';\n\nimport type { BkOTPlugin, BkOTRuntimeContext } from '../core/plugin';\n\nconst getErrorMessage = (value: unknown) => {\n if (value instanceof Error) {\n return value.message;\n }\n if (typeof value === 'string') {\n return value;\n }\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n};\n\ninterface EmitErrorOptions {\n context: BkOTRuntimeContext;\n error: unknown;\n exceptionType?: string;\n extra?: Record<string, unknown>;\n source: string;\n}\n\nconst emitError = ({ context, error, exceptionType, extra = {}, source }: EmitErrorOptions) => {\n if (!context.isSampled()) return;\n const occurredAt = Date.now();\n const message = getErrorMessage(error);\n context.notifyActivity({ time: occurredAt, type: 'error' });\n\n const resolvedExceptionType = exceptionType ?? (error instanceof Error ? error.name || 'Error' : source);\n const exceptionLike = error instanceof Error ? error : { message, name: resolvedExceptionType };\n const attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...context.config.hooks.getErrorAttributes(),\n ...buildRumSpanAttributes({\n outcome: RUM_SPAN_OUTCOME.error,\n spanType: RUM_SPAN_TYPE.error,\n }),\n 'error.message': message,\n 'error.handled': false,\n 'error.source': source,\n ...extra,\n };\n // 错误分析统一沉淀为 error span;若当前存在 active context,OTel 会自动建立父子关系。\n const errorSpan = context.startSpan(\n buildRumSpanName({ attributes, nameHint: resolvedExceptionType, spanType: RUM_SPAN_TYPE.error }),\n attributes,\n { startTime: occurredAt },\n );\n errorSpan.recordException(exceptionLike);\n errorSpan.setStatus({ code: SpanStatusCode.ERROR, message });\n errorSpan.end();\n};\n\nexport const createErrorPlugin = (): BkOTPlugin => {\n const listeners: Array<() => void> = [];\n\n return {\n name: 'error',\n init(context) {\n if (typeof window === 'undefined') {\n return;\n }\n\n const onError = (event: ErrorEvent) => {\n emitError({\n context,\n source: 'window.error',\n error: event.error ?? event.message,\n extra: {\n 'code.filepath': event.filename,\n 'code.lineno': event.lineno,\n 'code.column': event.colno,\n },\n });\n };\n const onUnhandledRejection = (event: PromiseRejectionEvent) => {\n emitError({\n context,\n source: 'unhandledrejection',\n error: event.reason,\n exceptionType: event.reason instanceof Error ? event.reason.name : 'UnhandledRejection',\n });\n };\n const onResourceError = (event: Event) => {\n // JS 运行时错误是 ErrorEvent,已由 bubble 阶段的 onError 处理;这里只关心资源加载失败\n if (event instanceof ErrorEvent) return;\n const target = event.target;\n if (!(target instanceof Element)) return;\n const elementWithUrl = target as Element & { href?: string; src?: string };\n const resourceUrl = elementWithUrl.src || elementWithUrl.href || (target as HTMLMediaElement).currentSrc || '';\n emitError({\n context,\n source: 'resource',\n error: new Error(`Resource load failed: ${target.tagName.toLowerCase()} ${resourceUrl}`),\n exceptionType: 'ResourceError',\n extra: {\n 'url.full': context.config.hooks.redactUrl(resourceUrl),\n },\n });\n };\n\n window.addEventListener('error', onError);\n window.addEventListener('unhandledrejection', onUnhandledRejection);\n window.addEventListener('error', onResourceError, true);\n listeners.push(\n () => window.removeEventListener('error', onError),\n () => window.removeEventListener('unhandledrejection', onUnhandledRejection),\n () => window.removeEventListener('error', onResourceError, true),\n );\n },\n shutdown() {\n while (listeners.length) {\n listeners.pop()?.();\n }\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\nimport { createRandomId } from '../core/id';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_TYPE } from '../schema/span';\n\nimport type { BkOTPlugin } from '../core/plugin';\nimport type { Attributes } from '@opentelemetry/api';\n\n/**\n * 主线程阻塞优先使用 Long Animation Frame API 获取脚本归因,不支持时回退到 Long Tasks API;\n * span 保留单次诊断详情,分布与计数由服务端从原始事件计算。\n */\nexport interface BkOTLongTaskPluginOptions {\n /** 采集阈值,默认 50ms。Performance API 本身通常只产生大于 50ms 的条目。 */\n threshold?: number;\n}\n\ninterface LegacyLongTaskEntry extends PerformanceEntry {\n attribution?: Array<{\n containerId?: string;\n containerName?: string;\n containerSrc?: string;\n containerType?: string;\n name?: string;\n }>;\n}\n\ninterface LongAnimationFrameEntry extends PerformanceEntry {\n blockingDuration: number;\n firstUIEventTimestamp: number;\n renderStart: number;\n scripts: ScriptTiming[];\n styleAndLayoutStart: number;\n}\n\ninterface ScriptTiming {\n duration: number;\n executionStart: number;\n forcedStyleAndLayoutDuration: number;\n invoker: string;\n invokerType: string;\n pauseDuration: number;\n sourceCharPosition: number;\n sourceFunctionName: string;\n sourceURL: string;\n startTime: number;\n windowAttribution: string;\n}\n\nconst DEFAULT_THRESHOLD = 50;\n\nconst nonNegativeNumber = (value: number | undefined, fallback: number) =>\n typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : fallback;\n\nconst finiteNumber = (value: number | undefined) => (Number.isFinite(value) ? value : undefined);\n\nconst getLegacyAttributionAttributes = (\n attribution: NonNullable<LegacyLongTaskEntry['attribution']>[number],\n redactUrl: (url: string) => string,\n): Attributes => ({\n ...(attribution.containerId ? { 'long_task.attribution.container_id': attribution.containerId } : {}),\n ...(attribution.containerName ? { 'long_task.attribution.container_name': attribution.containerName } : {}),\n ...(attribution.containerSrc ? { 'long_task.attribution.container_src': redactUrl(attribution.containerSrc) } : {}),\n ...(attribution.containerType ? { 'long_task.attribution.container_type': attribution.containerType } : {}),\n ...(attribution.name ? { 'long_task.attribution.name': attribution.name } : {}),\n});\n\nconst getScriptAttributes = (script: ScriptTiming, redactUrl: (url: string) => string): Attributes => ({\n 'long_task.script.duration': script.duration,\n 'long_task.script.execution_start': script.executionStart,\n 'long_task.script.forced_style_and_layout_duration': script.forcedStyleAndLayoutDuration,\n 'long_task.script.invoker': script.invoker,\n 'long_task.script.invoker_type': script.invokerType,\n 'long_task.script.pause_duration': script.pauseDuration,\n 'long_task.script.source_char_position': script.sourceCharPosition,\n 'long_task.script.source_function_name': script.sourceFunctionName,\n 'long_task.script.source_url': script.sourceURL ? redactUrl(script.sourceURL) : '',\n 'long_task.script.start_time': script.startTime,\n 'long_task.script.window_attribution': script.windowAttribution,\n});\n\nexport const createLongTaskPlugin = (options: BkOTLongTaskPluginOptions = {}): BkOTPlugin => {\n const threshold = nonNegativeNumber(options.threshold, DEFAULT_THRESHOLD);\n let observer: PerformanceObserver | undefined;\n let initialBatchTimer: ReturnType<typeof setTimeout> | undefined;\n let initialEntries: PerformanceEntry[] = [];\n\n return {\n name: 'long-task',\n init(context) {\n if (typeof PerformanceObserver === 'undefined' || typeof performance === 'undefined') return;\n const supportedEntryTypes = PerformanceObserver.supportedEntryTypes ?? [];\n // LoAF 提供脚本归因与 blockingDuration,支持时优先使用;旧浏览器回退到 longtask。\n const entryType = supportedEntryTypes.includes('long-animation-frame')\n ? 'long-animation-frame'\n : supportedEntryTypes.includes('longtask')\n ? 'longtask'\n : undefined;\n if (!entryType) return;\n\n const emitEntry = (entry: LegacyLongTaskEntry | LongAnimationFrameEntry) => {\n if (!context.isSampled()) return;\n if (!Number.isFinite(entry.duration) || entry.duration < threshold) return;\n const isLoaf = entry.entryType === 'long-animation-frame';\n const loaf = isLoaf ? (entry as LongAnimationFrameEntry) : undefined;\n const scripts = loaf?.scripts ?? [];\n const id = createRandomId('long-task');\n const startTime = performance.timeOrigin + entry.startTime;\n const endTime = startTime + entry.duration;\n const entryTypeAttribute = isLoaf ? 'long-animation-frame' : 'long-task';\n const legacyAttributions = isLoaf ? [] : ((entry as LegacyLongTaskEntry).attribution ?? []);\n const attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...buildRumSpanAttributes({\n spanType: RUM_SPAN_TYPE.longTask,\n }),\n ...(finiteNumber(loaf?.blockingDuration) !== undefined\n ? { [RUM_ATTRIBUTES.longTaskBlockingDuration]: loaf!.blockingDuration }\n : {}),\n [RUM_ATTRIBUTES.longTaskEntryType]: entryTypeAttribute,\n [RUM_ATTRIBUTES.longTaskId]: id,\n 'long_task.name': entry.name,\n ...(finiteNumber(loaf?.firstUIEventTimestamp) !== undefined\n ? { 'long_task.first_ui_event_timestamp': loaf!.firstUIEventTimestamp }\n : {}),\n ...(finiteNumber(loaf?.renderStart) !== undefined ? { 'long_task.render_start': loaf!.renderStart } : {}),\n ...(finiteNumber(loaf?.styleAndLayoutStart) !== undefined\n ? { 'long_task.style_and_layout_start': loaf!.styleAndLayoutStart }\n : {}),\n };\n const span = context.startSpan(buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.longTask }), attributes, {\n startTime,\n });\n scripts.forEach(script => {\n span.addEvent(\n 'long_task.script',\n context.applyRedact(getScriptAttributes(script, context.config.hooks.redactUrl)),\n performance.timeOrigin + script.startTime,\n );\n });\n legacyAttributions.forEach((attribution, index) => {\n span.addEvent(\n 'long_task.attribution',\n context.applyRedact({\n 'long_task.attribution.index': index,\n ...getLegacyAttributionAttributes(attribution, context.config.hooks.redactUrl),\n }),\n startTime,\n );\n });\n span.end(endTime);\n context.notifyActivity({ endTime, startTime, type: 'long_task' });\n };\n\n const emitEntries = (entries: PerformanceEntry[]) =>\n entries.forEach(entry => emitEntry(entry as LegacyLongTaskEntry));\n try {\n let initializing = true;\n observer = new PerformanceObserver(list => {\n const entries = list.getEntries();\n if (initializing) {\n // buffered 条目可能在 observe() 内同步回调,先合并到下一宏任务,等 Session/View 上下文就绪后再归属。\n initialEntries.push(...entries);\n if (!initialBatchTimer) {\n initialBatchTimer = setTimeout(() => {\n const entriesToEmit = initialEntries;\n initialEntries = [];\n initialBatchTimer = undefined;\n emitEntries(entriesToEmit);\n });\n }\n } else {\n emitEntries(entries);\n }\n });\n observer.observe({ type: entryType, buffered: true });\n initializing = false;\n } catch {\n observer = undefined;\n }\n },\n shutdown() {\n observer?.disconnect();\n observer = undefined;\n clearTimeout(initialBatchTimer);\n initialBatchTimer = undefined;\n initialEntries = [];\n },\n };\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nexport interface RouteChangeEvent {\n fromUrl: string;\n source: RouteChangeSource;\n toUrl: string;\n}\n\nexport type RouteChangeSource = 'hashchange' | 'popstate' | 'pushState' | 'replaceState';\n\ntype RouteChangeHandler = (event: RouteChangeEvent) => void;\n\nconst subscribers = new Set<RouteChangeHandler>();\n\n// History 只 patch 一次,多个插件/实例共用订阅集合;最后一个订阅者退出时恢复原方法。\nlet lastUrl = '';\nlet originalPushState: typeof history.pushState | undefined;\nlet originalReplaceState: typeof history.replaceState | undefined;\nlet patched = false;\n\nconst getCurrentUrl = () => (typeof location === 'undefined' ? '' : location.href);\n\nconst emitRouteChange = (source: RouteChangeSource, fromUrl: string) => {\n const toUrl = getCurrentUrl();\n lastUrl = toUrl;\n const event: RouteChangeEvent = { fromUrl, source, toUrl };\n\n for (const subscriber of Array.from(subscribers)) {\n subscriber(event);\n }\n};\n\nconst onPopState = () => {\n emitRouteChange('popstate', lastUrl || getCurrentUrl());\n};\n\nconst onHashChange = () => {\n emitRouteChange('hashchange', lastUrl || getCurrentUrl());\n};\n\nconst patchHistory = () => {\n if (patched || typeof window === 'undefined' || typeof history === 'undefined') {\n return;\n }\n\n patched = true;\n lastUrl = getCurrentUrl();\n originalPushState = history.pushState;\n originalReplaceState = history.replaceState;\n\n history.pushState = function patchedPushState(this: History, data: any, title: string, url?: null | string | URL) {\n const fromUrl = lastUrl || getCurrentUrl();\n // 先执行原方法,让订阅者读取到的 location 与浏览器最终状态一致。\n const result = originalPushState?.apply(this, [data, title, url]);\n emitRouteChange('pushState', fromUrl);\n return result;\n };\n history.replaceState = function patchedReplaceState(\n this: History,\n data: any,\n title: string,\n url?: null | string | URL,\n ) {\n const fromUrl = lastUrl || getCurrentUrl();\n const result = originalReplaceState?.apply(this, [data, title, url]);\n emitRouteChange('replaceState', fromUrl);\n return result;\n };\n window.addEventListener('popstate', onPopState);\n window.addEventListener('hashchange', onHashChange);\n};\n\nconst restoreHistory = () => {\n if (!patched || typeof window === 'undefined' || typeof history === 'undefined') {\n return;\n }\n\n if (originalPushState) {\n history.pushState = originalPushState;\n }\n if (originalReplaceState) {\n history.replaceState = originalReplaceState;\n }\n window.removeEventListener('popstate', onPopState);\n window.removeEventListener('hashchange', onHashChange);\n originalPushState = undefined;\n originalReplaceState = undefined;\n patched = false;\n lastUrl = '';\n};\n\nexport const subscribeRouteChange = (handler: RouteChangeHandler) => {\n if (typeof window === 'undefined' || typeof history === 'undefined') {\n return () => {};\n }\n\n patchHistory();\n subscribers.add(handler);\n\n return () => {\n subscribers.delete(handler);\n if (subscribers.size === 0) {\n restoreHistory();\n }\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n/**\n * Page View 插件\n *\n * 自动模式监听初始加载、SPA 路由和 BFCache;手动模式仅由 startView() 划分 View。\n *\n * 上报形态:使用 view.name 命名的 start/update/end 原始生命周期事件 span。\n *\n * 自动边界与 Datadog 对齐:pathname 或非锚点 hash path 改变才创建 View,query-only 变化不创建。\n *\n * 关键属性:\n * - view.url:当前页面 URL(经 redactUrl 脱敏)\n * - view.previous:跳转前的 URL(来自 route-observer 的 fromUrl,初始 load 为空字符串)\n * - view.previous_url_template:跳转前 URL 的低基数路由模板,初始 load 为空字符串\n * - view.referrer:仅初始加载且值非空时携带\n */\n\nimport { createRandomId } from '../core/id';\nimport { waitForPageActivityEnd } from '../core/page-activity';\nimport { subscribeRouteChange } from '../core/route-observer';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_TYPE } from '../schema/span';\n\nimport type { BkOTPlugin } from '../core/plugin';\nimport type { BkOTStartViewOptions, BkOTViewContext } from '../core/runtime-context';\nimport type { Attributes } from '@opentelemetry/api';\n\ninterface ActiveView {\n attributes: Attributes;\n id: string;\n loadingTime?: number;\n loadingTimeSource?: 'auto' | 'manual';\n loadingType: ViewLoadingType;\n /** 业务显式命名优先;未命名时使用 view.url_template */\n name?: string;\n rawUrl: string;\n snapshotAttributes: Attributes;\n startedAt: number;\n url: string;\n urlTemplate: string;\n version: number;\n stopLoadingTime?: () => void;\n}\n\ntype ViewLoadingType = NonNullable<BkOTViewContext['loadingType']>;\n\nconst PROTECTED_ATTRIBUTE_KEYS = new Set<string>(Object.values(RUM_ATTRIBUTES));\n\nconst getCurrentUrl = () => {\n if (typeof location === 'undefined') {\n return '';\n }\n return location.href;\n};\n\nconst getNavigationTimingAttributes = (): Attributes => {\n if (typeof performance === 'undefined') return {};\n const navigation = performance.getEntriesByType('navigation')[0] as PerformanceNavigationTiming | undefined;\n if (!navigation) return {};\n const attributes: Attributes = {};\n const setTiming = (key: string, value: number) => {\n if (Number.isFinite(value) && value > 0) attributes[key] = value;\n };\n setTiming(RUM_ATTRIBUTES.viewFirstByte, navigation.responseStart);\n setTiming(RUM_ATTRIBUTES.viewDomInteractive, navigation.domInteractive);\n setTiming(RUM_ATTRIBUTES.viewDomContentLoaded, navigation.domContentLoadedEventEnd);\n setTiming(RUM_ATTRIBUTES.viewDomComplete, navigation.domComplete);\n setTiming(RUM_ATTRIBUTES.viewLoadEvent, navigation.loadEventEnd);\n return attributes;\n};\n\nconst getHashPath = (hash: string) => {\n const queryIndex = hash.indexOf('?');\n return queryIndex < 0 ? hash : hash.slice(0, queryIndex);\n};\n\nconst isHashAnchor = (hash: string) => {\n const id = hash.slice(1);\n if (!id || typeof document === 'undefined' || typeof document.getElementById !== 'function') return false;\n try {\n return Boolean(document.getElementById(decodeURIComponent(id)));\n } catch {\n return Boolean(document.getElementById(id));\n }\n};\n\nexport const isViewLocationChange = (fromUrl: string, toUrl: string) => {\n try {\n const base = typeof location === 'undefined' ? 'http://localhost' : location.href;\n const from = new URL(fromUrl, base);\n const to = new URL(toUrl, base);\n return from.pathname !== to.pathname || (!isHashAnchor(to.hash) && getHashPath(from.hash) !== getHashPath(to.hash));\n } catch {\n return fromUrl !== toUrl;\n }\n};\n\nexport const createPageViewPlugin = (): BkOTPlugin => {\n const teardownCallbacks: Array<() => void> = [];\n\n return {\n name: 'page-view',\n init(context) {\n if (typeof window === 'undefined') {\n return;\n }\n\n let activeView: ActiveView | undefined;\n let bfCacheView: Omit<ActiveView, 'stopLoadingTime'> | undefined;\n let renewalView: Omit<ActiveView, 'stopLoadingTime'> | undefined;\n\n const clearViewContext = (changedAt = Date.now()) => context.setView({}, changedAt);\n\n const emitViewEvent = (\n view: ActiveView,\n phase: 'end' | 'start' | 'update',\n timestamp = Date.now(),\n reason?: string,\n ) => {\n view.version += 1;\n const attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...view.attributes,\n ...view.snapshotAttributes,\n [RUM_ATTRIBUTES.viewPhase]: phase,\n [RUM_ATTRIBUTES.viewStartedAt]: view.startedAt,\n [RUM_ATTRIBUTES.viewVersion]: view.version,\n ...(reason ? { 'view.end_reason': reason } : {}),\n ...(view.loadingTime === undefined\n ? {}\n : {\n [RUM_ATTRIBUTES.viewLoadingTime]: view.loadingTime,\n [RUM_ATTRIBUTES.viewLoadingTimeSource]: view.loadingTimeSource,\n }),\n };\n const span = context.startSpan(buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.view }), attributes, {\n contextTime: timestamp,\n rumSpanType: RUM_SPAN_TYPE.view,\n startTime: timestamp,\n });\n span.end(timestamp);\n };\n\n const endActiveView = (reason: string, clearContext = true, endedAt = Date.now()) => {\n if (!activeView) {\n if (clearContext) clearViewContext(endedAt);\n return undefined;\n }\n const snapshot = { ...activeView };\n activeView.stopLoadingTime?.();\n emitViewEvent(activeView, 'end', endedAt, reason);\n activeView = undefined;\n if (clearContext) clearViewContext(endedAt);\n const { stopLoadingTime: _stopLoadingTime, ...rest } = snapshot;\n return rest;\n };\n\n const setLoadingTime = (view: ActiveView, duration: number, source: 'auto' | 'manual') => {\n if (activeView !== view || !Number.isFinite(duration) || duration < 0) return;\n const navigationTimingAttributes = view.loadingType === 'initial_load' ? getNavigationTimingAttributes() : {};\n const updatedAttributes = {\n ...navigationTimingAttributes,\n [RUM_ATTRIBUTES.viewLoadingTime]: duration,\n [RUM_ATTRIBUTES.viewLoadingTimeSource]: source,\n };\n Object.assign(view.snapshotAttributes, updatedAttributes);\n view.loadingTime = duration;\n view.loadingTimeSource = source;\n emitViewEvent(view, 'update');\n };\n\n const startLoadingTimeTracking = (view: ActiveView) => {\n if (!context.config.view.loadingTime || document.visibilityState === 'hidden') return;\n let activityResolved = false;\n let activityCandidate: number | undefined;\n let loadResolved = view.loadingType !== 'initial_load';\n let loadCandidate: number | undefined;\n let loadListener: (() => void) | undefined;\n let hidden = false;\n let visibilityListener: (() => void) | undefined;\n\n const tryComplete = () => {\n if (hidden || !activityResolved || !loadResolved || activeView !== view) return;\n const candidates = [activityCandidate, loadCandidate].filter(\n (candidate): candidate is number => candidate !== undefined,\n );\n if (candidates.length) setLoadingTime(view, Math.max(...candidates), 'auto');\n view.stopLoadingTime?.();\n view.stopLoadingTime = undefined;\n };\n\n const readLoadEvent = () => {\n const navigation = performance.getEntriesByType?.('navigation')[0] as PerformanceNavigationTiming | undefined;\n if (!navigation?.loadEventEnd) return false;\n loadCandidate = Math.max(0, performance.timeOrigin + navigation.loadEventEnd - view.startedAt);\n loadResolved = true;\n return true;\n };\n\n if (!loadResolved && !readLoadEvent()) {\n const onLoad = () => {\n setTimeout(() => {\n if (activeView !== view) return;\n readLoadEvent();\n loadResolved = true;\n tryComplete();\n });\n };\n window.addEventListener('load', onLoad, { once: true });\n loadListener = () => window.removeEventListener('load', onLoad);\n }\n\n const stopActivity = waitForPageActivityEnd(context, view.startedAt, result => {\n activityResolved = true;\n if (result.hadActivity) activityCandidate = Math.max(0, result.endTime - view.startedAt);\n tryComplete();\n });\n const onVisibilityChange = () => {\n if (document.visibilityState !== 'hidden') return;\n hidden = true;\n view.stopLoadingTime?.();\n view.stopLoadingTime = undefined;\n };\n document.addEventListener('visibilitychange', onVisibilityChange);\n visibilityListener = () => document.removeEventListener('visibilitychange', onVisibilityChange);\n view.stopLoadingTime = () => {\n stopActivity();\n loadListener?.();\n loadListener = undefined;\n visibilityListener?.();\n visibilityListener = undefined;\n };\n tryComplete();\n };\n\n const sanitizeViewAttributes = (attributes: Attributes | undefined) => {\n const redacted = context.applyRedact(attributes ?? {});\n return Object.fromEntries(\n Object.entries(redacted).filter(([key, value]) => value !== undefined && !PROTECTED_ATTRIBUTE_KEYS.has(key)),\n ) as Attributes;\n };\n\n const startView = (\n options: BkOTStartViewOptions,\n source: string,\n loadingType: ViewLoadingType,\n previousUrl = activeView?.rawUrl ?? '',\n ) => {\n if (!context.isSessionActive()) return;\n const currentUrl = options.url ?? getCurrentUrl();\n const urlTemplate = context.config.hooks.getViewUrlTemplate(currentUrl);\n const previousUrlTemplate = previousUrl ? context.config.hooks.getViewUrlTemplate(previousUrl) : '';\n const name = options.name ?? urlTemplate;\n const customAttributes = sanitizeViewAttributes(options.attributes);\n endActiveView(source, false);\n\n const viewId = createRandomId('view');\n const redactedCurrentUrl = context.config.hooks.redactUrl(currentUrl);\n const redactedPreviousUrl = context.config.hooks.redactUrl(previousUrl);\n const isInitialLoad = loadingType === 'initial_load';\n const startedAt = isInitialLoad && typeof performance !== 'undefined' ? performance.timeOrigin : Date.now();\n const navigationTimingAttributes = isInitialLoad ? getNavigationTimingAttributes() : {};\n\n context.setView(\n {\n attributes: customAttributes,\n id: viewId,\n loadingType,\n name,\n startedAt,\n url: redactedCurrentUrl,\n urlTemplate,\n },\n startedAt,\n );\n\n const viewAttributes = {\n ...customAttributes,\n ...context.config.hooks.getPageAttributes(),\n ...navigationTimingAttributes,\n ...buildRumSpanAttributes({\n spanType: RUM_SPAN_TYPE.view,\n }),\n [RUM_ATTRIBUTES.viewId]: viewId,\n ...(name ? { [RUM_ATTRIBUTES.viewName]: name } : {}),\n [RUM_ATTRIBUTES.viewUrl]: redactedCurrentUrl,\n [RUM_ATTRIBUTES.viewUrlTemplate]: urlTemplate,\n [RUM_ATTRIBUTES.viewLoadingType]: loadingType,\n [RUM_ATTRIBUTES.viewPrevious]: redactedPreviousUrl,\n [RUM_ATTRIBUTES.viewPreviousUrlTemplate]: previousUrlTemplate,\n ...(isInitialLoad && document.referrer\n ? { [RUM_ATTRIBUTES.viewReferrer]: context.config.hooks.redactUrl(document.referrer) }\n : {}),\n };\n activeView = {\n attributes: customAttributes,\n version: 0,\n id: viewId,\n loadingType,\n name,\n rawUrl: currentUrl,\n snapshotAttributes: viewAttributes,\n startedAt,\n url: redactedCurrentUrl,\n urlTemplate,\n };\n emitViewEvent(activeView, 'start', startedAt);\n startLoadingTimeTracking(activeView);\n };\n\n const unsubscribeViewCommands = context.onViewCommand(command => {\n if (command.type === 'start') {\n startView(command.options, 'manual', activeView ? 'route_change' : 'initial_load');\n return;\n }\n if (!activeView) return;\n if (command.type === 'set_loading_time') {\n activeView.stopLoadingTime?.();\n activeView.stopLoadingTime = undefined;\n setLoadingTime(activeView, Math.max(0, command.time - activeView.startedAt), 'manual');\n return;\n }\n if (activeView.name === command.name) return;\n activeView.name = command.name;\n activeView.snapshotAttributes[RUM_ATTRIBUTES.viewName] = command.name;\n context.setView({\n attributes: activeView.attributes,\n id: activeView.id,\n loadingType: activeView.loadingType,\n name: activeView.name,\n startedAt: activeView.startedAt,\n url: activeView.url,\n urlTemplate: activeView.urlTemplate,\n });\n emitViewEvent(activeView, 'update');\n });\n\n let unsubscribeRoute = () => {};\n if (context.config.view.tracking === 'auto') {\n if (!activeView) startView({}, 'load', 'initial_load');\n unsubscribeRoute = subscribeRouteChange(event => {\n if (isViewLocationChange(event.fromUrl, event.toUrl)) {\n startView({}, event.source, 'route_change', event.fromUrl);\n }\n });\n }\n\n const onPageHide = (event: PageTransitionEvent) => {\n if (event.persisted) {\n bfCacheView = endActiveView('bfcache');\n return;\n }\n bfCacheView = undefined;\n endActiveView('pagehide');\n };\n const onPageShow = (event: PageTransitionEvent) => {\n if (event.persisted && context.config.view.tracking === 'auto') {\n const restoredView = bfCacheView;\n bfCacheView = undefined;\n if (!context.isSessionActive()) {\n renewalView = restoredView;\n return;\n }\n startView(\n restoredView\n ? { attributes: restoredView.attributes, name: restoredView.name, url: restoredView.rawUrl }\n : {},\n 'bfCache',\n 'bf_cache',\n restoredView?.rawUrl,\n );\n }\n };\n const unsubscribeSessionLifecycle = context.onSessionLifecycle(event => {\n if (event.type === 'expired') {\n renewalView = endActiveView('session_expired', true, event.expiredAt) ?? bfCacheView;\n bfCacheView = undefined;\n return;\n }\n if (renewalView) {\n startView(\n { attributes: renewalView.attributes, name: renewalView.name, url: renewalView.rawUrl },\n 'sessionRenewal',\n 'session_renewal',\n renewalView.rawUrl,\n );\n renewalView = undefined;\n }\n });\n window.addEventListener('pagehide', onPageHide);\n window.addEventListener('pageshow', onPageShow);\n\n teardownCallbacks.push(\n unsubscribeRoute,\n unsubscribeSessionLifecycle,\n unsubscribeViewCommands,\n () => window.removeEventListener('pagehide', onPageHide),\n () => window.removeEventListener('pageshow', onPageShow),\n () => endActiveView('shutdown'),\n );\n },\n shutdown() {\n while (teardownCallbacks.length) {\n teardownCallbacks.pop()?.();\n }\n },\n };\n};\n","export interface ActiveSessionRecord {\n expiresAt: number;\n id: string;\n startedAt: number;\n status: 'active';\n}\n\nexport interface ExpiredSessionRecord {\n expiredAt: number;\n previousId: string;\n reason: SessionExpireReason;\n status: 'expired';\n}\n\n/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\nexport type SessionExpireReason = 'inactivity' | 'maxLifetime';\n\nexport type SessionRecord = ActiveSessionRecord | ExpiredSessionRecord;\n\nconst FUTURE_CLOCK_TOLERANCE_MS = 5_000;\n\nconst isTimestamp = (value: unknown): value is number =>\n typeof value === 'number' && Number.isFinite(value) && value > 0;\n\nexport const createActiveSessionRecord = (\n id: string,\n now: number,\n idleTimeoutMs: number,\n maxDurationMs: number,\n): ActiveSessionRecord => ({\n expiresAt: Math.min(now + idleTimeoutMs, now + maxDurationMs),\n id,\n startedAt: now,\n status: 'active',\n});\n\nexport const getSessionExpireReason = (\n record: ActiveSessionRecord,\n now: number,\n maxDurationMs: number,\n): SessionExpireReason | undefined => {\n if (now >= record.startedAt + maxDurationMs) return 'maxLifetime';\n if (now >= record.expiresAt) return 'inactivity';\n return undefined;\n};\n\nexport const expandActiveSession = (\n record: ActiveSessionRecord,\n now: number,\n idleTimeoutMs: number,\n maxDurationMs: number,\n): ActiveSessionRecord => ({\n ...record,\n expiresAt: Math.min(now + idleTimeoutMs, record.startedAt + maxDurationMs),\n});\n\nexport const parseSessionRecord = (raw: null | string, now: number, maxDurationMs: number): null | SessionRecord => {\n if (!raw) return null;\n try {\n const parsed = JSON.parse(raw) as Partial<SessionRecord>;\n if (\n parsed.status === 'active' &&\n typeof parsed.id === 'string' &&\n parsed.id.length > 0 &&\n isTimestamp(parsed.startedAt) &&\n // 容忍轻微时钟漂移,但拒绝远期时间与超出最大生命周期的记录,避免脏 storage 永久续期。\n parsed.startedAt <= now + FUTURE_CLOCK_TOLERANCE_MS &&\n isTimestamp(parsed.expiresAt) &&\n parsed.expiresAt >= parsed.startedAt &&\n parsed.expiresAt <= parsed.startedAt + maxDurationMs\n ) {\n return parsed as ActiveSessionRecord;\n }\n if (\n parsed.status === 'expired' &&\n typeof parsed.previousId === 'string' &&\n parsed.previousId.length > 0 &&\n (parsed.reason === 'inactivity' || parsed.reason === 'maxLifetime') &&\n isTimestamp(parsed.expiredAt) &&\n parsed.expiredAt <= now + FUTURE_CLOCK_TOLERANCE_MS\n ) {\n return parsed as ExpiredSessionRecord;\n }\n } catch {\n /* JSON 损坏视为无记录 */\n }\n return null;\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n/**\n * Session 插件\n *\n * 生命周期:\n * - 首次访问创建 session;用户交互会续期有效 session,或重建已过期 session\n * - 固定 15 分钟无活动 / 4 小时最长生命周期,任一到达时立即清理运行时 session.id\n * - 页面重新可见时只续期有效 session,不会复活已过期 session\n * - 跨 tab 共享持久化状态;本 tab 过期后不会被其他 tab 的新 session 被动复活\n */\n\nimport { hashString } from '../core/hash';\nimport { createRandomId } from '../core/id';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_TYPE } from '../schema/span';\nimport {\n createActiveSessionRecord,\n expandActiveSession,\n getSessionExpireReason,\n parseSessionRecord,\n} from './session-state';\n\nimport type { BkOTPlugin, BkOTRuntimeContext } from '../core/plugin';\nimport type { ActiveSessionRecord, ExpiredSessionRecord, SessionExpireReason, SessionRecord } from './session-state';\n\nexport interface BkOTSessionConfig {\n /** 以 0~1 表示的 Session 采样率,默认 1。 */\n sampleRate?: number;\n // 自定义 storage key;不传则按 endpoint host 自动生成隔离后缀\n storageKey?: string;\n}\n\nconst SESSION_IDLE_TIMEOUT_MS = 15 * 60 * 1000;\nconst SESSION_MAX_DURATION_MS = 4 * 60 * 60 * 1000;\nconst ACTIVITY_THROTTLE_MS = 1_000;\nconst VISIBILITY_CHECK_MS = 60_000;\nconst ACTIVITY_EVENTS: Array<keyof WindowEventMap> = ['click', 'keydown', 'scroll', 'touchstart'];\nconst memoryRecords = new Map<string, string>();\n\ninterface SessionStorage {\n isLocalStorage: () => boolean;\n read: () => null | string;\n write: (record: SessionRecord) => void;\n}\n\nconst createSessionStorage = (storageKey: string): SessionStorage => {\n let localStorageAvailable = typeof window !== 'undefined';\n\n const read = () => {\n if (localStorageAvailable) {\n try {\n return window.localStorage.getItem(storageKey);\n } catch {\n localStorageAvailable = false;\n }\n }\n return memoryRecords.get(storageKey) ?? null;\n };\n\n const write = (record: SessionRecord) => {\n const serialized = JSON.stringify(record);\n memoryRecords.set(storageKey, serialized);\n if (!localStorageAvailable) return;\n try {\n window.localStorage.setItem(storageKey, serialized);\n } catch {\n localStorageAvailable = false;\n }\n };\n\n read();\n return { isLocalStorage: () => localStorageAvailable, read, write };\n};\n\nconst buildDefaultStorageKey = (endpoint: string, applicationName: string) => {\n let suffix = '';\n try {\n suffix = new URL(endpoint).host;\n } catch {\n suffix = endpoint;\n }\n return `bk_ot_session__${hashString(`${applicationName}\\0${suffix || 'default'}`)}`;\n};\n\nconst emitSessionEvent = (\n context: BkOTRuntimeContext,\n phase: 'end' | 'rotate' | 'start',\n sessionId: string,\n timestamp: number,\n) => {\n const attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...buildRumSpanAttributes({\n spanType: RUM_SPAN_TYPE.session,\n }),\n [RUM_ATTRIBUTES.sessionPhase]: phase,\n [RUM_ATTRIBUTES.sessionHasReplay]: false,\n [RUM_ATTRIBUTES.sessionId]: sessionId,\n [RUM_ATTRIBUTES.sessionType]: 'user',\n };\n const span = context.startSpan(buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.session }), attributes, {\n contextTime: timestamp,\n startTime: timestamp,\n });\n span.end(timestamp);\n};\n\nexport const createSessionPlugin = (options: BkOTSessionConfig = {}): BkOTPlugin => {\n const teardownCallbacks: Array<() => void> = [];\n\n return {\n name: 'session',\n init(context) {\n if (typeof window === 'undefined' || typeof document === 'undefined') {\n const now = Date.now();\n const sessionId = createRandomId('session');\n context.setRuntimeAttributes(\n {\n [RUM_ATTRIBUTES.sessionHasReplay]: false,\n [RUM_ATTRIBUTES.sessionId]: sessionId,\n [RUM_ATTRIBUTES.sessionType]: 'user',\n },\n now,\n );\n return;\n }\n\n const storageKey =\n options.storageKey ??\n buildDefaultStorageKey(context.config.transport.endpoint, context.config.application.name);\n const storage = createSessionStorage(storageKey);\n const documentStartedAt =\n typeof performance !== 'undefined' && Number.isFinite(performance.timeOrigin)\n ? performance.timeOrigin\n : Date.now();\n let currentSessionId: string | undefined;\n let expirationTimeout: ReturnType<typeof setTimeout> | undefined;\n\n const readRecord = (now = Date.now()) => parseSessionRecord(storage.read(), now, SESSION_MAX_DURATION_MS);\n\n const clearExpirationTimeout = () => {\n if (expirationTimeout !== undefined) {\n clearTimeout(expirationTimeout);\n expirationTimeout = undefined;\n }\n };\n\n const deactivate = (reason: 'external' | SessionExpireReason, expiredAt = Date.now()) => {\n const expiredSessionId = currentSessionId;\n if (!expiredSessionId) return;\n context.notifySessionLifecycle({\n expiredAt,\n id: expiredSessionId,\n reason,\n type: 'expired',\n });\n emitSessionEvent(context, 'end', expiredSessionId, expiredAt);\n clearExpirationTimeout();\n currentSessionId = undefined;\n context.setRuntimeAttributes(\n {\n [RUM_ATTRIBUTES.sessionHasReplay]: undefined,\n [RUM_ATTRIBUTES.sessionId]: undefined,\n [RUM_ATTRIBUTES.sessionType]: undefined,\n },\n expiredAt,\n );\n void context.flush();\n };\n\n const expireCurrentSession = () => {\n const now = Date.now();\n const record = readRecord(now);\n if (!record) {\n deactivate('external', now);\n return;\n }\n if (record.status === 'expired') {\n deactivate(record.reason, record.expiredAt);\n return;\n }\n if (record.id !== currentSessionId) {\n deactivate('external', now);\n return;\n }\n const reason = getSessionExpireReason(record, now, SESSION_MAX_DURATION_MS);\n if (!reason) {\n scheduleExpiration(record);\n return;\n }\n const expired: ExpiredSessionRecord = {\n expiredAt: now,\n previousId: record.id,\n reason,\n status: 'expired',\n };\n storage.write(expired);\n deactivate(reason, now);\n };\n\n const scheduleExpiration = (record: ActiveSessionRecord) => {\n clearExpirationTimeout();\n const expiresAt = Math.min(record.expiresAt, record.startedAt + SESSION_MAX_DURATION_MS);\n expirationTimeout = setTimeout(expireCurrentSession, Math.max(0, expiresAt - Date.now()));\n };\n\n const activate = (\n record: ActiveSessionRecord,\n lifecycle?: {\n previousId?: string;\n reason: 'inactivity' | 'init' | 'maxLifetime' | 'shared';\n },\n ) => {\n const changed = record.id !== currentSessionId;\n currentSessionId = record.id;\n context.setRuntimeAttributes(\n {\n [RUM_ATTRIBUTES.sessionHasReplay]: false,\n [RUM_ATTRIBUTES.sessionId]: record.id,\n [RUM_ATTRIBUTES.sessionType]: 'user',\n },\n Math.min(record.startedAt, documentStartedAt),\n );\n scheduleExpiration(record);\n if (changed && lifecycle) {\n context.notifySessionLifecycle({\n id: record.id,\n previousId: lifecycle.previousId,\n reason: lifecycle.reason,\n startedAt: record.startedAt,\n type: 'renewed',\n });\n }\n };\n\n const expandOrRenew = (isInitialization = false) => {\n const now = Date.now();\n const record = readRecord(now);\n if (record?.status === 'active' && !getSessionExpireReason(record, now, SESSION_MAX_DURATION_MS)) {\n const expanded = expandActiveSession(record, now, SESSION_IDLE_TIMEOUT_MS, SESSION_MAX_DURATION_MS);\n storage.write(expanded);\n activate(expanded, currentSessionId ? undefined : { reason: 'shared' });\n return;\n }\n\n const previousId = record?.status === 'expired' ? record.previousId : record?.id;\n const reason =\n record?.status === 'expired'\n ? record.reason\n : record\n ? getSessionExpireReason(record, now, SESSION_MAX_DURATION_MS)\n : isInitialization\n ? 'init'\n : undefined;\n const created = createActiveSessionRecord(\n createRandomId('session'),\n now,\n SESSION_IDLE_TIMEOUT_MS,\n SESSION_MAX_DURATION_MS,\n );\n storage.write(created);\n activate(created, {\n previousId,\n reason: reason ?? 'init',\n });\n const lifecycleReason = reason ?? 'init';\n emitSessionEvent(context, lifecycleReason === 'init' ? 'start' : 'rotate', created.id, created.startedAt);\n };\n\n const expandOnly = () => {\n if (!currentSessionId) return;\n const now = Date.now();\n const record = readRecord(now);\n if (\n record?.status !== 'active' ||\n record.id !== currentSessionId ||\n getSessionExpireReason(record, now, SESSION_MAX_DURATION_MS)\n ) {\n expireCurrentSession();\n return;\n }\n const expanded = expandActiveSession(record, now, SESSION_IDLE_TIMEOUT_MS, SESSION_MAX_DURATION_MS);\n storage.write(expanded);\n activate(expanded);\n };\n\n expandOrRenew(true);\n\n let lastActivityAt = 0;\n const onActivity = () => {\n const now = Date.now();\n if (now - lastActivityAt < ACTIVITY_THROTTLE_MS) return;\n lastActivityAt = now;\n expandOrRenew();\n };\n const activityListenerOptions: AddEventListenerOptions = { capture: true, passive: true };\n ACTIVITY_EVENTS.forEach(eventName => window.addEventListener(eventName, onActivity, activityListenerOptions));\n teardownCallbacks.push(() => {\n ACTIVITY_EVENTS.forEach(eventName =>\n window.removeEventListener(eventName, onActivity, activityListenerOptions),\n );\n });\n\n const expandWhenVisible = () => {\n if (document.visibilityState === 'visible') expandOnly();\n };\n document.addEventListener('visibilitychange', expandWhenVisible);\n const visibilityInterval = window.setInterval(expandWhenVisible, VISIBILITY_CHECK_MS);\n teardownCallbacks.push(() => {\n document.removeEventListener('visibilitychange', expandWhenVisible);\n window.clearInterval(visibilityInterval);\n });\n\n const onStorage = (event: StorageEvent) => {\n if (!storage.isLocalStorage() || event.storageArea !== window.localStorage || event.key !== storageKey) return;\n const now = Date.now();\n const record = parseSessionRecord(event.newValue, now, SESSION_MAX_DURATION_MS);\n if (\n record?.status === 'active' &&\n record.id === currentSessionId &&\n !getSessionExpireReason(record, now, SESSION_MAX_DURATION_MS)\n ) {\n scheduleExpiration(record);\n return;\n }\n // 当前 tab 一旦失效,不被其他 tab 新建的 session 被动复活;本 tab 发生交互后再接管共享 session。\n deactivate(\n record?.status === 'expired' ? record.reason : 'external',\n record?.status === 'expired' ? record.expiredAt : now,\n );\n };\n window.addEventListener('storage', onStorage);\n teardownCallbacks.push(() => window.removeEventListener('storage', onStorage));\n teardownCallbacks.push(clearExpirationTimeout);\n },\n shutdown() {\n while (teardownCallbacks.length) teardownCallbacks.pop()?.();\n },\n };\n};\n","class t{t;o=0;i=[];u(t){if(t.hadRecentInput)return;const e=this.i[0],n=this.i.at(-1);this.o&&e&&n&&t.startTime-n.startTime<1e3&&t.startTime-e.startTime<5e3?(this.o+=t.value,this.i.push(t)):(this.o=t.value,this.i=[t]),this.t?.(t)}}const e=()=>{const t=performance.getEntriesByType(\"navigation\")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},n=t=>{if(\"loading\"===document.readyState)return\"loading\";const n=e();if(n){if(t<n.domInteractive)return\"loading\";if(0===n.domContentLoadedEventStart||t<n.domContentLoadedEventStart)return\"dom-interactive\";if(0===n.domComplete||t<n.domComplete)return\"dom-content-loaded\"}return\"complete\"},o=t=>{const e=t.nodeName;return 1===t.nodeType?e.toLowerCase():e.toUpperCase().replace(/^#/,\"\")},i=t=>{let e=\"\";try{for(;9!==t?.nodeType;){const n=t,i=n.id?\"#\"+n.id:[o(n),...Array.from(n.classList).sort()].join(\".\");if(e.length+i.length>99)return e||i;if(e=e?i+\">\"+e:i,n.id)break;t=n.parentNode}}catch{}return e},r=new WeakMap;function s(t,e){return r.get(t)||r.set(t,new e),r.get(t)}let a=-1;const c=()=>a,u=t=>{addEventListener(\"pageshow\",e=>{e.persisted&&(a=e.timeStamp,t(e))},!0)},f=(t,e,n,o)=>{let i,r;return s=>{e.value>=0&&(s||o)&&(r=e.value-(i??0),(r||void 0===i)&&(i=e.value,e.delta=r,e.rating=((t,e)=>t>e[1]?\"poor\":t>e[0]?\"needs-improvement\":\"good\")(e.value,n),t(e)))}},d=t=>{requestAnimationFrame(()=>requestAnimationFrame(t))},l=()=>e()?.activationStart??0,h=(t,n=-1)=>{const o=e();let i=\"navigate\";c()>=0?i=\"back-forward-cache\":o&&(document.prerendering||l()>0?i=\"prerender\":document.wasDiscarded?i=\"restore\":o.type&&(i=o.type.replace(/_/g,\"-\")));return{name:t,value:n,rating:\"good\",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:i}},m=(t,e,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(t)){const o=new PerformanceObserver(t=>{queueMicrotask(()=>{e(t.getEntries())})});return o.observe({type:t,buffered:!0,...n}),o}}catch{}},g=t=>{let e=!1;return()=>{e||(t(),e=!0)}};let p=-1;const y=new Set,v=()=>\"hidden\"!==document.visibilityState||document.prerendering?1/0:0,b=t=>{if(\"hidden\"===document.visibilityState){if(\"visibilitychange\"===t.type)for(const t of y)t();isFinite(p)||(p=\"visibilitychange\"===t.type?t.timeStamp:0,removeEventListener(\"prerenderingchange\",b,!0))}},M=()=>{if(p<0){const t=l(),e=document.prerendering?void 0:globalThis.performance.getEntriesByType(\"visibility-state\").find(e=>\"hidden\"===e.name&&e.startTime>=t)?.startTime;p=e??v(),addEventListener(\"visibilitychange\",b,!0),addEventListener(\"prerenderingchange\",b,!0),u(()=>{setTimeout(()=>{p=v()})})}return{get firstHiddenTime(){return p},onHidden(t){y.add(t)}}},T=t=>{document.prerendering?addEventListener(\"prerenderingchange\",t,!0):t()},E=[1800,3e3],D=(t,e={})=>{T(()=>{const n=M();let o,i=h(\"FCP\");const r=m(\"paint\",t=>{for(const e of t)\"first-contentful-paint\"===e.name&&(r.disconnect(),e.startTime<n.firstHiddenTime&&(i.value=Math.max(e.startTime-l(),0),i.entries.push(e),o(!0)))});r&&(o=f(t,i,E,e.reportAllChanges),u(n=>{i=h(\"FCP\"),o=f(t,i,E,e.reportAllChanges),d(()=>{i.value=performance.now()-n.timeStamp,o(!0)})}))})},L=[.1,.25],S=t=>t.find(t=>1===t.node?.nodeType)||t[0],P=(e,o={})=>{const r=s(o=Object.assign({},o),t),a=new WeakMap;r.t=t=>{if(t?.sources?.length){const e=S(t.sources),n=e?.node;if(n){const t=o.generateTarget?.(n)??i(n);a.set(e,t)}}};((e,n={})=>{const o=M();D(g(()=>{let i,r=h(\"CLS\",0);const a=s(n,t),c=t=>{for(const e of t)a.u(e);a.o>r.value&&(r.value=a.o,r.entries=a.i,i())},l=m(\"layout-shift\",c);l&&(i=f(e,r,L,n.reportAllChanges),o.onHidden(()=>{c(l.takeRecords()),i(!0)}),u(()=>{a.o=0,r=h(\"CLS\",0),i=f(e,r,L,n.reportAllChanges),d(i)}),setTimeout(i))}))})(t=>{e((t=>{let e={};if(t.entries.length){const o=t.entries.reduce((t,e)=>t.value>e.value?t:e);if(o?.sources?.length){const t=S(o.sources);t&&(e={largestShiftTarget:a.get(t),largestShiftTime:o.startTime,largestShiftValue:o.value,largestShiftSource:t,largestShiftEntry:o,loadState:n(o.startTime)})}}return Object.assign(t,{attribution:e})})(t))},o)},w=(t,o={})=>{D(o=>{t((t=>{let o={timeToFirstByte:0,firstByteToFCP:t.value,loadState:n(c())};if(t.entries.length){const i=e(),r=t.entries.at(-1);if(i){const e=i.activationStart||0,s=Math.max(0,i.responseStart-e);o={timeToFirstByte:s,firstByteToFCP:t.value-s,loadState:n(t.entries[0].startTime),navigationEntry:i,fcpEntry:r}}}return Object.assign(t,{attribution:o})})(o))},o)};let _=0,k=1/0,F=0;const B=t=>{for(const e of t)e.interactionId&&(k=Math.min(k,e.interactionId),F=Math.max(F,e.interactionId),_=F?(F-k)/7+1:0)};let C;const O=()=>C?_:performance.interactionCount??0,j=()=>{\"interactionCount\"in performance||C||(C=m(\"event\",B,{durationThreshold:0}))};let I=0;class A{l=[];h=new Map;m;p;v(){I=O(),this.l.length=0,this.h.clear()}M(){const t=Math.min(this.l.length-1,Math.floor((O()-I)/50));return this.l[t]}u(t){if(this.m?.(t),!t.interactionId&&\"first-input\"!==t.entryType)return;const e=this.l.at(-1);let n=this.h.get(t.interactionId);if(n||this.l.length<10||t.duration>e.T){if(n?t.duration>n.T?(n.entries=[t],n.T=t.duration):t.duration===n.T&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],T:t.duration},this.h.set(n.id,n),this.l.push(n)),this.l.sort((t,e)=>e.T-t.T),this.l.length>10){const t=this.l.splice(10);for(const e of t)this.h.delete(e.id)}this.p?.(n)}}}const q=t=>{const e=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if(\"hidden\"===document.visibilityState)t();else{const o=g(t);let i=-1;const r=()=>{n(i),o()};addEventListener(\"visibilitychange\",r,{once:!0,capture:!0}),i=e(()=>{removeEventListener(\"visibilitychange\",r,{capture:!0}),o()})}},W=[200,500],x=(t,e={})=>{const o=s(e=Object.assign({},e),A);let r=[],a=[],c=0;const d=new WeakMap,l=new WeakMap;let g=!1;const p=()=>{g||(q(y),g=!0)},y=()=>{const t=new Set(o.l.map(t=>d.get(t.entries[0]))),e=a.length-10;a=a.filter((n,o)=>o>=e||t.has(n));const n=new Set;for(const t of a){const e=v(t.startTime,t.processingEnd);for(const t of e)n.add(t)}r=r.filter(t=>t.startTime>c||n.has(t)),g=!1};o.m=t=>{const n=t.startTime+t.duration;let o;c=Math.max(c,t.processingEnd);for(let i=a.length-1;i>=0;i--){const r=a[i];if(Math.abs(n-r.renderTime)<=8){o=r,o.startTime=Math.min(t.startTime,o.startTime),o.processingStart=Math.min(t.processingStart,o.processingStart),o.processingEnd=Math.max(t.processingEnd,o.processingEnd),!1!==e.includeProcessedEventEntries&&o.entries.push(t);break}}o||(o={startTime:t.startTime,processingStart:t.processingStart,processingEnd:t.processingEnd,renderTime:n,entries:!1!==e.includeProcessedEventEntries?[t]:[]},a.push(o)),(t.interactionId||\"first-input\"===t.entryType)&&d.set(t,o),p()},o.p=t=>{if(!l.get(t)){const n=t.entries[0].target;if(n){const o=e.generateTarget?.(n)??i(n);l.set(t,o)}}};const v=(t,e)=>{const n=[];for(const o of r)if(!(o.startTime+o.duration<t)){if(o.startTime>e)break;n.push(o)}return n},b=t=>{const e=t.entries[0],i=d.get(e),r=e.processingStart,s=Math.max(e.startTime+e.duration,r),a=Math.min(i.processingEnd,s),c=i.entries.sort((t,e)=>t.processingStart-e.processingStart),u=v(e.startTime,a),f=o.h.get(e.interactionId),h={interactionTarget:l.get(f),interactionType:e.name.startsWith(\"key\")?\"keyboard\":\"pointer\",interactionTime:e.startTime,nextPaintTime:s,processedEventEntries:c,longAnimationFrameEntries:u,inputDelay:r-e.startTime,processingDuration:a-r,presentationDelay:s-a,loadState:n(e.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(t=>{if(!t.longAnimationFrameEntries?.length)return;const e=t.interactionTime,n=t.inputDelay,o=t.processingDuration;let i,r,s=0,a=0,c=0,u=0;for(const c of t.longAnimationFrameEntries){a=a+c.startTime+c.duration-c.styleAndLayoutStart;for(const t of c.scripts){const c=t.startTime+t.duration;if(c<e)continue;const f=c-Math.max(e,t.startTime),d=t.duration?f/t.duration*t.forcedStyleAndLayoutDuration:0;s+=f-d,a+=d,f>u&&(r=t.startTime<e+n?\"input-delay\":t.startTime>=e+n+o?\"presentation-delay\":\"processing-duration\",i=t,u=f)}}const f=t.longAnimationFrameEntries.at(-1),d=f?f.startTime+f.duration:0;d>=e+n+o&&(c=t.nextPaintTime-d),i&&r&&(t.longestScript={entry:i,subpart:r,intersectingDuration:u}),t.totalScriptDuration=s,t.totalStyleAndLayoutDuration=a,t.totalPaintDuration=c,t.totalUnattributedDuration=t.nextPaintTime-e-s-a-c})(h),Object.assign(t,{attribution:h})};m(\"long-animation-frame\",t=>{r=r.concat(t),p()}),((t,e={})=>{if(!globalThis.PerformanceEventTiming||!(\"interactionId\"in PerformanceEventTiming.prototype))return;const n=M();T(()=>{j();let o,i=h(\"INP\");const r=s(e,A),a=t=>{q(()=>{for(const e of t)r.u(e);const e=r.M();e&&e.T!==i.value&&(i.value=e.T,i.entries=e.entries,o())})},c=m(\"event\",a,{durationThreshold:e.durationThreshold??40});o=f(t,i,W,e.reportAllChanges),c&&(c.observe({type:\"first-input\",buffered:!0}),n.onHidden(()=>{a(c.takeRecords()),o(!0)}),u(()=>{r.v(),i=h(\"INP\"),o=f(t,i,W,e.reportAllChanges)}))})})(e=>{t(b(e))},e)};class N{m;u(t){this.m?.(t)}}const $=[2500,4e3],H=(t,n={})=>{const o=s(n=Object.assign({},n),N),r=new WeakMap;o.m=t=>{const e=t.element;if(e){const o=n.generateTarget?.(e)??i(e);r.set(t,o)}else t.id&&r.set(t,`#${t.id}`)};((t,e={})=>{T(()=>{const n=M();let o,i=h(\"LCP\");const r=s(e,N),a=t=>{e.reportAllChanges||(t=t.slice(-1));for(const e of t)r.u(e),e.startTime<n.firstHiddenTime&&(i.value=Math.max(e.startTime-l(),0),i.entries=[e],o())},c=m(\"largest-contentful-paint\",a);if(c){o=f(t,i,$,e.reportAllChanges);const n=g(()=>{a(c.takeRecords()),c.disconnect(),o(!0)}),r=t=>{t.isTrusted&&(q(n),removeEventListener(t.type,r,{capture:!0}))};for(const t of[\"keydown\",\"click\",\"visibilitychange\"])addEventListener(t,r,{capture:!0});u(n=>{i=h(\"LCP\"),o=f(t,i,$,e.reportAllChanges),d(()=>{i.value=performance.now()-n.timeStamp,o(!0)})})}})})(n=>{t((t=>{let n={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:t.value};if(t.entries.length){const o=t.entries.at(-1),i=o.url&&performance.getEntriesByType(\"resource\").find(t=>t.name===o.url);n.target=r.get(o),n.lcpEntry=o,o.url&&(n.url=o.url),i&&(n.lcpResourceEntry=i);const s=e();if(s){const e=s.activationStart||0,o=Math.max(0,s.responseStart-e),r=Math.max(o,i?(i.requestStart||i.startTime)-e:0),a=Math.min(t.value,Math.max(r,i?i.responseEnd-e:0));n={...n,timeToFirstByte:o,resourceLoadDelay:r-o,resourceLoadDuration:a-r,elementRenderDelay:t.value-a,navigationEntry:s}}}return Object.assign(t,{attribution:n})})(n))},n)},R=[800,1800],U=t=>{document.prerendering?T(()=>U(t)):\"complete\"!==document.readyState?addEventListener(\"load\",()=>U(t),!0):setTimeout(t)},V=(t,n={})=>{((t,n={})=>{let o=h(\"TTFB\"),i=f(t,o,R,n.reportAllChanges);U(()=>{const r=e();r&&(o.value=Math.max(r.responseStart-l(),0),o.entries=[r],i(!0),u(()=>{o=h(\"TTFB\",0),i=f(t,o,R,n.reportAllChanges),i(!0)}))})})(e=>{t((t=>{let e={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(t.entries.length){const n=t.entries[0],o=n.activationStart||0,i=Math.max((n.workerStart||n.fetchStart)-o,0),r=Math.max(n.domainLookupStart-o,0),s=Math.max(n.connectStart-o,0),a=Math.max(n.connectEnd-o,0);e={waitingDuration:i,cacheDuration:r-i,dnsDuration:s-r,connectionDuration:a-s,requestDuration:t.value-a,navigationEntry:n}}return Object.assign(t,{attribution:e})})(e))},n)};export{L as CLSThresholds,E as FCPThresholds,W as INPThresholds,$ as LCPThresholds,R as TTFBThresholds,P as onCLS,w as onFCP,x as onINP,H as onLCP,V as onTTFB};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n/**\n * Web Vitals 插件\n *\n * 基于 google/web-vitals 库(attribution 版本)采集 Core Web Vitals:\n * CLS / FCP / INP / LCP / TTFB\n *\n * Span 使用大写 vital.metric 命名,并带 vital.id(唯一)、vital.value 与 attribution 详情\n * (LCP 元素 url / CLS shift target / INP interaction target 等高基数字段),\n * 方便按个例排查\"哪个元素拖累了 LCP\"\n *\n * 数值语义:CLS 是无量纲分数,FCP/INP/LCP/TTFB 的 vital.value 单位为 ms。\n *\n * View 边界:FCP/LCP/TTFB 使用 web-vitals 的条目时间回查历史 View;CLS/INP 按 SDK View 重置,\n * CLS 使用 session window,INP 使用当前 View 的 p98 交互候选。\n *\n * 生命周期保护:\n * - disposed 标志位:shutdown 后所有回调入口 early return,避免向已销毁的 provider 上报\n * - dynamic import 完成后再次检查 disposed:处理\"start() 完成前 shutdown()\"的 race\n * - dynamic import 自身 try/catch:与 PluginManager 的 per-plugin 隔离形成纵深防御,\n * 即使加载失败也不影响整体启动\n */\n\nimport { type Attributes } from '@opentelemetry/api';\n\nimport { createRandomId } from '../core/id';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { buildRumSpanAttributes, buildRumSpanName, getVitalOutcome, RUM_SPAN_TYPE } from '../schema/span';\n\nimport type { BkOTPlugin } from '../core/plugin';\nimport type * as WebVitalsAttribution from 'web-vitals/attribution';\nimport type { MetricWithAttribution } from 'web-vitals/attribution';\n\ninterface EventTimingEntry extends PerformanceEntry {\n interactionId?: number;\n processingEnd?: number;\n processingStart?: number;\n target?: EventTarget | null;\n}\n\ninterface InpCandidate {\n duration: number;\n inputDelay: number;\n interactionId: number;\n interactionTarget?: string;\n interactionType: string;\n presentationDelay: number;\n processingDuration: number;\n}\n\ninterface LayoutShiftEntry extends PerformanceEntry {\n hadRecentInput?: boolean;\n value?: number;\n}\n\ninterface ViewVitalState {\n cls: number;\n clsWindowEnd?: number;\n clsWindowStart?: number;\n clsWindowValue: number;\n id: string;\n inpCandidates: InpCandidate[];\n interactionCountAtStart?: number;\n interactionIdMax: number;\n interactionIdMin: number;\n runtimeAttributes: Attributes;\n startedAt: number;\n}\n\ntype VitalLike = Pick<MetricWithAttribution, 'attribution' | 'entries' | 'id' | 'name' | 'rating' | 'value'>;\n\nconst MAX_INP_CANDIDATES = 10;\nconst MAX_INP_VALUE = 60_000;\nconst MAX_CLS_WINDOW_DURATION = 5_000;\nconst MAX_CLS_UPDATE_GAP = 1_000;\n\nexport const isSameViewId = (currentViewId: string | undefined, nextViewId: string | undefined) =>\n Boolean(nextViewId) && currentViewId === nextViewId;\n\nconst getRating = (name: 'CLS' | 'INP', value: number): VitalLike['rating'] => {\n const [good, poor] = name === 'CLS' ? [0.1, 0.25] : [200, 500];\n return value <= good ? 'good' : value <= poor ? 'needs-improvement' : 'poor';\n};\n\nconst getTargetName = (target: EventTarget | Node | null | undefined) => {\n if (typeof Element === 'undefined' || !(target instanceof Element)) return undefined;\n return (\n target.getAttribute('data-bk-action-name') ??\n target.getAttribute('aria-label') ??\n target.getAttribute('name') ??\n target.tagName.toLowerCase()\n );\n};\n\nconst getInteractionCount = () => {\n if (typeof performance === 'undefined') return undefined;\n const value = (performance as Performance & { interactionCount?: number }).interactionCount;\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n};\n\nexport const updateViewCls = (view: ViewVitalState, entry: LayoutShiftEntry) => {\n const value = entry.value ?? 0;\n if (entry.hadRecentInput || !Number.isFinite(value)) return;\n const shouldCreateWindow =\n view.clsWindowStart === undefined ||\n entry.startTime - (view.clsWindowEnd ?? entry.startTime) >= MAX_CLS_UPDATE_GAP ||\n entry.startTime - view.clsWindowStart >= MAX_CLS_WINDOW_DURATION;\n if (shouldCreateWindow) {\n view.clsWindowStart = entry.startTime;\n view.clsWindowValue = value;\n } else {\n view.clsWindowValue += value;\n }\n view.clsWindowEnd = entry.startTime;\n if (view.clsWindowValue > view.cls) {\n view.cls = Math.round(view.clsWindowValue * 10_000) / 10_000;\n }\n};\n\nexport const updateViewInp = (view: ViewVitalState, entry: EventTimingEntry) => {\n if (!entry.interactionId || !Number.isFinite(entry.duration)) return;\n view.interactionIdMin = Math.min(view.interactionIdMin, entry.interactionId);\n view.interactionIdMax = Math.max(view.interactionIdMax, entry.interactionId);\n const processingStart = entry.processingStart ?? entry.startTime;\n const processingEnd = entry.processingEnd ?? processingStart;\n const candidate: InpCandidate = {\n duration: Math.min(entry.duration, MAX_INP_VALUE),\n inputDelay: Math.max(0, processingStart - entry.startTime),\n interactionId: entry.interactionId,\n interactionTarget: getTargetName(entry.target),\n interactionType: entry.name,\n presentationDelay: Math.max(0, entry.startTime + entry.duration - processingEnd),\n processingDuration: Math.max(0, processingEnd - processingStart),\n };\n const index = view.inpCandidates.findIndex(item => item.interactionId === entry.interactionId);\n if (index >= 0) {\n if (candidate.duration > view.inpCandidates[index].duration) view.inpCandidates[index] = candidate;\n } else {\n view.inpCandidates.push(candidate);\n }\n view.inpCandidates.sort((left, right) => right.duration - left.duration).splice(MAX_INP_CANDIDATES);\n};\n\nexport const getViewInp = (view: ViewVitalState): InpCandidate | undefined => {\n const nativeCount = getInteractionCount();\n const interactionCount =\n nativeCount !== undefined && view.interactionCountAtStart !== undefined\n ? Math.max(0, nativeCount - view.interactionCountAtStart)\n : view.interactionIdMin === Infinity\n ? 0\n : (view.interactionIdMax - view.interactionIdMin) / 7 + 1;\n if (!view.inpCandidates.length) return undefined;\n return view.inpCandidates[Math.min(view.inpCandidates.length - 1, Math.floor(interactionCount / 50))];\n};\n\n// 把 attribution 中价值最高的字段抽出来写入 Span。\nconst pickAttribution = (metric: VitalLike, redactUrl: (url: string) => string): Attributes => {\n const attr = metric.attribution ?? {};\n const result: Attributes = {};\n const getAttrValue = (key: string) => (attr as Record<string, unknown>)[key];\n\n const setIfDefined = (key: string, value: unknown, transform?: (value: string) => string) => {\n if (value === undefined || value === null) return;\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n result[key] = typeof value === 'string' && transform ? transform(value) : value;\n }\n };\n\n switch (metric.name) {\n case 'LCP':\n setIfDefined('vital.lcp.url', getAttrValue('url'), redactUrl);\n setIfDefined('vital.lcp.target', getAttrValue('target'));\n setIfDefined('vital.lcp.element_render_delay', getAttrValue('elementRenderDelay'));\n setIfDefined('vital.lcp.resource_load_duration', getAttrValue('resourceLoadDuration'));\n break;\n case 'CLS':\n setIfDefined('vital.cls.load_state', getAttrValue('loadState'));\n break;\n case 'INP':\n setIfDefined('vital.inp.interaction_target', getAttrValue('interactionTarget'));\n setIfDefined('vital.inp.interaction_type', getAttrValue('interactionType'));\n setIfDefined('vital.inp.input_delay', getAttrValue('inputDelay'));\n setIfDefined('vital.inp.processing_duration', getAttrValue('processingDuration'));\n setIfDefined('vital.inp.presentation_delay', getAttrValue('presentationDelay'));\n break;\n case 'TTFB':\n setIfDefined('vital.ttfb.waiting_duration', getAttrValue('waitingDuration'));\n setIfDefined('vital.ttfb.dns_duration', getAttrValue('dnsDuration'));\n setIfDefined('vital.ttfb.connection_duration', getAttrValue('connectionDuration'));\n setIfDefined('vital.ttfb.request_duration', getAttrValue('requestDuration'));\n break;\n default:\n break;\n }\n return result;\n};\n\nexport const createWebVitalsPlugin = (): BkOTPlugin => {\n let cleanup: (() => void) | undefined;\n let disposed = false;\n\n return {\n name: 'web-vitals',\n async init(context) {\n if (typeof window === 'undefined') {\n return;\n }\n\n // dynamic import 自包 try/catch:与 PluginManager 的 per-plugin 隔离形成纵深防御,\n // 离线 / chunk 加载失败时不影响其他插件,且 debug 模式留下排查痕迹\n let webVitalsModule: typeof WebVitalsAttribution;\n try {\n webVitalsModule = await import('web-vitals/attribution');\n } catch (error) {\n if (context.config.debug) {\n globalThis.console?.warn('[bk-ot] web-vitals load failed:', error);\n }\n return;\n }\n // import 期间用户可能已经 shutdown:此后再注册回调会向已销毁 provider 上报\n if (disposed) return;\n\n const { onFCP, onLCP, onTTFB } = webVitalsModule;\n const recordSpan = (\n metric: VitalLike,\n runtimeAttributes: Attributes,\n contextTime?: number,\n occurredAt = contextTime ?? Date.now(),\n ) => {\n if (!context.isSampled()) return;\n const metricName = metric.name.toLowerCase();\n const attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...runtimeAttributes,\n ...buildRumSpanAttributes({\n outcome: getVitalOutcome(metric.rating),\n spanType: RUM_SPAN_TYPE.vital,\n }),\n [RUM_ATTRIBUTES.vitalMetric]: metricName,\n [RUM_ATTRIBUTES.vitalValue]: metric.value,\n 'vital.id': metric.id,\n ...pickAttribution(metric, context.config.hooks.redactUrl),\n };\n const span = context.startSpan(buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.vital }), attributes, {\n contextTime,\n startTime: occurredAt,\n });\n span.end(occurredAt);\n };\n\n const recordDurationVital = (metric: VitalLike) => {\n // 防御非法值:极端浏览器实现 bug 可能给出 NaN/Infinity,OT 后端会拒收\n if (disposed || !Number.isFinite(metric.value) || !context.isSampled()) return;\n const firstEntry = metric.entries[0];\n const contextTime =\n firstEntry && typeof performance !== 'undefined' ? performance.timeOrigin + firstEntry.startTime : undefined;\n const runtimeAttributes =\n contextTime === undefined ? context.getRuntimeAttributes() : context.getRuntimeAttributesAt(contextTime);\n recordSpan(metric, runtimeAttributes, contextTime);\n };\n\n let currentView: undefined | ViewVitalState;\n let eventObserver: PerformanceObserver | undefined;\n let layoutShiftObserver: PerformanceObserver | undefined;\n\n const recordViewVital = (metric: VitalLike, runtimeAttributes: Attributes, contextTime: number) => {\n recordSpan(metric, runtimeAttributes, contextTime, Date.now());\n };\n\n const finalizeView = () => {\n const view = currentView;\n if (!view || !context.isSampled()) return;\n recordViewVital(\n {\n attribution: {},\n entries: [],\n id: createRandomId('vital'),\n name: 'CLS',\n rating: getRating('CLS', view.cls),\n value: view.cls,\n } as VitalLike,\n view.runtimeAttributes,\n view.startedAt,\n );\n const inp = getViewInp(view);\n if (inp) {\n recordViewVital(\n {\n attribution: {\n inputDelay: inp.inputDelay,\n interactionTarget: inp.interactionTarget,\n interactionType: inp.interactionType,\n presentationDelay: inp.presentationDelay,\n processingDuration: inp.processingDuration,\n },\n entries: [],\n id: createRandomId('vital'),\n name: 'INP',\n rating: getRating('INP', inp.duration),\n value: inp.duration,\n } as VitalLike,\n view.runtimeAttributes,\n view.startedAt,\n );\n }\n };\n\n const unsubscribeView = context.onViewChange(view => {\n const activeVitalView = currentView;\n if (activeVitalView && isSameViewId(activeVitalView.id, view.id)) {\n activeVitalView.runtimeAttributes = {\n ...activeVitalView.runtimeAttributes,\n [RUM_ATTRIBUTES.viewId]: view.id,\n ...(view.name ? { [RUM_ATTRIBUTES.viewName]: view.name } : {}),\n [RUM_ATTRIBUTES.viewUrl]: view.url,\n [RUM_ATTRIBUTES.viewUrlTemplate]: view.urlTemplate,\n };\n return;\n }\n finalizeView();\n currentView = view.id\n ? {\n cls: 0,\n clsWindowValue: 0,\n interactionCountAtStart: getInteractionCount(),\n interactionIdMax: 0,\n interactionIdMin: Infinity,\n inpCandidates: [],\n id: view.id,\n runtimeAttributes: context.getRuntimeAttributes(),\n startedAt: view.startedAt ?? Date.now(),\n }\n : undefined;\n });\n\n if (typeof PerformanceObserver !== 'undefined') {\n if (PerformanceObserver.supportedEntryTypes?.includes('layout-shift')) {\n layoutShiftObserver = new PerformanceObserver(list => {\n if (!currentView) return;\n for (const entry of list.getEntries() as LayoutShiftEntry[]) {\n const startedAt = performance.timeOrigin + entry.startTime;\n if (startedAt < currentView.startedAt) continue;\n updateViewCls(currentView, entry);\n }\n });\n layoutShiftObserver.observe({ buffered: true, type: 'layout-shift' });\n }\n if (PerformanceObserver.supportedEntryTypes?.includes('event')) {\n eventObserver = new PerformanceObserver(list => {\n if (!currentView) return;\n for (const entry of list.getEntries() as EventTimingEntry[]) {\n const startedAt = performance.timeOrigin + entry.startTime;\n if (startedAt < currentView.startedAt || !entry.interactionId || !Number.isFinite(entry.duration))\n continue;\n updateViewInp(currentView, entry);\n }\n });\n eventObserver.observe({ buffered: true, durationThreshold: 40, type: 'event' });\n }\n }\n onFCP(recordDurationVital);\n onLCP(recordDurationVital);\n onTTFB(recordDurationVital);\n\n cleanup = () => {\n finalizeView();\n currentView = undefined;\n unsubscribeView();\n layoutShiftObserver?.disconnect();\n eventObserver?.disconnect();\n };\n },\n shutdown() {\n // web-vitals 的 onXXX 不返回 unsubscribe,无法真正取消订阅;\n // 用 disposed 标志位让回调入口 early return 即可\n disposed = true;\n cleanup?.();\n cleanup = undefined;\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\nimport { SpanKind } from '@opentelemetry/api';\n\nimport { createRandomId } from '../core/id';\nimport { shouldIgnoreUrl } from '../core/url';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_OUTCOME, RUM_SPAN_TYPE } from '../schema/span';\n\nimport type { BkOTPlugin, BkOTRuntimeContext } from '../core/plugin';\nimport type { Attributes } from '@opentelemetry/api';\n\nconst buildWebSocketAttributes = (url: string, redactUrl: (url: string) => string): Attributes => {\n const attributes: Attributes = {\n 'network.protocol.name': 'websocket',\n 'url.full': redactUrl(url),\n };\n try {\n const parsed = new URL(url, typeof location === 'undefined' ? 'http://localhost' : location.href);\n attributes['server.address'] = parsed.hostname;\n if (parsed.port) attributes['server.port'] = Number(parsed.port);\n attributes['url.scheme'] = parsed.protocol.replace(':', '');\n } catch {\n // 非法 URL 仍保留脱敏后的原始字符串。\n }\n return attributes;\n};\n\nconst instrumentSocket = (socket: WebSocket, context: BkOTRuntimeContext, url: string, isDisposed: () => boolean) => {\n const connectionId = createRandomId('websocket');\n const baseAttributes = buildWebSocketAttributes(url, context.config.hooks.redactUrl);\n let opened = false;\n\n const emit = (phase: 'close' | 'connect' | 'error' | 'open', timestamp: number, attributes: Attributes = {}) => {\n if (isDisposed() || !context.isSampled()) return;\n const isError = phase === 'error';\n const spanAttributes = {\n ...baseAttributes,\n ...buildRumSpanAttributes({\n outcome: isError ? RUM_SPAN_OUTCOME.error : RUM_SPAN_OUTCOME.success,\n spanType: RUM_SPAN_TYPE.websocket,\n }),\n [RUM_ATTRIBUTES.websocketPhase]: phase,\n 'websocket.connection.id': connectionId,\n ...attributes,\n };\n const span = context.startSpan(\n buildRumSpanName({ attributes: spanAttributes, spanType: RUM_SPAN_TYPE.websocket }),\n spanAttributes,\n { kind: SpanKind.CLIENT, startTime: timestamp },\n );\n span.end(timestamp);\n };\n\n emit('connect', Date.now());\n socket.addEventListener('open', () => {\n opened = true;\n emit('open', Date.now());\n });\n socket.addEventListener('error', () => {\n emit('error', Date.now(), { 'websocket.error.phase': opened ? 'runtime' : 'connect' });\n });\n socket.addEventListener('close', event => {\n emit('close', Date.now(), {\n 'websocket.close.code': event.code,\n 'websocket.close.reason': event.reason,\n 'websocket.close.was_clean': event.wasClean,\n });\n });\n};\n\nexport const createWebSocketPlugin = (): BkOTPlugin => {\n let originalWebSocket: typeof WebSocket | undefined;\n let patchedProxy: typeof WebSocket | undefined;\n let disposed = false;\n\n return {\n name: 'websocket',\n init(context) {\n if (typeof window === 'undefined' || typeof window.WebSocket === 'undefined') return;\n const nativeWebSocket = window.WebSocket;\n originalWebSocket = nativeWebSocket;\n patchedProxy = new Proxy(nativeWebSocket, {\n construct(target, args, newTarget) {\n const socket = Reflect.construct(target, args, newTarget) as WebSocket;\n if (disposed || !context.isSampled()) return socket;\n const url = args[0] == null ? '' : String(args[0]);\n if (url && !shouldIgnoreUrl(context.config, url)) {\n instrumentSocket(socket, context, url, () => disposed);\n }\n return socket;\n },\n });\n window.WebSocket = patchedProxy;\n },\n shutdown() {\n disposed = true;\n if (typeof window !== 'undefined' && originalWebSocket && window.WebSocket === patchedProxy) {\n window.WebSocket = originalWebSocket;\n }\n patchedProxy = undefined;\n originalWebSocket = undefined;\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\nexport type BkOTActivityEvent =\n | { endTime: number; startTime: number; type: 'long_task'; url?: never }\n | { endTime: number; startTime: number; type: 'resource'; url?: string }\n | { id: string; time: number; type: 'request_end' }\n | { id: string; time: number; type: 'request_start'; url?: string }\n | { time: number; type: 'dom_mutation' | 'error' | 'window_open' };\n\nexport class RumActivityObserver {\n private readonly listeners = new Set<(event: BkOTActivityEvent) => void>();\n\n public notify = (event: BkOTActivityEvent) => {\n this.listeners.forEach(listener => listener(event));\n };\n\n public subscribe = (listener: (event: BkOTActivityEvent) => void) => {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n };\n}\n","{\n \"name\": \"@blueking/open-telemetry\",\n \"version\": \"0.0.33\",\n \"description\": \"OpenTelemetry browser SDK for BK RUM\",\n \"author\": \"TencentCloud Real User Monitoring\",\n \"main\": \"dist/index.js\",\n \"unpkg\": \"dist/bk-rum.global.js\",\n \"jsdelivr\": \"dist/bk-rum.global.js\",\n \"license\": \"MIT\",\n \"files\": [\n \"dist\",\n \"skills\"\n ],\n \"scripts\": {\n \"prepublishOnly\": \"pnpm build && pnpm dts && pnpm skill:refs\",\n \"skill:refs\": \"node scripts/gen-skill-references.mjs\",\n \"test:skill-refs\": \"node --test tests/gen-skill-references.test.mjs\",\n \"build\": \"vite build && vite build --mode cdn && pnpm dts\",\n \"build:cdn\": \"vite build --mode cdn\",\n \"build:esm\": \"vite build\",\n \"docs:build\": \"vitepress build wikis\",\n \"docs:dev\": \"vitepress dev wikis\",\n \"docs:preview\": \"vitepress preview wikis\",\n \"dev\": \"vite dev\",\n \"dts\": \"vue-tsc --project tsconfig.dts.json\",\n \"test:rum-context\": \"node --experimental-default-type=module --experimental-strip-types --test tests/action-plugin.test.mjs tests/consent.test.mjs tests/experience-plugins.test.mjs tests/request-model.test.mjs tests/runtime-context.test.mjs tests/sampling.test.mjs tests/session-state.test.ts tests/session-plugin.test.mjs tests/session-page-view.test.mjs tests/session-processors.test.mjs tests/trace-context.test.mjs tests/web-vitals.test.mjs\"\n },\n \"dependencies\": {\n \"@opentelemetry/api\": \"^1.9.1\",\n \"@opentelemetry/context-zone\": \"2.7.1\",\n \"@opentelemetry/core\": \"^2.7.1\",\n \"@opentelemetry/exporter-trace-otlp-http\": \"^0.217.0\",\n \"@opentelemetry/instrumentation\": \"^0.217.0\",\n \"@opentelemetry/resources\": \"^2.7.1\",\n \"@opentelemetry/sdk-trace-base\": \"^2.7.1\",\n \"@opentelemetry/sdk-trace-web\": \"^2.7.1\",\n \"@opentelemetry/semantic-conventions\": \"^1.38.0\",\n \"web-vitals\": \"^5.0.3\"\n },\n \"devDependencies\": {\n \"@vitejs/plugin-vue\": \"^6.0.6\",\n \"@vue/test-utils\": \"^2.4.6\",\n \"@vue/tsconfig\": \"^0.9.0\",\n \"oxc-minify\": \"^0.133.0\",\n \"vite\": \"^8.0.2\",\n \"vite-bundle-analyzer\": \"^1.3.2\",\n \"vitepress\": \"2.0.0-alpha.16\",\n \"vue\": \"^3.5.34\",\n \"vue-router\": \"^5.0.6\",\n \"vue-tsc\": \"^3.1.4\"\n }\n}\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { version as packageVersion } from '../../package.json';\nimport { getDeviceResourceAttributes } from '../plugins/device';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { normalizeUrlPathTemplate } from './url';\n\nimport type { BkOTActionPluginOptions } from '../plugins/action';\nimport type { BkOTBlankScreenPluginOptions } from '../plugins/blank-screen';\nimport type { BkOTDevicePluginOptions } from '../plugins/device';\nimport type { BkOTLongTaskPluginOptions } from '../plugins/long-task';\nimport type { BkOTSessionConfig } from '../plugins/session';\nimport type { RumRequestOutcome } from '../schema/span';\nimport type { BkOTPlugin } from './plugin';\nimport type { BkOTUserContext } from './runtime-context';\nimport type { Attributes } from '@opentelemetry/api';\nimport type { Instrumentation } from '@opentelemetry/instrumentation';\n\nexport interface BkOTActionEventPayload {\n attributes?: Attributes;\n name: string;\n}\n\nexport interface BkOTApplicationConfig {\n environment?: string;\n name: string;\n version?: string;\n}\n\nexport interface BkOTAttributesConfig {\n custom?: () => Attributes;\n error?: () => Attributes;\n page?: () => Attributes;\n}\n\nexport type BkOTAttributeValue = boolean | number | string;\n\nexport interface BkOTBatchConfig {\n exportTimeoutMillis?: number;\n maxExportBatchSize?: number;\n maxQueueSize?: number;\n scheduledDelayMillis?: number;\n}\n\nexport interface BkOTBeforeSendEvent {\n attributes: Record<string, unknown>;\n name: string;\n signal: 'span';\n}\n\nexport interface BkOTContextConfig {\n attributes?: BkOTAttributesConfig;\n user?: BkOTUserContext;\n}\n\nexport interface BkOTCustomEventPayload {\n attributes?: Attributes;\n error?: Error;\n name: string;\n}\n\nexport interface BkOTExtensionsConfig {\n instrumentations?: Instrumentation[];\n plugins?: BkOTPlugin[];\n}\n\nexport interface BkOTOptions {\n application: BkOTApplicationConfig;\n autoStart?: boolean;\n context?: BkOTContextConfig;\n debug?: boolean;\n enabled?: boolean;\n extensions?: BkOTExtensionsConfig;\n privacy?: BkOTPrivacyConfig;\n session?: BkOTSessionConfig;\n tracking?: BkOTTrackingConfig;\n transport: BkOTTransportConfig;\n}\n\nexport interface BkOTPrivacyConfig {\n /** 初始化时的采集授权状态;运行期可通过 setTrackingConsent 更新。 */\n trackingConsent?: BkOTTrackingConsent;\n /** 在所有 RUM 自定义插件 emit 前统一过滤属性。 */\n redactAttributes?: (attributes: Attributes) => Attributes;\n /** 所有写入 attribute 的 URL 都会先经过此函数。 */\n redactUrl?: (url: string) => string;\n}\n\nexport interface BkOTRequestConfig {\n allowedTracingUrls?: BkOTUrlMatcher | BkOTUrlMatcher[];\n excludedUrls?: BkOTUrlMatcher | BkOTUrlMatcher[];\n beforeSend?: (event: BkOTRequestEvent, context: BkOTRequestContext) => boolean | void;\n /** 返回请求 URL 的低基数模板,例如 `/api/orders/{id}`;返回空值时回退到默认折叠规则。 */\n getUrlTemplate?: (url: string) => string | undefined;\n}\n\nexport type BkOTRequestContext =\n | { error?: unknown; request: Request | RequestInit; response?: Response; type: 'fetch' }\n | { type: 'xhr'; xhr: XMLHttpRequest };\n\nexport interface BkOTRequestEvent {\n attributes: Attributes;\n type: 'resource';\n resource: {\n method?: string;\n outcome: BkOTRequestOutcome;\n transport: 'fetch' | 'xhr';\n url?: string;\n };\n}\n\nexport type BkOTRequestOutcome = RumRequestOutcome;\n\nexport type BkOTSpanProcessorMode = 'batch' | 'simple';\n\nexport interface BkOTTrackingConfig {\n action?: BkOTActionPluginOptions | boolean;\n blankScreen?: BkOTBlankScreenPluginOptions | boolean;\n cspViolation?: boolean;\n device?: BkOTDevicePluginOptions | boolean;\n error?: boolean;\n longTask?: BkOTLongTaskPluginOptions | boolean;\n request?: BkOTRequestConfig | boolean;\n resource?: boolean;\n view?: BkOTViewConfig;\n websocket?: boolean;\n webVitals?: boolean;\n beforeSend?: (event: BkOTBeforeSendEvent) => boolean | void;\n}\n\nexport type BkOTTrackingConsent = 'granted' | 'not-granted';\n\nexport interface BkOTTransportConfig {\n batch?: BkOTBatchConfig;\n concurrencyLimit?: number;\n endpoint: string;\n headers?: Record<string, string>;\n processor?: BkOTSpanProcessorMode;\n timeoutMillis?: number;\n token?: string;\n}\n\nexport type BkOTUrlMatcher = ((url: string) => boolean) | RegExp | string;\n\nexport interface BkOTViewConfig {\n /** 不参与 View loading time 的长轮询、流式请求或埋点 URL。 */\n excludedActivityUrls?: BkOTUrlMatcher | BkOTUrlMatcher[];\n /** 自动计算初始加载与 SPA 路由的页面稳定耗时,默认开启。 */\n loadingTime?: boolean;\n tracking?: 'auto' | 'manual';\n /** 返回页面路由的低基数模板,例如 `/trace/:id`;返回空值时回退到默认折叠规则。 */\n getUrlTemplate?: (url: string) => string | undefined;\n}\n\nexport interface ResolvedApplicationConfig {\n environment: string;\n name: string;\n version?: string;\n}\n\nexport interface ResolvedBkOTConfig {\n application: ResolvedApplicationConfig;\n autoStart: boolean;\n debug: boolean;\n enabled: boolean;\n extensions: BkOTExtensionsConfig;\n hooks: ResolvedConfigHooks;\n resourceAttributes: Attributes;\n session: ResolvedSessionConfig;\n spanBatch?: BkOTBatchConfig;\n spanProcessor: BkOTSpanProcessorMode;\n tracking: BkOTTrackingConfig;\n trackingConsent: BkOTTrackingConsent;\n transport: ResolvedTransportConfig;\n user?: BkOTUserContext;\n view: ResolvedViewConfig;\n}\n\nexport interface ResolvedConfigHooks {\n beforeSend?: (event: BkOTBeforeSendEvent) => boolean | void;\n getCustomAttributes: () => Attributes;\n getErrorAttributes: () => Attributes;\n getPageAttributes: () => Attributes;\n getRequestUrlTemplate: (url: string) => string;\n getViewUrlTemplate: (url: string) => string;\n redactAttributes: (attributes: Attributes) => Attributes;\n redactUrl: (url: string) => string;\n}\n\nexport interface ResolvedSessionConfig extends BkOTSessionConfig {\n sampleRate: number;\n}\n\nexport interface ResolvedTransportConfig {\n concurrencyLimit?: number;\n endpoint: string;\n headers?: Record<string, string>;\n timeoutMillis?: number;\n}\n\nexport interface ResolvedViewConfig {\n excludedActivityUrls?: BkOTUrlMatcher | BkOTUrlMatcher[];\n loadingTime: boolean;\n tracking: 'auto' | 'manual';\n}\n\nconst trimTrailingSlash = (value: string) => value.trim().replace(/\\/+$/, '');\n\nconst resolveTransportConfig = (transport: BkOTTransportConfig): ResolvedTransportConfig => {\n // token 只负责提供默认鉴权头;headers 保持显式配置优先,便于特殊场景覆盖。\n const mergedHeaders =\n transport.token || transport.headers\n ? {\n ...(transport.token ? { Authorization: `Bearer ${transport.token}` } : {}),\n ...(transport.headers ?? {}),\n }\n : undefined;\n\n return {\n concurrencyLimit: transport.concurrencyLimit,\n endpoint: `${trimTrailingSlash(transport.endpoint)}/v1/rum`,\n headers: mergedHeaders,\n timeoutMillis: transport.timeoutMillis,\n };\n};\n\nconst clampSampleRate = (sampleRate?: number) => {\n if (typeof sampleRate !== 'number' || !Number.isFinite(sampleRate)) {\n return 1;\n }\n return Math.max(0, Math.min(1, sampleRate));\n};\n\nconst identityRedactAttributes = (attributes: Attributes) => attributes;\n\n// 默认只保留 URL 的定位信息;认证信息、查询参数和 fragment 可能携带用户数据,统一移除。\nconst defaultRedactUrl = (url: string) => {\n if (!url) return url;\n try {\n const parsed = new URL(url, typeof location === 'undefined' ? 'http://localhost' : location.href);\n parsed.username = '';\n parsed.password = '';\n parsed.search = '';\n parsed.hash = '';\n return parsed.href;\n } catch {\n return url.replace(/[?#].*$/, '');\n }\n};\n\nconst getUrlPathname = (url: string) => {\n try {\n return new URL(url, typeof location === 'undefined' ? 'http://localhost' : location.href).pathname || '/';\n } catch {\n return url || '/';\n }\n};\n\n/**\n * 低基数路径模板,供 `view.url_template` 与 `url.template` 共用同一套折叠规则。\n * 只保留 path:host 维度由 `server.address` 表达,query 由 `normalizeUrlPathTemplate` 去掉。\n */\nconst templatizeUrlPath = (url: string) => normalizeUrlPathTemplate(getUrlPathname(url));\n\n/** 模板 Hook 在每个请求/导航上都会跑,抛错不能影响追踪本身 */\nconst resolveTemplateHook =\n (config: BkOTOptions, custom: ((url: string) => string | undefined) | undefined) => (url: string) => {\n try {\n const templated = custom?.(url);\n if (templated) return templated;\n } catch (error) {\n if (config.debug) globalThis.console?.warn('[bk-ot] url template hook failed:', error);\n }\n return templatizeUrlPath(url);\n };\n\nconst resolveApplicationConfig = (application: BkOTOptions['application']): ResolvedApplicationConfig => ({\n environment: application.environment ?? 'production',\n name: application.name,\n version: application.version,\n});\n\nconst resolveResourceAttributes = (\n application: ResolvedApplicationConfig,\n device: BkOTTrackingConfig['device'],\n sampleRate: number,\n): Attributes => ({\n [RUM_ATTRIBUTES.deploymentEnvironmentName]: application.environment,\n ...(device === false ? {} : getDeviceResourceAttributes()),\n [RUM_ATTRIBUTES.serviceName]: application.name,\n ...(application.version ? { [RUM_ATTRIBUTES.serviceVersion]: application.version } : {}),\n [RUM_ATTRIBUTES.sessionSampleRate]: sampleRate,\n 'telemetry.sdk.language': 'webjs',\n 'telemetry.sdk.name': 'blueking',\n 'telemetry.sdk.version': packageVersion,\n});\n\nconst validateTransportConfig = (transport: BkOTTransportConfig | undefined) => {\n if (!transport) throw new Error('[bk-ot] transport is required.');\n if (!transport.endpoint?.trim()) throw new Error('[bk-ot] transport.endpoint is required.');\n};\n\nconst resolveHooks = (config: BkOTOptions): ResolvedConfigHooks => ({\n beforeSend: config.tracking?.beforeSend,\n getPageAttributes: config.context?.attributes?.page ?? (() => ({})),\n getErrorAttributes: config.context?.attributes?.error ?? (() => ({})),\n getCustomAttributes: config.context?.attributes?.custom ?? (() => ({})),\n getRequestUrlTemplate: resolveTemplateHook(\n config,\n typeof config.tracking?.request === 'object' ? config.tracking.request.getUrlTemplate : undefined,\n ),\n getViewUrlTemplate: resolveTemplateHook(\n config,\n typeof config.tracking?.view === 'object' ? config.tracking.view.getUrlTemplate : undefined,\n ),\n redactAttributes: config.privacy?.redactAttributes ?? identityRedactAttributes,\n redactUrl: config.privacy?.redactUrl ?? defaultRedactUrl,\n});\n\nexport const resolveConfig = (config: BkOTOptions): ResolvedBkOTConfig => {\n if (!config.application?.name?.trim()) {\n throw new Error('[bk-ot] application.name is required.');\n }\n validateTransportConfig(config.transport);\n const application = resolveApplicationConfig(config.application);\n const viewConfig = typeof config.tracking?.view === 'object' ? config.tracking.view : undefined;\n const hooks = resolveHooks(config);\n const sampleRate = clampSampleRate(config.session?.sampleRate);\n\n return {\n application,\n autoStart: config.autoStart ?? true,\n debug: config.debug ?? false,\n enabled: config.enabled ?? true,\n extensions: {\n instrumentations: [...(config.extensions?.instrumentations ?? [])],\n plugins: [...(config.extensions?.plugins ?? [])],\n },\n hooks,\n resourceAttributes: hooks.redactAttributes(\n resolveResourceAttributes(application, config.tracking?.device, sampleRate),\n ),\n session: {\n ...config.session,\n sampleRate,\n },\n spanBatch: config.transport.batch,\n spanProcessor: config.transport.processor ?? 'batch',\n tracking: config.tracking ?? {},\n trackingConsent: config.privacy?.trackingConsent ?? 'granted',\n transport: resolveTransportConfig(config.transport),\n user: config.context?.user,\n view: {\n excludedActivityUrls: viewConfig?.excludedActivityUrls,\n loadingTime: viewConfig?.loadingTime !== false,\n tracking: viewConfig?.tracking === 'manual' ? 'manual' : 'auto',\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport type { RumSpanType } from '../schema/span';\nimport type { BkOTActivityEvent } from './action-activity';\nimport type { ResolvedBkOTConfig } from './config';\nimport type { BkOTSessionLifecycleEvent, BkOTUserContext, BkOTViewCommand, BkOTViewContext } from './runtime-context';\nimport type { Attributes, Link, Span, SpanKind, TimeInput, Tracer } from '@opentelemetry/api';\nimport type { Instrumentation } from '@opentelemetry/instrumentation';\n\nexport interface BkOTPlugin {\n enabled?: ((config: ResolvedBkOTConfig) => boolean) | boolean;\n name: string;\n flush?: () => Promise<void> | void;\n init: (context: BkOTRuntimeContext) => Promise<void> | void;\n shutdown?: () => Promise<void> | void;\n}\n\nexport interface BkOTRuntimeContext {\n config: ResolvedBkOTConfig;\n tracer: Tracer;\n /** 对外提供的属性脱敏入口,所有插件在 emit 前都应过一次 */\n applyRedact: (attributes: Attributes) => Attributes;\n flush: () => Promise<void>;\n getRuntimeAttributes: () => Attributes;\n getRuntimeAttributesAt: (timestamp: number) => Attributes;\n isSampled: () => boolean;\n isSessionActive: () => boolean;\n isViewActive: () => boolean;\n notifyActivity: (event: BkOTActivityEvent) => void;\n notifySessionLifecycle: (event: BkOTSessionLifecycleEvent) => void;\n onActivity: (listener: (event: BkOTActivityEvent) => void) => () => void;\n onSessionLifecycle: (listener: (event: BkOTSessionLifecycleEvent) => void) => () => void;\n onViewChange: (listener: (view: BkOTViewContext) => void) => () => void;\n onViewCommand: (listener: (command: BkOTViewCommand) => void) => () => void;\n registerInstrumentations: (instrumentations: Instrumentation[]) => void;\n setRuntimeAttributes: (attributes: Attributes, changedAt?: number) => void;\n /** 更新用户上下文;user.id 由接入方传入,SDK 原样透传 */\n setUser: (user: BkOTUserContext) => void;\n /** 更新当前 View 上下文,后续 span 会自动带上 view.* 关联字段 */\n setView: (view: BkOTViewContext, changedAt?: number) => void;\n startSpan: (name: string, attributes?: Attributes, options?: BkOTStartSpanOptions) => Span;\n}\n\n/**\n * startSpan 的扩展选项。\n *\n * 用于\"事件实际发生在过去某个时刻,但 span 现在才创建\"的场景:\n * 例如 PerformanceObserver 在条目结束后才回调,但 span 的时间窗仍需反映\n * 条目真实发生的区间,方便 trace 视图与并发请求对齐。\n *\n * startTime 接受 OT TimeInput;常用 epoch 毫秒(performance.timeOrigin + performance.now())。\n * 配合 span.end(endTime?) 可控制结束时间。\n */\nexport interface BkOTStartSpanOptions {\n /** 内置 Span 根据脱敏后的属性生成名称;自定义 startSpan 默认保留传入名称。 */\n rumSpanType?: RumSpanType;\n /** 用于从历史中解析 Session/View/Action 归属;默认复用数字类型 startTime。 */\n contextTime?: number;\n kind?: SpanKind;\n /** 关联其他 trace 的 Span Link;OTel 要求在创建时传入。 */\n links?: Link[];\n startTime?: TimeInput;\n}\n\nexport const isPluginEnabled = (plugin: BkOTPlugin, config: ResolvedBkOTConfig) => {\n if (typeof plugin.enabled === 'function') {\n return plugin.enabled(config);\n }\n return plugin.enabled !== false;\n};\n\nexport const createPlugin = (plugin: BkOTPlugin) => plugin;\n\nexport class PluginManager {\n private readonly plugins: BkOTPlugin[];\n private startedPlugins: BkOTPlugin[] = [];\n\n public constructor(plugins: BkOTPlugin[]) {\n this.plugins = plugins;\n }\n\n public async flush() {\n // 并行 flush,避免单个慢插件拖累整体\n await Promise.all(this.startedPlugins.map(plugin => Promise.resolve().then(() => plugin.flush?.())));\n }\n\n public async shutdown() {\n const plugins = [...this.startedPlugins].reverse();\n for (const plugin of plugins) {\n await plugin.shutdown?.();\n }\n this.startedPlugins = [];\n }\n\n public async start(context: BkOTRuntimeContext) {\n // 每个插件独立 try/catch,单个插件 init 失败不应拖累其他插件:\n // - 失败的插件不会进入 startedPlugins(shutdown 时不会被反向 teardown)\n // - debug 模式打 warn,方便排查;非 debug 静默失败避免污染业务日志\n for (const plugin of this.plugins) {\n if (!isPluginEnabled(plugin, context.config)) {\n continue;\n }\n try {\n await plugin.init(context);\n this.startedPlugins.push(plugin);\n } catch (error) {\n if (context.config.debug) {\n globalThis.console?.warn(`[bk-ot] plugin \"${plugin.name}\" init failed:`, error);\n }\n }\n }\n }\n}\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\n\nimport type { Attributes } from '@opentelemetry/api';\n\nexport type BkOTSessionLifecycleEvent =\n | {\n expiredAt: number;\n id: string;\n reason: 'external' | 'inactivity' | 'maxLifetime';\n type: 'expired';\n }\n | {\n id: string;\n previousId?: string;\n reason: 'inactivity' | 'init' | 'maxLifetime' | 'shared';\n startedAt: number;\n type: 'renewed';\n };\n\nexport interface BkOTStartViewOptions {\n attributes?: Attributes;\n name?: string;\n url?: string;\n}\n\nexport interface BkOTUserContext {\n /** 由接入方传入并由 SDK 原样透传;SDK 不 hash、不脱敏、不改写。 */\n id?: string;\n}\n\nexport type BkOTViewCommand =\n | { name: string; type: 'set_name' }\n | { options: BkOTStartViewOptions; type: 'start' }\n | { time: number; type: 'set_loading_time' };\n\nexport interface BkOTViewContext {\n attributes?: Attributes;\n id?: string;\n loadingType?: 'bf_cache' | 'initial_load' | 'route_change' | 'session_renewal';\n name?: string;\n startedAt?: number;\n url?: string;\n urlTemplate?: string;\n}\n\nconst PROTECTED_VIEW_ATTRIBUTE_KEYS = new Set<string>(Object.values(RUM_ATTRIBUTES));\n\nconst toActionId = (value: unknown): string | undefined => {\n if (typeof value === 'string' && value.length > 0) return value;\n if (!Array.isArray(value)) return undefined;\n for (let index = value.length - 1; index >= 0; index -= 1) {\n const item = value[index];\n if (typeof item === 'string' && item.length > 0) return item;\n }\n return undefined;\n};\n\n/**\n * 管理 SDK 运行期公共属性快照。\n *\n * 这里仅保存“后续事件都需要带上”的低成本上下文,Session/View/用户切换时更新快照,\n * 插件发 Span 时读取当前快照即可,避免每个插件重复维护公共字段。\n */\nexport class RumRuntimeContext {\n private readonly actionHistory: Array<{ attributes: Attributes; endedAt?: number; startedAt: number }> = [];\n private readonly attributes: Attributes = {};\n private readonly queuedViewCommands: BkOTViewCommand[] = [];\n\n // 保存关联关系的生效区间,供延迟到达的 PerformanceEntry 按事件时间回查原 Session/View/Action。\n private recordAssociation = (\n history: Array<{ attributes: Attributes; endedAt?: number; startedAt: number }>,\n keys: Iterable<string>,\n changedAt: number,\n active: boolean,\n ) => {\n const previous = history.at(-1);\n if (previous && previous.endedAt === undefined) previous.endedAt = Math.max(previous.startedAt, changedAt);\n if (active) {\n const associationAttributes: Attributes = {};\n for (const key of keys) {\n const value = this.attributes[key];\n if (value !== undefined) associationAttributes[key] = value;\n }\n history.push({ attributes: associationAttributes, startedAt: changedAt });\n }\n if (history.length > 100) history.splice(0, history.length - 100);\n };\n private readonly sessionHistory: Array<{ attributes: Attributes; endedAt?: number; startedAt: number }> = [];\n private sampled = false;\n private readonly samplingHistory: Array<{ endedAt?: number; sampled: boolean; startedAt: number }> = [];\n private readonly sessionLifecycleListeners = new Set<(event: BkOTSessionLifecycleEvent) => void>();\n private readonly setOptionalAttribute = (key: string, value: string | undefined) => {\n if (value === undefined) {\n delete this.attributes[key];\n return;\n }\n this.attributes[key] = value;\n };\n private user: BkOTUserContext = {};\n private view: BkOTViewContext = {};\n private readonly viewAttributeKeys = new Set<string>();\n private readonly viewChangeListeners = new Set<(view: BkOTViewContext) => void>();\n private readonly viewCommandListeners = new Set<(command: BkOTViewCommand) => void>();\n\n private readonly viewHistory: Array<{ attributes: Attributes; endedAt?: number; startedAt: number }> = [];\n\n private readonly viewScopedAttributeKeys = new Set<string>();\n\n public dispatchViewCommand = (command: BkOTViewCommand) => {\n // autoStart 下调用方可能早于 page-view 插件发命令,先排队可避免 startView/setViewName 丢失。\n if (this.viewCommandListeners.size === 0) {\n this.queuedViewCommands.push(command);\n return;\n }\n this.viewCommandListeners.forEach(listener => listener(command));\n };\n\n public getAttributes = (): Attributes => ({ ...this.attributes });\n\n public getAttributesAt = (timestamp: number): Attributes => {\n if (!Number.isFinite(timestamp)) return this.getAttributes();\n const result = this.getAttributes();\n const applyHistory = (\n history: Array<{ attributes: Attributes; endedAt?: number; startedAt: number }>,\n keys: Iterable<string>,\n ) => {\n // 先移除当前关联字段,再用目标时间所在的历史快照覆盖,避免把旧事件错误归到当前 View。\n for (const key of keys) delete result[key];\n const matched = [...history]\n .reverse()\n .find(entry => entry.startedAt <= timestamp && (entry.endedAt === undefined || timestamp < entry.endedAt));\n if (matched) Object.assign(result, matched.attributes);\n };\n applyHistory(this.sessionHistory, [RUM_ATTRIBUTES.sessionId, RUM_ATTRIBUTES.sessionHasReplay]);\n applyHistory(this.viewHistory, this.viewScopedAttributeKeys);\n applyHistory(this.actionHistory, [RUM_ATTRIBUTES.actionId]);\n return result;\n };\n\n public getUser = (): BkOTUserContext => ({ ...this.user });\n\n public getView = (): BkOTViewContext => ({ ...this.view });\n\n public isSessionActive = () => typeof this.attributes[RUM_ATTRIBUTES.sessionId] === 'string';\n\n public isSessionSampledAt = (timestamp: number) => {\n if (!Number.isFinite(timestamp)) return this.sampled;\n return (\n [...this.samplingHistory]\n .reverse()\n .find(entry => entry.startedAt <= timestamp && (entry.endedAt === undefined || timestamp < entry.endedAt))\n ?.sampled ?? false\n );\n };\n\n public isViewActive = () => typeof this.attributes[RUM_ATTRIBUTES.viewId] === 'string';\n\n public notifySessionLifecycle = (event: BkOTSessionLifecycleEvent) => {\n this.sessionLifecycleListeners.forEach(listener => listener(event));\n };\n\n public onSessionLifecycle = (listener: (event: BkOTSessionLifecycleEvent) => void) => {\n this.sessionLifecycleListeners.add(listener);\n return () => this.sessionLifecycleListeners.delete(listener);\n };\n\n public onViewChange = (listener: (view: BkOTViewContext) => void) => {\n this.viewChangeListeners.add(listener);\n if (this.view.id) listener(this.getView());\n return () => this.viewChangeListeners.delete(listener);\n };\n\n public onViewCommand = (listener: (command: BkOTViewCommand) => void) => {\n this.viewCommandListeners.add(listener);\n while (this.queuedViewCommands.length) {\n listener(this.queuedViewCommands.shift()!);\n }\n return () => this.viewCommandListeners.delete(listener);\n };\n\n public setAttributes = (attributes: Attributes, changedAt = Date.now()) => {\n for (const [key, value] of Object.entries(attributes)) {\n if (value === undefined) {\n delete this.attributes[key];\n continue;\n }\n this.attributes[key] = value;\n }\n if (RUM_ATTRIBUTES.sessionId in attributes) {\n this.recordAssociation(\n this.sessionHistory,\n [RUM_ATTRIBUTES.sessionId, RUM_ATTRIBUTES.sessionHasReplay],\n changedAt,\n typeof this.attributes[RUM_ATTRIBUTES.sessionId] === 'string',\n );\n }\n if (RUM_ATTRIBUTES.actionId in attributes) {\n const actionId = toActionId(this.attributes[RUM_ATTRIBUTES.actionId]);\n if (actionId === undefined) delete this.attributes[RUM_ATTRIBUTES.actionId];\n else this.attributes[RUM_ATTRIBUTES.actionId] = actionId;\n this.recordAssociation(\n this.actionHistory,\n [RUM_ATTRIBUTES.actionId],\n changedAt,\n typeof this.attributes[RUM_ATTRIBUTES.actionId] === 'string',\n );\n }\n };\n\n public setUser = (user: BkOTUserContext) => {\n this.user = {\n ...this.user,\n ...user,\n };\n\n if ('id' in user) {\n if (user.id === undefined) {\n delete this.attributes[RUM_ATTRIBUTES.userId];\n return;\n }\n this.attributes[RUM_ATTRIBUTES.userId] = user.id;\n }\n };\n\n public setSessionSampled = (sampled: boolean, changedAt = Date.now()) => {\n if (sampled === this.sampled) return;\n const previous = this.samplingHistory.at(-1);\n if (previous && previous.endedAt === undefined) previous.endedAt = Math.max(previous.startedAt, changedAt);\n this.sampled = sampled;\n if (sampled) this.samplingHistory.push({ sampled, startedAt: changedAt });\n if (this.samplingHistory.length > 100) {\n this.samplingHistory.splice(0, this.samplingHistory.length - 100);\n }\n };\n\n public setView = (view: BkOTViewContext, changedAt = view.startedAt ?? Date.now()) => {\n this.viewAttributeKeys.forEach(key => delete this.attributes[key]);\n this.viewAttributeKeys.clear();\n const viewAttributes: Attributes = {};\n for (const [key, value] of Object.entries(view.attributes ?? {})) {\n // 自定义 View 属性不能覆盖 SDK 维护的关联和语义字段。\n if (value === undefined || PROTECTED_VIEW_ATTRIBUTE_KEYS.has(key)) continue;\n viewAttributes[key] = value;\n this.attributes[key] = value;\n this.viewAttributeKeys.add(key);\n this.viewScopedAttributeKeys.add(key);\n }\n this.view = { ...view, attributes: viewAttributes };\n this.setOptionalAttribute(RUM_ATTRIBUTES.viewId, view.id);\n this.setOptionalAttribute(RUM_ATTRIBUTES.viewUrl, view.url);\n this.setOptionalAttribute(RUM_ATTRIBUTES.viewUrlTemplate, view.urlTemplate);\n this.setOptionalAttribute(RUM_ATTRIBUTES.viewLoadingType, view.loadingType);\n this.setOptionalAttribute(RUM_ATTRIBUTES.viewName, view.name);\n [\n RUM_ATTRIBUTES.viewId,\n RUM_ATTRIBUTES.viewUrl,\n RUM_ATTRIBUTES.viewUrlTemplate,\n RUM_ATTRIBUTES.viewLoadingType,\n RUM_ATTRIBUTES.viewName,\n ].forEach(key => this.viewScopedAttributeKeys.add(key));\n this.recordAssociation(\n this.viewHistory,\n this.viewScopedAttributeKeys,\n changedAt,\n typeof view.id === 'string' && view.id.length > 0,\n );\n this.viewChangeListeners.forEach(listener => listener(this.getView()));\n };\n\n public constructor(initialAttributes: Attributes = {}, user?: BkOTUserContext) {\n this.setAttributes(initialAttributes);\n if (user) {\n this.setUser(user);\n }\n }\n}\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport type { ResolvedBkOTConfig } from './config';\n\nconst hashToUnitInterval = (input: string) => {\n let hash = 0x811c9dc5;\n for (let index = 0; index < input.length; index += 1) {\n hash = Math.imul(hash ^ input.charCodeAt(index), 0x01000193);\n }\n hash += hash << 13;\n hash ^= hash >>> 7;\n hash += hash << 3;\n hash ^= hash >>> 17;\n hash += hash << 5;\n return (hash >>> 0) / 0x100000000;\n};\n\n/**\n * 按应用和 RUM Session ID 做确定性采样。采样决定随 Session 更新,不再依赖 Tab 级 sessionStorage。\n */\nexport const isBkOTSampled = (\n { application, session }: Pick<ResolvedBkOTConfig, 'application' | 'session'>,\n sessionId: string,\n) => {\n if (session.sampleRate <= 0) {\n return false;\n }\n if (session.sampleRate >= 1) {\n return true;\n }\n return hashToUnitInterval(`${application.name}\\0${sessionId}`) < session.sampleRate;\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { type Attributes, type Span, context, propagation, SpanKind, SpanStatusCode } from '@opentelemetry/api';\nimport { ZoneContextManager } from '@opentelemetry/context-zone';\nimport { W3CTraceContextPropagator } from '@opentelemetry/core';\nimport { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';\nimport { resourceFromAttributes } from '@opentelemetry/resources';\nimport { BatchSpanProcessor, SamplingDecision, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base';\nimport { WebTracerProvider } from '@opentelemetry/sdk-trace-web';\n\nimport { createActionPlugin } from '../plugins/action';\nimport { createActivityPlugin } from '../plugins/activity';\nimport { createBlankScreenPlugin } from '../plugins/blank-screen';\nimport { createCommonInstrumentationsPlugin } from '../plugins/common';\nimport { createCspViolationPlugin } from '../plugins/csp-violation';\nimport { createDevicePlugin } from '../plugins/device';\nimport { createErrorPlugin } from '../plugins/error';\nimport { createLongTaskPlugin } from '../plugins/long-task';\nimport { createPageViewPlugin } from '../plugins/page-view';\nimport { createResourcePlugin } from '../plugins/resource';\nimport { createSessionPlugin } from '../plugins/session';\nimport { createWebVitalsPlugin } from '../plugins/web-vitals';\nimport { createWebSocketPlugin } from '../plugins/websocket';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_OUTCOME, RUM_SPAN_TYPE } from '../schema/span';\nimport { RumActivityObserver } from './action-activity';\nimport {\n type BkOTActionEventPayload,\n type BkOTCustomEventPayload,\n type BkOTOptions,\n type BkOTTrackingConfig,\n type BkOTTrackingConsent,\n type ResolvedBkOTConfig,\n type ResolvedTransportConfig,\n resolveConfig,\n} from './config';\nimport { createRandomId } from './id';\nimport { type BkOTPlugin, type BkOTRuntimeContext, type BkOTStartSpanOptions, PluginManager } from './plugin';\nimport { FilteringSpanProcessor } from './processor';\nimport {\n type BkOTSessionLifecycleEvent,\n type BkOTStartViewOptions,\n type BkOTUserContext,\n RumRuntimeContext,\n} from './runtime-context';\nimport { isBkOTSampled } from './sampling';\n\nimport type { Instrumentation } from '@opentelemetry/instrumentation';\nimport type { Sampler } from '@opentelemetry/sdk-trace-base';\n\nexport interface BkOTInstance extends Omit<\n BkOTRuntimeContext,\n 'notifyActivity' | 'onActivity' | 'onViewChange' | 'onViewCommand' | 'registerInstrumentations' | 'setView'\n> {\n flush: () => Promise<void>;\n reportAction: (payload: BkOTActionEventPayload) => void;\n reportCustomEvent: (payload: BkOTCustomEventPayload) => void;\n setTrackingConsent: (consent: BkOTTrackingConsent) => Promise<void>;\n setUser: (user: BkOTUserContext) => void;\n setViewLoadingTime: () => void;\n setViewName: (name: string) => void;\n shutdown: () => Promise<void>;\n start: () => Promise<void>;\n startView: (options?: BkOTStartViewOptions) => void;\n use: (plugin: BkOTPlugin) => BkOTInstance;\n useInstrumentation: (instrumentation: Instrumentation) => BkOTInstance;\n}\n\nconst createExporterOptions = (config: ResolvedTransportConfig) => ({\n url: config.endpoint,\n headers: config.headers,\n concurrencyLimit: config.concurrencyLimit,\n timeoutMillis: config.timeoutMillis,\n});\n\nconst BK_OT_INSTRUMENTATION_NAME = 'bk-rum';\n\nclass RumSessionSampler implements Sampler {\n public constructor(private readonly isSampled: () => boolean) {}\n\n public shouldSample() {\n return {\n decision: this.isSampled() ? SamplingDecision.RECORD_AND_SAMPLED : SamplingDecision.NOT_RECORD,\n };\n }\n\n public toString() {\n return 'RumSessionSampler';\n }\n}\n\n// OTel context manager 和 propagator 是页面级全局对象,多 SDK 实例通过引用计数共享,最后一个实例退出时释放。\nlet globalRegistration:\n | undefined\n | {\n contextManager?: ZoneContextManager;\n ownsContext: boolean;\n ownsPropagator: boolean;\n users: number;\n };\n\nconst acquireOtelGlobals = () => {\n if (globalRegistration) {\n globalRegistration.users += 1;\n } else {\n const contextManager = new ZoneContextManager().enable();\n const ownsContext = context.setGlobalContextManager(contextManager);\n if (!ownsContext) contextManager.disable();\n globalRegistration = {\n contextManager: ownsContext ? contextManager : undefined,\n ownsContext,\n ownsPropagator: propagation.setGlobalPropagator(new W3CTraceContextPropagator()),\n users: 1,\n };\n }\n let released = false;\n return () => {\n if (released || !globalRegistration) return;\n released = true;\n globalRegistration.users -= 1;\n if (globalRegistration.users > 0) return;\n if (globalRegistration.ownsContext) context.disable();\n if (globalRegistration.ownsPropagator) propagation.disable();\n globalRegistration = undefined;\n };\n};\n\n/**\n * 用 Proxy 包装一层 debug 旁路,避免直接 mutate 第三方 exporter 实例(其内部可能含 #private fields)。\n */\nconst wrapWithDebug = <TExporter extends { export: (...args: any[]) => any }>(\n exporter: TExporter,\n enabled: boolean,\n): TExporter => {\n if (!enabled) {\n return exporter;\n }\n return new Proxy(exporter, {\n get(target, prop, receiver) {\n if (prop === 'export') {\n return (records: unknown, callback: unknown) => {\n globalThis.console?.log('[bk-ot][rum]', records);\n return (target as { export: (...args: unknown[]) => unknown }).export(records, callback);\n };\n }\n const value = Reflect.get(target, prop, receiver);\n return typeof value === 'function' ? value.bind(target) : value;\n },\n });\n};\n\n// 请求插件统一负责 Fetch/XHR span、Trace Header 与活动计数。\nconst getCorePlugins = (config: ResolvedBkOTConfig): BkOTPlugin[] => [\n createCommonInstrumentationsPlugin(config.tracking.request),\n];\n\nconst getRumContextPlugins = (config: ResolvedBkOTConfig): BkOTPlugin[] => [\n createSessionPlugin(config.session),\n ...createBuiltInPlugin(config.tracking.device, true, createDevicePlugin),\n createActivityPlugin(),\n createPageViewPlugin(),\n createResourcePlugin(isBuiltInPluginEnabled(config.tracking.resource, true)),\n];\n\nconst isBuiltInPluginEnabled = <TOptions extends object>(\n option: boolean | TOptions | undefined,\n defaultEnabled: boolean,\n) => (option === undefined ? defaultEnabled : option !== false);\n\nconst getBuiltInPluginOptions = <TOptions extends object>(option: boolean | TOptions | undefined) =>\n typeof option === 'object' && option !== null ? option : undefined;\n\nconst createBuiltInPlugin = <TOptions extends object>(\n option: boolean | TOptions | undefined,\n defaultEnabled: boolean,\n factory: (options?: TOptions) => BkOTPlugin,\n) => (isBuiltInPluginEnabled(option, defaultEnabled) ? [factory(getBuiltInPluginOptions(option))] : []);\n\n// 上下文插件先启动,确保后续 span 能带上关联字段;Session sampler 与 processor 负责统一采样。\nconst getRumPlugins = (tracking: BkOTTrackingConfig): BkOTPlugin[] => [\n ...createBuiltInPlugin(tracking.error, true, createErrorPlugin),\n ...createBuiltInPlugin(tracking.webVitals, true, createWebVitalsPlugin),\n ...createBuiltInPlugin(tracking.blankScreen, true, createBlankScreenPlugin),\n ...createBuiltInPlugin(tracking.action, true, createActionPlugin),\n ...createBuiltInPlugin(tracking.websocket, false, createWebSocketPlugin),\n ...createBuiltInPlugin(tracking.longTask, false, createLongTaskPlugin),\n ...createBuiltInPlugin(tracking.cspViolation, false, createCspViolationPlugin),\n];\n\ntype SdkLifecyclePhase = 'idle' | 'started' | 'starting' | 'stopped';\n\n/**\n * 浏览器 RUM SDK 的生命周期入口。Provider 在构造时创建,插件和全局 patch 则随 start、授权变更和\n * shutdown 安装或卸载;Session 决定统一作用于所有 RUM span。\n */\nexport class BkOpenTelemetry implements BkOTInstance {\n private readonly activityObserver = new RumActivityObserver();\n private readonly flushProviders = async () => {\n await this.tracerProvider.forceFlush();\n };\n private phase: SdkLifecyclePhase = 'idle';\n private pluginManager?: PluginManager;\n private readonly registeredInstrumentations: Instrumentation[];\n private releaseOtelGlobals?: () => void;\n private readonly runtimeContext: RumRuntimeContext;\n\n private sampled = false;\n private readonly startCollection = async () => {\n // Provider 始终存在以保持公开 API 稳定;采集插件仅在启用且获得授权后安装。\n if (this.pluginManager || !this.config.enabled || this.config.trackingConsent !== 'granted') return;\n this.releaseOtelGlobals = acquireOtelGlobals();\n const pluginManager = this.createPluginManager();\n this.pluginManager = pluginManager;\n try {\n await pluginManager.start(this.createPluginContext());\n this.registerInstrumentations(this.config.extensions.instrumentations ?? []);\n } catch (error) {\n await pluginManager.shutdown();\n this.pluginManager = undefined;\n while (this.registeredInstrumentations.length) this.registeredInstrumentations.pop()?.disable?.();\n this.releaseOtelGlobals?.();\n this.releaseOtelGlobals = undefined;\n throw error;\n }\n };\n private readonly stopCollection = async (flush: boolean) => {\n const pluginManager = this.pluginManager;\n if (!pluginManager) return;\n await pluginManager.shutdown();\n this.pluginManager = undefined;\n while (this.registeredInstrumentations.length) this.registeredInstrumentations.pop()?.disable?.();\n // 撤销授权后立即清空 Session,防止后续手工 API 继续复用旧采样决定。\n this.setRuntimeAttributes({\n [RUM_ATTRIBUTES.sessionHasReplay]: undefined,\n [RUM_ATTRIBUTES.sessionId]: undefined,\n });\n if (flush) await this.flushProviders();\n this.releaseOtelGlobals?.();\n this.releaseOtelGlobals = undefined;\n };\n private readonly teardownCallbacks: Array<() => void> = [];\n private readonly tracerProvider: WebTracerProvider;\n private assertBeforeStart(method: string) {\n if (this.phase !== 'idle') {\n throw new Error(`[bk-ot] ${method}() must be called before start(); set autoStart: false before registration.`);\n }\n }\n private createPluginContext(): BkOTRuntimeContext {\n return {\n applyRedact: this.applyRedact,\n config: this.config,\n flush: this.flush,\n getRuntimeAttributes: this.getRuntimeAttributes,\n getRuntimeAttributesAt: this.getRuntimeAttributesAt,\n isSampled: this.isSampled,\n isSessionActive: this.isSessionActive,\n isViewActive: this.isViewActive,\n notifySessionLifecycle: this.notifySessionLifecycle,\n notifyActivity: this.activityObserver.notify,\n onActivity: this.activityObserver.subscribe,\n onSessionLifecycle: this.onSessionLifecycle,\n onViewCommand: this.runtimeContext.onViewCommand,\n onViewChange: this.runtimeContext.onViewChange,\n registerInstrumentations: this.registerInstrumentations,\n setRuntimeAttributes: this.setRuntimeAttributes,\n setUser: this.setUser,\n setView: this.runtimeContext.setView,\n startSpan: this.startSpan,\n tracer: this.tracer,\n };\n }\n private createPluginManager() {\n return new PluginManager([\n ...getRumContextPlugins(this.config),\n ...getCorePlugins(this.config),\n ...getRumPlugins(this.config.tracking),\n ...(this.config.extensions.plugins ?? []),\n ]);\n }\n public readonly applyRedact = (attributes: Attributes) => this.config.hooks.redactAttributes(attributes);\n\n public readonly config: ResolvedBkOTConfig;\n\n public readonly flush = async () => {\n await this.pluginManager?.flush();\n await this.flushProviders();\n };\n\n public readonly getRuntimeAttributes = () => this.runtimeContext.getAttributes();\n public readonly getRuntimeAttributesAt = (timestamp: number) => this.runtimeContext.getAttributesAt(timestamp);\n public readonly isSampled = () => this.sampled;\n public readonly isSessionActive = () => this.runtimeContext.isSessionActive();\n public readonly isViewActive = () => this.runtimeContext.isViewActive();\n public readonly notifySessionLifecycle = (event: BkOTSessionLifecycleEvent) => {\n this.runtimeContext.notifySessionLifecycle(event);\n };\n\n public readonly onSessionLifecycle = (listener: (event: BkOTSessionLifecycleEvent) => void) =>\n this.runtimeContext.onSessionLifecycle(listener);\n\n public readonly registerInstrumentations = (instrumentations: Instrumentation[]) => {\n if (!instrumentations.length) return;\n instrumentations.forEach(instrumentation => {\n instrumentation.setTracerProvider(this.tracerProvider);\n if (!instrumentation.getConfig().enabled) instrumentation.enable();\n });\n this.registeredInstrumentations.push(...instrumentations);\n };\n\n public readonly reportAction = ({ attributes = {}, name }: BkOTActionEventPayload) => {\n if (!this.isSampled()) {\n return;\n }\n const actionId = createRandomId('action');\n const occurredAt = Date.now();\n const spanAttributes = {\n ...this.config.hooks.getPageAttributes(),\n ...attributes,\n ...buildRumSpanAttributes({\n spanType: RUM_SPAN_TYPE.action,\n }),\n [RUM_ATTRIBUTES.actionId]: actionId,\n [RUM_ATTRIBUTES.actionName]: name,\n [RUM_ATTRIBUTES.actionType]: 'custom',\n };\n const span = this.startSpan(\n buildRumSpanName({ attributes: spanAttributes, spanType: RUM_SPAN_TYPE.action }),\n spanAttributes,\n { rumSpanType: RUM_SPAN_TYPE.action, startTime: occurredAt },\n );\n span.end(occurredAt);\n };\n\n public readonly reportCustomEvent = ({ attributes = {}, error, name }: BkOTCustomEventPayload) => {\n if (!this.isSampled()) {\n // 未采样时静默丢弃;如需调试请把 debug 选项打开\n if (this.config.debug) {\n globalThis.console?.warn('[bk-ot] custom event dropped (not sampled):', name);\n }\n return;\n }\n\n const occurredAt = Date.now();\n const spanAttributes = {\n ...this.config.hooks.getPageAttributes(),\n ...this.config.hooks.getCustomAttributes(),\n ...attributes,\n ...buildRumSpanAttributes({\n outcome: error ? RUM_SPAN_OUTCOME.error : RUM_SPAN_OUTCOME.success,\n spanType: RUM_SPAN_TYPE.custom,\n }),\n };\n const span = this.startSpan(\n buildRumSpanName({ attributes: spanAttributes, nameHint: name, spanType: RUM_SPAN_TYPE.custom }),\n spanAttributes,\n { startTime: occurredAt },\n );\n\n if (error) {\n span.recordException(error);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: error.message,\n });\n }\n\n span.end(occurredAt);\n };\n\n public readonly setRuntimeAttributes = (attributes: Attributes, changedAt?: number) => {\n const nextAttributes = { ...attributes };\n const effectiveChangedAt = changedAt ?? Date.now();\n if (RUM_ATTRIBUTES.sessionId in attributes) {\n // 采样以 Session 为边界重新计算,并保存在运行时私有历史中。\n const sessionId = attributes[RUM_ATTRIBUTES.sessionId];\n this.sampled =\n this.config.enabled && typeof sessionId === 'string' && sessionId.length > 0\n ? isBkOTSampled(this.config, sessionId)\n : false;\n this.runtimeContext.setSessionSampled(this.sampled, effectiveChangedAt);\n }\n this.runtimeContext.setAttributes(nextAttributes, effectiveChangedAt);\n };\n\n public readonly setTrackingConsent = async (consent: BkOTTrackingConsent) => {\n if (this.config.trackingConsent === consent) return;\n this.config.trackingConsent = consent;\n if (this.phase !== 'started') return;\n if (consent === 'granted') await this.startCollection();\n else await this.stopCollection(true);\n };\n\n public readonly setUser = (user: BkOTUserContext) => {\n this.runtimeContext.setUser(user);\n };\n\n public readonly setViewLoadingTime = () => {\n if (this.isSampled()) this.runtimeContext.dispatchViewCommand({ time: Date.now(), type: 'set_loading_time' });\n };\n\n public readonly setViewName = (name: string) => {\n if (this.isSampled()) this.runtimeContext.dispatchViewCommand({ name, type: 'set_name' });\n };\n\n public readonly shutdown = async () => {\n if (this.phase === 'stopped') {\n return;\n }\n await this.stopCollection(false);\n await this.flushProviders();\n while (this.teardownCallbacks.length) {\n this.teardownCallbacks.pop()?.();\n }\n await this.tracerProvider.shutdown();\n this.phase = 'stopped';\n };\n\n public readonly start = async () => {\n if (this.phase === 'started' || this.phase === 'starting') {\n return;\n }\n if (this.phase === 'stopped') {\n // shutdown 已经销毁了 provider/processor,此处禁止再次启动\n throw new Error('[bk-ot] instance has been shut down and cannot be restarted; create a new instance instead.');\n }\n if (!this.config.enabled) {\n this.phase = 'started';\n return;\n }\n this.phase = 'starting';\n try {\n await this.startCollection();\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n // 页面进入后台或被丢弃前尽力导出批量数据;两个事件并存以覆盖不同浏览器生命周期。\n const flushOnPageHide = () => {\n void this.flush();\n };\n const flushOnHidden = () => {\n if (document.visibilityState === 'hidden') {\n void this.flush();\n }\n };\n window.addEventListener('pagehide', flushOnPageHide);\n document.addEventListener('visibilitychange', flushOnHidden);\n this.teardownCallbacks.push(\n () => window.removeEventListener('pagehide', flushOnPageHide),\n () => document.removeEventListener('visibilitychange', flushOnHidden),\n );\n }\n } catch (error) {\n while (this.teardownCallbacks.length) {\n this.teardownCallbacks.pop()?.();\n }\n await this.stopCollection(false);\n this.phase = 'idle';\n throw error;\n }\n this.phase = 'started';\n };\n\n public readonly startSpan = (name: string, attributes: Attributes = {}, options?: BkOTStartSpanOptions): Span => {\n const contextTime =\n options?.contextTime ?? (typeof options?.startTime === 'number' ? options.startTime : undefined);\n // 返回 provider 创建的 non-recording span,而不是让每个调用方处理 undefined。\n if (!this.isSampled() || (contextTime !== undefined && !this.runtimeContext.isSessionSampledAt(contextTime))) {\n return this.tracer.startSpan(name);\n }\n const runtimeAttributes =\n contextTime === undefined ? this.getRuntimeAttributes() : this.runtimeContext.getAttributesAt(contextTime);\n const redactedAttributes = this.applyRedact({ ...runtimeAttributes, ...attributes });\n const spanName = options?.rumSpanType\n ? buildRumSpanName({ attributes: redactedAttributes, spanType: options.rumSpanType })\n : name;\n return this.tracer.startSpan(spanName, {\n kind: options?.kind ?? SpanKind.INTERNAL,\n links: options?.links,\n startTime: options?.startTime,\n attributes: redactedAttributes,\n });\n };\n\n public readonly startView = (options: BkOTStartViewOptions = {}) => {\n if (this.isSampled()) this.runtimeContext.dispatchViewCommand({ options, type: 'start' });\n };\n\n public readonly tracer: BkOTRuntimeContext['tracer'];\n\n public readonly use = (plugin: BkOTPlugin): this => {\n this.assertBeforeStart('use');\n this.config.extensions.plugins?.push(plugin);\n return this;\n };\n\n public readonly useInstrumentation = (instrumentation: Instrumentation): this => {\n this.assertBeforeStart('useInstrumentation');\n if (this.config.enabled) this.config.extensions.instrumentations?.push(instrumentation);\n return this;\n };\n\n constructor(inputConfig: BkOTOptions) {\n this.config = resolveConfig(inputConfig);\n this.runtimeContext = new RumRuntimeContext({}, this.config.user);\n\n const resource = resourceFromAttributes(this.config.resourceAttributes);\n const spanProcessors = (() => {\n const exporter = wrapWithDebug(\n new OTLPTraceExporter(createExporterOptions(this.config.transport)),\n this.config.debug,\n );\n const processor =\n this.config.spanProcessor === 'simple'\n ? new SimpleSpanProcessor(exporter)\n : new BatchSpanProcessor(exporter, this.config.spanBatch);\n return [\n new FilteringSpanProcessor(processor, this.config, () =>\n this.applyRedact({\n ...this.runtimeContext.getAttributes(),\n ...this.config.hooks.getPageAttributes(),\n }),\n ),\n ];\n })();\n this.tracerProvider = new WebTracerProvider({\n resource,\n sampler: new RumSessionSampler(this.isSampled),\n spanProcessors,\n });\n this.tracer = this.tracerProvider.getTracer(BK_OT_INSTRUMENTATION_NAME);\n this.registeredInstrumentations = [];\n if (this.config.autoStart) {\n void this.start().catch(error => {\n globalThis.console?.warn('[bk-ot] auto start failed:', error);\n });\n }\n }\n}\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { BkOpenTelemetry } from './core/sdk';\n\nif (typeof window !== 'undefined') {\n Object.assign(window, {\n BkOpenTelemetry,\n });\n}\n\nexport default BkOpenTelemetry;\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,130],"mappings":"mNAKaA,EAAU,QCAjB,EAAK,g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,KAAU,OAAO,CAAC,MAAM,GAAS,QAC/B,EAAA,WAAW,UAAA,MAAA,EAAS,KAAK,6BAA8B,EAAM,EAC7D,UCjhBJ,OAAO,OAAW,KACpB,OAAO,OAAO,OAAQ,CACpB,mBACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"bk-rum.global.js","names":["VERSION","VERSION","VERSION","_global","API_NAME","diag","API_NAME","SamplingDecision","API_NAME","global","isFunction","VERSION","VERSION","performance","VERSION","this","this","this","this","this","api.createNoopMeter","context","api.INVALID_SPAN_CONTEXT","this"],"sources":["../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/version.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/semver.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/types.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/diag.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/baggage/internal/symbol.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/baggage/utils.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/context.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/context.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/SamplingResult.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/span_kind.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/status.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context-api.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag-api.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/propagation.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/propagation-api.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/trace.js","../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace-api.js","../../../node_modules/.pnpm/@opentelemetry+context-zone-peer-dep@2.7.1_@opentelemetry+api@1.9.1_zone.js@0.16.2/node_modules/@opentelemetry/context-zone-peer-dep/build/esm/util.js","../../../node_modules/.pnpm/@opentelemetry+context-zone-peer-dep@2.7.1_@opentelemetry+api@1.9.1_zone.js@0.16.2/node_modules/@opentelemetry/context-zone-peer-dep/build/esm/ZoneContextManager.js","../../../node_modules/.pnpm/zone.js@0.16.2/node_modules/zone.js/fesm2015/zone.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/baggage/constants.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/baggage/utils.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/baggage/propagation/W3CBaggagePropagator.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/attributes.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/logging-error-handler.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/global-error-handler.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/environment.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/version.js","../../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/semconv.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/sdk-info.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/index.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/time.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/ExportResult.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/propagation/composite.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/internal/validators.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/trace/TraceState.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/trace/W3CTraceContextPropagator.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/lodash.merge.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/merge.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/promise.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/callback.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/internal/exporter.js","../../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/index.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/OTLPExporterBase.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/types.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/shared-configuration.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/bounded-queue-export-promise-handler.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/logging-response-handler.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-export-delegate.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-network-export-delegate.js","../../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/default-service-name.js","../../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/utils.js","../../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/ResourceImpl.js","../../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/common/internal.js","../../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/common/utils.js","../../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js","../../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/trace.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/retrying-transport.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/is-export-retryable.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/fetch-transport.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-browser-http-export-delegate.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/util.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-http-configuration.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/convert-legacy-http-options.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/convert-legacy-browser-http-options.js","../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/create-legacy-browser-delegate.js","../../../node_modules/.pnpm/@opentelemetry+exporter-trace-otlp-http@0.217.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/platform/browser/OTLPTraceExporter.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/enums.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Span.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Sampler.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/AlwaysOffSampler.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/AlwaysOnSampler.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/ParentBasedSampler.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/TraceIdRatioBasedSampler.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/config.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/utility.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/BatchSpanProcessorBase.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/export/BatchSpanProcessor.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/RandomIdGenerator.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/semconv.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/TracerMetrics.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/MultiSpanProcessor.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/BasicTracerProvider.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/SimpleSpanProcessor.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-web@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-web/build/esm/StackContextManager.js","../../../node_modules/.pnpm/@opentelemetry+sdk-trace-web@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-web/build/esm/WebTracerProvider.js","../src/core/action-target.ts","../src/core/event-time.ts","../src/core/id.ts","../src/core/url.ts","../src/schema/attributes.ts","../src/schema/span.ts","../src/plugins/action.ts","../src/plugins/activity.ts","../src/plugins/blank-screen-detection.ts","../src/plugins/blank-screen.ts","../src/core/runtime-context.ts","../src/core/processor.ts","../src/core/request-timing.ts","../src/core/trace-context.ts","../src/core/performance-timing.ts","../src/plugins/resource.ts","../src/plugins/common.ts","../src/plugins/csp-violation.ts","../src/core/hash.ts","../src/plugins/device.ts","../src/plugins/error.ts","../src/plugins/long-task.ts","../src/core/page-activity.ts","../src/core/route-observer.ts","../src/core/view-location.ts","../src/plugins/page-view.ts","../src/plugins/session-state.ts","../src/plugins/session-store.ts","../src/plugins/session.ts","../src/plugins/document-vitals.ts","../src/plugins/web-vitals-metrics.ts","../src/plugins/web-vitals.ts","../src/plugins/websocket.ts","../src/core/action-activity.ts","../package.json","../src/core/config.ts","../src/core/plugin.ts","../src/core/sampling.ts","../src/core/session-transition.ts","../src/core/sdk.ts","../src/browser.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '1.9.1';\n//# sourceMappingURL=version.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { VERSION } from '../version';\nconst re = /^(\\d+)\\.(\\d+)\\.(\\d+)(-(.+))?$/;\n/**\n * Create a function to test an API version to see if it is compatible with the provided ownVersion.\n *\n * The returned function has the following semantics:\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param ownVersion version which should be checked against\n */\nexport function _makeCompatibilityCheck(ownVersion) {\n const acceptedVersions = new Set([ownVersion]);\n const rejectedVersions = new Set();\n const myVersionMatch = ownVersion.match(re);\n if (!myVersionMatch) {\n // we cannot guarantee compatibility so we always return noop\n return () => false;\n }\n const ownVersionParsed = {\n major: +myVersionMatch[1],\n minor: +myVersionMatch[2],\n patch: +myVersionMatch[3],\n prerelease: myVersionMatch[4],\n };\n // if ownVersion has a prerelease tag, versions must match exactly\n if (ownVersionParsed.prerelease != null) {\n return function isExactmatch(globalVersion) {\n return globalVersion === ownVersion;\n };\n }\n function _reject(v) {\n rejectedVersions.add(v);\n return false;\n }\n function _accept(v) {\n acceptedVersions.add(v);\n return true;\n }\n return function isCompatible(globalVersion) {\n if (acceptedVersions.has(globalVersion)) {\n return true;\n }\n if (rejectedVersions.has(globalVersion)) {\n return false;\n }\n const globalVersionMatch = globalVersion.match(re);\n if (!globalVersionMatch) {\n // cannot parse other version\n // we cannot guarantee compatibility so we always noop\n return _reject(globalVersion);\n }\n const globalVersionParsed = {\n major: +globalVersionMatch[1],\n minor: +globalVersionMatch[2],\n patch: +globalVersionMatch[3],\n prerelease: globalVersionMatch[4],\n };\n // if globalVersion has a prerelease tag, versions must match exactly\n if (globalVersionParsed.prerelease != null) {\n return _reject(globalVersion);\n }\n // major versions must match\n if (ownVersionParsed.major !== globalVersionParsed.major) {\n return _reject(globalVersion);\n }\n if (ownVersionParsed.major === 0) {\n if (ownVersionParsed.minor === globalVersionParsed.minor &&\n ownVersionParsed.patch <= globalVersionParsed.patch) {\n return _accept(globalVersion);\n }\n return _reject(globalVersion);\n }\n if (ownVersionParsed.minor <= globalVersionParsed.minor) {\n return _accept(globalVersion);\n }\n return _reject(globalVersion);\n };\n}\n/**\n * Test an API version to see if it is compatible with this API.\n *\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param version version of the API requesting an instance of the global API\n */\nexport const isCompatible = _makeCompatibilityCheck(VERSION);\n//# sourceMappingURL=semver.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { VERSION } from '../version';\nimport { isCompatible } from './semver';\nconst major = VERSION.split('.')[0];\nconst GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(`opentelemetry.js.api.${major}`);\nconst _global = (typeof globalThis === 'object'\n ? globalThis\n : typeof self === 'object'\n ? self\n : typeof window === 'object'\n ? window\n : typeof global === 'object'\n ? global\n : {});\nexport function registerGlobal(type, instance, diag, allowOverride = false) {\n var _a;\n const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : {\n version: VERSION,\n });\n if (!allowOverride && api[type]) {\n // already registered an API of this type\n const err = new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${type}`);\n diag.error(err.stack || err.message);\n return false;\n }\n if (api.version !== VERSION) {\n // All registered APIs must be of the same version exactly\n const err = new Error(`@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION}`);\n diag.error(err.stack || err.message);\n return false;\n }\n api[type] = instance;\n diag.debug(`@opentelemetry/api: Registered a global for ${type} v${VERSION}.`);\n return true;\n}\nexport function getGlobal(type) {\n var _a, _b;\n const globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version;\n if (!globalVersion || !isCompatible(globalVersion)) {\n return;\n }\n return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type];\n}\nexport function unregisterGlobal(type, diag) {\n diag.debug(`@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`);\n const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];\n if (api) {\n delete api[type];\n }\n}\n//# sourceMappingURL=global-utils.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { getGlobal } from '../internal/global-utils';\n/**\n * Component Logger which is meant to be used as part of any component which\n * will add automatically additional namespace in front of the log message.\n * It will then forward all message to global diag logger\n * @example\n * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' });\n * cLogger.debug('test');\n * // @opentelemetry/instrumentation-http test\n */\nexport class DiagComponentLogger {\n constructor(props) {\n this._namespace = props.namespace || 'DiagComponentLogger';\n }\n debug(...args) {\n return logProxy('debug', this._namespace, args);\n }\n error(...args) {\n return logProxy('error', this._namespace, args);\n }\n info(...args) {\n return logProxy('info', this._namespace, args);\n }\n warn(...args) {\n return logProxy('warn', this._namespace, args);\n }\n verbose(...args) {\n return logProxy('verbose', this._namespace, args);\n }\n}\nfunction logProxy(funcName, namespace, args) {\n const logger = getGlobal('diag');\n // shortcut if logger not set\n if (!logger) {\n return;\n }\n return logger[funcName](namespace, ...args);\n}\n//# sourceMappingURL=ComponentLogger.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * Defines the available internal logging levels for the diagnostic logger, the numeric values\n * of the levels are defined to match the original values from the initial LogLevel to avoid\n * compatibility/migration issues for any implementation that assume the numeric ordering.\n */\nexport var DiagLogLevel;\n(function (DiagLogLevel) {\n /** Diagnostic Logging level setting to disable all logging (except and forced logs) */\n DiagLogLevel[DiagLogLevel[\"NONE\"] = 0] = \"NONE\";\n /** Identifies an error scenario */\n DiagLogLevel[DiagLogLevel[\"ERROR\"] = 30] = \"ERROR\";\n /** Identifies a warning scenario */\n DiagLogLevel[DiagLogLevel[\"WARN\"] = 50] = \"WARN\";\n /** General informational log message */\n DiagLogLevel[DiagLogLevel[\"INFO\"] = 60] = \"INFO\";\n /** General debug log message */\n DiagLogLevel[DiagLogLevel[\"DEBUG\"] = 70] = \"DEBUG\";\n /**\n * Detailed trace level logging should only be used for development, should only be set\n * in a development environment.\n */\n DiagLogLevel[DiagLogLevel[\"VERBOSE\"] = 80] = \"VERBOSE\";\n /** Used to set the logging level to include all logging */\n DiagLogLevel[DiagLogLevel[\"ALL\"] = 9999] = \"ALL\";\n})(DiagLogLevel || (DiagLogLevel = {}));\n//# sourceMappingURL=types.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { DiagLogLevel } from '../types';\nexport function createLogLevelDiagLogger(maxLevel, logger) {\n if (maxLevel < DiagLogLevel.NONE) {\n maxLevel = DiagLogLevel.NONE;\n }\n else if (maxLevel > DiagLogLevel.ALL) {\n maxLevel = DiagLogLevel.ALL;\n }\n // In case the logger is null or undefined\n logger = logger || {};\n function _filterFunc(funcName, theLevel) {\n const theFunc = logger[funcName];\n if (typeof theFunc === 'function' && maxLevel >= theLevel) {\n return theFunc.bind(logger);\n }\n return function () { };\n }\n return {\n error: _filterFunc('error', DiagLogLevel.ERROR),\n warn: _filterFunc('warn', DiagLogLevel.WARN),\n info: _filterFunc('info', DiagLogLevel.INFO),\n debug: _filterFunc('debug', DiagLogLevel.DEBUG),\n verbose: _filterFunc('verbose', DiagLogLevel.VERBOSE),\n };\n}\n//# sourceMappingURL=logLevelLogger.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { DiagComponentLogger } from '../diag/ComponentLogger';\nimport { createLogLevelDiagLogger } from '../diag/internal/logLevelLogger';\nimport { DiagLogLevel } from '../diag/types';\nimport { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';\nconst API_NAME = 'diag';\n/**\n * Singleton object which represents the entry point to the OpenTelemetry internal\n * diagnostic API\n *\n * @since 1.0.0\n */\nexport class DiagAPI {\n /** Get the singleton instance of the DiagAPI API */\n static instance() {\n if (!this._instance) {\n this._instance = new DiagAPI();\n }\n return this._instance;\n }\n /**\n * Private internal constructor\n * @private\n */\n constructor() {\n function _logProxy(funcName) {\n return function (...args) {\n const logger = getGlobal('diag');\n // shortcut if logger not set\n if (!logger)\n return;\n return logger[funcName](...args);\n };\n }\n // Using self local variable for minification purposes as 'this' cannot be minified\n const self = this;\n // DiagAPI specific functions\n const setLogger = (logger, optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }) => {\n var _a, _b, _c;\n if (logger === self) {\n // There isn't much we can do here.\n // Logging to the console might break the user application.\n // Try to log to self. If a logger was previously registered it will receive the log.\n const err = new Error('Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation');\n self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);\n return false;\n }\n if (typeof optionsOrLogLevel === 'number') {\n optionsOrLogLevel = {\n logLevel: optionsOrLogLevel,\n };\n }\n const oldLogger = getGlobal('diag');\n const newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger);\n // There already is an logger registered. We'll let it know before overwriting it.\n if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {\n const stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : '<failed to generate stacktrace>';\n oldLogger.warn(`Current logger will be overwritten from ${stack}`);\n newLogger.warn(`Current logger will overwrite one already registered from ${stack}`);\n }\n return registerGlobal('diag', newLogger, self, true);\n };\n self.setLogger = setLogger;\n self.disable = () => {\n unregisterGlobal(API_NAME, self);\n };\n self.createComponentLogger = (options) => {\n return new DiagComponentLogger(options);\n };\n self.verbose = _logProxy('verbose');\n self.debug = _logProxy('debug');\n self.info = _logProxy('info');\n self.warn = _logProxy('warn');\n self.error = _logProxy('error');\n }\n}\n//# sourceMappingURL=diag.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport class BaggageImpl {\n constructor(entries) {\n this._entries = entries ? new Map(entries) : new Map();\n }\n getEntry(key) {\n const entry = this._entries.get(key);\n if (!entry) {\n return undefined;\n }\n return Object.assign({}, entry);\n }\n getAllEntries() {\n return Array.from(this._entries.entries());\n }\n setEntry(key, entry) {\n const newBaggage = new BaggageImpl(this._entries);\n newBaggage._entries.set(key, entry);\n return newBaggage;\n }\n removeEntry(key) {\n const newBaggage = new BaggageImpl(this._entries);\n newBaggage._entries.delete(key);\n return newBaggage;\n }\n removeEntries(...keys) {\n const newBaggage = new BaggageImpl(this._entries);\n for (const key of keys) {\n newBaggage._entries.delete(key);\n }\n return newBaggage;\n }\n clear() {\n return new BaggageImpl();\n }\n}\n//# sourceMappingURL=baggage-impl.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * Symbol used to make BaggageEntryMetadata an opaque type\n */\nexport const baggageEntryMetadataSymbol = Symbol('BaggageEntryMetadata');\n//# sourceMappingURL=symbol.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { DiagAPI } from '../api/diag';\nimport { BaggageImpl } from './internal/baggage-impl';\nimport { baggageEntryMetadataSymbol } from './internal/symbol';\nconst diag = DiagAPI.instance();\n/**\n * Create a new Baggage with optional entries\n *\n * @param entries An array of baggage entries the new baggage should contain\n */\nexport function createBaggage(entries = {}) {\n return new BaggageImpl(new Map(Object.entries(entries)));\n}\n/**\n * Create a serializable BaggageEntryMetadata object from a string.\n *\n * @param str string metadata. Format is currently not defined by the spec and has no special meaning.\n *\n * @since 1.0.0\n */\nexport function baggageEntryMetadataFromString(str) {\n if (typeof str !== 'string') {\n diag.error(`Cannot create baggage metadata from unknown type: ${typeof str}`);\n str = '';\n }\n return {\n __TYPE__: baggageEntryMetadataSymbol,\n toString() {\n return str;\n },\n };\n}\n//# sourceMappingURL=utils.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * Get a key to uniquely identify a context value\n *\n * @since 1.0.0\n */\nexport function createContextKey(description) {\n // The specification states that for the same input, multiple calls should\n // return different keys. Due to the nature of the JS dependency management\n // system, this creates problems where multiple versions of some package\n // could hold different keys for the same property.\n //\n // Therefore, we use Symbol.for which returns the same key for the same input.\n return Symbol.for(description);\n}\nclass BaseContext {\n /**\n * Construct a new context which inherits values from an optional parent context.\n *\n * @param parentContext a context from which to inherit values\n */\n constructor(parentContext) {\n // for minification\n const self = this;\n self._currentContext = parentContext ? new Map(parentContext) : new Map();\n self.getValue = (key) => self._currentContext.get(key);\n self.setValue = (key, value) => {\n const context = new BaseContext(self._currentContext);\n context._currentContext.set(key, value);\n return context;\n };\n self.deleteValue = (key) => {\n const context = new BaseContext(self._currentContext);\n context._currentContext.delete(key);\n return context;\n };\n }\n}\n/**\n * The root context is used as the default parent context when there is no active context\n *\n * @since 1.0.0\n */\nexport const ROOT_CONTEXT = new BaseContext();\n//# sourceMappingURL=context.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses\n * constant NoopMetrics for all of its methods.\n */\nexport class NoopMeter {\n constructor() { }\n /**\n * @see {@link Meter.createGauge}\n */\n createGauge(_name, _options) {\n return NOOP_GAUGE_METRIC;\n }\n /**\n * @see {@link Meter.createHistogram}\n */\n createHistogram(_name, _options) {\n return NOOP_HISTOGRAM_METRIC;\n }\n /**\n * @see {@link Meter.createCounter}\n */\n createCounter(_name, _options) {\n return NOOP_COUNTER_METRIC;\n }\n /**\n * @see {@link Meter.createUpDownCounter}\n */\n createUpDownCounter(_name, _options) {\n return NOOP_UP_DOWN_COUNTER_METRIC;\n }\n /**\n * @see {@link Meter.createObservableGauge}\n */\n createObservableGauge(_name, _options) {\n return NOOP_OBSERVABLE_GAUGE_METRIC;\n }\n /**\n * @see {@link Meter.createObservableCounter}\n */\n createObservableCounter(_name, _options) {\n return NOOP_OBSERVABLE_COUNTER_METRIC;\n }\n /**\n * @see {@link Meter.createObservableUpDownCounter}\n */\n createObservableUpDownCounter(_name, _options) {\n return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;\n }\n /**\n * @see {@link Meter.addBatchObservableCallback}\n */\n addBatchObservableCallback(_callback, _observables) { }\n /**\n * @see {@link Meter.removeBatchObservableCallback}\n */\n removeBatchObservableCallback(_callback) { }\n}\nexport class NoopMetric {\n}\nexport class NoopCounterMetric extends NoopMetric {\n add(_value, _attributes) { }\n}\nexport class NoopUpDownCounterMetric extends NoopMetric {\n add(_value, _attributes) { }\n}\nexport class NoopGaugeMetric extends NoopMetric {\n record(_value, _attributes) { }\n}\nexport class NoopHistogramMetric extends NoopMetric {\n record(_value, _attributes) { }\n}\nexport class NoopObservableMetric {\n addCallback(_callback) { }\n removeCallback(_callback) { }\n}\nexport class NoopObservableCounterMetric extends NoopObservableMetric {\n}\nexport class NoopObservableGaugeMetric extends NoopObservableMetric {\n}\nexport class NoopObservableUpDownCounterMetric extends NoopObservableMetric {\n}\nexport const NOOP_METER = new NoopMeter();\n// Synchronous instruments\nexport const NOOP_COUNTER_METRIC = new NoopCounterMetric();\nexport const NOOP_GAUGE_METRIC = new NoopGaugeMetric();\nexport const NOOP_HISTOGRAM_METRIC = new NoopHistogramMetric();\nexport const NOOP_UP_DOWN_COUNTER_METRIC = new NoopUpDownCounterMetric();\n// Asynchronous instruments\nexport const NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric();\nexport const NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric();\nexport const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = new NoopObservableUpDownCounterMetric();\n/**\n * Create a no-op Meter\n *\n * @since 1.3.0\n */\nexport function createNoopMeter() {\n return NOOP_METER;\n}\n//# sourceMappingURL=NoopMeter.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @since 1.0.0\n */\nexport const defaultTextMapGetter = {\n get(carrier, key) {\n if (carrier == null) {\n return undefined;\n }\n return carrier[key];\n },\n keys(carrier) {\n if (carrier == null) {\n return [];\n }\n return Object.keys(carrier);\n },\n};\n/**\n * @since 1.0.0\n */\nexport const defaultTextMapSetter = {\n set(carrier, key, value) {\n if (carrier == null) {\n return;\n }\n carrier[key] = value;\n },\n};\n//# sourceMappingURL=TextMapPropagator.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ROOT_CONTEXT } from './context';\nexport class NoopContextManager {\n active() {\n return ROOT_CONTEXT;\n }\n with(_context, fn, thisArg, ...args) {\n return fn.call(thisArg, ...args);\n }\n bind(_context, target) {\n return target;\n }\n enable() {\n return this;\n }\n disable() {\n return this;\n }\n}\n//# sourceMappingURL=NoopContextManager.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { NoopContextManager } from '../context/NoopContextManager';\nimport { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';\nimport { DiagAPI } from './diag';\nconst API_NAME = 'context';\nconst NOOP_CONTEXT_MANAGER = new NoopContextManager();\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Context API\n *\n * @since 1.0.0\n */\nexport class ContextAPI {\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n constructor() { }\n /** Get the singleton instance of the Context API */\n static getInstance() {\n if (!this._instance) {\n this._instance = new ContextAPI();\n }\n return this._instance;\n }\n /**\n * Set the current context manager.\n *\n * @returns true if the context manager was successfully registered, else false\n */\n setGlobalContextManager(contextManager) {\n return registerGlobal(API_NAME, contextManager, DiagAPI.instance());\n }\n /**\n * Get the currently active context\n */\n active() {\n return this._getContextManager().active();\n }\n /**\n * Execute a function with an active context\n *\n * @param context context to be active during function execution\n * @param fn function to execute in a context\n * @param thisArg optional receiver to be used for calling fn\n * @param args optional arguments forwarded to fn\n */\n with(context, fn, thisArg, ...args) {\n return this._getContextManager().with(context, fn, thisArg, ...args);\n }\n /**\n * Bind a context to a target function or event emitter\n *\n * @param context context to bind to the event emitter or function. Defaults to the currently active context\n * @param target function or event emitter to bind\n */\n bind(context, target) {\n return this._getContextManager().bind(context, target);\n }\n _getContextManager() {\n return getGlobal(API_NAME) || NOOP_CONTEXT_MANAGER;\n }\n /** Disable and remove the global context manager */\n disable() {\n this._getContextManager().disable();\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n}\n//# sourceMappingURL=context.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @since 1.0.0\n */\nexport var TraceFlags;\n(function (TraceFlags) {\n /** Represents no flag set. */\n TraceFlags[TraceFlags[\"NONE\"] = 0] = \"NONE\";\n /** Bit to represent whether trace is sampled in trace flags. */\n TraceFlags[TraceFlags[\"SAMPLED\"] = 1] = \"SAMPLED\";\n})(TraceFlags || (TraceFlags = {}));\n//# sourceMappingURL=trace_flags.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { TraceFlags } from './trace_flags';\n/**\n * @since 1.0.0\n */\nexport const INVALID_SPANID = '0000000000000000';\n/**\n * @since 1.0.0\n */\nexport const INVALID_TRACEID = '00000000000000000000000000000000';\n/**\n * @since 1.0.0\n */\nexport const INVALID_SPAN_CONTEXT = {\n traceId: INVALID_TRACEID,\n spanId: INVALID_SPANID,\n traceFlags: TraceFlags.NONE,\n};\n//# sourceMappingURL=invalid-span-constants.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { INVALID_SPAN_CONTEXT } from './invalid-span-constants';\n/**\n * The NonRecordingSpan is the default {@link Span} that is used when no Span\n * implementation is available. All operations are no-op including context\n * propagation.\n */\nexport class NonRecordingSpan {\n constructor(spanContext = INVALID_SPAN_CONTEXT) {\n this._spanContext = spanContext;\n }\n // Returns a SpanContext.\n spanContext() {\n return this._spanContext;\n }\n // By default does nothing\n setAttribute(_key, _value) {\n return this;\n }\n // By default does nothing\n setAttributes(_attributes) {\n return this;\n }\n // By default does nothing\n addEvent(_name, _attributes) {\n return this;\n }\n addLink(_link) {\n return this;\n }\n addLinks(_links) {\n return this;\n }\n // By default does nothing\n setStatus(_status) {\n return this;\n }\n // By default does nothing\n updateName(_name) {\n return this;\n }\n // By default does nothing\n end(_endTime) { }\n // isRecording always returns false for NonRecordingSpan.\n isRecording() {\n return false;\n }\n // By default does nothing\n recordException(_exception, _time) { }\n}\n//# sourceMappingURL=NonRecordingSpan.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { createContextKey } from '../context/context';\nimport { NonRecordingSpan } from './NonRecordingSpan';\nimport { ContextAPI } from '../api/context';\n/**\n * span key\n */\nconst SPAN_KEY = createContextKey('OpenTelemetry Context Key SPAN');\n/**\n * Return the span if one exists\n *\n * @param context context to get span from\n */\nexport function getSpan(context) {\n return context.getValue(SPAN_KEY) || undefined;\n}\n/**\n * Gets the span from the current context, if one exists.\n */\nexport function getActiveSpan() {\n return getSpan(ContextAPI.getInstance().active());\n}\n/**\n * Set the span on a context\n *\n * @param context context to use as parent\n * @param span span to set active\n */\nexport function setSpan(context, span) {\n return context.setValue(SPAN_KEY, span);\n}\n/**\n * Remove current span stored in the context\n *\n * @param context context to delete span from\n */\nexport function deleteSpan(context) {\n return context.deleteValue(SPAN_KEY);\n}\n/**\n * Wrap span context in a NoopSpan and set as span in a new\n * context\n *\n * @param context context to set active span on\n * @param spanContext span context to be wrapped\n */\nexport function setSpanContext(context, spanContext) {\n return setSpan(context, new NonRecordingSpan(spanContext));\n}\n/**\n * Get the span context of the span if it exists.\n *\n * @param context context to get values from\n */\nexport function getSpanContext(context) {\n var _a;\n return (_a = getSpan(context)) === null || _a === void 0 ? void 0 : _a.spanContext();\n}\n//# sourceMappingURL=context-utils.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { INVALID_SPANID, INVALID_TRACEID } from './invalid-span-constants';\nimport { NonRecordingSpan } from './NonRecordingSpan';\n// Valid characters (0-9, a-f, A-F) are marked as 1.\nconst isHex = new Uint8Array([\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,\n 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,\n]);\nfunction isValidHex(id, length) {\n // As of 1.9.0 the id was allowed to be a non-string value,\n // even though it was not possible in the types.\n if (typeof id !== 'string' || id.length !== length)\n return false;\n let r = 0;\n for (let i = 0; i < id.length; i += 4) {\n r +=\n (isHex[id.charCodeAt(i)] | 0) +\n (isHex[id.charCodeAt(i + 1)] | 0) +\n (isHex[id.charCodeAt(i + 2)] | 0) +\n (isHex[id.charCodeAt(i + 3)] | 0);\n }\n return r === length;\n}\n/**\n * @since 1.0.0\n */\nexport function isValidTraceId(traceId) {\n return isValidHex(traceId, 32) && traceId !== INVALID_TRACEID;\n}\n/**\n * @since 1.0.0\n */\nexport function isValidSpanId(spanId) {\n return isValidHex(spanId, 16) && spanId !== INVALID_SPANID;\n}\n/**\n * Returns true if this {@link SpanContext} is valid.\n * @return true if this {@link SpanContext} is valid.\n *\n * @since 1.0.0\n */\nexport function isSpanContextValid(spanContext) {\n return (isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId));\n}\n/**\n * Wrap the given {@link SpanContext} in a new non-recording {@link Span}\n *\n * @param spanContext span context to be wrapped\n * @returns a new non-recording {@link Span} with the provided context\n */\nexport function wrapSpanContext(spanContext) {\n return new NonRecordingSpan(spanContext);\n}\n//# sourceMappingURL=spancontext-utils.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ContextAPI } from '../api/context';\nimport { getSpanContext, setSpan } from '../trace/context-utils';\nimport { NonRecordingSpan } from './NonRecordingSpan';\nimport { isSpanContextValid } from './spancontext-utils';\nconst contextApi = ContextAPI.getInstance();\n/**\n * No-op implementations of {@link Tracer}.\n */\nexport class NoopTracer {\n // startSpan starts a noop span.\n startSpan(name, options, context = contextApi.active()) {\n const root = Boolean(options === null || options === void 0 ? void 0 : options.root);\n if (root) {\n return new NonRecordingSpan();\n }\n const parentFromContext = context && getSpanContext(context);\n if (isSpanContext(parentFromContext) &&\n isSpanContextValid(parentFromContext)) {\n return new NonRecordingSpan(parentFromContext);\n }\n else {\n return new NonRecordingSpan();\n }\n }\n startActiveSpan(name, arg2, arg3, arg4) {\n let opts;\n let ctx;\n let fn;\n if (arguments.length < 2) {\n return;\n }\n else if (arguments.length === 2) {\n fn = arg2;\n }\n else if (arguments.length === 3) {\n opts = arg2;\n fn = arg3;\n }\n else {\n opts = arg2;\n ctx = arg3;\n fn = arg4;\n }\n const parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();\n const span = this.startSpan(name, opts, parentContext);\n const contextWithSpanSet = setSpan(parentContext, span);\n return contextApi.with(contextWithSpanSet, fn, undefined, span);\n }\n}\nfunction isSpanContext(spanContext) {\n return (spanContext !== null &&\n typeof spanContext === 'object' &&\n 'spanId' in spanContext &&\n typeof spanContext['spanId'] === 'string' &&\n 'traceId' in spanContext &&\n typeof spanContext['traceId'] === 'string' &&\n 'traceFlags' in spanContext &&\n typeof spanContext['traceFlags'] === 'number');\n}\n//# sourceMappingURL=NoopTracer.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { NoopTracer } from './NoopTracer';\nconst NOOP_TRACER = new NoopTracer();\n/**\n * Proxy tracer provided by the proxy tracer provider\n *\n * @since 1.0.0\n */\nexport class ProxyTracer {\n constructor(provider, name, version, options) {\n this._provider = provider;\n this.name = name;\n this.version = version;\n this.options = options;\n }\n startSpan(name, options, context) {\n return this._getTracer().startSpan(name, options, context);\n }\n startActiveSpan(_name, _options, _context, _fn) {\n const tracer = this._getTracer();\n return Reflect.apply(tracer.startActiveSpan, tracer, arguments);\n }\n /**\n * Try to get a tracer from the proxy tracer provider.\n * If the proxy tracer provider has no delegate, return a noop tracer.\n */\n _getTracer() {\n if (this._delegate) {\n return this._delegate;\n }\n const tracer = this._provider.getDelegateTracer(this.name, this.version, this.options);\n if (!tracer) {\n return NOOP_TRACER;\n }\n this._delegate = tracer;\n return this._delegate;\n }\n}\n//# sourceMappingURL=ProxyTracer.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { NoopTracer } from './NoopTracer';\n/**\n * An implementation of the {@link TracerProvider} which returns an impotent\n * Tracer for all calls to `getTracer`.\n *\n * All operations are no-op.\n */\nexport class NoopTracerProvider {\n getTracer(_name, _version, _options) {\n return new NoopTracer();\n }\n}\n//# sourceMappingURL=NoopTracerProvider.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ProxyTracer } from './ProxyTracer';\nimport { NoopTracerProvider } from './NoopTracerProvider';\nconst NOOP_TRACER_PROVIDER = new NoopTracerProvider();\n/**\n * Tracer provider which provides {@link ProxyTracer}s.\n *\n * Before a delegate is set, tracers provided are NoOp.\n * When a delegate is set, traces are provided from the delegate.\n * When a delegate is set after tracers have already been provided,\n * all tracers already provided will use the provided delegate implementation.\n *\n * @deprecated This will be removed in the next major version.\n * @since 1.0.0\n */\nexport class ProxyTracerProvider {\n /**\n * Get a {@link ProxyTracer}\n */\n getTracer(name, version, options) {\n var _a;\n return ((_a = this.getDelegateTracer(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version, options));\n }\n getDelegate() {\n var _a;\n return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER;\n }\n /**\n * Set the delegate tracer provider\n */\n setDelegate(delegate) {\n this._delegate = delegate;\n }\n getDelegateTracer(name, version, options) {\n var _a;\n return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options);\n }\n}\n//# sourceMappingURL=ProxyTracerProvider.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.\n * A sampling decision that determines how a {@link Span} will be recorded\n * and collected.\n *\n * @since 1.0.0\n */\nexport var SamplingDecision;\n(function (SamplingDecision) {\n /**\n * `Span.isRecording() === false`, span will not be recorded and all events\n * and attributes will be dropped.\n */\n SamplingDecision[SamplingDecision[\"NOT_RECORD\"] = 0] = \"NOT_RECORD\";\n /**\n * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags}\n * MUST NOT be set.\n */\n SamplingDecision[SamplingDecision[\"RECORD\"] = 1] = \"RECORD\";\n /**\n * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags}\n * MUST be set.\n */\n SamplingDecision[SamplingDecision[\"RECORD_AND_SAMPLED\"] = 2] = \"RECORD_AND_SAMPLED\";\n})(SamplingDecision || (SamplingDecision = {}));\n//# sourceMappingURL=SamplingResult.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @since 1.0.0\n */\nexport var SpanKind;\n(function (SpanKind) {\n /** Default value. Indicates that the span is used internally. */\n SpanKind[SpanKind[\"INTERNAL\"] = 0] = \"INTERNAL\";\n /**\n * Indicates that the span covers server-side handling of an RPC or other\n * remote request.\n */\n SpanKind[SpanKind[\"SERVER\"] = 1] = \"SERVER\";\n /**\n * Indicates that the span covers the client-side wrapper around an RPC or\n * other remote request.\n */\n SpanKind[SpanKind[\"CLIENT\"] = 2] = \"CLIENT\";\n /**\n * Indicates that the span describes producer sending a message to a\n * broker. Unlike client and server, there is no direct critical path latency\n * relationship between producer and consumer spans.\n */\n SpanKind[SpanKind[\"PRODUCER\"] = 3] = \"PRODUCER\";\n /**\n * Indicates that the span describes consumer receiving a message from a\n * broker. Unlike client and server, there is no direct critical path latency\n * relationship between producer and consumer spans.\n */\n SpanKind[SpanKind[\"CONSUMER\"] = 4] = \"CONSUMER\";\n})(SpanKind || (SpanKind = {}));\n//# sourceMappingURL=span_kind.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * An enumeration of status codes.\n *\n * @since 1.0.0\n */\nexport var SpanStatusCode;\n(function (SpanStatusCode) {\n /**\n * The default status.\n */\n SpanStatusCode[SpanStatusCode[\"UNSET\"] = 0] = \"UNSET\";\n /**\n * The operation has been validated by an Application developer or\n * Operator to have completed successfully.\n */\n SpanStatusCode[SpanStatusCode[\"OK\"] = 1] = \"OK\";\n /**\n * The operation contains an error.\n */\n SpanStatusCode[SpanStatusCode[\"ERROR\"] = 2] = \"ERROR\";\n})(SpanStatusCode || (SpanStatusCode = {}));\n//# sourceMappingURL=status.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { ContextAPI } from './api/context';\n/**\n * Entrypoint for context API\n * @since 1.0.0\n */\nexport const context = ContextAPI.getInstance();\n//# sourceMappingURL=context-api.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { DiagAPI } from './api/diag';\n/**\n * Entrypoint for Diag API.\n * Defines Diagnostic handler used for internal diagnostic logging operations.\n * The default provides a Noop DiagLogger implementation which may be changed via the\n * diag.setLogger(logger: DiagLogger) function.\n *\n * @since 1.0.0\n */\nexport const diag = DiagAPI.instance();\n//# sourceMappingURL=diag-api.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * No-op implementations of {@link TextMapPropagator}.\n */\nexport class NoopTextMapPropagator {\n /** Noop inject function does nothing */\n inject(_context, _carrier) { }\n /** Noop extract function does nothing and returns the input context */\n extract(context, _carrier) {\n return context;\n }\n fields() {\n return [];\n }\n}\n//# sourceMappingURL=NoopTextMapPropagator.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ContextAPI } from '../api/context';\nimport { createContextKey } from '../context/context';\n/**\n * Baggage key\n */\nconst BAGGAGE_KEY = createContextKey('OpenTelemetry Baggage Key');\n/**\n * Retrieve the current baggage from the given context\n *\n * @param {Context} Context that manage all context values\n * @returns {Baggage} Extracted baggage from the context\n */\nexport function getBaggage(context) {\n return context.getValue(BAGGAGE_KEY) || undefined;\n}\n/**\n * Retrieve the current baggage from the active/current context\n *\n * @returns {Baggage} Extracted baggage from the context\n */\nexport function getActiveBaggage() {\n return getBaggage(ContextAPI.getInstance().active());\n}\n/**\n * Store a baggage in the given context\n *\n * @param {Context} Context that manage all context values\n * @param {Baggage} baggage that will be set in the actual context\n */\nexport function setBaggage(context, baggage) {\n return context.setValue(BAGGAGE_KEY, baggage);\n}\n/**\n * Delete the baggage stored in the given context\n *\n * @param {Context} Context that manage all context values\n */\nexport function deleteBaggage(context) {\n return context.deleteValue(BAGGAGE_KEY);\n}\n//# sourceMappingURL=context-helpers.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';\nimport { NoopTextMapPropagator } from '../propagation/NoopTextMapPropagator';\nimport { defaultTextMapGetter, defaultTextMapSetter, } from '../propagation/TextMapPropagator';\nimport { getBaggage, getActiveBaggage, setBaggage, deleteBaggage, } from '../baggage/context-helpers';\nimport { createBaggage } from '../baggage/utils';\nimport { DiagAPI } from './diag';\nconst API_NAME = 'propagation';\nconst NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Propagation API\n *\n * @since 1.0.0\n */\nexport class PropagationAPI {\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n constructor() {\n this.createBaggage = createBaggage;\n this.getBaggage = getBaggage;\n this.getActiveBaggage = getActiveBaggage;\n this.setBaggage = setBaggage;\n this.deleteBaggage = deleteBaggage;\n }\n /** Get the singleton instance of the Propagator API */\n static getInstance() {\n if (!this._instance) {\n this._instance = new PropagationAPI();\n }\n return this._instance;\n }\n /**\n * Set the current propagator.\n *\n * @returns true if the propagator was successfully registered, else false\n */\n setGlobalPropagator(propagator) {\n return registerGlobal(API_NAME, propagator, DiagAPI.instance());\n }\n /**\n * Inject context into a carrier to be propagated inter-process\n *\n * @param context Context carrying tracing data to inject\n * @param carrier carrier to inject context into\n * @param setter Function used to set values on the carrier\n */\n inject(context, carrier, setter = defaultTextMapSetter) {\n return this._getGlobalPropagator().inject(context, carrier, setter);\n }\n /**\n * Extract context from a carrier\n *\n * @param context Context which the newly created context will inherit from\n * @param carrier Carrier to extract context from\n * @param getter Function used to extract keys from a carrier\n */\n extract(context, carrier, getter = defaultTextMapGetter) {\n return this._getGlobalPropagator().extract(context, carrier, getter);\n }\n /**\n * Return a list of all fields which may be used by the propagator.\n */\n fields() {\n return this._getGlobalPropagator().fields();\n }\n /** Remove the global propagator */\n disable() {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n _getGlobalPropagator() {\n return getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;\n }\n}\n//# sourceMappingURL=propagation.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { PropagationAPI } from './api/propagation';\n/**\n * Entrypoint for propagation API\n *\n * @since 1.0.0\n */\nexport const propagation = PropagationAPI.getInstance();\n//# sourceMappingURL=propagation-api.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';\nimport { ProxyTracerProvider } from '../trace/ProxyTracerProvider';\nimport { isSpanContextValid, wrapSpanContext, } from '../trace/spancontext-utils';\nimport { deleteSpan, getActiveSpan, getSpan, getSpanContext, setSpan, setSpanContext, } from '../trace/context-utils';\nimport { DiagAPI } from './diag';\nconst API_NAME = 'trace';\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Tracing API\n *\n * @since 1.0.0\n */\nexport class TraceAPI {\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n constructor() {\n this._proxyTracerProvider = new ProxyTracerProvider();\n this.wrapSpanContext = wrapSpanContext;\n this.isSpanContextValid = isSpanContextValid;\n this.deleteSpan = deleteSpan;\n this.getSpan = getSpan;\n this.getActiveSpan = getActiveSpan;\n this.getSpanContext = getSpanContext;\n this.setSpan = setSpan;\n this.setSpanContext = setSpanContext;\n }\n /** Get the singleton instance of the Trace API */\n static getInstance() {\n if (!this._instance) {\n this._instance = new TraceAPI();\n }\n return this._instance;\n }\n /**\n * Set the current global tracer.\n *\n * @returns true if the tracer provider was successfully registered, else false\n */\n setGlobalTracerProvider(provider) {\n const success = registerGlobal(API_NAME, this._proxyTracerProvider, DiagAPI.instance());\n if (success) {\n this._proxyTracerProvider.setDelegate(provider);\n }\n return success;\n }\n /**\n * Returns the global tracer provider.\n */\n getTracerProvider() {\n return getGlobal(API_NAME) || this._proxyTracerProvider;\n }\n /**\n * Returns a tracer from the global tracer provider.\n */\n getTracer(name, version) {\n return this.getTracerProvider().getTracer(name, version);\n }\n /** Remove the global tracer provider */\n disable() {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n this._proxyTracerProvider = new ProxyTracerProvider();\n }\n}\n//# sourceMappingURL=trace.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { TraceAPI } from './api/trace';\n/**\n * Entrypoint for trace API\n *\n * @since 1.0.0\n */\nexport const trace = TraceAPI.getInstance();\n//# sourceMappingURL=trace-api.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * check if an object has `addEventListener` and `removeEventListener` functions.\n * Generally only called with a `TargetWithEvents` but may be called with an `unknown` value.\n * @param obj - The object to check.\n */\nexport function isListenerObject(obj) {\n return (typeof obj === 'object' &&\n obj !== null &&\n 'addEventListener' in obj &&\n typeof obj.addEventListener === 'function' &&\n 'removeEventListener' in obj &&\n typeof obj.removeEventListener === 'function');\n}\n//# sourceMappingURL=util.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ROOT_CONTEXT } from '@opentelemetry/api';\nimport { isListenerObject } from './util';\n/* Key name to be used to save a context reference in Zone */\nconst ZONE_CONTEXT_KEY = 'OT_ZONE_CONTEXT';\n/**\n * ZoneContextManager\n * This module provides an easy functionality for tracing action between asynchronous operations in web.\n * It was not possible with standard [StackContextManager]{@link https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-sdk-trace-web/src/StackContextManager.ts}.\n * It heavily depends on [zone.js]{@link https://www.npmjs.com/package/zone.js}.\n * It stores the information about context in zone. Each Context will have always new Zone;\n * It also supports binding a certain Span to a target that has \"addEventListener\" and \"removeEventListener\".\n * When this happens a new zone is being created and the provided Span is being assigned to this zone.\n */\nexport class ZoneContextManager {\n /**\n * whether the context manager is enabled or not\n */\n _enabled = false;\n /**\n * @param context A context (span) to be executed within target function\n * @param target Function to be executed within the context\n */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n _bindFunction(context, target) {\n const manager = this;\n const contextWrapper = function (...args) {\n return manager.with(context, () => target.apply(this, args));\n };\n Object.defineProperty(contextWrapper, 'length', {\n enumerable: false,\n configurable: true,\n writable: false,\n value: target.length,\n });\n return contextWrapper;\n }\n /**\n * @param context A context (span) to be bind to target\n * @param obj target object on which the listeners will be patched\n */\n _bindListener(context, obj) {\n const target = obj;\n if (target.__ot_listeners !== undefined) {\n return obj;\n }\n target.__ot_listeners = {};\n if (typeof target.addEventListener === 'function') {\n target.addEventListener = this._patchAddEventListener(target, target.addEventListener, context);\n }\n if (typeof target.removeEventListener === 'function') {\n target.removeEventListener = this._patchRemoveEventListener(target, target.removeEventListener);\n }\n return obj;\n }\n /**\n * Creates a new zone\n * @param zoneName zone name\n * @param context A context (span) to be bind with Zone\n */\n _createZone(zoneName, context) {\n return Zone.current.fork({\n name: zoneName,\n properties: {\n [ZONE_CONTEXT_KEY]: context,\n },\n onCancelTask(parentZoneDelegate, currentZone, targetZone, task) {\n if (task.state === 'notScheduled' || task.state === 'running') {\n return task;\n }\n return parentZoneDelegate.cancelTask(targetZone, task);\n },\n });\n }\n /**\n * Patches addEventListener method\n * @param target any target that has \"addEventListener\" method\n * @param original reference to the patched method\n * @param [context] context to be bind to the listener\n */\n _patchAddEventListener(target, original, context) {\n const contextManager = this;\n return function (event, listener, opts) {\n if (target.__ot_listeners === undefined) {\n target.__ot_listeners = {};\n }\n let listeners = target.__ot_listeners[event];\n if (listeners === undefined) {\n listeners = new WeakMap();\n target.__ot_listeners[event] = listeners;\n }\n const patchedListener = contextManager.bind(context, listener);\n // store a weak reference of the user listener to ours\n listeners.set(listener, patchedListener);\n return original.call(this, event, patchedListener, opts);\n };\n }\n /**\n * Patches removeEventListener method\n * @param target any target that has \"removeEventListener\" method\n * @param original reference to the patched method\n */\n _patchRemoveEventListener(target, original) {\n return function (event, listener) {\n if (target.__ot_listeners === undefined ||\n target.__ot_listeners[event] === undefined) {\n return original.call(this, event, listener);\n }\n const events = target.__ot_listeners[event];\n const patchedListener = events.get(listener);\n events.delete(listener);\n return original.call(this, event, patchedListener || listener);\n };\n }\n /**\n * Returns the active context\n */\n active() {\n if (!this._enabled || !Zone.current) {\n return ROOT_CONTEXT;\n }\n return Zone.current.get(ZONE_CONTEXT_KEY) || ROOT_CONTEXT;\n }\n /**\n * Binds a the certain context or the active one to the target function and then returns the target\n * @param context A context (span) to be bind to target\n * @param target a function or event emitter. When target or one of its callbacks is called,\n * the provided context will be used as the active context for the duration of the call.\n */\n bind(context, target) {\n if (typeof target === 'function') {\n return this._bindFunction(context, target);\n }\n else if (isListenerObject(target)) {\n this._bindListener(context, target);\n }\n return target;\n }\n /**\n * Disable the context manager (clears all the contexts)\n */\n disable() {\n this._enabled = false;\n return this;\n }\n /**\n * Enables the context manager and creates a default(root) context\n */\n enable() {\n this._enabled = true;\n return this;\n }\n /**\n * Calls the callback function [fn] with the provided [context].\n * If [context] is undefined then it will use the active context.\n * The context will be set as active\n * @param context A context (span) to be called with provided callback\n * @param fn Callback function\n * @param thisArg optional receiver to be used for calling fn\n * @param args optional arguments forwarded to fn\n */\n with(context, fn, thisArg, ...args) {\n let zoneName = 'otel:with';\n if (fn.name) {\n zoneName += `:${fn.name}`;\n }\n return this._createZone(zoneName, context).run(fn, thisArg, args);\n }\n}\n//# sourceMappingURL=ZoneContextManager.js.map","'use strict';\n/**\n * @license Angular\n * (c) 2010-2026 Google LLC. https://angular.dev/\n * License: MIT\n */\nvar __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\n\n// packages/zone.js/lib/zone-impl.js\nvar global = globalThis;\nfunction __symbol__(name) {\n const symbolPrefix = global[\"__Zone_symbol_prefix\"] || \"__zone_symbol__\";\n return symbolPrefix + name;\n}\nfunction initZone() {\n const performance = global[\"performance\"];\n function mark(name) {\n performance && performance[\"mark\"] && performance[\"mark\"](name);\n }\n function performanceMeasure(name, label) {\n performance && performance[\"measure\"] && performance[\"measure\"](name, label);\n }\n mark(\"Zone\");\n const _ZoneImpl = class _ZoneImpl {\n constructor(parent, zoneSpec) {\n __publicField(this, \"_parent\");\n __publicField(this, \"_name\");\n __publicField(this, \"_properties\");\n __publicField(this, \"_zoneDelegate\");\n this._parent = parent;\n this._name = zoneSpec ? zoneSpec.name || \"unnamed\" : \"<root>\";\n this._properties = zoneSpec && zoneSpec.properties || {};\n this._zoneDelegate = new _ZoneDelegate(this, this._parent && this._parent._zoneDelegate, zoneSpec);\n }\n static assertZonePatched() {\n if (global[\"Promise\"] !== patches[\"ZoneAwarePromise\"]) {\n 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.)\");\n }\n }\n static get root() {\n let zone = _ZoneImpl.current;\n while (zone.parent) {\n zone = zone.parent;\n }\n return zone;\n }\n static get current() {\n return _currentZoneFrame.zone;\n }\n static get currentTask() {\n return _currentTask;\n }\n static __load_patch(name, fn, ignoreDuplicate = false) {\n if (patches.hasOwnProperty(name)) {\n const checkDuplicate = global[__symbol__(\"forceDuplicateZoneCheck\")] === true;\n if (!ignoreDuplicate && checkDuplicate) {\n throw Error(\"Already loaded patch: \" + name);\n }\n } else if (!global[\"__Zone_disable_\" + name]) {\n const perfName = \"Zone:\" + name;\n mark(perfName);\n patches[name] = fn(global, _ZoneImpl, _api);\n performanceMeasure(perfName, perfName);\n }\n }\n get parent() {\n return this._parent;\n }\n get name() {\n return this._name;\n }\n get(key) {\n const zone = this.getZoneWith(key);\n if (zone)\n return zone._properties[key];\n }\n getZoneWith(key) {\n let current = this;\n while (current) {\n if (current._properties.hasOwnProperty(key)) {\n return current;\n }\n current = current._parent;\n }\n return null;\n }\n fork(zoneSpec) {\n if (!zoneSpec)\n throw new Error(\"ZoneSpec required!\");\n return this._zoneDelegate.fork(this, zoneSpec);\n }\n wrap(callback, source) {\n if (typeof callback !== \"function\") {\n throw new Error(\"Expecting function got: \" + callback);\n }\n const _callback = this._zoneDelegate.intercept(this, callback, source);\n const zone = this;\n return function() {\n return zone.runGuarded(_callback, this, arguments, source);\n };\n }\n run(callback, applyThis, applyArgs, source) {\n _currentZoneFrame = { parent: _currentZoneFrame, zone: this };\n try {\n return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);\n } finally {\n _currentZoneFrame = _currentZoneFrame.parent;\n }\n }\n runGuarded(callback, applyThis = null, applyArgs, source) {\n _currentZoneFrame = { parent: _currentZoneFrame, zone: this };\n try {\n try {\n return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);\n } catch (error) {\n if (this._zoneDelegate.handleError(this, error)) {\n throw error;\n }\n }\n } finally {\n _currentZoneFrame = _currentZoneFrame.parent;\n }\n }\n runTask(task, applyThis, applyArgs) {\n if (task.zone != this) {\n throw new Error(\"A task can only be run in the zone of creation! (Creation: \" + (task.zone || NO_ZONE).name + \"; Execution: \" + this.name + \")\");\n }\n const zoneTask = task;\n const { type, data: { isPeriodic = false, isRefreshable = false } = {} } = task;\n if (task.state === notScheduled && (type === eventTask || type === macroTask)) {\n return;\n }\n const reEntryGuard = task.state != running;\n reEntryGuard && zoneTask._transitionTo(running, scheduled);\n const previousTask = _currentTask;\n _currentTask = zoneTask;\n _currentZoneFrame = { parent: _currentZoneFrame, zone: this };\n try {\n if (type == macroTask && task.data && !isPeriodic && !isRefreshable) {\n task.cancelFn = void 0;\n }\n try {\n return this._zoneDelegate.invokeTask(this, zoneTask, applyThis, applyArgs);\n } catch (error) {\n if (this._zoneDelegate.handleError(this, error)) {\n throw error;\n }\n }\n } finally {\n const state = task.state;\n if (state !== notScheduled && state !== unknown) {\n if (type == eventTask || isPeriodic || isRefreshable && state === scheduling) {\n reEntryGuard && zoneTask._transitionTo(scheduled, running, scheduling);\n } else {\n const zoneDelegates = zoneTask._zoneDelegates;\n this._updateTaskCount(zoneTask, -1);\n reEntryGuard && zoneTask._transitionTo(notScheduled, running, notScheduled);\n if (isRefreshable) {\n zoneTask._zoneDelegates = zoneDelegates;\n }\n }\n }\n _currentZoneFrame = _currentZoneFrame.parent;\n _currentTask = previousTask;\n }\n }\n scheduleTask(task) {\n if (task.zone && task.zone !== this) {\n let newZone = this;\n while (newZone) {\n if (newZone === task.zone) {\n throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${task.zone.name}`);\n }\n newZone = newZone.parent;\n }\n }\n task._transitionTo(scheduling, notScheduled);\n const zoneDelegates = [];\n task._zoneDelegates = zoneDelegates;\n task._zone = this;\n try {\n task = this._zoneDelegate.scheduleTask(this, task);\n } catch (err) {\n task._transitionTo(unknown, scheduling, notScheduled);\n this._zoneDelegate.handleError(this, err);\n throw err;\n }\n if (task._zoneDelegates === zoneDelegates) {\n this._updateTaskCount(task, 1);\n }\n if (task.state == scheduling) {\n task._transitionTo(scheduled, scheduling);\n }\n return task;\n }\n scheduleMicroTask(source, callback, data, customSchedule) {\n return this.scheduleTask(new ZoneTask(microTask, source, callback, data, customSchedule, void 0));\n }\n scheduleMacroTask(source, callback, data, customSchedule, customCancel) {\n return this.scheduleTask(new ZoneTask(macroTask, source, callback, data, customSchedule, customCancel));\n }\n scheduleEventTask(source, callback, data, customSchedule, customCancel) {\n return this.scheduleTask(new ZoneTask(eventTask, source, callback, data, customSchedule, customCancel));\n }\n cancelTask(task) {\n if (task.zone != this)\n throw new Error(\"A task can only be cancelled in the zone of creation! (Creation: \" + (task.zone || NO_ZONE).name + \"; Execution: \" + this.name + \")\");\n if (task.state !== scheduled && task.state !== running) {\n return;\n }\n task._transitionTo(canceling, scheduled, running);\n try {\n this._zoneDelegate.cancelTask(this, task);\n } catch (err) {\n task._transitionTo(unknown, canceling);\n this._zoneDelegate.handleError(this, err);\n throw err;\n }\n this._updateTaskCount(task, -1);\n task._transitionTo(notScheduled, canceling);\n task.runCount = -1;\n return task;\n }\n _updateTaskCount(task, count) {\n const zoneDelegates = task._zoneDelegates;\n if (count == -1) {\n task._zoneDelegates = null;\n }\n for (let i = 0; i < zoneDelegates.length; i++) {\n zoneDelegates[i]._updateTaskCount(task.type, count);\n }\n }\n };\n __publicField(_ZoneImpl, \"__symbol__\", __symbol__);\n let ZoneImpl = _ZoneImpl;\n const DELEGATE_ZS = {\n name: \"\",\n onHasTask: (delegate, _, target, hasTaskState) => delegate.hasTask(target, hasTaskState),\n onScheduleTask: (delegate, _, target, task) => delegate.scheduleTask(target, task),\n onInvokeTask: (delegate, _, target, task, applyThis, applyArgs) => delegate.invokeTask(target, task, applyThis, applyArgs),\n onCancelTask: (delegate, _, target, task) => delegate.cancelTask(target, task)\n };\n class _ZoneDelegate {\n constructor(zone, parentDelegate, zoneSpec) {\n __publicField(this, \"_zone\");\n __publicField(this, \"_taskCounts\", {\n \"microTask\": 0,\n \"macroTask\": 0,\n \"eventTask\": 0\n });\n __publicField(this, \"_forkDlgt\");\n __publicField(this, \"_forkZS\");\n __publicField(this, \"_forkCurrZone\");\n __publicField(this, \"_interceptDlgt\");\n __publicField(this, \"_interceptZS\");\n __publicField(this, \"_interceptCurrZone\");\n __publicField(this, \"_invokeDlgt\");\n __publicField(this, \"_invokeZS\");\n __publicField(this, \"_invokeCurrZone\");\n __publicField(this, \"_handleErrorDlgt\");\n __publicField(this, \"_handleErrorZS\");\n __publicField(this, \"_handleErrorCurrZone\");\n __publicField(this, \"_scheduleTaskDlgt\");\n __publicField(this, \"_scheduleTaskZS\");\n __publicField(this, \"_scheduleTaskCurrZone\");\n __publicField(this, \"_invokeTaskDlgt\");\n __publicField(this, \"_invokeTaskZS\");\n __publicField(this, \"_invokeTaskCurrZone\");\n __publicField(this, \"_cancelTaskDlgt\");\n __publicField(this, \"_cancelTaskZS\");\n __publicField(this, \"_cancelTaskCurrZone\");\n __publicField(this, \"_hasTaskDlgt\");\n __publicField(this, \"_hasTaskDlgtOwner\");\n __publicField(this, \"_hasTaskZS\");\n __publicField(this, \"_hasTaskCurrZone\");\n this._zone = zone;\n this._forkZS = zoneSpec && (zoneSpec && zoneSpec.onFork ? zoneSpec : parentDelegate._forkZS);\n this._forkDlgt = zoneSpec && (zoneSpec.onFork ? parentDelegate : parentDelegate._forkDlgt);\n this._forkCurrZone = zoneSpec && (zoneSpec.onFork ? this._zone : parentDelegate._forkCurrZone);\n this._interceptZS = zoneSpec && (zoneSpec.onIntercept ? zoneSpec : parentDelegate._interceptZS);\n this._interceptDlgt = zoneSpec && (zoneSpec.onIntercept ? parentDelegate : parentDelegate._interceptDlgt);\n this._interceptCurrZone = zoneSpec && (zoneSpec.onIntercept ? this._zone : parentDelegate._interceptCurrZone);\n this._invokeZS = zoneSpec && (zoneSpec.onInvoke ? zoneSpec : parentDelegate._invokeZS);\n this._invokeDlgt = zoneSpec && (zoneSpec.onInvoke ? parentDelegate : parentDelegate._invokeDlgt);\n this._invokeCurrZone = zoneSpec && (zoneSpec.onInvoke ? this._zone : parentDelegate._invokeCurrZone);\n this._handleErrorZS = zoneSpec && (zoneSpec.onHandleError ? zoneSpec : parentDelegate._handleErrorZS);\n this._handleErrorDlgt = zoneSpec && (zoneSpec.onHandleError ? parentDelegate : parentDelegate._handleErrorDlgt);\n this._handleErrorCurrZone = zoneSpec && (zoneSpec.onHandleError ? this._zone : parentDelegate._handleErrorCurrZone);\n this._scheduleTaskZS = zoneSpec && (zoneSpec.onScheduleTask ? zoneSpec : parentDelegate._scheduleTaskZS);\n this._scheduleTaskDlgt = zoneSpec && (zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);\n this._scheduleTaskCurrZone = zoneSpec && (zoneSpec.onScheduleTask ? this._zone : parentDelegate._scheduleTaskCurrZone);\n this._invokeTaskZS = zoneSpec && (zoneSpec.onInvokeTask ? zoneSpec : parentDelegate._invokeTaskZS);\n this._invokeTaskDlgt = zoneSpec && (zoneSpec.onInvokeTask ? parentDelegate : parentDelegate._invokeTaskDlgt);\n this._invokeTaskCurrZone = zoneSpec && (zoneSpec.onInvokeTask ? this._zone : parentDelegate._invokeTaskCurrZone);\n this._cancelTaskZS = zoneSpec && (zoneSpec.onCancelTask ? zoneSpec : parentDelegate._cancelTaskZS);\n this._cancelTaskDlgt = zoneSpec && (zoneSpec.onCancelTask ? parentDelegate : parentDelegate._cancelTaskDlgt);\n this._cancelTaskCurrZone = zoneSpec && (zoneSpec.onCancelTask ? this._zone : parentDelegate._cancelTaskCurrZone);\n this._hasTaskZS = null;\n this._hasTaskDlgt = null;\n this._hasTaskDlgtOwner = null;\n this._hasTaskCurrZone = null;\n const zoneSpecHasTask = zoneSpec && zoneSpec.onHasTask;\n const parentHasTask = parentDelegate && parentDelegate._hasTaskZS;\n if (zoneSpecHasTask || parentHasTask) {\n this._hasTaskZS = zoneSpecHasTask ? zoneSpec : DELEGATE_ZS;\n this._hasTaskDlgt = parentDelegate;\n this._hasTaskDlgtOwner = this;\n this._hasTaskCurrZone = this._zone;\n if (!zoneSpec.onScheduleTask) {\n this._scheduleTaskZS = DELEGATE_ZS;\n this._scheduleTaskDlgt = parentDelegate;\n this._scheduleTaskCurrZone = this._zone;\n }\n if (!zoneSpec.onInvokeTask) {\n this._invokeTaskZS = DELEGATE_ZS;\n this._invokeTaskDlgt = parentDelegate;\n this._invokeTaskCurrZone = this._zone;\n }\n if (!zoneSpec.onCancelTask) {\n this._cancelTaskZS = DELEGATE_ZS;\n this._cancelTaskDlgt = parentDelegate;\n this._cancelTaskCurrZone = this._zone;\n }\n }\n }\n get zone() {\n return this._zone;\n }\n fork(targetZone, zoneSpec) {\n return this._forkZS ? this._forkZS.onFork(this._forkDlgt, this.zone, targetZone, zoneSpec) : new ZoneImpl(targetZone, zoneSpec);\n }\n intercept(targetZone, callback, source) {\n return this._interceptZS ? this._interceptZS.onIntercept(this._interceptDlgt, this._interceptCurrZone, targetZone, callback, source) : callback;\n }\n invoke(targetZone, callback, applyThis, applyArgs, source) {\n return this._invokeZS ? this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) : callback.apply(applyThis, applyArgs);\n }\n handleError(targetZone, error) {\n return this._handleErrorZS ? this._handleErrorZS.onHandleError(this._handleErrorDlgt, this._handleErrorCurrZone, targetZone, error) : true;\n }\n scheduleTask(targetZone, task) {\n let returnTask = task;\n if (this._scheduleTaskZS) {\n if (this._hasTaskZS) {\n returnTask._zoneDelegates.push(this._hasTaskDlgtOwner);\n }\n returnTask = this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt, this._scheduleTaskCurrZone, targetZone, task);\n if (!returnTask)\n returnTask = task;\n } else {\n if (task.scheduleFn) {\n task.scheduleFn(task);\n } else if (task.type == microTask) {\n scheduleMicroTask(task);\n } else {\n throw new Error(\"Task is missing scheduleFn.\");\n }\n }\n return returnTask;\n }\n invokeTask(targetZone, task, applyThis, applyArgs) {\n return this._invokeTaskZS ? this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) : task.callback.apply(applyThis, applyArgs);\n }\n cancelTask(targetZone, task) {\n let value;\n if (this._cancelTaskZS) {\n value = this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt, this._cancelTaskCurrZone, targetZone, task);\n } else {\n if (!task.cancelFn) {\n throw Error(\"Task is not cancelable\");\n }\n value = task.cancelFn(task);\n }\n return value;\n }\n hasTask(targetZone, isEmpty) {\n try {\n this._hasTaskZS && this._hasTaskZS.onHasTask(this._hasTaskDlgt, this._hasTaskCurrZone, targetZone, isEmpty);\n } catch (err) {\n this.handleError(targetZone, err);\n }\n }\n _updateTaskCount(type, count) {\n const counts = this._taskCounts;\n const prev = counts[type];\n const next = counts[type] = prev + count;\n if (next < 0) {\n throw new Error(\"More tasks executed then were scheduled.\");\n }\n if (prev == 0 || next == 0) {\n const isEmpty = {\n microTask: counts[\"microTask\"] > 0,\n macroTask: counts[\"macroTask\"] > 0,\n eventTask: counts[\"eventTask\"] > 0,\n change: type\n };\n this.hasTask(this._zone, isEmpty);\n }\n }\n }\n class ZoneTask {\n constructor(type, source, callback, options, scheduleFn, cancelFn) {\n __publicField(this, \"type\");\n __publicField(this, \"source\");\n __publicField(this, \"invoke\");\n __publicField(this, \"callback\");\n __publicField(this, \"data\");\n __publicField(this, \"scheduleFn\");\n __publicField(this, \"cancelFn\");\n __publicField(this, \"_zone\", null);\n __publicField(this, \"runCount\", 0);\n __publicField(this, \"_zoneDelegates\", null);\n __publicField(this, \"_state\", \"notScheduled\");\n this.type = type;\n this.source = source;\n this.data = options;\n this.scheduleFn = scheduleFn;\n this.cancelFn = cancelFn;\n if (!callback) {\n throw new Error(\"callback is not defined\");\n }\n this.callback = callback;\n const self2 = this;\n if (type === eventTask && options && options.useG) {\n this.invoke = ZoneTask.invokeTask;\n } else {\n this.invoke = function() {\n return ZoneTask.invokeTask.call(global, self2, this, arguments);\n };\n }\n }\n static invokeTask(task, target, args) {\n if (!task) {\n task = this;\n }\n _numberOfNestedTaskFrames++;\n try {\n task.runCount++;\n return task.zone.runTask(task, target, args);\n } finally {\n if (_numberOfNestedTaskFrames === 1 && !global[enableNativeMicrotaskDraining]) {\n drainMicroTaskQueueSynchronously();\n }\n _numberOfNestedTaskFrames--;\n }\n }\n get zone() {\n return this._zone;\n }\n get state() {\n return this._state;\n }\n cancelScheduleRequest() {\n this._transitionTo(notScheduled, scheduling);\n }\n _transitionTo(toState, fromState1, fromState2) {\n if (this._state === fromState1 || this._state === fromState2) {\n this._state = toState;\n if (toState == notScheduled) {\n this._zoneDelegates = null;\n }\n } else {\n throw new Error(`${this.type} '${this.source}': can not transition to '${toState}', expecting state '${fromState1}'${fromState2 ? \" or '\" + fromState2 + \"'\" : \"\"}, was '${this._state}'.`);\n }\n }\n toString() {\n if (this.data && typeof this.data.handleId !== \"undefined\") {\n return this.data.handleId.toString();\n } else {\n return Object.prototype.toString.call(this);\n }\n }\n // add toJSON method to prevent cyclic error when\n // call JSON.stringify(zoneTask)\n toJSON() {\n return {\n type: this.type,\n state: this.state,\n source: this.source,\n zone: this.zone.name,\n runCount: this.runCount\n };\n }\n }\n const symbolSetTimeout = __symbol__(\"setTimeout\");\n const symbolPromise = __symbol__(\"Promise\");\n const symbolThen = __symbol__(\"then\");\n const enableNativeMicrotaskDraining = __symbol__(\"enable_native_microtask_draining\");\n let _microTaskQueue = [];\n let _isDrainingMicrotaskQueue = false;\n let nativeMicroTaskQueuePromise;\n function nativeScheduleMicroTask(func) {\n var _a;\n if (!nativeMicroTaskQueuePromise && global[symbolPromise]) {\n nativeMicroTaskQueuePromise = global[symbolPromise].resolve(0);\n }\n if (nativeMicroTaskQueuePromise) {\n const thenFn = (_a = nativeMicroTaskQueuePromise[symbolThen]) != null ? _a : nativeMicroTaskQueuePromise[\"then\"];\n thenFn.call(nativeMicroTaskQueuePromise, func);\n } else {\n global[symbolSetTimeout](func, 0);\n }\n }\n function scheduleMicroTask(task) {\n const isNativeDrainingEnabled = global[enableNativeMicrotaskDraining];\n const shouldDrainWithNative = isNativeDrainingEnabled && _microTaskQueue.length === 0 && !_isDrainingMicrotaskQueue;\n const shouldDrainWithoutNative = !isNativeDrainingEnabled && _numberOfNestedTaskFrames === 0 && _microTaskQueue.length === 0;\n if (shouldDrainWithNative || shouldDrainWithoutNative) {\n nativeScheduleMicroTask(drainMicroTaskQueueSynchronously);\n }\n if (task) {\n _microTaskQueue.push(task);\n }\n }\n function drainMicroTaskQueueSynchronously() {\n if (_isDrainingMicrotaskQueue) {\n return;\n }\n _isDrainingMicrotaskQueue = true;\n while (_microTaskQueue.length) {\n const queue = _microTaskQueue;\n _microTaskQueue = [];\n for (const task of queue) {\n try {\n task.zone.runTask(task, null, null);\n } catch (error) {\n _api.onUnhandledError(error);\n }\n }\n }\n if (global[enableNativeMicrotaskDraining]) {\n _isDrainingMicrotaskQueue = false;\n _api.microtaskDrainDone();\n } else {\n _api.microtaskDrainDone();\n _isDrainingMicrotaskQueue = false;\n }\n }\n const NO_ZONE = { name: \"NO ZONE\" };\n const notScheduled = \"notScheduled\", scheduling = \"scheduling\", scheduled = \"scheduled\", running = \"running\", canceling = \"canceling\", unknown = \"unknown\";\n const microTask = \"microTask\", macroTask = \"macroTask\", eventTask = \"eventTask\";\n const patches = {};\n const _api = {\n symbol: __symbol__,\n currentZoneFrame: () => _currentZoneFrame,\n onUnhandledError: noop,\n microtaskDrainDone: noop,\n scheduleMicroTask,\n showUncaughtError: () => !ZoneImpl[__symbol__(\"ignoreConsoleErrorUncaughtError\")],\n patchEventTarget: () => [],\n patchOnProperties: noop,\n patchMethod: () => noop,\n bindArguments: () => [],\n patchThen: () => noop,\n patchMacroTask: () => noop,\n patchEventPrototype: () => noop,\n getGlobalObjects: () => void 0,\n ObjectDefineProperty: () => noop,\n ObjectGetOwnPropertyDescriptor: () => void 0,\n ObjectCreate: () => void 0,\n ArraySlice: () => [],\n patchClass: () => noop,\n wrapWithCurrentZone: () => noop,\n filterProperties: () => [],\n attachOriginToPatched: () => noop,\n _redefineProperty: () => noop,\n patchCallbacks: () => noop,\n nativeScheduleMicroTask\n };\n let _currentZoneFrame = { parent: null, zone: new ZoneImpl(null, null) };\n let _currentTask = null;\n let _numberOfNestedTaskFrames = 0;\n function noop() {\n }\n performanceMeasure(\"Zone\", \"Zone\");\n return ZoneImpl;\n}\n\n// packages/zone.js/lib/zone.js\nfunction loadZone() {\n var _a;\n const global2 = globalThis;\n const checkDuplicate = global2[__symbol__(\"forceDuplicateZoneCheck\")] === true;\n if (global2[\"Zone\"] && (checkDuplicate || typeof global2[\"Zone\"].__symbol__ !== \"function\")) {\n throw new Error(\"Zone already loaded.\");\n }\n (_a = global2[\"Zone\"]) != null ? _a : global2[\"Zone\"] = initZone();\n return global2[\"Zone\"];\n}\n\n// packages/zone.js/lib/common/utils.js\nvar ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar ObjectDefineProperty = Object.defineProperty;\nvar ObjectGetPrototypeOf = Object.getPrototypeOf;\nvar ObjectCreate = Object.create;\nvar ArraySlice = Array.prototype.slice;\nvar ADD_EVENT_LISTENER_STR = \"addEventListener\";\nvar REMOVE_EVENT_LISTENER_STR = \"removeEventListener\";\nvar ZONE_SYMBOL_ADD_EVENT_LISTENER = __symbol__(ADD_EVENT_LISTENER_STR);\nvar ZONE_SYMBOL_REMOVE_EVENT_LISTENER = __symbol__(REMOVE_EVENT_LISTENER_STR);\nvar TRUE_STR = \"true\";\nvar FALSE_STR = \"false\";\nvar ZONE_SYMBOL_PREFIX = __symbol__(\"\");\nfunction wrapWithCurrentZone(callback, source) {\n return Zone.current.wrap(callback, source);\n}\nfunction scheduleMacroTaskWithCurrentZone(source, callback, data, customSchedule, customCancel) {\n return Zone.current.scheduleMacroTask(source, callback, data, customSchedule, customCancel);\n}\nvar zoneSymbol = __symbol__;\nvar isWindowExists = typeof window !== \"undefined\";\nvar internalWindow = isWindowExists ? window : void 0;\nvar _global = isWindowExists && internalWindow || globalThis;\nvar REMOVE_ATTRIBUTE = \"removeAttribute\";\nfunction bindArguments(args, source) {\n for (let i = args.length - 1; i >= 0; i--) {\n if (typeof args[i] === \"function\") {\n args[i] = wrapWithCurrentZone(args[i], source + \"_\" + i);\n }\n }\n return args;\n}\nfunction patchPrototype(prototype, fnNames) {\n const source = prototype.constructor[\"name\"];\n for (let i = 0; i < fnNames.length; i++) {\n const name = fnNames[i];\n const delegate = prototype[name];\n if (delegate) {\n const prototypeDesc = ObjectGetOwnPropertyDescriptor(prototype, name);\n if (!isPropertyWritable(prototypeDesc)) {\n continue;\n }\n prototype[name] = ((delegate2) => {\n const patched = function() {\n return delegate2.apply(this, bindArguments(arguments, source + \".\" + name));\n };\n attachOriginToPatched(patched, delegate2);\n return patched;\n })(delegate);\n }\n }\n}\nfunction isPropertyWritable(propertyDesc) {\n if (!propertyDesc) {\n return true;\n }\n if (propertyDesc.writable === false) {\n return false;\n }\n return !(typeof propertyDesc.get === \"function\" && typeof propertyDesc.set === \"undefined\");\n}\nvar isWebWorker = typeof WorkerGlobalScope !== \"undefined\" && self instanceof WorkerGlobalScope;\nvar isNode = !(\"nw\" in _global) && typeof _global.process !== \"undefined\" && _global.process.toString() === \"[object process]\";\nvar isBrowser = !isNode && !isWebWorker && !!(isWindowExists && internalWindow[\"HTMLElement\"]);\nvar isMix = typeof _global.process !== \"undefined\" && _global.process.toString() === \"[object process]\" && !isWebWorker && !!(isWindowExists && internalWindow[\"HTMLElement\"]);\nvar zoneSymbolEventNames = {};\nvar enableBeforeunloadSymbol = zoneSymbol(\"enable_beforeunload\");\nvar wrapFn = function(event) {\n event = event || _global.event;\n if (!event) {\n return;\n }\n let eventNameSymbol = zoneSymbolEventNames[event.type];\n if (!eventNameSymbol) {\n eventNameSymbol = zoneSymbolEventNames[event.type] = zoneSymbol(\"ON_PROPERTY\" + event.type);\n }\n const target = this || event.target || _global;\n const listener = target[eventNameSymbol];\n let result;\n if (isBrowser && target === internalWindow && event.type === \"error\") {\n const errorEvent = event;\n result = listener && listener.call(this, errorEvent.message, errorEvent.filename, errorEvent.lineno, errorEvent.colno, errorEvent.error);\n if (result === true) {\n event.preventDefault();\n }\n } else {\n result = listener && listener.apply(this, arguments);\n if (\n // https://github.com/angular/angular/issues/47579\n // https://www.w3.org/TR/2011/WD-html5-20110525/history.html#beforeunloadevent\n // This is the only specific case we should check for. The spec defines that the\n // `returnValue` attribute represents the message to show the user. When the event\n // is created, this attribute must be set to the empty string.\n event.type === \"beforeunload\" && // To prevent any breaking changes resulting from this change, given that\n // it was already causing a significant number of failures in G3, we have hidden\n // that behavior behind a global configuration flag. Consumers can enable this\n // flag explicitly if they want the `beforeunload` event to be handled as defined\n // in the specification.\n _global[enableBeforeunloadSymbol] && // The IDL event definition is `attribute DOMString returnValue`, so we check whether\n // `typeof result` is a string.\n typeof result === \"string\"\n ) {\n event.returnValue = result;\n } else if (result != void 0 && !result) {\n event.preventDefault();\n }\n }\n return result;\n};\nfunction patchProperty(obj, prop, prototype) {\n let desc = ObjectGetOwnPropertyDescriptor(obj, prop);\n if (!desc && prototype) {\n const prototypeDesc = ObjectGetOwnPropertyDescriptor(prototype, prop);\n if (prototypeDesc) {\n desc = { enumerable: true, configurable: true };\n }\n }\n if (!desc || !desc.configurable) {\n return;\n }\n const onPropPatchedSymbol = zoneSymbol(\"on\" + prop + \"patched\");\n if (obj.hasOwnProperty(onPropPatchedSymbol) && obj[onPropPatchedSymbol]) {\n return;\n }\n delete desc.writable;\n delete desc.value;\n const originalDescGet = desc.get;\n const originalDescSet = desc.set;\n const eventName = prop.slice(2);\n let eventNameSymbol = zoneSymbolEventNames[eventName];\n if (!eventNameSymbol) {\n eventNameSymbol = zoneSymbolEventNames[eventName] = zoneSymbol(\"ON_PROPERTY\" + eventName);\n }\n desc.set = function(newValue) {\n let target = this;\n if (!target && obj === _global) {\n target = _global;\n }\n if (!target) {\n return;\n }\n const previousValue = target[eventNameSymbol];\n if (typeof previousValue === \"function\") {\n target.removeEventListener(eventName, wrapFn);\n }\n originalDescSet == null ? void 0 : originalDescSet.call(target, null);\n target[eventNameSymbol] = newValue;\n if (typeof newValue === \"function\") {\n target.addEventListener(eventName, wrapFn, false);\n }\n };\n desc.get = function() {\n let target = this;\n if (!target && obj === _global) {\n target = _global;\n }\n if (!target) {\n return null;\n }\n const listener = target[eventNameSymbol];\n if (listener) {\n return listener;\n } else if (originalDescGet) {\n let value = originalDescGet.call(this);\n if (value) {\n desc.set.call(this, value);\n if (typeof target[REMOVE_ATTRIBUTE] === \"function\") {\n target.removeAttribute(prop);\n }\n return value;\n }\n }\n return null;\n };\n ObjectDefineProperty(obj, prop, desc);\n obj[onPropPatchedSymbol] = true;\n}\nfunction patchOnProperties(obj, properties, prototype) {\n if (properties) {\n for (let i = 0; i < properties.length; i++) {\n patchProperty(obj, \"on\" + properties[i], prototype);\n }\n } else {\n const onProperties = [];\n for (const prop in obj) {\n if (prop.slice(0, 2) == \"on\") {\n onProperties.push(prop);\n }\n }\n for (let j = 0; j < onProperties.length; j++) {\n patchProperty(obj, onProperties[j], prototype);\n }\n }\n}\nvar originalInstanceKey = zoneSymbol(\"originalInstance\");\nfunction patchClass(className) {\n const OriginalClass = _global[className];\n if (!OriginalClass)\n return;\n _global[zoneSymbol(className)] = OriginalClass;\n _global[className] = function() {\n const a = bindArguments(arguments, className);\n switch (a.length) {\n case 0:\n this[originalInstanceKey] = new OriginalClass();\n break;\n case 1:\n this[originalInstanceKey] = new OriginalClass(a[0]);\n break;\n case 2:\n this[originalInstanceKey] = new OriginalClass(a[0], a[1]);\n break;\n case 3:\n this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2]);\n break;\n case 4:\n this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2], a[3]);\n break;\n default:\n throw new Error(\"Arg list too long.\");\n }\n };\n attachOriginToPatched(_global[className], OriginalClass);\n const instance = new OriginalClass(function() {\n });\n let prop;\n for (prop in instance) {\n if (className === \"XMLHttpRequest\" && prop === \"responseBlob\")\n continue;\n (function(prop2) {\n if (typeof instance[prop2] === \"function\") {\n _global[className].prototype[prop2] = function() {\n return this[originalInstanceKey][prop2].apply(this[originalInstanceKey], arguments);\n };\n } else {\n ObjectDefineProperty(_global[className].prototype, prop2, {\n set: function(fn) {\n if (typeof fn === \"function\") {\n this[originalInstanceKey][prop2] = wrapWithCurrentZone(fn, className + \".\" + prop2);\n attachOriginToPatched(this[originalInstanceKey][prop2], fn);\n } else {\n this[originalInstanceKey][prop2] = fn;\n }\n },\n get: function() {\n return this[originalInstanceKey][prop2];\n }\n });\n }\n })(prop);\n }\n for (prop in OriginalClass) {\n if (prop !== \"prototype\" && OriginalClass.hasOwnProperty(prop)) {\n _global[className][prop] = OriginalClass[prop];\n }\n }\n}\nfunction copySymbolProperties(src, dest) {\n if (typeof Object.getOwnPropertySymbols !== \"function\") {\n return;\n }\n const symbols = Object.getOwnPropertySymbols(src);\n symbols.forEach((symbol) => {\n const desc = Object.getOwnPropertyDescriptor(src, symbol);\n Object.defineProperty(dest, symbol, {\n get: function() {\n return src[symbol];\n },\n set: function(value) {\n if (desc && (!desc.writable || typeof desc.set !== \"function\")) {\n return;\n }\n src[symbol] = value;\n },\n enumerable: desc ? desc.enumerable : true,\n configurable: desc ? desc.configurable : true\n });\n });\n}\nvar shouldCopySymbolProperties = false;\nfunction patchMethod(target, name, patchFn) {\n let proto = target;\n while (proto && !proto.hasOwnProperty(name)) {\n proto = ObjectGetPrototypeOf(proto);\n }\n if (!proto && target[name]) {\n proto = target;\n }\n const delegateName = zoneSymbol(name);\n let delegate = null;\n if (proto && (!(delegate = proto[delegateName]) || !proto.hasOwnProperty(delegateName))) {\n delegate = proto[delegateName] = proto[name];\n const desc = proto && ObjectGetOwnPropertyDescriptor(proto, name);\n if (isPropertyWritable(desc)) {\n const patchDelegate = patchFn(delegate, delegateName, name);\n proto[name] = function() {\n return patchDelegate(this, arguments);\n };\n attachOriginToPatched(proto[name], delegate);\n if (shouldCopySymbolProperties) {\n copySymbolProperties(delegate, proto[name]);\n }\n }\n }\n return delegate;\n}\nfunction patchMacroTask(obj, funcName, metaCreator) {\n let setNative = null;\n function scheduleTask(task) {\n const data = task.data;\n data.args[data.cbIdx] = function() {\n task.invoke.apply(this, arguments);\n };\n setNative.apply(data.target, data.args);\n return task;\n }\n setNative = patchMethod(obj, funcName, (delegate) => function(self2, args) {\n const meta = metaCreator(self2, args);\n if (meta.cbIdx >= 0 && typeof args[meta.cbIdx] === \"function\") {\n return scheduleMacroTaskWithCurrentZone(meta.name, args[meta.cbIdx], meta, scheduleTask);\n } else {\n return delegate.apply(self2, args);\n }\n });\n}\nfunction attachOriginToPatched(patched, original) {\n patched[zoneSymbol(\"OriginalDelegate\")] = original;\n}\nfunction isFunction(value) {\n return typeof value === \"function\";\n}\nfunction isNumber(value) {\n return typeof value === \"number\";\n}\n\n// packages/zone.js/lib/common/events.js\nvar OPTIMIZED_ZONE_EVENT_TASK_DATA = {\n useG: true\n};\nvar zoneSymbolEventNames2 = {};\nvar globalSources = {};\nvar EVENT_NAME_SYMBOL_REGX = new RegExp(\"^\" + ZONE_SYMBOL_PREFIX + \"(\\\\w+)(true|false)$\");\nvar IMMEDIATE_PROPAGATION_SYMBOL = zoneSymbol(\"propagationStopped\");\nfunction prepareEventNames(eventName, eventNameToString) {\n const falseEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + FALSE_STR;\n const trueEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + TRUE_STR;\n const symbol = ZONE_SYMBOL_PREFIX + falseEventName;\n const symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;\n zoneSymbolEventNames2[eventName] = {};\n zoneSymbolEventNames2[eventName][FALSE_STR] = symbol;\n zoneSymbolEventNames2[eventName][TRUE_STR] = symbolCapture;\n}\nfunction patchEventTarget(_global2, api, apis, patchOptions) {\n const ADD_EVENT_LISTENER = patchOptions && patchOptions.add || ADD_EVENT_LISTENER_STR;\n const REMOVE_EVENT_LISTENER = patchOptions && patchOptions.rm || REMOVE_EVENT_LISTENER_STR;\n const LISTENERS_EVENT_LISTENER = patchOptions && patchOptions.listeners || \"eventListeners\";\n const REMOVE_ALL_LISTENERS_EVENT_LISTENER = patchOptions && patchOptions.rmAll || \"removeAllListeners\";\n const zoneSymbolAddEventListener = zoneSymbol(ADD_EVENT_LISTENER);\n const ADD_EVENT_LISTENER_SOURCE = \".\" + ADD_EVENT_LISTENER + \":\";\n const PREPEND_EVENT_LISTENER = \"prependListener\";\n const PREPEND_EVENT_LISTENER_SOURCE = \".\" + PREPEND_EVENT_LISTENER + \":\";\n const invokeTask = function(task, target, event) {\n if (task.isRemoved) {\n return;\n }\n const delegate = task.callback;\n if (typeof delegate === \"object\" && delegate.handleEvent) {\n task.callback = (event2) => delegate.handleEvent(event2);\n task.originalDelegate = delegate;\n }\n let error;\n try {\n task.invoke(task, target, [event]);\n } catch (err) {\n error = err;\n }\n const options = task.options;\n if (options && typeof options === \"object\" && options.once) {\n const delegate2 = task.originalDelegate ? task.originalDelegate : task.callback;\n target[REMOVE_EVENT_LISTENER].call(target, event.type, delegate2, options);\n }\n return error;\n };\n function globalCallback(context, event, isCapture) {\n event = event || _global2.event;\n if (!event) {\n return;\n }\n const target = context || event.target || _global2;\n const tasks = target[zoneSymbolEventNames2[event.type][isCapture ? TRUE_STR : FALSE_STR]];\n if (tasks) {\n const errors = [];\n if (tasks.length === 1) {\n const err = invokeTask(tasks[0], target, event);\n err && errors.push(err);\n } else {\n const copyTasks = tasks.slice();\n for (let i = 0; i < copyTasks.length; i++) {\n if (event && event[IMMEDIATE_PROPAGATION_SYMBOL] === true) {\n break;\n }\n const err = invokeTask(copyTasks[i], target, event);\n err && errors.push(err);\n }\n }\n if (errors.length === 1) {\n throw errors[0];\n } else {\n for (let i = 0; i < errors.length; i++) {\n const err = errors[i];\n api.nativeScheduleMicroTask(() => {\n throw err;\n });\n }\n }\n }\n }\n const globalZoneAwareCallback = function(event) {\n return globalCallback(this, event, false);\n };\n const globalZoneAwareCaptureCallback = function(event) {\n return globalCallback(this, event, true);\n };\n function patchEventTargetMethods(obj, patchOptions2) {\n if (!obj) {\n return false;\n }\n let useGlobalCallback = true;\n if (patchOptions2 && patchOptions2.useG !== void 0) {\n useGlobalCallback = patchOptions2.useG;\n }\n const validateHandler = patchOptions2 && patchOptions2.vh;\n let checkDuplicate = true;\n if (patchOptions2 && patchOptions2.chkDup !== void 0) {\n checkDuplicate = patchOptions2.chkDup;\n }\n let returnTarget = false;\n if (patchOptions2 && patchOptions2.rt !== void 0) {\n returnTarget = patchOptions2.rt;\n }\n let proto = obj;\n while (proto && !proto.hasOwnProperty(ADD_EVENT_LISTENER)) {\n proto = ObjectGetPrototypeOf(proto);\n }\n if (!proto && obj[ADD_EVENT_LISTENER]) {\n proto = obj;\n }\n if (!proto) {\n return false;\n }\n if (proto[zoneSymbolAddEventListener]) {\n return false;\n }\n const eventNameToString = patchOptions2 && patchOptions2.eventNameToString;\n const taskData = {};\n const nativeAddEventListener = proto[zoneSymbolAddEventListener] = proto[ADD_EVENT_LISTENER];\n const nativeRemoveEventListener = proto[zoneSymbol(REMOVE_EVENT_LISTENER)] = proto[REMOVE_EVENT_LISTENER];\n const nativeListeners = proto[zoneSymbol(LISTENERS_EVENT_LISTENER)] = proto[LISTENERS_EVENT_LISTENER];\n const nativeRemoveAllListeners = proto[zoneSymbol(REMOVE_ALL_LISTENERS_EVENT_LISTENER)] = proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER];\n let nativePrependEventListener;\n if (patchOptions2 && patchOptions2.prepend) {\n nativePrependEventListener = proto[zoneSymbol(patchOptions2.prepend)] = proto[patchOptions2.prepend];\n }\n function buildEventListenerOptions(options, passive) {\n if (!passive) {\n return options;\n }\n if (typeof options === \"boolean\") {\n return { capture: options, passive: true };\n }\n if (!options) {\n return { passive: true };\n }\n if (typeof options === \"object\" && options.passive !== false) {\n return __spreadProps(__spreadValues({}, options), { passive: true });\n }\n return options;\n }\n const customScheduleGlobal = function(task) {\n if (taskData.isExisting) {\n return;\n }\n return nativeAddEventListener.call(taskData.target, taskData.eventName, taskData.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, taskData.options);\n };\n const customCancelGlobal = function(task) {\n if (!task.isRemoved) {\n const symbolEventNames = zoneSymbolEventNames2[task.eventName];\n let symbolEventName;\n if (symbolEventNames) {\n symbolEventName = symbolEventNames[task.capture ? TRUE_STR : FALSE_STR];\n }\n const existingTasks = symbolEventName && task.target[symbolEventName];\n if (existingTasks) {\n for (let i = 0; i < existingTasks.length; i++) {\n const existingTask = existingTasks[i];\n if (existingTask === task) {\n existingTasks.splice(i, 1);\n task.isRemoved = true;\n if (task.removeAbortListener) {\n task.removeAbortListener();\n task.removeAbortListener = null;\n }\n if (existingTasks.length === 0) {\n task.allRemoved = true;\n task.target[symbolEventName] = null;\n }\n break;\n }\n }\n }\n }\n if (!task.allRemoved) {\n return;\n }\n return nativeRemoveEventListener.call(task.target, task.eventName, task.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, task.options);\n };\n const customScheduleNonGlobal = function(task) {\n return nativeAddEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);\n };\n const customSchedulePrepend = function(task) {\n return nativePrependEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);\n };\n const customCancelNonGlobal = function(task) {\n return nativeRemoveEventListener.call(task.target, task.eventName, task.invoke, task.options);\n };\n const customSchedule = useGlobalCallback ? customScheduleGlobal : customScheduleNonGlobal;\n const customCancel = useGlobalCallback ? customCancelGlobal : customCancelNonGlobal;\n const compareTaskCallbackVsDelegate = function(task, delegate) {\n const typeOfDelegate = typeof delegate;\n return typeOfDelegate === \"function\" && task.callback === delegate || typeOfDelegate === \"object\" && task.originalDelegate === delegate;\n };\n const compare = (patchOptions2 == null ? void 0 : patchOptions2.diff) || compareTaskCallbackVsDelegate;\n const unpatchedEvents = Zone[zoneSymbol(\"UNPATCHED_EVENTS\")];\n const passiveEvents = _global2[zoneSymbol(\"PASSIVE_EVENTS\")];\n function copyEventListenerOptions(options) {\n if (typeof options === \"object\" && options !== null) {\n const newOptions = __spreadValues({}, options);\n if (options.signal) {\n newOptions.signal = options.signal;\n }\n return newOptions;\n }\n return options;\n }\n const makeAddListener = function(nativeListener, addSource, customScheduleFn, customCancelFn, returnTarget2 = false, prepend = false) {\n return function() {\n const target = this || _global2;\n let eventName = arguments[0];\n if (patchOptions2 && patchOptions2.transferEventName) {\n eventName = patchOptions2.transferEventName(eventName);\n }\n let delegate = arguments[1];\n if (!delegate) {\n return nativeListener.apply(this, arguments);\n }\n if (isNode && eventName === \"uncaughtException\") {\n return nativeListener.apply(this, arguments);\n }\n let isEventListenerObject = false;\n if (typeof delegate !== \"function\") {\n if (!delegate.handleEvent) {\n return nativeListener.apply(this, arguments);\n }\n isEventListenerObject = true;\n }\n if (validateHandler && !validateHandler(nativeListener, delegate, target, arguments)) {\n return;\n }\n const passive = !!passiveEvents && passiveEvents.indexOf(eventName) !== -1;\n const options = copyEventListenerOptions(buildEventListenerOptions(arguments[2], passive));\n const signal = options == null ? void 0 : options.signal;\n if (signal == null ? void 0 : signal.aborted) {\n return;\n }\n if (unpatchedEvents) {\n for (let i = 0; i < unpatchedEvents.length; i++) {\n if (eventName === unpatchedEvents[i]) {\n if (passive) {\n return nativeListener.call(target, eventName, delegate, options);\n } else {\n return nativeListener.apply(this, arguments);\n }\n }\n }\n }\n const capture = !options ? false : typeof options === \"boolean\" ? true : options.capture;\n const once = options && typeof options === \"object\" ? options.once : false;\n const zone = Zone.current;\n let symbolEventNames = zoneSymbolEventNames2[eventName];\n if (!symbolEventNames) {\n prepareEventNames(eventName, eventNameToString);\n symbolEventNames = zoneSymbolEventNames2[eventName];\n }\n const symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR];\n let existingTasks = target[symbolEventName];\n let isExisting = false;\n if (existingTasks) {\n isExisting = true;\n if (checkDuplicate) {\n for (let i = 0; i < existingTasks.length; i++) {\n if (compare(existingTasks[i], delegate)) {\n return;\n }\n }\n }\n } else {\n existingTasks = target[symbolEventName] = [];\n }\n let source;\n const constructorName = target.constructor[\"name\"];\n const targetSource = globalSources[constructorName];\n if (targetSource) {\n source = targetSource[eventName];\n }\n if (!source) {\n source = constructorName + addSource + (eventNameToString ? eventNameToString(eventName) : eventName);\n }\n taskData.options = options;\n if (once) {\n taskData.options.once = false;\n }\n taskData.target = target;\n taskData.capture = capture;\n taskData.eventName = eventName;\n taskData.isExisting = isExisting;\n const data = useGlobalCallback ? OPTIMIZED_ZONE_EVENT_TASK_DATA : void 0;\n if (data) {\n data.taskData = taskData;\n }\n if (signal) {\n taskData.options.signal = void 0;\n }\n const task = zone.scheduleEventTask(source, delegate, data, customScheduleFn, customCancelFn);\n if (signal) {\n taskData.options.signal = signal;\n const onAbort = () => task.zone.cancelTask(task);\n nativeListener.call(signal, \"abort\", onAbort, { once: true });\n task.removeAbortListener = () => signal.removeEventListener(\"abort\", onAbort);\n }\n taskData.target = null;\n if (data) {\n data.taskData = null;\n }\n if (once) {\n taskData.options.once = true;\n }\n if (typeof task.options !== \"boolean\") {\n task.options = options;\n }\n task.target = target;\n task.capture = capture;\n task.eventName = eventName;\n if (isEventListenerObject) {\n task.originalDelegate = delegate;\n }\n if (!prepend) {\n existingTasks.push(task);\n } else {\n existingTasks.unshift(task);\n }\n if (returnTarget2) {\n return target;\n }\n };\n };\n proto[ADD_EVENT_LISTENER] = makeAddListener(nativeAddEventListener, ADD_EVENT_LISTENER_SOURCE, customSchedule, customCancel, returnTarget);\n if (nativePrependEventListener) {\n proto[PREPEND_EVENT_LISTENER] = makeAddListener(nativePrependEventListener, PREPEND_EVENT_LISTENER_SOURCE, customSchedulePrepend, customCancel, returnTarget, true);\n }\n proto[REMOVE_EVENT_LISTENER] = function() {\n const target = this || _global2;\n let eventName = arguments[0];\n if (patchOptions2 && patchOptions2.transferEventName) {\n eventName = patchOptions2.transferEventName(eventName);\n }\n const options = arguments[2];\n const capture = !options ? false : typeof options === \"boolean\" ? true : options.capture;\n const delegate = arguments[1];\n if (!delegate) {\n return nativeRemoveEventListener.apply(this, arguments);\n }\n if (validateHandler && !validateHandler(nativeRemoveEventListener, delegate, target, arguments)) {\n return;\n }\n const symbolEventNames = zoneSymbolEventNames2[eventName];\n let symbolEventName;\n if (symbolEventNames) {\n symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR];\n }\n const existingTasks = symbolEventName && target[symbolEventName];\n if (existingTasks) {\n for (let i = 0; i < existingTasks.length; i++) {\n const existingTask = existingTasks[i];\n if (compare(existingTask, delegate)) {\n existingTasks.splice(i, 1);\n existingTask.isRemoved = true;\n if (existingTasks.length === 0) {\n existingTask.allRemoved = true;\n target[symbolEventName] = null;\n if (!capture && typeof eventName === \"string\") {\n const onPropertySymbol = ZONE_SYMBOL_PREFIX + \"ON_PROPERTY\" + eventName;\n target[onPropertySymbol] = null;\n }\n }\n existingTask.zone.cancelTask(existingTask);\n if (returnTarget) {\n return target;\n }\n return;\n }\n }\n }\n return nativeRemoveEventListener.apply(this, arguments);\n };\n proto[LISTENERS_EVENT_LISTENER] = function() {\n const target = this || _global2;\n let eventName = arguments[0];\n if (patchOptions2 && patchOptions2.transferEventName) {\n eventName = patchOptions2.transferEventName(eventName);\n }\n const listeners = [];\n const tasks = findEventTasks(target, eventNameToString ? eventNameToString(eventName) : eventName);\n for (let i = 0; i < tasks.length; i++) {\n const task = tasks[i];\n let delegate = task.originalDelegate ? task.originalDelegate : task.callback;\n listeners.push(delegate);\n }\n return listeners;\n };\n proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER] = function() {\n const target = this || _global2;\n let eventName = arguments[0];\n if (!eventName) {\n const keys = Object.keys(target);\n for (let i = 0; i < keys.length; i++) {\n const prop = keys[i];\n const match = EVENT_NAME_SYMBOL_REGX.exec(prop);\n let evtName = match && match[1];\n if (evtName && evtName !== \"removeListener\") {\n this[REMOVE_ALL_LISTENERS_EVENT_LISTENER].call(this, evtName);\n }\n }\n this[REMOVE_ALL_LISTENERS_EVENT_LISTENER].call(this, \"removeListener\");\n } else {\n if (patchOptions2 && patchOptions2.transferEventName) {\n eventName = patchOptions2.transferEventName(eventName);\n }\n const symbolEventNames = zoneSymbolEventNames2[eventName];\n if (symbolEventNames) {\n const symbolEventName = symbolEventNames[FALSE_STR];\n const symbolCaptureEventName = symbolEventNames[TRUE_STR];\n const tasks = target[symbolEventName];\n const captureTasks = target[symbolCaptureEventName];\n if (tasks) {\n const removeTasks = tasks.slice();\n for (let i = 0; i < removeTasks.length; i++) {\n const task = removeTasks[i];\n let delegate = task.originalDelegate ? task.originalDelegate : task.callback;\n this[REMOVE_EVENT_LISTENER].call(this, eventName, delegate, task.options);\n }\n }\n if (captureTasks) {\n const removeTasks = captureTasks.slice();\n for (let i = 0; i < removeTasks.length; i++) {\n const task = removeTasks[i];\n let delegate = task.originalDelegate ? task.originalDelegate : task.callback;\n this[REMOVE_EVENT_LISTENER].call(this, eventName, delegate, task.options);\n }\n }\n }\n }\n if (returnTarget) {\n return this;\n }\n };\n attachOriginToPatched(proto[ADD_EVENT_LISTENER], nativeAddEventListener);\n attachOriginToPatched(proto[REMOVE_EVENT_LISTENER], nativeRemoveEventListener);\n if (nativeRemoveAllListeners) {\n attachOriginToPatched(proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER], nativeRemoveAllListeners);\n }\n if (nativeListeners) {\n attachOriginToPatched(proto[LISTENERS_EVENT_LISTENER], nativeListeners);\n }\n return true;\n }\n let results = [];\n for (let i = 0; i < apis.length; i++) {\n results[i] = patchEventTargetMethods(apis[i], patchOptions);\n }\n return results;\n}\nfunction findEventTasks(target, eventName) {\n if (!eventName) {\n const foundTasks = [];\n for (let prop in target) {\n const match = EVENT_NAME_SYMBOL_REGX.exec(prop);\n let evtName = match && match[1];\n if (evtName && (!eventName || evtName === eventName)) {\n const tasks = target[prop];\n if (tasks) {\n for (let i = 0; i < tasks.length; i++) {\n foundTasks.push(tasks[i]);\n }\n }\n }\n }\n return foundTasks;\n }\n let symbolEventName = zoneSymbolEventNames2[eventName];\n if (!symbolEventName) {\n prepareEventNames(eventName);\n symbolEventName = zoneSymbolEventNames2[eventName];\n }\n const captureFalseTasks = target[symbolEventName[FALSE_STR]];\n const captureTrueTasks = target[symbolEventName[TRUE_STR]];\n if (!captureFalseTasks) {\n return captureTrueTasks ? captureTrueTasks.slice() : [];\n } else {\n return captureTrueTasks ? captureFalseTasks.concat(captureTrueTasks) : captureFalseTasks.slice();\n }\n}\nfunction patchEventPrototype(global2, api) {\n const Event = global2[\"Event\"];\n if (Event && Event.prototype) {\n api.patchMethod(Event.prototype, \"stopImmediatePropagation\", (delegate) => function(self2, args) {\n self2[IMMEDIATE_PROPAGATION_SYMBOL] = true;\n delegate && delegate.apply(self2, args);\n });\n }\n}\n\n// packages/zone.js/lib/common/queue-microtask.js\nfunction patchQueueMicrotask(global2, api) {\n api.patchMethod(global2, \"queueMicrotask\", (delegate) => {\n return function(self2, args) {\n Zone.current.scheduleMicroTask(\"queueMicrotask\", args[0]);\n };\n });\n}\n\n// packages/zone.js/lib/common/timers.js\nvar taskSymbol = zoneSymbol(\"zoneTask\");\nfunction patchTimer(window2, setName, cancelName, nameSuffix) {\n let setNative = null;\n let clearNative = null;\n setName += nameSuffix;\n cancelName += nameSuffix;\n const tasksByHandleId = {};\n function scheduleTask(task) {\n const data = task.data;\n data.args[0] = function() {\n return task.invoke.apply(this, arguments);\n };\n const handleOrId = setNative.apply(window2, data.args);\n if (isNumber(handleOrId)) {\n data.handleId = handleOrId;\n } else {\n data.handle = handleOrId;\n data.isRefreshable = isFunction(handleOrId.refresh);\n }\n return task;\n }\n function clearTask(task) {\n const { handle, handleId } = task.data;\n return clearNative.call(window2, handle != null ? handle : handleId);\n }\n setNative = patchMethod(window2, setName, (delegate) => function(self2, args) {\n var _a;\n if (isFunction(args[0])) {\n const options = {\n isRefreshable: false,\n isPeriodic: nameSuffix === \"Interval\",\n delay: nameSuffix === \"Timeout\" || nameSuffix === \"Interval\" ? args[1] || 0 : void 0,\n args\n };\n const callback = args[0];\n args[0] = function timer() {\n try {\n return callback.apply(this, arguments);\n } finally {\n const { handle: handle2, handleId: handleId2, isPeriodic: isPeriodic2, isRefreshable: isRefreshable2 } = options;\n if (!isPeriodic2 && !isRefreshable2) {\n if (handleId2) {\n delete tasksByHandleId[handleId2];\n } else if (handle2) {\n handle2[taskSymbol] = null;\n }\n }\n }\n };\n const task = scheduleMacroTaskWithCurrentZone(setName, args[0], options, scheduleTask, clearTask);\n if (!task) {\n return task;\n }\n const { handleId, handle, isRefreshable, isPeriodic } = task.data;\n if (handleId) {\n tasksByHandleId[handleId] = task;\n } else if (handle) {\n handle[taskSymbol] = task;\n if (isRefreshable && !isPeriodic) {\n const originalRefresh = handle.refresh;\n handle.refresh = function() {\n const { zone, state } = task;\n if (state === \"notScheduled\") {\n task._state = \"scheduled\";\n zone._updateTaskCount(task, 1);\n } else if (state === \"running\") {\n task._state = \"scheduling\";\n }\n return originalRefresh.call(this);\n };\n }\n }\n return (_a = handle != null ? handle : handleId) != null ? _a : task;\n } else {\n return delegate.apply(window2, args);\n }\n });\n clearNative = patchMethod(window2, cancelName, (delegate) => function(self2, args) {\n const id = args[0];\n let task;\n if (isNumber(id)) {\n task = tasksByHandleId[id];\n delete tasksByHandleId[id];\n } else {\n task = id == null ? void 0 : id[taskSymbol];\n if (task) {\n id[taskSymbol] = null;\n } else {\n task = id;\n }\n }\n if (task == null ? void 0 : task.type) {\n if (task.cancelFn) {\n task.zone.cancelTask(task);\n }\n } else {\n delegate.apply(window2, args);\n }\n });\n}\n\n// packages/zone.js/lib/browser/custom-elements.js\nfunction patchCustomElements(_global2, api) {\n const { isBrowser: isBrowser2, isMix: isMix2 } = api.getGlobalObjects();\n if (!isBrowser2 && !isMix2 || !_global2[\"customElements\"] || !(\"customElements\" in _global2)) {\n return;\n }\n const callbacks = [\n \"connectedCallback\",\n \"disconnectedCallback\",\n \"adoptedCallback\",\n \"attributeChangedCallback\",\n \"formAssociatedCallback\",\n \"formDisabledCallback\",\n \"formResetCallback\",\n \"formStateRestoreCallback\"\n ];\n api.patchCallbacks(api, _global2.customElements, \"customElements\", \"define\", callbacks);\n}\n\n// packages/zone.js/lib/browser/event-target.js\nfunction eventTargetPatch(_global2, api) {\n if (Zone[api.symbol(\"patchEventTarget\")]) {\n return;\n }\n const { eventNames, zoneSymbolEventNames: zoneSymbolEventNames3, TRUE_STR: TRUE_STR2, FALSE_STR: FALSE_STR2, ZONE_SYMBOL_PREFIX: ZONE_SYMBOL_PREFIX2 } = api.getGlobalObjects();\n for (let i = 0; i < eventNames.length; i++) {\n const eventName = eventNames[i];\n const falseEventName = eventName + FALSE_STR2;\n const trueEventName = eventName + TRUE_STR2;\n const symbol = ZONE_SYMBOL_PREFIX2 + falseEventName;\n const symbolCapture = ZONE_SYMBOL_PREFIX2 + trueEventName;\n zoneSymbolEventNames3[eventName] = {};\n zoneSymbolEventNames3[eventName][FALSE_STR2] = symbol;\n zoneSymbolEventNames3[eventName][TRUE_STR2] = symbolCapture;\n }\n const EVENT_TARGET = _global2[\"EventTarget\"];\n if (!EVENT_TARGET || !EVENT_TARGET.prototype) {\n return;\n }\n api.patchEventTarget(_global2, api, [EVENT_TARGET && EVENT_TARGET.prototype]);\n return true;\n}\nfunction patchEvent(global2, api) {\n api.patchEventPrototype(global2, api);\n}\n\n// packages/zone.js/lib/browser/property-descriptor.js\nfunction filterProperties(target, onProperties, ignoreProperties) {\n if (!ignoreProperties || ignoreProperties.length === 0) {\n return onProperties;\n }\n const tip = ignoreProperties.filter((ip) => ip.target === target);\n if (tip.length === 0) {\n return onProperties;\n }\n const targetIgnoreProperties = tip[0].ignoreProperties;\n return onProperties.filter((op) => targetIgnoreProperties.indexOf(op) === -1);\n}\nfunction patchFilteredProperties(target, onProperties, ignoreProperties, prototype) {\n if (!target) {\n return;\n }\n const filteredProperties = filterProperties(target, onProperties, ignoreProperties);\n patchOnProperties(target, filteredProperties, prototype);\n}\nfunction getOnEventNames(target) {\n return Object.getOwnPropertyNames(target).filter((name) => name.startsWith(\"on\") && name.length > 2).map((name) => name.substring(2));\n}\nfunction propertyDescriptorPatch(api, _global2) {\n if (isNode && !isMix) {\n return;\n }\n if (Zone[api.symbol(\"patchEvents\")]) {\n return;\n }\n const ignoreProperties = _global2[\"__Zone_ignore_on_properties\"];\n let patchTargets = [];\n if (isBrowser) {\n const internalWindow2 = window;\n patchTargets = patchTargets.concat([\n \"Document\",\n \"SVGElement\",\n \"Element\",\n \"HTMLElement\",\n \"HTMLBodyElement\",\n \"HTMLMediaElement\",\n \"HTMLFrameSetElement\",\n \"HTMLFrameElement\",\n \"HTMLIFrameElement\",\n \"HTMLMarqueeElement\",\n \"Worker\"\n ]);\n patchFilteredProperties(internalWindow2, getOnEventNames(internalWindow2), ignoreProperties, ObjectGetPrototypeOf(internalWindow2));\n }\n patchTargets = patchTargets.concat([\n \"XMLHttpRequest\",\n \"XMLHttpRequestEventTarget\",\n \"IDBIndex\",\n \"IDBRequest\",\n \"IDBOpenDBRequest\",\n \"IDBDatabase\",\n \"IDBTransaction\",\n \"IDBCursor\",\n \"WebSocket\"\n ]);\n for (let i = 0; i < patchTargets.length; i++) {\n const target = _global2[patchTargets[i]];\n (target == null ? void 0 : target.prototype) && patchFilteredProperties(target.prototype, getOnEventNames(target.prototype), ignoreProperties);\n }\n}\n\n// packages/zone.js/lib/browser/browser.js\nfunction patchBrowser(Zone3) {\n Zone3.__load_patch(\"timers\", (global2) => {\n const set = \"set\";\n const clear = \"clear\";\n patchTimer(global2, set, clear, \"Timeout\");\n patchTimer(global2, set, clear, \"Interval\");\n patchTimer(global2, set, clear, \"Immediate\");\n });\n Zone3.__load_patch(\"requestAnimationFrame\", (global2) => {\n patchTimer(global2, \"request\", \"cancel\", \"AnimationFrame\");\n patchTimer(global2, \"mozRequest\", \"mozCancel\", \"AnimationFrame\");\n patchTimer(global2, \"webkitRequest\", \"webkitCancel\", \"AnimationFrame\");\n });\n Zone3.__load_patch(\"blocking\", (global2, Zone4) => {\n const blockingMethods = [\"alert\", \"prompt\", \"confirm\"];\n for (let i = 0; i < blockingMethods.length; i++) {\n const name = blockingMethods[i];\n patchMethod(global2, name, (delegate, symbol, name2) => {\n return function(s, args) {\n return Zone4.current.run(delegate, global2, args, name2);\n };\n });\n }\n });\n Zone3.__load_patch(\"EventTarget\", (global2, Zone4, api) => {\n patchEvent(global2, api);\n eventTargetPatch(global2, api);\n const XMLHttpRequestEventTarget = global2[\"XMLHttpRequestEventTarget\"];\n if (XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype) {\n api.patchEventTarget(global2, api, [XMLHttpRequestEventTarget.prototype]);\n }\n });\n Zone3.__load_patch(\"MutationObserver\", (global2, Zone4, api) => {\n patchClass(\"MutationObserver\");\n patchClass(\"WebKitMutationObserver\");\n });\n Zone3.__load_patch(\"IntersectionObserver\", (global2, Zone4, api) => {\n patchClass(\"IntersectionObserver\");\n });\n Zone3.__load_patch(\"FileReader\", (global2, Zone4, api) => {\n patchClass(\"FileReader\");\n });\n Zone3.__load_patch(\"on_property\", (global2, Zone4, api) => {\n propertyDescriptorPatch(api, global2);\n });\n Zone3.__load_patch(\"customElements\", (global2, Zone4, api) => {\n patchCustomElements(global2, api);\n });\n Zone3.__load_patch(\"XHR\", (global2, Zone4) => {\n patchXHR(global2);\n const XHR_TASK = zoneSymbol(\"xhrTask\");\n const XHR_SYNC = zoneSymbol(\"xhrSync\");\n const XHR_LISTENER = zoneSymbol(\"xhrListener\");\n const XHR_SCHEDULED = zoneSymbol(\"xhrScheduled\");\n const XHR_URL = zoneSymbol(\"xhrURL\");\n const XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol(\"xhrErrorBeforeScheduled\");\n function patchXHR(window2) {\n const XMLHttpRequest = window2[\"XMLHttpRequest\"];\n if (!XMLHttpRequest) {\n return;\n }\n const XMLHttpRequestPrototype = XMLHttpRequest.prototype;\n function findPendingTask(target) {\n return target[XHR_TASK];\n }\n let oriAddListener = XMLHttpRequestPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];\n let oriRemoveListener = XMLHttpRequestPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];\n if (!oriAddListener) {\n const XMLHttpRequestEventTarget = window2[\"XMLHttpRequestEventTarget\"];\n if (XMLHttpRequestEventTarget) {\n const XMLHttpRequestEventTargetPrototype = XMLHttpRequestEventTarget.prototype;\n oriAddListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];\n oriRemoveListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];\n }\n }\n const READY_STATE_CHANGE = \"readystatechange\";\n const SCHEDULED = \"scheduled\";\n function scheduleTask(task) {\n const data = task.data;\n const target = data.target;\n target[XHR_SCHEDULED] = false;\n target[XHR_ERROR_BEFORE_SCHEDULED] = false;\n const listener = target[XHR_LISTENER];\n if (!oriAddListener) {\n oriAddListener = target[ZONE_SYMBOL_ADD_EVENT_LISTENER];\n oriRemoveListener = target[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];\n }\n if (listener) {\n oriRemoveListener.call(target, READY_STATE_CHANGE, listener);\n }\n const newListener = target[XHR_LISTENER] = () => {\n if (target.readyState === target.DONE) {\n if (!data.aborted && target[XHR_SCHEDULED] && task.state === SCHEDULED) {\n const loadTasks = target[Zone4.__symbol__(\"loadfalse\")];\n if (target.status !== 0 && loadTasks && loadTasks.length > 0) {\n const oriInvoke = task.invoke;\n task.invoke = function() {\n const loadTasks2 = target[Zone4.__symbol__(\"loadfalse\")];\n for (let i = 0; i < loadTasks2.length; i++) {\n if (loadTasks2[i] === task) {\n loadTasks2.splice(i, 1);\n }\n }\n if (!data.aborted && task.state === SCHEDULED) {\n oriInvoke.call(task);\n }\n };\n loadTasks.push(task);\n } else {\n task.invoke();\n }\n } else if (!data.aborted && target[XHR_SCHEDULED] === false) {\n target[XHR_ERROR_BEFORE_SCHEDULED] = true;\n }\n }\n };\n oriAddListener.call(target, READY_STATE_CHANGE, newListener);\n const storedTask = target[XHR_TASK];\n if (!storedTask) {\n target[XHR_TASK] = task;\n }\n sendNative.apply(target, data.args);\n target[XHR_SCHEDULED] = true;\n return task;\n }\n function placeholderCallback() {\n }\n function clearTask(task) {\n const data = task.data;\n data.aborted = true;\n return abortNative.apply(data.target, data.args);\n }\n const openNative = patchMethod(XMLHttpRequestPrototype, \"open\", () => function(self2, args) {\n self2[XHR_SYNC] = args[2] == false;\n self2[XHR_URL] = args[1];\n return openNative.apply(self2, args);\n });\n const XMLHTTPREQUEST_SOURCE = \"XMLHttpRequest.send\";\n const fetchTaskAborting = zoneSymbol(\"fetchTaskAborting\");\n const fetchTaskScheduling = zoneSymbol(\"fetchTaskScheduling\");\n const sendNative = patchMethod(XMLHttpRequestPrototype, \"send\", () => function(self2, args) {\n if (Zone4.current[fetchTaskScheduling] === true) {\n return sendNative.apply(self2, args);\n }\n if (self2[XHR_SYNC]) {\n return sendNative.apply(self2, args);\n } else {\n const options = {\n target: self2,\n url: self2[XHR_URL],\n isPeriodic: false,\n args,\n aborted: false\n };\n const task = scheduleMacroTaskWithCurrentZone(XMLHTTPREQUEST_SOURCE, placeholderCallback, options, scheduleTask, clearTask);\n if (self2 && self2[XHR_ERROR_BEFORE_SCHEDULED] === true && !options.aborted && task.state === SCHEDULED) {\n task.invoke();\n }\n }\n });\n const abortNative = patchMethod(XMLHttpRequestPrototype, \"abort\", () => function(self2, args) {\n const task = findPendingTask(self2);\n if (task && typeof task.type == \"string\") {\n if (task.cancelFn == null || task.data && task.data.aborted) {\n return;\n }\n task.zone.cancelTask(task);\n } else if (Zone4.current[fetchTaskAborting] === true) {\n return abortNative.apply(self2, args);\n }\n });\n }\n });\n Zone3.__load_patch(\"geolocation\", (global2) => {\n if (global2[\"navigator\"] && global2[\"navigator\"].geolocation) {\n patchPrototype(global2[\"navigator\"].geolocation, [\"getCurrentPosition\", \"watchPosition\"]);\n }\n });\n Zone3.__load_patch(\"PromiseRejectionEvent\", (global2, Zone4) => {\n function findPromiseRejectionHandler(evtName) {\n return function(e) {\n const eventTasks = findEventTasks(global2, evtName);\n eventTasks.forEach((eventTask) => {\n const PromiseRejectionEvent = global2[\"PromiseRejectionEvent\"];\n if (PromiseRejectionEvent) {\n const evt = new PromiseRejectionEvent(evtName, {\n promise: e.promise,\n reason: e.rejection\n });\n eventTask.invoke(evt);\n }\n });\n };\n }\n if (global2[\"PromiseRejectionEvent\"]) {\n Zone4[zoneSymbol(\"unhandledPromiseRejectionHandler\")] = findPromiseRejectionHandler(\"unhandledrejection\");\n Zone4[zoneSymbol(\"rejectionHandledHandler\")] = findPromiseRejectionHandler(\"rejectionhandled\");\n }\n });\n Zone3.__load_patch(\"queueMicrotask\", (global2, Zone4, api) => {\n patchQueueMicrotask(global2, api);\n });\n}\n\n// packages/zone.js/lib/common/promise.js\nfunction patchPromise(Zone3) {\n Zone3.__load_patch(\"ZoneAwarePromise\", (global2, Zone4, api) => {\n const ObjectGetOwnPropertyDescriptor2 = Object.getOwnPropertyDescriptor;\n const ObjectDefineProperty2 = Object.defineProperty;\n function readableObjectToString(obj) {\n if (obj && obj.toString === Object.prototype.toString) {\n const className = obj.constructor && obj.constructor.name;\n return (className ? className : \"\") + \": \" + JSON.stringify(obj);\n }\n return obj ? obj.toString() : Object.prototype.toString.call(obj);\n }\n const __symbol__2 = api.symbol;\n const _uncaughtPromiseErrors = [];\n const isDisableWrappingUncaughtPromiseRejection = global2[__symbol__2(\"DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION\")] !== false;\n const symbolPromise = __symbol__2(\"Promise\");\n const symbolThen = __symbol__2(\"then\");\n const creationTrace = \"__creationTrace__\";\n api.onUnhandledError = (e) => {\n if (api.showUncaughtError()) {\n const rejection = e && e.rejection;\n if (rejection) {\n console.error(\"Unhandled Promise rejection:\", rejection instanceof Error ? rejection.message : rejection, \"; Zone:\", e.zone.name, \"; Task:\", e.task && e.task.source, \"; Value:\", rejection, rejection instanceof Error ? rejection.stack : void 0);\n } else {\n console.error(e);\n }\n }\n };\n api.microtaskDrainDone = () => {\n while (_uncaughtPromiseErrors.length) {\n const uncaughtPromiseError = _uncaughtPromiseErrors.shift();\n try {\n uncaughtPromiseError.zone.runGuarded(() => {\n if (uncaughtPromiseError.throwOriginal) {\n throw uncaughtPromiseError.rejection;\n }\n throw uncaughtPromiseError;\n });\n } catch (error) {\n handleUnhandledRejection(error);\n }\n }\n };\n const UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL = __symbol__2(\"unhandledPromiseRejectionHandler\");\n function handleUnhandledRejection(e) {\n api.onUnhandledError(e);\n try {\n const handler = Zone4[UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL];\n if (typeof handler === \"function\") {\n handler.call(this, e);\n }\n } catch (err) {\n }\n }\n function isThenable(value) {\n return value && typeof value.then === \"function\";\n }\n function forwardResolution(value) {\n return value;\n }\n function forwardRejection(rejection) {\n return ZoneAwarePromise.reject(rejection);\n }\n const symbolState = __symbol__2(\"state\");\n const symbolValue = __symbol__2(\"value\");\n const symbolFinally = __symbol__2(\"finally\");\n const symbolParentPromiseValue = __symbol__2(\"parentPromiseValue\");\n const symbolParentPromiseState = __symbol__2(\"parentPromiseState\");\n const source = \"Promise.then\";\n const UNRESOLVED = null;\n const RESOLVED = true;\n const REJECTED = false;\n const REJECTED_NO_CATCH = 0;\n function makeResolver(promise, state) {\n return (v) => {\n try {\n resolvePromise(promise, state, v);\n } catch (err) {\n resolvePromise(promise, false, err);\n }\n };\n }\n const once = function() {\n let wasCalled = false;\n return function wrapper(wrappedFunction) {\n return function() {\n if (wasCalled) {\n return;\n }\n wasCalled = true;\n wrappedFunction.apply(null, arguments);\n };\n };\n };\n const TYPE_ERROR = \"Promise resolved with itself\";\n const CURRENT_TASK_TRACE_SYMBOL = __symbol__2(\"currentTaskTrace\");\n function resolvePromise(promise, state, value) {\n const onceWrapper = once();\n if (promise === value) {\n throw new TypeError(TYPE_ERROR);\n }\n if (promise[symbolState] === UNRESOLVED) {\n let then = null;\n try {\n if (typeof value === \"object\" || typeof value === \"function\") {\n then = value && value.then;\n }\n } catch (err) {\n onceWrapper(() => {\n resolvePromise(promise, false, err);\n })();\n return promise;\n }\n if (state !== REJECTED && value instanceof ZoneAwarePromise && value.hasOwnProperty(symbolState) && value.hasOwnProperty(symbolValue) && value[symbolState] !== UNRESOLVED) {\n clearRejectedNoCatch(value);\n resolvePromise(promise, value[symbolState], value[symbolValue]);\n } else if (state !== REJECTED && typeof then === \"function\") {\n try {\n then.call(value, onceWrapper(makeResolver(promise, state)), onceWrapper(makeResolver(promise, false)));\n } catch (err) {\n onceWrapper(() => {\n resolvePromise(promise, false, err);\n })();\n }\n } else {\n promise[symbolState] = state;\n const queue = promise[symbolValue];\n promise[symbolValue] = value;\n if (promise[symbolFinally] === symbolFinally) {\n if (state === RESOLVED) {\n promise[symbolState] = promise[symbolParentPromiseState];\n promise[symbolValue] = promise[symbolParentPromiseValue];\n }\n }\n if (state === REJECTED && value instanceof Error) {\n const trace = Zone4.currentTask && Zone4.currentTask.data && Zone4.currentTask.data[creationTrace];\n if (trace) {\n ObjectDefineProperty2(value, CURRENT_TASK_TRACE_SYMBOL, {\n configurable: true,\n enumerable: false,\n writable: true,\n value: trace\n });\n }\n }\n for (let i = 0; i < queue.length; ) {\n scheduleResolveOrReject(promise, queue[i++], queue[i++], queue[i++], queue[i++]);\n }\n if (queue.length == 0 && state == REJECTED) {\n promise[symbolState] = REJECTED_NO_CATCH;\n let uncaughtPromiseError = value;\n try {\n throw new Error(\"Uncaught (in promise): \" + readableObjectToString(value) + (value && value.stack ? \"\\n\" + value.stack : \"\"));\n } catch (err) {\n uncaughtPromiseError = err;\n }\n if (isDisableWrappingUncaughtPromiseRejection) {\n uncaughtPromiseError.throwOriginal = true;\n }\n uncaughtPromiseError.rejection = value;\n uncaughtPromiseError.promise = promise;\n uncaughtPromiseError.zone = Zone4.current;\n uncaughtPromiseError.task = Zone4.currentTask;\n _uncaughtPromiseErrors.push(uncaughtPromiseError);\n api.scheduleMicroTask();\n }\n }\n }\n return promise;\n }\n const REJECTION_HANDLED_HANDLER = __symbol__2(\"rejectionHandledHandler\");\n function clearRejectedNoCatch(promise) {\n if (promise[symbolState] === REJECTED_NO_CATCH) {\n try {\n const handler = Zone4[REJECTION_HANDLED_HANDLER];\n if (handler && typeof handler === \"function\") {\n handler.call(this, { rejection: promise[symbolValue], promise });\n }\n } catch (err) {\n }\n promise[symbolState] = REJECTED;\n for (let i = 0; i < _uncaughtPromiseErrors.length; i++) {\n if (promise === _uncaughtPromiseErrors[i].promise) {\n _uncaughtPromiseErrors.splice(i, 1);\n }\n }\n }\n }\n function scheduleResolveOrReject(promise, zone, chainPromise, onFulfilled, onRejected) {\n clearRejectedNoCatch(promise);\n const promiseState = promise[symbolState];\n const delegate = promiseState ? typeof onFulfilled === \"function\" ? onFulfilled : forwardResolution : typeof onRejected === \"function\" ? onRejected : forwardRejection;\n zone.scheduleMicroTask(source, () => {\n try {\n const parentPromiseValue = promise[symbolValue];\n const isFinallyPromise = !!chainPromise && symbolFinally === chainPromise[symbolFinally];\n if (isFinallyPromise) {\n chainPromise[symbolParentPromiseValue] = parentPromiseValue;\n chainPromise[symbolParentPromiseState] = promiseState;\n }\n const value = zone.run(delegate, void 0, isFinallyPromise && delegate !== forwardRejection && delegate !== forwardResolution ? [] : [parentPromiseValue]);\n resolvePromise(chainPromise, true, value);\n } catch (error) {\n resolvePromise(chainPromise, false, error);\n }\n }, chainPromise);\n }\n const ZONE_AWARE_PROMISE_TO_STRING = \"function ZoneAwarePromise() { [native code] }\";\n const noop = function() {\n };\n const AggregateError = global2.AggregateError;\n class ZoneAwarePromise {\n static toString() {\n return ZONE_AWARE_PROMISE_TO_STRING;\n }\n static resolve(value) {\n if (value instanceof ZoneAwarePromise) {\n return value;\n }\n return resolvePromise(new this(null), RESOLVED, value);\n }\n static reject(error) {\n return resolvePromise(new this(null), REJECTED, error);\n }\n static withResolvers() {\n const result = {};\n result.promise = new ZoneAwarePromise((res, rej) => {\n result.resolve = res;\n result.reject = rej;\n });\n return result;\n }\n static any(values) {\n if (!values || typeof values[Symbol.iterator] !== \"function\") {\n return Promise.reject(new AggregateError([], \"All promises were rejected\"));\n }\n const promises = [];\n let count = 0;\n try {\n for (let v of values) {\n count++;\n promises.push(ZoneAwarePromise.resolve(v));\n }\n } catch (err) {\n return Promise.reject(new AggregateError([], \"All promises were rejected\"));\n }\n if (count === 0) {\n return Promise.reject(new AggregateError([], \"All promises were rejected\"));\n }\n let finished = false;\n const errors = [];\n return new ZoneAwarePromise((resolve, reject) => {\n for (let i = 0; i < promises.length; i++) {\n promises[i].then((v) => {\n if (finished) {\n return;\n }\n finished = true;\n resolve(v);\n }, (err) => {\n errors.push(err);\n count--;\n if (count === 0) {\n finished = true;\n reject(new AggregateError(errors, \"All promises were rejected\"));\n }\n });\n }\n });\n }\n static race(values) {\n let resolve;\n let reject;\n let promise = new this((res, rej) => {\n resolve = res;\n reject = rej;\n });\n function onResolve(value) {\n resolve(value);\n }\n function onReject(error) {\n reject(error);\n }\n for (let value of values) {\n if (!isThenable(value)) {\n value = this.resolve(value);\n }\n value.then(onResolve, onReject);\n }\n return promise;\n }\n static all(values) {\n return ZoneAwarePromise.allWithCallback(values);\n }\n static allSettled(values) {\n const P = this && this.prototype instanceof ZoneAwarePromise ? this : ZoneAwarePromise;\n return P.allWithCallback(values, {\n thenCallback: (value) => ({ status: \"fulfilled\", value }),\n errorCallback: (err) => ({ status: \"rejected\", reason: err })\n });\n }\n static allWithCallback(values, callback) {\n let resolve;\n let reject;\n let promise = new this((res, rej) => {\n resolve = res;\n reject = rej;\n });\n let unresolvedCount = 2;\n let valueIndex = 0;\n const resolvedValues = [];\n for (let value of values) {\n if (!isThenable(value)) {\n value = this.resolve(value);\n }\n const curValueIndex = valueIndex;\n try {\n value.then((value2) => {\n resolvedValues[curValueIndex] = callback ? callback.thenCallback(value2) : value2;\n unresolvedCount--;\n if (unresolvedCount === 0) {\n resolve(resolvedValues);\n }\n }, (err) => {\n if (!callback) {\n reject(err);\n } else {\n resolvedValues[curValueIndex] = callback.errorCallback(err);\n unresolvedCount--;\n if (unresolvedCount === 0) {\n resolve(resolvedValues);\n }\n }\n });\n } catch (thenErr) {\n reject(thenErr);\n }\n unresolvedCount++;\n valueIndex++;\n }\n unresolvedCount -= 2;\n if (unresolvedCount === 0) {\n resolve(resolvedValues);\n }\n return promise;\n }\n constructor(executor) {\n const promise = this;\n if (!(promise instanceof ZoneAwarePromise)) {\n throw new Error(\"Must be an instanceof Promise.\");\n }\n promise[symbolState] = UNRESOLVED;\n promise[symbolValue] = [];\n try {\n const onceWrapper = once();\n executor && executor(onceWrapper(makeResolver(promise, RESOLVED)), onceWrapper(makeResolver(promise, REJECTED)));\n } catch (error) {\n resolvePromise(promise, false, error);\n }\n }\n get [Symbol.toStringTag]() {\n return \"Promise\";\n }\n get [Symbol.species]() {\n return ZoneAwarePromise;\n }\n then(onFulfilled, onRejected) {\n var _a;\n let C = (_a = this.constructor) == null ? void 0 : _a[Symbol.species];\n if (!C || typeof C !== \"function\") {\n C = this.constructor || ZoneAwarePromise;\n }\n const chainPromise = new C(noop);\n const zone = Zone4.current;\n if (this[symbolState] == UNRESOLVED) {\n this[symbolValue].push(zone, chainPromise, onFulfilled, onRejected);\n } else {\n scheduleResolveOrReject(this, zone, chainPromise, onFulfilled, onRejected);\n }\n return chainPromise;\n }\n catch(onRejected) {\n return this.then(null, onRejected);\n }\n finally(onFinally) {\n var _a;\n let C = (_a = this.constructor) == null ? void 0 : _a[Symbol.species];\n if (!C || typeof C !== \"function\") {\n C = ZoneAwarePromise;\n }\n const chainPromise = new C(noop);\n chainPromise[symbolFinally] = symbolFinally;\n const zone = Zone4.current;\n if (this[symbolState] == UNRESOLVED) {\n this[symbolValue].push(zone, chainPromise, onFinally, onFinally);\n } else {\n scheduleResolveOrReject(this, zone, chainPromise, onFinally, onFinally);\n }\n return chainPromise;\n }\n }\n ZoneAwarePromise[\"resolve\"] = ZoneAwarePromise.resolve;\n ZoneAwarePromise[\"reject\"] = ZoneAwarePromise.reject;\n ZoneAwarePromise[\"race\"] = ZoneAwarePromise.race;\n ZoneAwarePromise[\"all\"] = ZoneAwarePromise.all;\n const NativePromise = global2[symbolPromise] = global2[\"Promise\"];\n global2[\"Promise\"] = ZoneAwarePromise;\n const symbolThenPatched = __symbol__2(\"thenPatched\");\n function patchThen(Ctor) {\n const proto = Ctor.prototype;\n const prop = ObjectGetOwnPropertyDescriptor2(proto, \"then\");\n if (prop && (prop.writable === false || !prop.configurable)) {\n return;\n }\n const originalThen = proto.then;\n proto[symbolThen] = originalThen;\n Ctor.prototype.then = function(onResolve, onReject) {\n const wrapped = new ZoneAwarePromise((resolve, reject) => {\n originalThen.call(this, resolve, reject);\n });\n return wrapped.then(onResolve, onReject);\n };\n Ctor[symbolThenPatched] = true;\n }\n api.patchThen = patchThen;\n function zoneify(fn) {\n return function(self2, args) {\n let resultPromise = fn.apply(self2, args);\n if (resultPromise instanceof ZoneAwarePromise) {\n return resultPromise;\n }\n let ctor = resultPromise.constructor;\n if (!ctor[symbolThenPatched]) {\n patchThen(ctor);\n }\n return resultPromise;\n };\n }\n if (NativePromise) {\n patchThen(NativePromise);\n const nativeTry = NativePromise[\"try\"];\n if (nativeTry && typeof nativeTry === \"function\") {\n ZoneAwarePromise[\"try\"] = nativeTry;\n }\n patchMethod(global2, \"fetch\", (delegate) => zoneify(delegate));\n }\n Promise[Zone4.__symbol__(\"uncaughtPromiseErrors\")] = _uncaughtPromiseErrors;\n return ZoneAwarePromise;\n });\n}\n\n// packages/zone.js/lib/common/to-string.js\nfunction patchToString(Zone3) {\n Zone3.__load_patch(\"toString\", (global2) => {\n const originalFunctionToString = Function.prototype.toString;\n const ORIGINAL_DELEGATE_SYMBOL = zoneSymbol(\"OriginalDelegate\");\n const PROMISE_SYMBOL = zoneSymbol(\"Promise\");\n const ERROR_SYMBOL = zoneSymbol(\"Error\");\n const newFunctionToString = function toString() {\n if (typeof this === \"function\") {\n const originalDelegate = this[ORIGINAL_DELEGATE_SYMBOL];\n if (originalDelegate) {\n if (typeof originalDelegate === \"function\") {\n return originalFunctionToString.call(originalDelegate);\n } else {\n return Object.prototype.toString.call(originalDelegate);\n }\n }\n if (this === Promise) {\n const nativePromise = global2[PROMISE_SYMBOL];\n if (nativePromise) {\n return originalFunctionToString.call(nativePromise);\n }\n }\n if (this === Error) {\n const nativeError = global2[ERROR_SYMBOL];\n if (nativeError) {\n return originalFunctionToString.call(nativeError);\n }\n }\n }\n return originalFunctionToString.call(this);\n };\n newFunctionToString[ORIGINAL_DELEGATE_SYMBOL] = originalFunctionToString;\n Function.prototype.toString = newFunctionToString;\n const originalObjectToString = Object.prototype.toString;\n const PROMISE_OBJECT_TO_STRING = \"[object Promise]\";\n Object.prototype.toString = function() {\n if (typeof Promise === \"function\" && this instanceof Promise) {\n return PROMISE_OBJECT_TO_STRING;\n }\n return originalObjectToString.call(this);\n };\n });\n}\n\n// packages/zone.js/lib/browser/browser-util.js\nfunction patchCallbacks(api, target, targetName, method, callbacks) {\n const symbol = Zone.__symbol__(method);\n if (target[symbol]) {\n return;\n }\n const nativeDelegate = target[symbol] = target[method];\n target[method] = function(name, opts, options) {\n if (opts && opts.prototype) {\n callbacks.forEach(function(callback) {\n const source = `${targetName}.${method}::` + callback;\n const prototype = opts.prototype;\n try {\n if (prototype.hasOwnProperty(callback)) {\n const descriptor = api.ObjectGetOwnPropertyDescriptor(prototype, callback);\n if (descriptor && descriptor.value) {\n descriptor.value = api.wrapWithCurrentZone(descriptor.value, source);\n api._redefineProperty(opts.prototype, callback, descriptor);\n } else if (prototype[callback]) {\n prototype[callback] = api.wrapWithCurrentZone(prototype[callback], source);\n }\n } else if (prototype[callback]) {\n prototype[callback] = api.wrapWithCurrentZone(prototype[callback], source);\n }\n } catch (e) {\n }\n });\n }\n return nativeDelegate.call(target, name, opts, options);\n };\n api.attachOriginToPatched(target[method], nativeDelegate);\n}\n\n// packages/zone.js/lib/browser/api-util.js\nfunction patchUtil(Zone3) {\n Zone3.__load_patch(\"util\", (global2, Zone4, api) => {\n const eventNames = getOnEventNames(global2);\n api.patchOnProperties = patchOnProperties;\n api.patchMethod = patchMethod;\n api.bindArguments = bindArguments;\n api.patchMacroTask = patchMacroTask;\n const SYMBOL_BLACK_LISTED_EVENTS = Zone4.__symbol__(\"BLACK_LISTED_EVENTS\");\n const SYMBOL_UNPATCHED_EVENTS = Zone4.__symbol__(\"UNPATCHED_EVENTS\");\n if (global2[SYMBOL_UNPATCHED_EVENTS]) {\n global2[SYMBOL_BLACK_LISTED_EVENTS] = global2[SYMBOL_UNPATCHED_EVENTS];\n }\n if (global2[SYMBOL_BLACK_LISTED_EVENTS]) {\n Zone4[SYMBOL_BLACK_LISTED_EVENTS] = Zone4[SYMBOL_UNPATCHED_EVENTS] = global2[SYMBOL_BLACK_LISTED_EVENTS];\n }\n api.patchEventPrototype = patchEventPrototype;\n api.patchEventTarget = patchEventTarget;\n api.ObjectDefineProperty = ObjectDefineProperty;\n api.ObjectGetOwnPropertyDescriptor = ObjectGetOwnPropertyDescriptor;\n api.ObjectCreate = ObjectCreate;\n api.ArraySlice = ArraySlice;\n api.patchClass = patchClass;\n api.wrapWithCurrentZone = wrapWithCurrentZone;\n api.filterProperties = filterProperties;\n api.attachOriginToPatched = attachOriginToPatched;\n api._redefineProperty = Object.defineProperty;\n api.patchCallbacks = patchCallbacks;\n api.getGlobalObjects = () => ({\n globalSources,\n zoneSymbolEventNames: zoneSymbolEventNames2,\n eventNames,\n isBrowser,\n isMix,\n isNode,\n TRUE_STR,\n FALSE_STR,\n ZONE_SYMBOL_PREFIX,\n ADD_EVENT_LISTENER_STR,\n REMOVE_EVENT_LISTENER_STR\n });\n });\n}\n\n// packages/zone.js/lib/browser/rollup-common.js\nfunction patchCommon(Zone3) {\n patchPromise(Zone3);\n patchToString(Zone3);\n patchUtil(Zone3);\n}\n\n// packages/zone.js/lib/browser/rollup-main.js\nvar Zone2 = loadZone();\npatchCommon(Zone2);\npatchBrowser(Zone2);\n","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { createContextKey } from '@opentelemetry/api';\nconst SUPPRESS_TRACING_KEY = createContextKey('OpenTelemetry SDK Context Key SUPPRESS_TRACING');\nexport function suppressTracing(context) {\n return context.setValue(SUPPRESS_TRACING_KEY, true);\n}\nexport function unsuppressTracing(context) {\n return context.deleteValue(SUPPRESS_TRACING_KEY);\n}\nexport function isTracingSuppressed(context) {\n return context.getValue(SUPPRESS_TRACING_KEY) === true;\n}\n//# sourceMappingURL=suppress-tracing.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport const BAGGAGE_KEY_PAIR_SEPARATOR = '=';\nexport const BAGGAGE_PROPERTIES_SEPARATOR = ';';\nexport const BAGGAGE_ITEMS_SEPARATOR = ',';\n// Name of the http header used to propagate the baggage\nexport const BAGGAGE_HEADER = 'baggage';\n// Maximum number of name-value pairs allowed by w3c spec\nexport const BAGGAGE_MAX_NAME_VALUE_PAIRS = 180;\n// Maximum number of bytes per a single name-value pair allowed by w3c spec\nexport const BAGGAGE_MAX_PER_NAME_VALUE_PAIRS = 4096;\n// Maximum total length of all name-value pairs allowed by w3c spec\nexport const BAGGAGE_MAX_TOTAL_LENGTH = 8192;\n//# sourceMappingURL=constants.js.map","import { baggageEntryMetadataFromString } from '@opentelemetry/api';\nimport { BAGGAGE_ITEMS_SEPARATOR, BAGGAGE_PROPERTIES_SEPARATOR, BAGGAGE_KEY_PAIR_SEPARATOR, BAGGAGE_MAX_TOTAL_LENGTH, } from './constants';\nexport function serializeKeyPairs(keyPairs) {\n return keyPairs.reduce((hValue, current) => {\n const value = `${hValue}${hValue !== '' ? BAGGAGE_ITEMS_SEPARATOR : ''}${current}`;\n return value.length > BAGGAGE_MAX_TOTAL_LENGTH ? hValue : value;\n }, '');\n}\nexport function getKeyPairs(baggage) {\n return baggage.getAllEntries().map(([key, value]) => {\n let entry = `${encodeURIComponent(key)}=${encodeURIComponent(value.value)}`;\n // include opaque metadata if provided\n // NOTE: we intentionally don't URI-encode the metadata - that responsibility falls on the metadata implementation\n if (value.metadata !== undefined) {\n entry += BAGGAGE_PROPERTIES_SEPARATOR + value.metadata.toString();\n }\n return entry;\n });\n}\nexport function parsePairKeyValue(entry) {\n if (!entry)\n return;\n const metadataSeparatorIndex = entry.indexOf(BAGGAGE_PROPERTIES_SEPARATOR);\n const keyPairPart = metadataSeparatorIndex === -1\n ? entry\n : entry.substring(0, metadataSeparatorIndex);\n const separatorIndex = keyPairPart.indexOf(BAGGAGE_KEY_PAIR_SEPARATOR);\n if (separatorIndex <= 0)\n return;\n const rawKey = keyPairPart.substring(0, separatorIndex).trim();\n const rawValue = keyPairPart.substring(separatorIndex + 1).trim();\n if (!rawKey || !rawValue)\n return;\n let key;\n let value;\n try {\n key = decodeURIComponent(rawKey);\n value = decodeURIComponent(rawValue);\n }\n catch {\n return;\n }\n let metadata;\n if (metadataSeparatorIndex !== -1 &&\n metadataSeparatorIndex < entry.length - 1) {\n const metadataString = entry.substring(metadataSeparatorIndex + 1);\n metadata = baggageEntryMetadataFromString(metadataString);\n }\n return { key, value, metadata };\n}\n/**\n * Parse a string serialized in the baggage HTTP Format (without metadata):\n * https://github.com/w3c/baggage/blob/master/baggage/HTTP_HEADER_FORMAT.md\n */\nexport function parseKeyPairsIntoRecord(value) {\n const result = {};\n if (typeof value === 'string' && value.length > 0) {\n value.split(BAGGAGE_ITEMS_SEPARATOR).forEach(entry => {\n const keyPair = parsePairKeyValue(entry);\n if (keyPair !== undefined && keyPair.value.length > 0) {\n result[keyPair.key] = keyPair.value;\n }\n });\n }\n return result;\n}\n//# sourceMappingURL=utils.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { propagation } from '@opentelemetry/api';\nimport { isTracingSuppressed } from '../../trace/suppress-tracing';\nimport { BAGGAGE_HEADER, BAGGAGE_ITEMS_SEPARATOR, BAGGAGE_MAX_NAME_VALUE_PAIRS, BAGGAGE_MAX_PER_NAME_VALUE_PAIRS, } from '../constants';\nimport { getKeyPairs, parsePairKeyValue, serializeKeyPairs } from '../utils';\n/**\n * Propagates {@link Baggage} through Context format propagation.\n *\n * Based on the Baggage specification:\n * https://w3c.github.io/baggage/\n */\nexport class W3CBaggagePropagator {\n inject(context, carrier, setter) {\n const baggage = propagation.getBaggage(context);\n if (!baggage || isTracingSuppressed(context))\n return;\n const keyPairs = getKeyPairs(baggage)\n .filter((pair) => {\n return pair.length <= BAGGAGE_MAX_PER_NAME_VALUE_PAIRS;\n })\n .slice(0, BAGGAGE_MAX_NAME_VALUE_PAIRS);\n const headerValue = serializeKeyPairs(keyPairs);\n if (headerValue.length > 0) {\n setter.set(carrier, BAGGAGE_HEADER, headerValue);\n }\n }\n extract(context, carrier, getter) {\n const headerValue = getter.get(carrier, BAGGAGE_HEADER);\n const baggageString = Array.isArray(headerValue)\n ? headerValue.join(BAGGAGE_ITEMS_SEPARATOR)\n : headerValue;\n if (!baggageString)\n return context;\n const baggage = {};\n if (baggageString.length === 0) {\n return context;\n }\n const pairs = baggageString.split(BAGGAGE_ITEMS_SEPARATOR);\n pairs.forEach(entry => {\n const keyPair = parsePairKeyValue(entry);\n if (keyPair) {\n const baggageEntry = { value: keyPair.value };\n if (keyPair.metadata) {\n baggageEntry.metadata = keyPair.metadata;\n }\n baggage[keyPair.key] = baggageEntry;\n }\n });\n if (Object.entries(baggage).length === 0) {\n return context;\n }\n return propagation.setBaggage(context, propagation.createBaggage(baggage));\n }\n fields() {\n return [BAGGAGE_HEADER];\n }\n}\n//# sourceMappingURL=W3CBaggagePropagator.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\nexport function sanitizeAttributes(attributes) {\n const out = {};\n if (typeof attributes !== 'object' || attributes == null) {\n return out;\n }\n for (const key in attributes) {\n if (!Object.prototype.hasOwnProperty.call(attributes, key)) {\n continue;\n }\n if (!isAttributeKey(key)) {\n diag.warn(`Invalid attribute key: ${key}`);\n continue;\n }\n const val = attributes[key];\n if (!isAttributeValue(val)) {\n diag.warn(`Invalid attribute value set for key: ${key}`);\n continue;\n }\n if (Array.isArray(val)) {\n out[key] = val.slice();\n }\n else {\n out[key] = val;\n }\n }\n return out;\n}\nexport function isAttributeKey(key) {\n return typeof key === 'string' && key !== '';\n}\nexport function isAttributeValue(val) {\n if (val == null) {\n return true;\n }\n if (Array.isArray(val)) {\n return isHomogeneousAttributeValueArray(val);\n }\n return isValidPrimitiveAttributeValueType(typeof val);\n}\nfunction isHomogeneousAttributeValueArray(arr) {\n let type;\n for (const element of arr) {\n // null/undefined elements are allowed\n if (element == null)\n continue;\n const elementType = typeof element;\n if (elementType === type) {\n continue;\n }\n if (!type) {\n if (isValidPrimitiveAttributeValueType(elementType)) {\n type = elementType;\n continue;\n }\n // encountered an invalid primitive\n return false;\n }\n return false;\n }\n return true;\n}\nfunction isValidPrimitiveAttributeValueType(valType) {\n switch (valType) {\n case 'number':\n case 'boolean':\n case 'string':\n return true;\n }\n return false;\n}\n//# sourceMappingURL=attributes.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\n/**\n * Returns a function that logs an error using the provided logger, or a\n * console logger if one was not provided.\n */\nexport function loggingErrorHandler() {\n return (ex) => {\n diag.error(stringifyException(ex));\n };\n}\n/**\n * Converts an exception into a string representation\n * @param {Exception} ex\n */\nfunction stringifyException(ex) {\n if (typeof ex === 'string') {\n return ex;\n }\n else {\n return JSON.stringify(flattenException(ex));\n }\n}\n/**\n * Flattens an exception into key-value pairs by traversing the prototype chain\n * and coercing values to strings. Duplicate properties will not be overwritten;\n * the first insert wins.\n */\nfunction flattenException(ex) {\n const result = {};\n let current = ex;\n while (current !== null) {\n Object.getOwnPropertyNames(current).forEach(propertyName => {\n if (result[propertyName])\n return;\n const value = current[propertyName];\n if (value) {\n result[propertyName] = String(value);\n }\n });\n current = Object.getPrototypeOf(current);\n }\n return result;\n}\n//# sourceMappingURL=logging-error-handler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { loggingErrorHandler } from './logging-error-handler';\n/** The global error handler delegate */\nlet delegateHandler = loggingErrorHandler();\n/**\n * Set the global error handler\n * @param {ErrorHandler} handler\n */\nexport function setGlobalErrorHandler(handler) {\n delegateHandler = handler;\n}\n/**\n * Return the global error handler\n * @param {Exception} ex\n */\nexport function globalErrorHandler(ex) {\n try {\n delegateHandler(ex);\n }\n catch { } // eslint-disable-line no-empty\n}\n//# sourceMappingURL=global-error-handler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport function getStringFromEnv(_) {\n return undefined;\n}\nexport function getBooleanFromEnv(_) {\n return undefined;\n}\nexport function getNumberFromEnv(_) {\n return undefined;\n}\nexport function getStringListFromEnv(_) {\n return undefined;\n}\n//# sourceMappingURL=environment.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '2.7.1';\n//# sourceMappingURL=version.js.map","/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//----------------------------------------------------------------------------------------------------------\n// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates/registry/stable/attributes.ts.j2\n//----------------------------------------------------------------------------------------------------------\n/**\n * ASP.NET Core exception middleware handling result.\n *\n * @example handled\n * @example unhandled\n */\nexport const ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT = 'aspnetcore.diagnostics.exception.result';\n/**\n * Enum value \"aborted\" for attribute {@link ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT}.\n *\n * Exception handling didn't run because the request was aborted.\n */\nexport const ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED = \"aborted\";\n/**\n * Enum value \"handled\" for attribute {@link ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT}.\n *\n * Exception was handled by the exception handling middleware.\n */\nexport const ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED = \"handled\";\n/**\n * Enum value \"skipped\" for attribute {@link ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT}.\n *\n * Exception handling was skipped because the response had started.\n */\nexport const ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED = \"skipped\";\n/**\n * Enum value \"unhandled\" for attribute {@link ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT}.\n *\n * Exception was not handled by the exception handling middleware.\n */\nexport const ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED = \"unhandled\";\n/**\n * Full type name of the [`IExceptionHandler`](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) implementation that handled the exception.\n *\n * @example Contoso.MyHandler\n */\nexport const ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE = 'aspnetcore.diagnostics.handler.type';\n/**\n * Rate limiting policy name.\n *\n * @example fixed\n * @example sliding\n * @example token\n */\nexport const ATTR_ASPNETCORE_RATE_LIMITING_POLICY = 'aspnetcore.rate_limiting.policy';\n/**\n * Rate-limiting result, shows whether the lease was acquired or contains a rejection reason\n *\n * @example acquired\n * @example request_canceled\n */\nexport const ATTR_ASPNETCORE_RATE_LIMITING_RESULT = 'aspnetcore.rate_limiting.result';\n/**\n * Enum value \"acquired\" for attribute {@link ATTR_ASPNETCORE_RATE_LIMITING_RESULT}.\n *\n * Lease was acquired\n */\nexport const ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED = \"acquired\";\n/**\n * Enum value \"endpoint_limiter\" for attribute {@link ATTR_ASPNETCORE_RATE_LIMITING_RESULT}.\n *\n * Lease request was rejected by the endpoint limiter\n */\nexport const ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER = \"endpoint_limiter\";\n/**\n * Enum value \"global_limiter\" for attribute {@link ATTR_ASPNETCORE_RATE_LIMITING_RESULT}.\n *\n * Lease request was rejected by the global limiter\n */\nexport const ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER = \"global_limiter\";\n/**\n * Enum value \"request_canceled\" for attribute {@link ATTR_ASPNETCORE_RATE_LIMITING_RESULT}.\n *\n * Lease request was canceled\n */\nexport const ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED = \"request_canceled\";\n/**\n * Flag indicating if request was handled by the application pipeline.\n *\n * @example true\n */\nexport const ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED = 'aspnetcore.request.is_unhandled';\n/**\n * A value that indicates whether the matched route is a fallback route.\n *\n * @example true\n */\nexport const ATTR_ASPNETCORE_ROUTING_IS_FALLBACK = 'aspnetcore.routing.is_fallback';\n/**\n * Match result - success or failure\n *\n * @example success\n * @example failure\n */\nexport const ATTR_ASPNETCORE_ROUTING_MATCH_STATUS = 'aspnetcore.routing.match_status';\n/**\n * Enum value \"failure\" for attribute {@link ATTR_ASPNETCORE_ROUTING_MATCH_STATUS}.\n *\n * Match failed\n */\nexport const ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE = \"failure\";\n/**\n * Enum value \"success\" for attribute {@link ATTR_ASPNETCORE_ROUTING_MATCH_STATUS}.\n *\n * Match succeeded\n */\nexport const ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS = \"success\";\n/**\n * A value that indicates whether the user is authenticated.\n *\n * @example true\n */\nexport const ATTR_ASPNETCORE_USER_IS_AUTHENTICATED = 'aspnetcore.user.is_authenticated';\n/**\n * Client address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.\n *\n * @example client.example.com\n * @example 10.1.2.80\n * @example /tmp/my.sock\n *\n * @note When observed from the server side, and when communicating through an intermediary, `client.address` **SHOULD** represent the client address behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_CLIENT_ADDRESS = 'client.address';\n/**\n * Client port number.\n *\n * @example 65123\n *\n * @note When observed from the server side, and when communicating through an intermediary, `client.port` **SHOULD** represent the client port behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_CLIENT_PORT = 'client.port';\n/**\n * The column number in `code.file.path` best representing the operation. It **SHOULD** point within the code unit named in `code.function.name`. This attribute **MUST NOT** be used on the Profile signal since the data is already captured in 'message Line'. This constraint is imposed to prevent redundancy and maintain data integrity.\n *\n * @example 16\n */\nexport const ATTR_CODE_COLUMN_NUMBER = 'code.column.number';\n/**\n * The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path). This attribute **MUST NOT** be used on the Profile signal since the data is already captured in 'message Function'. This constraint is imposed to prevent redundancy and maintain data integrity.\n *\n * @example \"/usr/local/MyApplication/content_root/app/index.php\"\n */\nexport const ATTR_CODE_FILE_PATH = 'code.file.path';\n/**\n * The method or function fully-qualified name without arguments. The value should fit the natural representation of the language runtime, which is also likely the same used within `code.stacktrace` attribute value. This attribute **MUST NOT** be used on the Profile signal since the data is already captured in 'message Function'. This constraint is imposed to prevent redundancy and maintain data integrity.\n *\n * @example com.example.MyHttpService.serveRequest\n * @example GuzzleHttp\\\\Client::transfer\n * @example fopen\n *\n * @note Values and format depends on each language runtime, thus it is impossible to provide an exhaustive list of examples.\n * The values are usually the same (or prefixes of) the ones found in native stack trace representation stored in\n * `code.stacktrace` without information on arguments.\n *\n * Examples:\n *\n * - Java method: `com.example.MyHttpService.serveRequest`\n * - Java anonymous class method: `com.mycompany.Main$1.myMethod`\n * - Java lambda method: `com.mycompany.Main$$Lambda/0x0000748ae4149c00.myMethod`\n * - PHP function: `GuzzleHttp\\Client::transfer`\n * - Go function: `github.com/my/repo/pkg.foo.func5`\n * - Elixir: `OpenTelemetry.Ctx.new`\n * - Erlang: `opentelemetry_ctx:new`\n * - Rust: `playground::my_module::my_cool_func`\n * - C function: `fopen`\n */\nexport const ATTR_CODE_FUNCTION_NAME = 'code.function.name';\n/**\n * The line number in `code.file.path` best representing the operation. It **SHOULD** point within the code unit named in `code.function.name`. This attribute **MUST NOT** be used on the Profile signal since the data is already captured in 'message Line'. This constraint is imposed to prevent redundancy and maintain data integrity.\n *\n * @example 42\n */\nexport const ATTR_CODE_LINE_NUMBER = 'code.line.number';\n/**\n * A stacktrace as a string in the natural representation for the language runtime. The representation is identical to [`exception.stacktrace`](/docs/exceptions/exceptions-spans.md#stacktrace-representation). This attribute **MUST NOT** be used on the Profile signal since the data is already captured in 'message Location'. This constraint is imposed to prevent redundancy and maintain data integrity.\n *\n * @example \"at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\\\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\\\n at com.example.GenerateTrace.main(GenerateTrace.java:5)\\\\n\"\n */\nexport const ATTR_CODE_STACKTRACE = 'code.stacktrace';\n/**\n * The name of a collection (table, container) within the database.\n *\n * @example public.users\n * @example customers\n *\n * @note It is **RECOMMENDED** to capture the value as provided by the application\n * without attempting to do any case normalization.\n *\n * The collection name **SHOULD NOT** be extracted from `db.query.text`,\n * when the database system supports query text with multiple collections\n * in non-batch operations.\n *\n * For batch operations, if the individual operations are known to have the same\n * collection name then that collection name **SHOULD** be used.\n */\nexport const ATTR_DB_COLLECTION_NAME = 'db.collection.name';\n/**\n * The name of the database, fully qualified within the server address and port.\n *\n * @example customers\n * @example test.users\n *\n * @note If a database system has multiple namespace components, they **SHOULD** be concatenated from the most general to the most specific namespace component, using `|` as a separator between the components. Any missing components (and their associated separators) **SHOULD** be omitted.\n * Semantic conventions for individual database systems **SHOULD** document what `db.namespace` means in the context of that system.\n * It is **RECOMMENDED** to capture the value as provided by the application without attempting to do any case normalization.\n */\nexport const ATTR_DB_NAMESPACE = 'db.namespace';\n/**\n * The number of queries included in a batch operation.\n *\n * @example 2\n * @example 3\n * @example 4\n *\n * @note Operations are only considered batches when they contain two or more operations, and so `db.operation.batch.size` **SHOULD** never be `1`.\n */\nexport const ATTR_DB_OPERATION_BATCH_SIZE = 'db.operation.batch.size';\n/**\n * The name of the operation or command being executed.\n *\n * @example findAndModify\n * @example HMSET\n * @example SELECT\n *\n * @note It is **RECOMMENDED** to capture the value as provided by the application\n * without attempting to do any case normalization.\n *\n * The operation name **SHOULD NOT** be extracted from `db.query.text`,\n * when the database system supports query text with multiple operations\n * in non-batch operations.\n *\n * If spaces can occur in the operation name, multiple consecutive spaces\n * **SHOULD** be normalized to a single space.\n *\n * For batch operations, if the individual operations are known to have the same operation name\n * then that operation name **SHOULD** be used prepended by `BATCH `,\n * otherwise `db.operation.name` **SHOULD** be `BATCH` or some other database\n * system specific term if more applicable.\n */\nexport const ATTR_DB_OPERATION_NAME = 'db.operation.name';\n/**\n * Low cardinality summary of a database query.\n *\n * @example SELECT wuser_table\n * @example INSERT shipping_details SELECT orders\n * @example get user by id\n *\n * @note The query summary describes a class of database queries and is useful\n * as a grouping key, especially when analyzing telemetry for database\n * calls involving complex queries.\n *\n * Summary may be available to the instrumentation through\n * instrumentation hooks or other means. If it is not available, instrumentations\n * that support query parsing **SHOULD** generate a summary following\n * [Generating query summary](/docs/db/database-spans.md#generating-a-summary-of-the-query)\n * section.\n *\n * For batch operations, if the individual operations are known to have the same query summary\n * then that query summary **SHOULD** be used prepended by `BATCH `,\n * otherwise `db.query.summary` **SHOULD** be `BATCH` or some other database\n * system specific term if more applicable.\n */\nexport const ATTR_DB_QUERY_SUMMARY = 'db.query.summary';\n/**\n * The database query being executed.\n *\n * @example SELECT * FROM wuser_table where username = ?\n * @example SET mykey ?\n *\n * @note For sanitization see [Sanitization of `db.query.text`](/docs/db/database-spans.md#sanitization-of-dbquerytext).\n * For batch operations, if the individual operations are known to have the same query text then that query text **SHOULD** be used, otherwise all of the individual query texts **SHOULD** be concatenated with separator `; ` or some other database system specific separator if more applicable.\n * Parameterized query text **SHOULD NOT** be sanitized. Even though parameterized query text can potentially have sensitive data, by using a parameterized query the user is giving a strong signal that any sensitive data will be passed as parameter values, and the benefit to observability of capturing the static part of the query text by default outweighs the risk.\n */\nexport const ATTR_DB_QUERY_TEXT = 'db.query.text';\n/**\n * Database response status code.\n *\n * @example 102\n * @example ORA-17002\n * @example 08P01\n * @example 404\n *\n * @note The status code returned by the database. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes.\n * Semantic conventions for individual database systems **SHOULD** document what `db.response.status_code` means in the context of that system.\n */\nexport const ATTR_DB_RESPONSE_STATUS_CODE = 'db.response.status_code';\n/**\n * The name of a stored procedure within the database.\n *\n * @example GetCustomer\n *\n * @note It is **RECOMMENDED** to capture the value as provided by the application\n * without attempting to do any case normalization.\n *\n * For batch operations, if the individual operations are known to have the same\n * stored procedure name then that stored procedure name **SHOULD** be used.\n */\nexport const ATTR_DB_STORED_PROCEDURE_NAME = 'db.stored_procedure.name';\n/**\n * The database management system (DBMS) product as identified by the client instrumentation.\n *\n * @note The actual DBMS may differ from the one identified by the client. For example, when using PostgreSQL client libraries to connect to a CockroachDB, the `db.system.name` is set to `postgresql` based on the instrumentation's best knowledge.\n */\nexport const ATTR_DB_SYSTEM_NAME = 'db.system.name';\n/**\n * Enum value \"mariadb\" for attribute {@link ATTR_DB_SYSTEM_NAME}.\n *\n * [MariaDB](https://mariadb.org/)\n */\nexport const DB_SYSTEM_NAME_VALUE_MARIADB = \"mariadb\";\n/**\n * Enum value \"microsoft.sql_server\" for attribute {@link ATTR_DB_SYSTEM_NAME}.\n *\n * [Microsoft SQL Server](https://www.microsoft.com/sql-server)\n */\nexport const DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER = \"microsoft.sql_server\";\n/**\n * Enum value \"mysql\" for attribute {@link ATTR_DB_SYSTEM_NAME}.\n *\n * [MySQL](https://www.mysql.com/)\n */\nexport const DB_SYSTEM_NAME_VALUE_MYSQL = \"mysql\";\n/**\n * Enum value \"postgresql\" for attribute {@link ATTR_DB_SYSTEM_NAME}.\n *\n * [PostgreSQL](https://www.postgresql.org/)\n */\nexport const DB_SYSTEM_NAME_VALUE_POSTGRESQL = \"postgresql\";\n/**\n * Name of the garbage collector managed heap generation.\n *\n * @example gen0\n * @example gen1\n * @example gen2\n */\nexport const ATTR_DOTNET_GC_HEAP_GENERATION = 'dotnet.gc.heap.generation';\n/**\n * Enum value \"gen0\" for attribute {@link ATTR_DOTNET_GC_HEAP_GENERATION}.\n *\n * Generation 0\n */\nexport const DOTNET_GC_HEAP_GENERATION_VALUE_GEN0 = \"gen0\";\n/**\n * Enum value \"gen1\" for attribute {@link ATTR_DOTNET_GC_HEAP_GENERATION}.\n *\n * Generation 1\n */\nexport const DOTNET_GC_HEAP_GENERATION_VALUE_GEN1 = \"gen1\";\n/**\n * Enum value \"gen2\" for attribute {@link ATTR_DOTNET_GC_HEAP_GENERATION}.\n *\n * Generation 2\n */\nexport const DOTNET_GC_HEAP_GENERATION_VALUE_GEN2 = \"gen2\";\n/**\n * Enum value \"loh\" for attribute {@link ATTR_DOTNET_GC_HEAP_GENERATION}.\n *\n * Large Object Heap\n */\nexport const DOTNET_GC_HEAP_GENERATION_VALUE_LOH = \"loh\";\n/**\n * Enum value \"poh\" for attribute {@link ATTR_DOTNET_GC_HEAP_GENERATION}.\n *\n * Pinned Object Heap\n */\nexport const DOTNET_GC_HEAP_GENERATION_VALUE_POH = \"poh\";\n/**\n * Describes a class of error the operation ended with.\n *\n * @example timeout\n * @example java.net.UnknownHostException\n * @example server_certificate_invalid\n * @example 500\n *\n * @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality.\n *\n * When `error.type` is set to a type (e.g., an exception type), its\n * canonical class name identifying the type within the artifact **SHOULD** be used.\n *\n * Instrumentations **SHOULD** document the list of errors they report.\n *\n * The cardinality of `error.type` within one instrumentation library **SHOULD** be low.\n * Telemetry consumers that aggregate data from multiple instrumentation libraries and applications\n * should be prepared for `error.type` to have high cardinality at query time when no\n * additional filters are applied.\n *\n * If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`.\n *\n * If a specific domain defines its own set of error identifiers (such as HTTP or RPC status codes),\n * it's **RECOMMENDED** to:\n *\n * - Use a domain-specific attribute\n * - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.\n */\nexport const ATTR_ERROR_TYPE = 'error.type';\n/**\n * Enum value \"_OTHER\" for attribute {@link ATTR_ERROR_TYPE}.\n *\n * A fallback error value to be used when the instrumentation doesn't define a custom value.\n */\nexport const ERROR_TYPE_VALUE_OTHER = \"_OTHER\";\n/**\n * Indicates that the exception is escaping the scope of the span.\n *\n * @deprecated It's no longer recommended to record exceptions that are handled and do not escape the scope of a span.\n */\nexport const ATTR_EXCEPTION_ESCAPED = 'exception.escaped';\n/**\n * The exception message.\n *\n * @example Division by zero\n * @example Can't convert 'int' object to str implicitly\n *\n * @note > [!WARNING]\n *\n * > This attribute may contain sensitive information.\n */\nexport const ATTR_EXCEPTION_MESSAGE = 'exception.message';\n/**\n * A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG.\n *\n * @example \"Exception in thread \"main\" java.lang.RuntimeException: Test exception\\\\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\\\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\\\n at com.example.GenerateTrace.main(GenerateTrace.java:5)\\\\n\"\n */\nexport const ATTR_EXCEPTION_STACKTRACE = 'exception.stacktrace';\n/**\n * The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it.\n *\n * @example java.net.ConnectException\n * @example OSError\n */\nexport const ATTR_EXCEPTION_TYPE = 'exception.type';\n/**\n * HTTP request headers, `<key>` being the normalized HTTP Header name (lowercase), the value being the header values.\n *\n * @example [\"application/json\"]\n * @example [\"1.2.3.4\", \"1.2.3.5\"]\n *\n * @note Instrumentations **SHOULD** require an explicit configuration of which headers are to be captured.\n * Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\n *\n * The `User-Agent` header is already captured in the `user_agent.original` attribute.\n * Users **MAY** explicitly configure instrumentations to capture them even though it is not recommended.\n *\n * The attribute value **MUST** consist of either multiple header values as an array of strings\n * or a single-item array containing a possibly comma-concatenated string, depending on the way\n * the HTTP library provides access to headers.\n *\n * Examples:\n *\n * - A header `Content-Type: application/json` **SHOULD** be recorded as the `http.request.header.content-type`\n * attribute with value `[\"application/json\"]`.\n * - A header `X-Forwarded-For: 1.2.3.4, 1.2.3.5` **SHOULD** be recorded as the `http.request.header.x-forwarded-for`\n * attribute with value `[\"1.2.3.4\", \"1.2.3.5\"]` or `[\"1.2.3.4, 1.2.3.5\"]` depending on the HTTP library.\n */\nexport const ATTR_HTTP_REQUEST_HEADER = (key) => `http.request.header.${key}`;\n/**\n * HTTP request method.\n *\n * @example GET\n * @example POST\n * @example HEAD\n *\n * @note HTTP request method value **SHOULD** be \"known\" to the instrumentation.\n * By default, this convention defines \"known\" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods),\n * the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html)\n * and the QUERY method defined in [httpbis-safe-method-w-body](https://datatracker.ietf.org/doc/draft-ietf-httpbis-safe-method-w-body/?include_text=1).\n *\n * If the HTTP request method is not known to instrumentation, it **MUST** set the `http.request.method` attribute to `_OTHER`.\n *\n * If the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it **MUST** provide a way to override\n * the list of known HTTP methods. If this override is done via environment variable, then the environment variable **MUST** be named\n * OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods.\n *\n *\n * If this override is done via declarative configuration, then the list **MUST** be configurable via the `known_methods` property\n * (an array of case-sensitive strings with minimum items 0) under `.instrumentation/development.general.http.client` and/or\n * `.instrumentation/development.general.http.server`.\n *\n * In either case, this list **MUST** be a full override of the default known methods,\n * it is not a list of known methods in addition to the defaults.\n *\n * HTTP method names are case-sensitive and `http.request.method` attribute value **MUST** match a known HTTP method name exactly.\n * Instrumentations for specific web frameworks that consider HTTP methods to be case insensitive, **SHOULD** populate a canonical equivalent.\n * Tracing instrumentations that do so, **MUST** also set `http.request.method_original` to the original value.\n */\nexport const ATTR_HTTP_REQUEST_METHOD = 'http.request.method';\n/**\n * Enum value \"_OTHER\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * Any HTTP method that the instrumentation has no prior knowledge of.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_OTHER = \"_OTHER\";\n/**\n * Enum value \"CONNECT\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * CONNECT method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_CONNECT = \"CONNECT\";\n/**\n * Enum value \"DELETE\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * DELETE method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_DELETE = \"DELETE\";\n/**\n * Enum value \"GET\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * GET method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_GET = \"GET\";\n/**\n * Enum value \"HEAD\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * HEAD method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_HEAD = \"HEAD\";\n/**\n * Enum value \"OPTIONS\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * OPTIONS method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_OPTIONS = \"OPTIONS\";\n/**\n * Enum value \"PATCH\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * PATCH method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_PATCH = \"PATCH\";\n/**\n * Enum value \"POST\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * POST method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_POST = \"POST\";\n/**\n * Enum value \"PUT\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * PUT method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_PUT = \"PUT\";\n/**\n * Enum value \"TRACE\" for attribute {@link ATTR_HTTP_REQUEST_METHOD}.\n *\n * TRACE method.\n */\nexport const HTTP_REQUEST_METHOD_VALUE_TRACE = \"TRACE\";\n/**\n * Original HTTP method sent by the client in the request line.\n *\n * @example GeT\n * @example ACL\n * @example foo\n */\nexport const ATTR_HTTP_REQUEST_METHOD_ORIGINAL = 'http.request.method_original';\n/**\n * The ordinal number of request resending attempt (for any reason, including redirects).\n *\n * @example 3\n *\n * @note The resend count **SHOULD** be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other).\n */\nexport const ATTR_HTTP_REQUEST_RESEND_COUNT = 'http.request.resend_count';\n/**\n * HTTP response headers, `<key>` being the normalized HTTP Header name (lowercase), the value being the header values.\n *\n * @example [\"application/json\"]\n * @example [\"abc\", \"def\"]\n *\n * @note Instrumentations **SHOULD** require an explicit configuration of which headers are to be captured.\n * Including all response headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\n *\n * Users **MAY** explicitly configure instrumentations to capture them even though it is not recommended.\n *\n * The attribute value **MUST** consist of either multiple header values as an array of strings\n * or a single-item array containing a possibly comma-concatenated string, depending on the way\n * the HTTP library provides access to headers.\n *\n * Examples:\n *\n * - A header `Content-Type: application/json` header **SHOULD** be recorded as the `http.request.response.content-type`\n * attribute with value `[\"application/json\"]`.\n * - A header `My-custom-header: abc, def` header **SHOULD** be recorded as the `http.response.header.my-custom-header`\n * attribute with value `[\"abc\", \"def\"]` or `[\"abc, def\"]` depending on the HTTP library.\n */\nexport const ATTR_HTTP_RESPONSE_HEADER = (key) => `http.response.header.${key}`;\n/**\n * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).\n *\n * @example 200\n */\nexport const ATTR_HTTP_RESPONSE_STATUS_CODE = 'http.response.status_code';\n/**\n * The matched route template for the request. This **MUST** be low-cardinality and include all static path segments, with dynamic path segments represented with placeholders.\n *\n * @example /users/:userID?\n * @example my-controller/my-action/{id?}\n *\n * @note **MUST NOT** be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it.\n * **SHOULD** include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one.\n *\n * A static path segment is a part of the route template with a fixed, low-cardinality value. This includes literal strings like `/users/` and placeholders that\n * are constrained to a finite, predefined set of values, e.g. `{controller}` or `{action}`.\n *\n * A dynamic path segment is a placeholder for a value that can have high cardinality and is not constrained to a predefined list like static path segments.\n *\n * Instrumentations **SHOULD** use routing information provided by the corresponding web framework. They **SHOULD** pick the most precise source of routing information and **MAY**\n * support custom route formatting. Instrumentations **SHOULD** document the format and the API used to obtain the route string.\n */\nexport const ATTR_HTTP_ROUTE = 'http.route';\n/**\n * Name of the garbage collector action.\n *\n * @example end of minor GC\n * @example end of major GC\n *\n * @note Garbage collector action is generally obtained via [GarbageCollectionNotificationInfo#getGcAction()](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/GarbageCollectionNotificationInfo.html#getGcAction()).\n */\nexport const ATTR_JVM_GC_ACTION = 'jvm.gc.action';\n/**\n * Name of the garbage collector.\n *\n * @example G1 Young Generation\n * @example G1 Old Generation\n *\n * @note Garbage collector name is generally obtained via [GarbageCollectionNotificationInfo#getGcName()](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/GarbageCollectionNotificationInfo.html#getGcName()).\n */\nexport const ATTR_JVM_GC_NAME = 'jvm.gc.name';\n/**\n * Name of the memory pool.\n *\n * @example G1 Old Gen\n * @example G1 Eden space\n * @example G1 Survivor Space\n *\n * @note Pool names are generally obtained via [MemoryPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html#getName()).\n */\nexport const ATTR_JVM_MEMORY_POOL_NAME = 'jvm.memory.pool.name';\n/**\n * The type of memory.\n *\n * @example heap\n * @example non_heap\n */\nexport const ATTR_JVM_MEMORY_TYPE = 'jvm.memory.type';\n/**\n * Enum value \"heap\" for attribute {@link ATTR_JVM_MEMORY_TYPE}.\n *\n * Heap memory.\n */\nexport const JVM_MEMORY_TYPE_VALUE_HEAP = \"heap\";\n/**\n * Enum value \"non_heap\" for attribute {@link ATTR_JVM_MEMORY_TYPE}.\n *\n * Non-heap memory\n */\nexport const JVM_MEMORY_TYPE_VALUE_NON_HEAP = \"non_heap\";\n/**\n * Whether the thread is daemon or not.\n */\nexport const ATTR_JVM_THREAD_DAEMON = 'jvm.thread.daemon';\n/**\n * State of the thread.\n *\n * @example runnable\n * @example blocked\n */\nexport const ATTR_JVM_THREAD_STATE = 'jvm.thread.state';\n/**\n * Enum value \"blocked\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread that is blocked waiting for a monitor lock is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_BLOCKED = \"blocked\";\n/**\n * Enum value \"new\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread that has not yet started is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_NEW = \"new\";\n/**\n * Enum value \"runnable\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread executing in the Java virtual machine is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_RUNNABLE = \"runnable\";\n/**\n * Enum value \"terminated\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread that has exited is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_TERMINATED = \"terminated\";\n/**\n * Enum value \"timed_waiting\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_TIMED_WAITING = \"timed_waiting\";\n/**\n * Enum value \"waiting\" for attribute {@link ATTR_JVM_THREAD_STATE}.\n *\n * A thread that is waiting indefinitely for another thread to perform a particular action is in this state.\n */\nexport const JVM_THREAD_STATE_VALUE_WAITING = \"waiting\";\n/**\n * Local address of the network connection - IP address or Unix domain socket name.\n *\n * @example 10.1.2.80\n * @example /tmp/my.sock\n */\nexport const ATTR_NETWORK_LOCAL_ADDRESS = 'network.local.address';\n/**\n * Local port number of the network connection.\n *\n * @example 65123\n */\nexport const ATTR_NETWORK_LOCAL_PORT = 'network.local.port';\n/**\n * Peer address of the network connection - IP address or Unix domain socket name.\n *\n * @example 10.1.2.80\n * @example /tmp/my.sock\n */\nexport const ATTR_NETWORK_PEER_ADDRESS = 'network.peer.address';\n/**\n * Peer port number of the network connection.\n *\n * @example 65123\n */\nexport const ATTR_NETWORK_PEER_PORT = 'network.peer.port';\n/**\n * [OSI application layer](https://wikipedia.org/wiki/Application_layer) or non-OSI equivalent.\n *\n * @example amqp\n * @example http\n * @example mqtt\n *\n * @note The value **SHOULD** be normalized to lowercase.\n */\nexport const ATTR_NETWORK_PROTOCOL_NAME = 'network.protocol.name';\n/**\n * The actual version of the protocol used for network communication.\n *\n * @example 1.1\n * @example 2\n *\n * @note If protocol version is subject to negotiation (for example using [ALPN](https://www.rfc-editor.org/rfc/rfc7301.html)), this attribute **SHOULD** be set to the negotiated version. If the actual protocol version is not known, this attribute **SHOULD NOT** be set.\n */\nexport const ATTR_NETWORK_PROTOCOL_VERSION = 'network.protocol.version';\n/**\n * [OSI transport layer](https://wikipedia.org/wiki/Transport_layer) or [inter-process communication method](https://wikipedia.org/wiki/Inter-process_communication).\n *\n * @example tcp\n * @example udp\n *\n * @note The value **SHOULD** be normalized to lowercase.\n *\n * Consider always setting the transport when setting a port number, since\n * a port number is ambiguous without knowing the transport. For example\n * different processes could be listening on TCP port 12345 and UDP port 12345.\n */\nexport const ATTR_NETWORK_TRANSPORT = 'network.transport';\n/**\n * Enum value \"pipe\" for attribute {@link ATTR_NETWORK_TRANSPORT}.\n *\n * Named or anonymous pipe.\n */\nexport const NETWORK_TRANSPORT_VALUE_PIPE = \"pipe\";\n/**\n * Enum value \"quic\" for attribute {@link ATTR_NETWORK_TRANSPORT}.\n *\n * QUIC\n */\nexport const NETWORK_TRANSPORT_VALUE_QUIC = \"quic\";\n/**\n * Enum value \"tcp\" for attribute {@link ATTR_NETWORK_TRANSPORT}.\n *\n * TCP\n */\nexport const NETWORK_TRANSPORT_VALUE_TCP = \"tcp\";\n/**\n * Enum value \"udp\" for attribute {@link ATTR_NETWORK_TRANSPORT}.\n *\n * UDP\n */\nexport const NETWORK_TRANSPORT_VALUE_UDP = \"udp\";\n/**\n * Enum value \"unix\" for attribute {@link ATTR_NETWORK_TRANSPORT}.\n *\n * Unix domain socket\n */\nexport const NETWORK_TRANSPORT_VALUE_UNIX = \"unix\";\n/**\n * [OSI network layer](https://wikipedia.org/wiki/Network_layer) or non-OSI equivalent.\n *\n * @example ipv4\n * @example ipv6\n *\n * @note The value **SHOULD** be normalized to lowercase.\n */\nexport const ATTR_NETWORK_TYPE = 'network.type';\n/**\n * Enum value \"ipv4\" for attribute {@link ATTR_NETWORK_TYPE}.\n *\n * IPv4\n */\nexport const NETWORK_TYPE_VALUE_IPV4 = \"ipv4\";\n/**\n * Enum value \"ipv6\" for attribute {@link ATTR_NETWORK_TYPE}.\n *\n * IPv6\n */\nexport const NETWORK_TYPE_VALUE_IPV6 = \"ipv6\";\n/**\n * The name of the instrumentation scope - (`InstrumentationScope.Name` in OTLP).\n *\n * @example io.opentelemetry.contrib.mongodb\n */\nexport const ATTR_OTEL_SCOPE_NAME = 'otel.scope.name';\n/**\n * The version of the instrumentation scope - (`InstrumentationScope.Version` in OTLP).\n *\n * @example 1.0.0\n */\nexport const ATTR_OTEL_SCOPE_VERSION = 'otel.scope.version';\n/**\n * Name of the code, either \"OK\" or \"ERROR\". **MUST NOT** be set if the status code is UNSET.\n */\nexport const ATTR_OTEL_STATUS_CODE = 'otel.status_code';\n/**\n * Enum value \"ERROR\" for attribute {@link ATTR_OTEL_STATUS_CODE}.\n *\n * The operation contains an error.\n */\nexport const OTEL_STATUS_CODE_VALUE_ERROR = \"ERROR\";\n/**\n * Enum value \"OK\" for attribute {@link ATTR_OTEL_STATUS_CODE}.\n *\n * The operation has been validated by an Application developer or Operator to have completed successfully.\n */\nexport const OTEL_STATUS_CODE_VALUE_OK = \"OK\";\n/**\n * Description of the Status if it has a value, otherwise not set.\n *\n * @example resource not found\n */\nexport const ATTR_OTEL_STATUS_DESCRIPTION = 'otel.status_description';\n/**\n * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.\n *\n * @example example.com\n * @example 10.1.2.80\n * @example /tmp/my.sock\n *\n * @note When observed from the client side, and when communicating through an intermediary, `server.address` **SHOULD** represent the server address behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_SERVER_ADDRESS = 'server.address';\n/**\n * Server port number.\n *\n * @example 80\n * @example 8080\n * @example 443\n *\n * @note When observed from the client side, and when communicating through an intermediary, `server.port` **SHOULD** represent the server port behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_SERVER_PORT = 'server.port';\n/**\n * The string ID of the service instance.\n *\n * @example 627cc493-f310-47de-96bd-71410b7dec09\n *\n * @note **MUST** be unique for each instance of the same `service.namespace,service.name` pair (in other words\n * `service.namespace,service.name,service.instance.id` triplet **MUST** be globally unique). The ID helps to\n * distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled\n * service).\n *\n * Implementations, such as SDKs, are recommended to generate a random Version 1 or Version 4 [RFC\n * 4122](https://www.ietf.org/rfc/rfc4122.txt) UUID, but are free to use an inherent unique ID as the source of\n * this value if stability is desirable. In that case, the ID **SHOULD** be used as source of a UUID Version 5 and\n * **SHOULD** use the following UUID as the namespace: `4d63009a-8d0f-11ee-aad7-4c796ed8e320`.\n *\n * UUIDs are typically recommended, as only an opaque value for the purposes of identifying a service instance is\n * needed. Similar to what can be seen in the man page for the\n * [`/etc/machine-id`](https://www.freedesktop.org/software/systemd/man/latest/machine-id.html) file, the underlying\n * data, such as pod name and namespace should be treated as confidential, being the user's choice to expose it\n * or not via another resource attribute.\n *\n * For applications running behind an application server (like unicorn), we do not recommend using one identifier\n * for all processes participating in the application. Instead, it's recommended each division (e.g. a worker\n * thread in unicorn) to have its own instance.id.\n *\n * It's not recommended for a Collector to set `service.instance.id` if it can't unambiguously determine the\n * service instance that is generating that telemetry. For instance, creating an UUID based on `pod.name` will\n * likely be wrong, as the Collector might not know from which container within that pod the telemetry originated.\n * However, Collectors can set the `service.instance.id` if they can unambiguously determine the service instance\n * for that telemetry. This is typically the case for scraping receivers, as they know the target address and\n * port.\n */\nexport const ATTR_SERVICE_INSTANCE_ID = 'service.instance.id';\n/**\n * Logical name of the service.\n *\n * @example shoppingcart\n *\n * @note **MUST** be the same for all instances of horizontally scaled services. If the value was not specified, SDKs **MUST** fallback to `unknown_service:` concatenated with [`process.executable.name`](process.md), e.g. `unknown_service:bash`. If `process.executable.name` is not available, the value **MUST** be set to `unknown_service`.\n */\nexport const ATTR_SERVICE_NAME = 'service.name';\n/**\n * A namespace for `service.name`.\n *\n * @example Shop\n *\n * @note A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. `service.name` is expected to be unique within the same namespace. If `service.namespace` is not specified in the Resource then `service.name` is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace.\n */\nexport const ATTR_SERVICE_NAMESPACE = 'service.namespace';\n/**\n * The version string of the service component. The format is not defined by these conventions.\n *\n * @example 2.0.0\n * @example a01dbef8a\n */\nexport const ATTR_SERVICE_VERSION = 'service.version';\n/**\n * SignalR HTTP connection closure status.\n *\n * @example app_shutdown\n * @example timeout\n */\nexport const ATTR_SIGNALR_CONNECTION_STATUS = 'signalr.connection.status';\n/**\n * Enum value \"app_shutdown\" for attribute {@link ATTR_SIGNALR_CONNECTION_STATUS}.\n *\n * The connection was closed because the app is shutting down.\n */\nexport const SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN = \"app_shutdown\";\n/**\n * Enum value \"normal_closure\" for attribute {@link ATTR_SIGNALR_CONNECTION_STATUS}.\n *\n * The connection was closed normally.\n */\nexport const SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE = \"normal_closure\";\n/**\n * Enum value \"timeout\" for attribute {@link ATTR_SIGNALR_CONNECTION_STATUS}.\n *\n * The connection was closed due to a timeout.\n */\nexport const SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT = \"timeout\";\n/**\n * [SignalR transport type](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md)\n *\n * @example web_sockets\n * @example long_polling\n */\nexport const ATTR_SIGNALR_TRANSPORT = 'signalr.transport';\n/**\n * Enum value \"long_polling\" for attribute {@link ATTR_SIGNALR_TRANSPORT}.\n *\n * LongPolling protocol\n */\nexport const SIGNALR_TRANSPORT_VALUE_LONG_POLLING = \"long_polling\";\n/**\n * Enum value \"server_sent_events\" for attribute {@link ATTR_SIGNALR_TRANSPORT}.\n *\n * ServerSentEvents protocol\n */\nexport const SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS = \"server_sent_events\";\n/**\n * Enum value \"web_sockets\" for attribute {@link ATTR_SIGNALR_TRANSPORT}.\n *\n * WebSockets protocol\n */\nexport const SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS = \"web_sockets\";\n/**\n * The language of the telemetry SDK.\n */\nexport const ATTR_TELEMETRY_SDK_LANGUAGE = 'telemetry.sdk.language';\n/**\n * Enum value \"cpp\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_CPP = \"cpp\";\n/**\n * Enum value \"dotnet\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET = \"dotnet\";\n/**\n * Enum value \"erlang\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG = \"erlang\";\n/**\n * Enum value \"go\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_GO = \"go\";\n/**\n * Enum value \"java\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_JAVA = \"java\";\n/**\n * Enum value \"nodejs\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS = \"nodejs\";\n/**\n * Enum value \"php\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_PHP = \"php\";\n/**\n * Enum value \"python\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON = \"python\";\n/**\n * Enum value \"ruby\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_RUBY = \"ruby\";\n/**\n * Enum value \"rust\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_RUST = \"rust\";\n/**\n * Enum value \"swift\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT = \"swift\";\n/**\n * Enum value \"webjs\" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.\n */\nexport const TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS = \"webjs\";\n/**\n * The name of the telemetry SDK as defined above.\n *\n * @example opentelemetry\n *\n * @note The OpenTelemetry SDK **MUST** set the `telemetry.sdk.name` attribute to `opentelemetry`.\n * If another SDK, like a fork or a vendor-provided implementation, is used, this SDK **MUST** set the\n * `telemetry.sdk.name` attribute to the fully-qualified class or module name of this SDK's main entry point\n * or another suitable identifier depending on the language.\n * The identifier `opentelemetry` is reserved and **MUST NOT** be used in this case.\n * All custom identifiers **SHOULD** be stable across different versions of an implementation.\n */\nexport const ATTR_TELEMETRY_SDK_NAME = 'telemetry.sdk.name';\n/**\n * The version string of the telemetry SDK.\n *\n * @example 1.2.3\n */\nexport const ATTR_TELEMETRY_SDK_VERSION = 'telemetry.sdk.version';\n/**\n * The [URI fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component\n *\n * @example SemConv\n */\nexport const ATTR_URL_FRAGMENT = 'url.fragment';\n/**\n * Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986)\n *\n * @example https://www.foo.bar/search?q=OpenTelemetry#SemConv\n * @example //localhost\n *\n * @note For network calls, URL usually has `scheme://host[:port][path][?query][#fragment]` format, where the fragment\n * is not transmitted over HTTP, but if it is known, it **SHOULD** be included nevertheless.\n *\n * `url.full` **MUST NOT** contain credentials passed via URL in form of `https://username:password@www.example.com/`.\n * In such case username and password **SHOULD** be redacted and attribute's value **SHOULD** be `https://REDACTED:REDACTED@www.example.com/`.\n *\n * `url.full` **SHOULD** capture the absolute URL when it is available (or can be reconstructed).\n *\n * Sensitive content provided in `url.full` **SHOULD** be scrubbed when instrumentations can identify it.\n *\n *\n * Query string values for the following keys **SHOULD** be redacted by default and replaced by the\n * value `REDACTED`:\n *\n * - [`AWSAccessKeyId`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)\n * - [`Signature`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)\n * - [`sig`](https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token)\n * - [`X-Goog-Signature`](https://cloud.google.com/storage/docs/access-control/signed-urls)\n *\n * This list is subject to change over time.\n *\n * Matching of query parameter keys against the sensitive list **SHOULD** be case-sensitive.\n *\n *\n * Instrumentation **MAY** provide a way to override this list via declarative configuration.\n * If so, it **SHOULD** use the `sensitive_query_parameters` property\n * (an array of case-sensitive strings with minimum items 0) under\n * `.instrumentation/development.general.sanitization.url`.\n * This list is a full override of the default sensitive query parameter keys,\n * it is not a list of keys in addition to the defaults.\n *\n * When a query string value is redacted, the query string key **SHOULD** still be preserved, e.g.\n * `https://www.example.com/path?color=blue&sig=REDACTED`.\n */\nexport const ATTR_URL_FULL = 'url.full';\n/**\n * The [URI path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component\n *\n * @example /search\n *\n * @note Sensitive content provided in `url.path` **SHOULD** be scrubbed when instrumentations can identify it.\n */\nexport const ATTR_URL_PATH = 'url.path';\n/**\n * The [URI query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component\n *\n * @example q=OpenTelemetry\n *\n * @note Sensitive content provided in `url.query` **SHOULD** be scrubbed when instrumentations can identify it.\n *\n *\n * Query string values for the following keys **SHOULD** be redacted by default and replaced by the value `REDACTED`:\n *\n * - [`AWSAccessKeyId`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)\n * - [`Signature`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)\n * - [`sig`](https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token)\n * - [`X-Goog-Signature`](https://cloud.google.com/storage/docs/access-control/signed-urls)\n *\n * This list is subject to change over time.\n *\n * Matching of query parameter keys against the sensitive list **SHOULD** be case-sensitive.\n *\n * Instrumentation **MAY** provide a way to override this list via declarative configuration.\n * If so, it **SHOULD** use the `sensitive_query_parameters` property\n * (an array of case-sensitive strings with minimum items 0) under\n * `.instrumentation/development.general.sanitization.url`.\n * This list is a full override of the default sensitive query parameter keys,\n * it is not a list of keys in addition to the defaults.\n *\n * When a query string value is redacted, the query string key **SHOULD** still be preserved, e.g.\n * `q=OpenTelemetry&sig=REDACTED`.\n */\nexport const ATTR_URL_QUERY = 'url.query';\n/**\n * The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol.\n *\n * @example https\n * @example ftp\n * @example telnet\n */\nexport const ATTR_URL_SCHEME = 'url.scheme';\n/**\n * Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client.\n *\n * @example CERN-LineMode/2.15 libwww/2.17b3\n * @example Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1\n * @example YourApp/1.0.0 grpc-java-okhttp/1.27.2\n */\nexport const ATTR_USER_AGENT_ORIGINAL = 'user_agent.original';\n//# sourceMappingURL=stable_attributes.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n/**\n * The name of the runtime of this process.\n *\n * @example OpenJDK Runtime Environment\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_PROCESS_RUNTIME_NAME = 'process.runtime.name';\n//# sourceMappingURL=semconv.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { VERSION } from '../../version';\nimport { ATTR_TELEMETRY_SDK_NAME, ATTR_TELEMETRY_SDK_LANGUAGE, TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS, ATTR_TELEMETRY_SDK_VERSION, } from '@opentelemetry/semantic-conventions';\nimport { ATTR_PROCESS_RUNTIME_NAME } from '../../semconv';\n/** Constants describing the SDK in use */\nexport const SDK_INFO = {\n [ATTR_TELEMETRY_SDK_NAME]: 'opentelemetry',\n [ATTR_PROCESS_RUNTIME_NAME]: 'browser',\n [ATTR_TELEMETRY_SDK_LANGUAGE]: TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS,\n [ATTR_TELEMETRY_SDK_VERSION]: VERSION,\n};\n//# sourceMappingURL=sdk-info.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport { getStringFromEnv, getBooleanFromEnv, getNumberFromEnv, getStringListFromEnv, } from './environment';\nexport { _globalThis } from '../../common/globalThis';\nexport { SDK_INFO } from './sdk-info';\n/**\n * @deprecated Use performance directly.\n */\nexport const otperformance = performance;\n//# sourceMappingURL=index.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { otperformance as performance } from '../platform';\nconst NANOSECOND_DIGITS = 9;\nconst NANOSECOND_DIGITS_IN_MILLIS = 6;\nconst MILLISECONDS_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS_IN_MILLIS);\nconst SECOND_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS);\n/**\n * Converts a number of milliseconds from epoch to HrTime([seconds, remainder in nanoseconds]).\n * @param epochMillis\n */\nexport function millisToHrTime(epochMillis) {\n const epochSeconds = epochMillis / 1000;\n // Decimals only.\n const seconds = Math.trunc(epochSeconds);\n // Round sub-nanosecond accuracy to nanosecond.\n const nanos = Math.round((epochMillis % 1000) * MILLISECONDS_TO_NANOSECONDS);\n return [seconds, nanos];\n}\n/**\n * @deprecated Use `performance.timeOrigin` directly.\n */\nexport function getTimeOrigin() {\n return performance.timeOrigin;\n}\n/**\n * Returns an hrtime calculated via performance component.\n * @param performanceNow\n */\nexport function hrTime(performanceNow) {\n const timeOrigin = millisToHrTime(performance.timeOrigin);\n const now = millisToHrTime(typeof performanceNow === 'number' ? performanceNow : performance.now());\n return addHrTimes(timeOrigin, now);\n}\n/**\n *\n * Converts a TimeInput to an HrTime, defaults to _hrtime().\n * @param time\n */\nexport function timeInputToHrTime(time) {\n // process.hrtime\n if (isTimeInputHrTime(time)) {\n return time;\n }\n else if (typeof time === 'number') {\n // Must be a performance.now() if it's smaller than process start time.\n if (time < performance.timeOrigin) {\n return hrTime(time);\n }\n else {\n // epoch milliseconds or performance.timeOrigin\n return millisToHrTime(time);\n }\n }\n else if (time instanceof Date) {\n return millisToHrTime(time.getTime());\n }\n else {\n throw TypeError('Invalid input type');\n }\n}\n/**\n * Returns a duration of two hrTime.\n * @param startTime\n * @param endTime\n */\nexport function hrTimeDuration(startTime, endTime) {\n let seconds = endTime[0] - startTime[0];\n let nanos = endTime[1] - startTime[1];\n // overflow\n if (nanos < 0) {\n seconds -= 1;\n // negate\n nanos += SECOND_TO_NANOSECONDS;\n }\n return [seconds, nanos];\n}\n/**\n * Convert hrTime to timestamp, for example \"2019-05-14T17:00:00.000123456Z\"\n * @param time\n */\nexport function hrTimeToTimeStamp(time) {\n const precision = NANOSECOND_DIGITS;\n const tmp = `${'0'.repeat(precision)}${time[1]}Z`;\n const nanoString = tmp.substring(tmp.length - precision - 1);\n const date = new Date(time[0] * 1000).toISOString();\n return date.replace('000Z', nanoString);\n}\n/**\n * Convert hrTime to nanoseconds.\n * @param time\n */\nexport function hrTimeToNanoseconds(time) {\n return time[0] * SECOND_TO_NANOSECONDS + time[1];\n}\n/**\n * Convert hrTime to milliseconds.\n * @param time\n */\nexport function hrTimeToMilliseconds(time) {\n return time[0] * 1e3 + time[1] / 1e6;\n}\n/**\n * Convert hrTime to microseconds.\n * @param time\n */\nexport function hrTimeToMicroseconds(time) {\n return time[0] * 1e6 + time[1] / 1e3;\n}\n/**\n * check if time is HrTime\n * @param value\n */\nexport function isTimeInputHrTime(value) {\n return (Array.isArray(value) &&\n value.length === 2 &&\n typeof value[0] === 'number' &&\n typeof value[1] === 'number');\n}\n/**\n * check if input value is a correct types.TimeInput\n * @param value\n */\nexport function isTimeInput(value) {\n return (isTimeInputHrTime(value) ||\n typeof value === 'number' ||\n value instanceof Date);\n}\n/**\n * Given 2 HrTime formatted times, return their sum as an HrTime.\n */\nexport function addHrTimes(time1, time2) {\n const out = [time1[0] + time2[0], time1[1] + time2[1]];\n // Nanoseconds\n if (out[1] >= SECOND_TO_NANOSECONDS) {\n out[1] -= SECOND_TO_NANOSECONDS;\n out[0] += 1;\n }\n return out;\n}\n//# sourceMappingURL=time.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport var ExportResultCode;\n(function (ExportResultCode) {\n ExportResultCode[ExportResultCode[\"SUCCESS\"] = 0] = \"SUCCESS\";\n ExportResultCode[ExportResultCode[\"FAILED\"] = 1] = \"FAILED\";\n})(ExportResultCode || (ExportResultCode = {}));\n//# sourceMappingURL=ExportResult.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\n/** Combines multiple propagators into a single propagator. */\nexport class CompositePropagator {\n _propagators;\n _fields;\n /**\n * Construct a composite propagator from a list of propagators.\n *\n * @param [config] Configuration object for composite propagator\n */\n constructor(config = {}) {\n this._propagators = config.propagators ?? [];\n const fields = new Set();\n for (const propagator of this._propagators) {\n // older propagators may not have fields function, null check to be sure\n const propagatorFields = typeof propagator.fields === 'function' ? propagator.fields() : [];\n for (const field of propagatorFields) {\n fields.add(field);\n }\n }\n this._fields = Array.from(fields);\n }\n /**\n * Run each of the configured propagators with the given context and carrier.\n * Propagators are run in the order they are configured, so if multiple\n * propagators write the same carrier key, the propagator later in the list\n * will \"win\".\n *\n * @param context Context to inject\n * @param carrier Carrier into which context will be injected\n */\n inject(context, carrier, setter) {\n for (const propagator of this._propagators) {\n try {\n propagator.inject(context, carrier, setter);\n }\n catch (err) {\n diag.warn(`Failed to inject with ${propagator.constructor.name}. Err: ${err.message}`);\n }\n }\n }\n /**\n * Run each of the configured propagators with the given context and carrier.\n * Propagators are run in the order they are configured, so if multiple\n * propagators write the same context key, the propagator later in the list\n * will \"win\".\n *\n * @param context Context to add values to\n * @param carrier Carrier from which to extract context\n */\n extract(context, carrier, getter) {\n return this._propagators.reduce((ctx, propagator) => {\n try {\n return propagator.extract(ctx, carrier, getter);\n }\n catch (err) {\n diag.warn(`Failed to extract with ${propagator.constructor.name}. Err: ${err.message}`);\n }\n return ctx;\n }, context);\n }\n fields() {\n // return a new array so our fields cannot be modified\n return this._fields.slice();\n }\n}\n//# sourceMappingURL=composite.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nconst VALID_KEY_CHAR_RANGE = '[_0-9a-z-*/]';\nconst VALID_KEY = `[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`;\nconst VALID_VENDOR_KEY = `[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`;\nconst VALID_KEY_REGEX = new RegExp(`^(?:${VALID_KEY}|${VALID_VENDOR_KEY})$`);\nconst VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/;\nconst INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/;\n/**\n * Key is opaque string up to 256 characters printable. It MUST begin with a\n * lowercase letter, and can only contain lowercase letters a-z, digits 0-9,\n * underscores _, dashes -, asterisks *, and forward slashes /.\n * For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the\n * vendor name. Vendors SHOULD set the tenant ID at the beginning of the key.\n * see https://www.w3.org/TR/trace-context/#key\n */\nexport function validateKey(key) {\n return VALID_KEY_REGEX.test(key);\n}\n/**\n * Value is opaque string up to 256 characters printable ASCII RFC0020\n * characters (i.e., the range 0x20 to 0x7E) except comma , and =.\n */\nexport function validateValue(value) {\n return (VALID_VALUE_BASE_REGEX.test(value) &&\n !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value));\n}\n//# sourceMappingURL=validators.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { validateKey, validateValue } from '../internal/validators';\nconst MAX_TRACE_STATE_ITEMS = 32;\nconst MAX_TRACE_STATE_LEN = 512;\nconst LIST_MEMBERS_SEPARATOR = ',';\nconst LIST_MEMBER_KEY_VALUE_SPLITTER = '=';\n/**\n * TraceState must be a class and not a simple object type because of the spec\n * requirement (https://www.w3.org/TR/trace-context/#tracestate-field).\n *\n * Here is the list of allowed mutations:\n * - New key-value pair should be added into the beginning of the list\n * - The value of any key can be updated. Modified keys MUST be moved to the\n * beginning of the list.\n */\nexport class TraceState {\n _length;\n _rawTraceState;\n _internalState;\n constructor(rawTraceState) {\n this._rawTraceState =\n typeof rawTraceState === 'string' ? rawTraceState : '';\n this._length = this._rawTraceState.length;\n }\n set(key, value) {\n if (!validateKey(key) || !validateValue(value)) {\n return this;\n }\n const currState = this._getState();\n const currValue = currState.get(key);\n // Get the new length depending if we already have a value or not\n // - for existing keys we add the difference between the length of the values\n // - for new keys is the key & value lenght plus\n // - +1 for the key/value splitter\n // - +1 for the separator if there are other keys\n let newLength = this._length;\n if (typeof currValue === 'string') {\n newLength += value.length - currValue.length;\n }\n else {\n newLength += key.length + value.length + (currState.size > 0 ? 2 : 1);\n }\n if (newLength > MAX_TRACE_STATE_LEN) {\n return this;\n }\n const newState = new Map(currState);\n newState.delete(key);\n newState.set(key, value);\n return this._fromState(newState, newLength);\n }\n unset(key) {\n const currState = this._getState();\n const currValue = currState.get(key);\n // No need to create a new instance if the key does not exist\n if (typeof currValue !== 'string') {\n return this;\n }\n // Get the new length depending if we already have a value or not\n // - for existing keys we substract key and value length plus\n // - +1 for the key/value splitter\n // - +1 for the separator if there are other keys\n let newLength = this._length - (key.length + currValue.length + 1);\n if (currState.size > 1) {\n // remove separator from length if there's no key or only one.\n newLength = newLength - 1;\n }\n const newState = new Map(currState);\n newState.delete(key);\n return this._fromState(newState, newLength);\n }\n get(key) {\n const currState = this._getState();\n return currState.get(key);\n }\n serialize() {\n // Maps put new entries at the end. We prepend the seralized entry\n // to get the right order according to the spec (updated members go 1st)\n let serialized = '';\n let index = 0;\n for (const entry of this._getState()) {\n if (index > 0) {\n serialized = LIST_MEMBERS_SEPARATOR + serialized;\n }\n serialized =\n `${entry[0]}${LIST_MEMBER_KEY_VALUE_SPLITTER}${entry[1]}` + serialized;\n index++;\n }\n return serialized;\n }\n _getState() {\n if (this._internalState) {\n return this._internalState;\n }\n // Not parsed yet, lets do it\n const vendorMembers = this._rawTraceState.split(LIST_MEMBERS_SEPARATOR);\n // This Map will have the order reversed\n const vendorEntries = new Map();\n let currentLength = 0;\n for (const member of vendorMembers) {\n const m = member.trim();\n const idx = m.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);\n if (idx === -1) {\n continue;\n }\n const key = m.slice(0, idx);\n const value = m.slice(idx + 1);\n if (!validateKey(key) || !validateValue(value)) {\n continue;\n }\n // Skip if adding the new member exceeds the length\n const futureLength = currentLength + m.length + (vendorEntries.size > 0 ? 1 : 0);\n if (futureLength > MAX_TRACE_STATE_LEN) {\n continue;\n }\n // All good, add it\n vendorEntries.set(key, value);\n currentLength = futureLength;\n // Check if we reached the max items\n if (vendorEntries.size >= MAX_TRACE_STATE_ITEMS) {\n break;\n }\n }\n // Now we set the length & the Map in the right order\n this._length = currentLength;\n this._internalState = new Map(Array.from(vendorEntries.entries()).reverse());\n return this._internalState;\n }\n _fromState(state, length) {\n const traceState = Object.create(TraceState.prototype);\n traceState._internalState = state;\n traceState._length = length;\n return traceState;\n }\n}\n//# sourceMappingURL=TraceState.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { isSpanContextValid, trace, TraceFlags } from '@opentelemetry/api';\nimport { isTracingSuppressed } from './suppress-tracing';\nimport { TraceState } from './TraceState';\nexport const TRACE_PARENT_HEADER = 'traceparent';\nexport const TRACE_STATE_HEADER = 'tracestate';\nconst VERSION = '00';\nconst VERSION_PART = '(?!ff)[\\\\da-f]{2}';\nconst TRACE_ID_PART = '(?![0]{32})[\\\\da-f]{32}';\nconst PARENT_ID_PART = '(?![0]{16})[\\\\da-f]{16}';\nconst FLAGS_PART = '[\\\\da-f]{2}';\nconst TRACE_PARENT_REGEX = new RegExp(`^\\\\s?(${VERSION_PART})-(${TRACE_ID_PART})-(${PARENT_ID_PART})-(${FLAGS_PART})(-.*)?\\\\s?$`);\n/**\n * Parses information from the [traceparent] span tag and converts it into {@link SpanContext}\n * @param traceParent - A meta property that comes from server.\n * It should be dynamically generated server side to have the server's request trace Id,\n * a parent span Id that was set on the server's request span,\n * and the trace flags to indicate the server's sampling decision\n * (01 = sampled, 00 = not sampled).\n * for example: '{version}-{traceId}-{spanId}-{sampleDecision}'\n * For more information see {@link https://www.w3.org/TR/trace-context/}\n */\nexport function parseTraceParent(traceParent) {\n const match = TRACE_PARENT_REGEX.exec(traceParent);\n if (!match)\n return null;\n // According to the specification the implementation should be compatible\n // with future versions. If there are more parts, we only reject it if it's using version 00\n // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent\n if (match[1] === '00' && match[5])\n return null;\n return {\n traceId: match[2],\n spanId: match[3],\n traceFlags: parseInt(match[4], 16),\n };\n}\n/**\n * Propagates {@link SpanContext} through Trace Context format propagation.\n *\n * Based on the Trace Context specification:\n * https://www.w3.org/TR/trace-context/\n */\nexport class W3CTraceContextPropagator {\n inject(context, carrier, setter) {\n const spanContext = trace.getSpanContext(context);\n if (!spanContext ||\n isTracingSuppressed(context) ||\n !isSpanContextValid(spanContext))\n return;\n const traceParent = `${VERSION}-${spanContext.traceId}-${spanContext.spanId}-0${Number(spanContext.traceFlags || TraceFlags.NONE).toString(16)}`;\n setter.set(carrier, TRACE_PARENT_HEADER, traceParent);\n if (spanContext.traceState) {\n setter.set(carrier, TRACE_STATE_HEADER, spanContext.traceState.serialize());\n }\n }\n extract(context, carrier, getter) {\n const traceParentHeader = getter.get(carrier, TRACE_PARENT_HEADER);\n if (!traceParentHeader)\n return context;\n const traceParent = Array.isArray(traceParentHeader)\n ? traceParentHeader[0]\n : traceParentHeader;\n if (typeof traceParent !== 'string')\n return context;\n const spanContext = parseTraceParent(traceParent);\n if (!spanContext)\n return context;\n spanContext.isRemote = true;\n const traceStateHeader = getter.get(carrier, TRACE_STATE_HEADER);\n if (traceStateHeader) {\n // If more than one `tracestate` header is found, we merge them into a\n // single header.\n const state = Array.isArray(traceStateHeader)\n ? traceStateHeader.join(',')\n : traceStateHeader;\n spanContext.traceState = new TraceState(typeof state === 'string' ? state : undefined);\n }\n return trace.setSpanContext(context, spanContext);\n }\n fields() {\n return [TRACE_PARENT_HEADER, TRACE_STATE_HEADER];\n }\n}\n//# sourceMappingURL=W3CTraceContextPropagator.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * based on lodash in order to support esm builds without esModuleInterop.\n * lodash is using MIT License.\n **/\nconst objectTag = '[object Object]';\nconst nullTag = '[object Null]';\nconst undefinedTag = '[object Undefined]';\nconst funcProto = Function.prototype;\nconst funcToString = funcProto.toString;\nconst objectCtorString = funcToString.call(Object);\nconst getPrototypeOf = Object.getPrototypeOf;\nconst objectProto = Object.prototype;\nconst hasOwnProperty = objectProto.hasOwnProperty;\nconst symToStringTag = Symbol ? Symbol.toStringTag : undefined;\nconst nativeObjectToString = objectProto.toString;\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nexport function isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) !== objectTag) {\n return false;\n }\n const proto = getPrototypeOf(value);\n if (proto === null) {\n return true;\n }\n const Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return (typeof Ctor == 'function' &&\n Ctor instanceof Ctor &&\n funcToString.call(Ctor) === objectCtorString);\n}\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return symToStringTag && symToStringTag in Object(value)\n ? getRawTag(value)\n : objectToString(value);\n}\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n const isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];\n let unmasked = false;\n try {\n value[symToStringTag] = undefined;\n unmasked = true;\n }\n catch {\n // silence\n }\n const result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n }\n else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n//# sourceMappingURL=lodash.merge.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { isPlainObject } from './lodash.merge';\nconst MAX_LEVEL = 20;\n/**\n * Merges objects together\n * @param args - objects / values to be merged\n */\nexport function merge(...args) {\n let result = args.shift();\n const objects = new WeakMap();\n while (args.length > 0) {\n result = mergeTwoObjects(result, args.shift(), 0, objects);\n }\n return result;\n}\nfunction takeValue(value) {\n if (isArray(value)) {\n return value.slice();\n }\n return value;\n}\n/**\n * Merges two objects\n * @param one - first object\n * @param two - second object\n * @param level - current deep level\n * @param objects - objects holder that has been already referenced - to prevent\n * cyclic dependency\n */\nfunction mergeTwoObjects(one, two, level = 0, objects) {\n let result;\n if (level > MAX_LEVEL) {\n return undefined;\n }\n level++;\n if (isPrimitive(one) || isPrimitive(two) || isFunction(two)) {\n result = takeValue(two);\n }\n else if (isArray(one)) {\n result = one.slice();\n if (isArray(two)) {\n for (let i = 0, j = two.length; i < j; i++) {\n result.push(takeValue(two[i]));\n }\n }\n else if (isObject(two)) {\n const keys = Object.keys(two);\n for (let i = 0, j = keys.length; i < j; i++) {\n const key = keys[i];\n if (key === '__proto__' ||\n key === 'constructor' ||\n key === 'prototype') {\n continue;\n }\n result[key] = takeValue(two[key]);\n }\n }\n }\n else if (isObject(one)) {\n if (isObject(two)) {\n if (!shouldMerge(one, two)) {\n return two;\n }\n result = Object.assign({}, one);\n const keys = Object.keys(two);\n for (let i = 0, j = keys.length; i < j; i++) {\n const key = keys[i];\n if (key === '__proto__' ||\n key === 'constructor' ||\n key === 'prototype') {\n continue;\n }\n const twoValue = two[key];\n if (isPrimitive(twoValue)) {\n if (typeof twoValue === 'undefined') {\n delete result[key];\n }\n else {\n // result[key] = takeValue(twoValue);\n result[key] = twoValue;\n }\n }\n else {\n const obj1 = result[key];\n const obj2 = twoValue;\n if (wasObjectReferenced(one, key, objects) ||\n wasObjectReferenced(two, key, objects)) {\n delete result[key];\n }\n else {\n if (isObject(obj1) && isObject(obj2)) {\n const arr1 = objects.get(obj1) || [];\n const arr2 = objects.get(obj2) || [];\n arr1.push({ obj: one, key });\n arr2.push({ obj: two, key });\n objects.set(obj1, arr1);\n objects.set(obj2, arr2);\n }\n result[key] = mergeTwoObjects(result[key], twoValue, level, objects);\n }\n }\n }\n }\n else {\n result = two;\n }\n }\n return result;\n}\n/**\n * Function to check if object has been already reference\n * @param obj\n * @param key\n * @param objects\n */\nfunction wasObjectReferenced(obj, key, objects) {\n const arr = objects.get(obj[key]) || [];\n for (let i = 0, j = arr.length; i < j; i++) {\n const info = arr[i];\n if (info.key === key && info.obj === obj) {\n return true;\n }\n }\n return false;\n}\nfunction isArray(value) {\n return Array.isArray(value);\n}\nfunction isFunction(value) {\n return typeof value === 'function';\n}\nfunction isObject(value) {\n return (!isPrimitive(value) &&\n !isArray(value) &&\n !isFunction(value) &&\n typeof value === 'object');\n}\nfunction isPrimitive(value) {\n return (typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n typeof value === 'undefined' ||\n value instanceof Date ||\n value instanceof RegExp ||\n value === null);\n}\nfunction shouldMerge(one, two) {\n if (!isPlainObject(one) || !isPlainObject(two)) {\n return false;\n }\n return true;\n}\n//# sourceMappingURL=merge.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport class Deferred {\n _promise;\n _resolve;\n _reject;\n constructor() {\n this._promise = new Promise((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n }\n get promise() {\n return this._promise;\n }\n resolve(val) {\n this._resolve(val);\n }\n reject(err) {\n this._reject(err);\n }\n}\n//# sourceMappingURL=promise.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { Deferred } from './promise';\n/**\n * Bind the callback and only invoke the callback once regardless how many times `BindOnceFuture.call` is invoked.\n */\nexport class BindOnceFuture {\n _isCalled = false;\n _deferred = new Deferred();\n _callback;\n _that;\n constructor(callback, that) {\n this._callback = callback;\n this._that = that;\n }\n get isCalled() {\n return this._isCalled;\n }\n get promise() {\n return this._deferred.promise;\n }\n call(...args) {\n if (!this._isCalled) {\n this._isCalled = true;\n try {\n Promise.resolve(this._callback.call(this._that, ...args)).then(val => this._deferred.resolve(val), err => this._deferred.reject(err));\n }\n catch (err) {\n this._deferred.reject(err);\n }\n }\n return this._deferred.promise;\n }\n}\n//# sourceMappingURL=callback.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { context } from '@opentelemetry/api';\nimport { suppressTracing } from '../trace/suppress-tracing';\n/**\n * @internal\n * Shared functionality used by Exporters while exporting data, including suppression of Traces.\n */\nexport function _export(exporter, arg) {\n return new Promise(resolve => {\n // prevent downstream exporter calls from generating spans\n context.with(suppressTracing(context.active()), () => {\n exporter.export(arg, resolve);\n });\n });\n}\n//# sourceMappingURL=exporter.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport { W3CBaggagePropagator } from './baggage/propagation/W3CBaggagePropagator';\nexport { AnchoredClock } from './common/anchored-clock';\nexport { isAttributeValue, sanitizeAttributes } from './common/attributes';\nexport { globalErrorHandler, setGlobalErrorHandler, } from './common/global-error-handler';\nexport { loggingErrorHandler } from './common/logging-error-handler';\nexport { addHrTimes, getTimeOrigin, hrTime, hrTimeDuration, hrTimeToMicroseconds, hrTimeToMilliseconds, hrTimeToNanoseconds, hrTimeToTimeStamp, isTimeInput, isTimeInputHrTime, millisToHrTime, timeInputToHrTime, } from './common/time';\nexport { unrefTimer } from './common/timer-util';\nexport { ExportResultCode } from './ExportResult';\nexport { parseKeyPairsIntoRecord } from './baggage/utils';\nexport { SDK_INFO, _globalThis, getStringFromEnv, getBooleanFromEnv, getNumberFromEnv, getStringListFromEnv, otperformance, } from './platform';\nexport { CompositePropagator } from './propagation/composite';\nexport { TRACE_PARENT_HEADER, TRACE_STATE_HEADER, W3CTraceContextPropagator, parseTraceParent, } from './trace/W3CTraceContextPropagator';\nexport { RPCType, deleteRPCMetadata, getRPCMetadata, setRPCMetadata, } from './trace/rpc-metadata';\nexport { isTracingSuppressed, suppressTracing, unsuppressTracing, } from './trace/suppress-tracing';\nexport { TraceState } from './trace/TraceState';\nexport { merge } from './utils/merge';\nexport { TimeoutError, callWithTimeout } from './utils/timeout';\nexport { isUrlIgnored, urlMatches } from './utils/url';\nexport { BindOnceFuture } from './utils/callback';\nexport { diagLogLevelFromString } from './utils/configuration';\nimport { _export } from './internal/exporter';\nexport const internal = {\n _export,\n};\n//# sourceMappingURL=index.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport class OTLPExporterBase {\n _delegate;\n constructor(delegate) {\n this._delegate = delegate;\n }\n /**\n * Export items.\n * @param items\n * @param resultCallback\n */\n export(items, resultCallback) {\n this._delegate.export(items, resultCallback);\n }\n forceFlush() {\n return this._delegate.forceFlush();\n }\n shutdown() {\n return this._delegate.shutdown();\n }\n}\n//# sourceMappingURL=OTLPExporterBase.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * Interface for handling error\n */\nexport class OTLPExporterError extends Error {\n code;\n name = 'OTLPExporterError';\n data;\n constructor(message, code, data) {\n super(message);\n this.data = data;\n this.code = code;\n }\n}\n//# sourceMappingURL=types.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport function validateTimeoutMillis(timeoutMillis) {\n if (Number.isFinite(timeoutMillis) && timeoutMillis > 0) {\n return timeoutMillis;\n }\n throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${timeoutMillis}')`);\n}\nexport function wrapStaticHeadersInFunction(headers) {\n if (headers == null) {\n return undefined;\n }\n return async () => headers;\n}\n/**\n * @param userProvidedConfiguration Configuration options provided by the user in code.\n * @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.\n * @param defaultConfiguration The defaults as defined by the exporter specification\n */\nexport function mergeOtlpSharedConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration) {\n return {\n timeoutMillis: validateTimeoutMillis(userProvidedConfiguration.timeoutMillis ??\n fallbackConfiguration.timeoutMillis ??\n defaultConfiguration.timeoutMillis),\n concurrencyLimit: userProvidedConfiguration.concurrencyLimit ??\n fallbackConfiguration.concurrencyLimit ??\n defaultConfiguration.concurrencyLimit,\n compression: userProvidedConfiguration.compression ??\n fallbackConfiguration.compression ??\n defaultConfiguration.compression,\n };\n}\nexport function getSharedConfigurationDefaults() {\n return {\n timeoutMillis: 10000,\n concurrencyLimit: 30,\n compression: 'none',\n };\n}\n//# sourceMappingURL=shared-configuration.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nclass BoundedQueueExportPromiseHandler {\n _concurrencyLimit;\n _sendingPromises = [];\n /**\n * @param concurrencyLimit maximum promises allowed in a queue at the same time.\n */\n constructor(concurrencyLimit) {\n this._concurrencyLimit = concurrencyLimit;\n }\n pushPromise(promise) {\n if (this.hasReachedLimit()) {\n throw new Error('Concurrency Limit reached');\n }\n this._sendingPromises.push(promise);\n const popPromise = () => {\n const index = this._sendingPromises.indexOf(promise);\n void this._sendingPromises.splice(index, 1);\n };\n promise.then(popPromise, popPromise);\n }\n hasReachedLimit() {\n return this._sendingPromises.length >= this._concurrencyLimit;\n }\n async awaitAll() {\n await Promise.all(this._sendingPromises);\n }\n}\n/**\n * Promise queue for keeping track of export promises. Finished promises will be auto-dequeued.\n * Allows for awaiting all promises in the queue.\n */\nexport function createBoundedQueueExportPromiseHandler(options) {\n return new BoundedQueueExportPromiseHandler(options.concurrencyLimit);\n}\n//# sourceMappingURL=bounded-queue-export-promise-handler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\nfunction isPartialSuccessResponse(response) {\n return Object.prototype.hasOwnProperty.call(response, 'partialSuccess');\n}\n/**\n * Default response handler that logs a partial success to the console.\n */\nexport function createLoggingPartialSuccessResponseHandler() {\n return {\n handleResponse(response) {\n // Partial success MUST never be an empty object according the specification\n // see https://opentelemetry.io/docs/specs/otlp/#partial-success\n if (response == null ||\n !isPartialSuccessResponse(response) ||\n response.partialSuccess == null ||\n Object.keys(response.partialSuccess).length === 0) {\n return;\n }\n diag.warn('Received Partial Success response:', JSON.stringify(response.partialSuccess));\n },\n };\n}\n//# sourceMappingURL=logging-response-handler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ExportResultCode } from '@opentelemetry/core';\nimport { OTLPExporterError } from './types';\nimport { createLoggingPartialSuccessResponseHandler } from './logging-response-handler';\nimport { diag } from '@opentelemetry/api';\nclass OTLPExportDelegate {\n _diagLogger;\n _transport;\n _serializer;\n _responseHandler;\n _promiseQueue;\n _timeout;\n constructor(transport, serializer, responseHandler, promiseQueue, timeout) {\n this._transport = transport;\n this._serializer = serializer;\n this._responseHandler = responseHandler;\n this._promiseQueue = promiseQueue;\n this._timeout = timeout;\n this._diagLogger = diag.createComponentLogger({\n namespace: 'OTLPExportDelegate',\n });\n }\n export(internalRepresentation, resultCallback) {\n this._diagLogger.debug('items to be sent', internalRepresentation);\n // don't do any work if too many exports are in progress.\n if (this._promiseQueue.hasReachedLimit()) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Concurrent export limit reached'),\n });\n return;\n }\n const serializedRequest = this._serializer.serializeRequest(internalRepresentation);\n if (serializedRequest == null) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Nothing to send'),\n });\n return;\n }\n this._promiseQueue.pushPromise(this._transport.send(serializedRequest, this._timeout).then(response => {\n if (response.status === 'success') {\n if (response.data != null) {\n try {\n this._responseHandler.handleResponse(this._serializer.deserializeResponse(response.data));\n }\n catch (e) {\n this._diagLogger.warn('Export succeeded but could not deserialize response - is the response specification compliant?', e, response.data);\n }\n }\n // No matter the response, we can consider the export still successful.\n resultCallback({\n code: ExportResultCode.SUCCESS,\n });\n return;\n }\n else if (response.status === 'failure' && response.error) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: response.error,\n });\n return;\n }\n else if (response.status === 'retryable') {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: response.error ??\n new OTLPExporterError('Export failed with retryable status'),\n });\n }\n else {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new OTLPExporterError('Export failed with unknown error'),\n });\n }\n }, reason => resultCallback({\n code: ExportResultCode.FAILED,\n error: reason,\n })));\n }\n forceFlush() {\n return this._promiseQueue.awaitAll();\n }\n async shutdown() {\n this._diagLogger.debug('shutdown started');\n await this.forceFlush();\n this._transport.shutdown();\n }\n}\n/**\n * Creates a generic delegate for OTLP exports which only contains parts of the OTLP export that are shared across all\n * signals.\n */\nexport function createOtlpExportDelegate(components, settings) {\n return new OTLPExportDelegate(components.transport, components.serializer, createLoggingPartialSuccessResponseHandler(), components.promiseHandler, settings.timeout);\n}\n//# sourceMappingURL=otlp-export-delegate.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { createBoundedQueueExportPromiseHandler } from './bounded-queue-export-promise-handler';\nimport { createOtlpExportDelegate } from './otlp-export-delegate';\nexport function createOtlpNetworkExportDelegate(options, serializer, transport) {\n return createOtlpExportDelegate({\n transport: transport,\n serializer,\n promiseHandler: createBoundedQueueExportPromiseHandler(options),\n }, { timeout: options.timeoutMillis });\n}\n//# sourceMappingURL=otlp-network-export-delegate.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nlet serviceName;\n/**\n * Returns the default service name for OpenTelemetry resources.\n * In Node.js environments, returns \"unknown_service:<process.argv0>\".\n * In browser/edge environments, returns \"unknown_service\".\n */\nexport function defaultServiceName() {\n if (serviceName === undefined) {\n try {\n const argv0 = globalThis.process.argv0;\n serviceName = argv0 ? `unknown_service:${argv0}` : 'unknown_service';\n }\n catch {\n serviceName = 'unknown_service';\n }\n }\n return serviceName;\n}\n/** @internal For testing purposes only */\nexport function _clearDefaultServiceNameCache() {\n serviceName = undefined;\n}\n//# sourceMappingURL=default-service-name.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport const isPromiseLike = (val) => {\n return (val !== null &&\n typeof val === 'object' &&\n typeof val.then === 'function');\n};\n//# sourceMappingURL=utils.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\nimport { SDK_INFO } from '@opentelemetry/core';\nimport { ATTR_SERVICE_NAME, ATTR_TELEMETRY_SDK_LANGUAGE, ATTR_TELEMETRY_SDK_NAME, ATTR_TELEMETRY_SDK_VERSION, } from '@opentelemetry/semantic-conventions';\nimport { defaultServiceName } from './default-service-name';\nimport { isPromiseLike } from './utils';\nclass ResourceImpl {\n _rawAttributes;\n _asyncAttributesPending = false;\n _schemaUrl;\n _memoizedAttributes;\n static FromAttributeList(attributes, options) {\n const res = new ResourceImpl({}, options);\n res._rawAttributes = guardedRawAttributes(attributes);\n res._asyncAttributesPending =\n attributes.filter(([_, val]) => isPromiseLike(val)).length > 0;\n return res;\n }\n constructor(\n /**\n * A dictionary of attributes with string keys and values that provide\n * information about the entity as numbers, strings or booleans\n * TODO: Consider to add check/validation on attributes.\n */\n resource, options) {\n const attributes = resource.attributes ?? {};\n this._rawAttributes = Object.entries(attributes).map(([k, v]) => {\n if (isPromiseLike(v)) {\n // side-effect\n this._asyncAttributesPending = true;\n }\n return [k, v];\n });\n this._rawAttributes = guardedRawAttributes(this._rawAttributes);\n this._schemaUrl = validateSchemaUrl(options?.schemaUrl);\n }\n get asyncAttributesPending() {\n return this._asyncAttributesPending;\n }\n async waitForAsyncAttributes() {\n if (!this.asyncAttributesPending) {\n return;\n }\n for (let i = 0; i < this._rawAttributes.length; i++) {\n const [k, v] = this._rawAttributes[i];\n this._rawAttributes[i] = [k, isPromiseLike(v) ? await v : v];\n }\n this._asyncAttributesPending = false;\n }\n get attributes() {\n if (this.asyncAttributesPending) {\n diag.error('Accessing resource attributes before async attributes settled');\n }\n if (this._memoizedAttributes) {\n return this._memoizedAttributes;\n }\n const attrs = {};\n for (const [k, v] of this._rawAttributes) {\n if (isPromiseLike(v)) {\n diag.debug(`Unsettled resource attribute ${k} skipped`);\n continue;\n }\n if (v != null) {\n attrs[k] ??= v;\n }\n }\n // only memoize output if all attributes are settled\n if (!this._asyncAttributesPending) {\n this._memoizedAttributes = attrs;\n }\n return attrs;\n }\n getRawAttributes() {\n return this._rawAttributes;\n }\n get schemaUrl() {\n return this._schemaUrl;\n }\n merge(resource) {\n if (resource == null)\n return this;\n // Order is important\n // Spec states incoming attributes override existing attributes\n const mergedSchemaUrl = mergeSchemaUrl(this, resource);\n const mergedOptions = mergedSchemaUrl\n ? { schemaUrl: mergedSchemaUrl }\n : undefined;\n return ResourceImpl.FromAttributeList([...resource.getRawAttributes(), ...this.getRawAttributes()], mergedOptions);\n }\n}\nexport function resourceFromAttributes(attributes, options) {\n return ResourceImpl.FromAttributeList(Object.entries(attributes), options);\n}\nexport function resourceFromDetectedResource(detectedResource, options) {\n return new ResourceImpl(detectedResource, options);\n}\nexport function emptyResource() {\n return resourceFromAttributes({});\n}\nexport function defaultResource() {\n return resourceFromAttributes({\n [ATTR_SERVICE_NAME]: defaultServiceName(),\n [ATTR_TELEMETRY_SDK_LANGUAGE]: SDK_INFO[ATTR_TELEMETRY_SDK_LANGUAGE],\n [ATTR_TELEMETRY_SDK_NAME]: SDK_INFO[ATTR_TELEMETRY_SDK_NAME],\n [ATTR_TELEMETRY_SDK_VERSION]: SDK_INFO[ATTR_TELEMETRY_SDK_VERSION],\n });\n}\nfunction guardedRawAttributes(attributes) {\n return attributes.map(([k, v]) => {\n if (isPromiseLike(v)) {\n return [\n k,\n v.catch(err => {\n diag.debug('promise rejection for resource attribute: %s - %s', k, err);\n return undefined;\n }),\n ];\n }\n return [k, v];\n });\n}\nfunction validateSchemaUrl(schemaUrl) {\n if (typeof schemaUrl === 'string' || schemaUrl === undefined) {\n return schemaUrl;\n }\n diag.warn('Schema URL must be string or undefined, got %s. Schema URL will be ignored.', schemaUrl);\n return undefined;\n}\nfunction mergeSchemaUrl(old, updating) {\n const oldSchemaUrl = old?.schemaUrl;\n const updatingSchemaUrl = updating?.schemaUrl;\n const isOldEmpty = oldSchemaUrl === undefined || oldSchemaUrl === '';\n const isUpdatingEmpty = updatingSchemaUrl === undefined || updatingSchemaUrl === '';\n if (isOldEmpty) {\n return updatingSchemaUrl;\n }\n if (isUpdatingEmpty) {\n return oldSchemaUrl;\n }\n if (oldSchemaUrl === updatingSchemaUrl) {\n return oldSchemaUrl;\n }\n diag.warn('Schema URL merge conflict: old resource has \"%s\", updating resource has \"%s\". Resulting resource will have undefined Schema URL.', oldSchemaUrl, updatingSchemaUrl);\n return undefined;\n}\n//# sourceMappingURL=ResourceImpl.js.map","export function createResource(resource, encoder) {\n const result = {\n attributes: toAttributes(resource.attributes, encoder),\n droppedAttributesCount: 0,\n };\n const schemaUrl = resource.schemaUrl;\n if (schemaUrl && schemaUrl !== '')\n result.schemaUrl = schemaUrl;\n return result;\n}\nexport function createInstrumentationScope(scope) {\n return {\n name: scope.name,\n version: scope.version,\n };\n}\nexport function toAttributes(attributes, encoder) {\n return Object.keys(attributes).map(key => toKeyValue(key, attributes[key], encoder));\n}\nexport function toKeyValue(key, value, encoder) {\n return {\n key: key,\n value: toAnyValue(value, encoder),\n };\n}\nexport function toAnyValue(value, encoder) {\n const t = typeof value;\n if (t === 'string')\n return { stringValue: value };\n if (t === 'number') {\n if (!Number.isInteger(value))\n return { doubleValue: value };\n return { intValue: value };\n }\n if (t === 'boolean')\n return { boolValue: value };\n if (value instanceof Uint8Array)\n return { bytesValue: encoder.encodeUint8Array(value) };\n if (Array.isArray(value)) {\n const values = new Array(value.length);\n for (let i = 0; i < value.length; i++) {\n values[i] = toAnyValue(value[i], encoder);\n }\n return { arrayValue: { values } };\n }\n if (t === 'object' && value != null) {\n const keys = Object.keys(value);\n const values = new Array(keys.length);\n for (let i = 0; i < keys.length; i++) {\n values[i] = {\n key: keys[i],\n value: toAnyValue(value[keys[i]], encoder),\n };\n }\n return { kvlistValue: { values } };\n }\n return {};\n}\n//# sourceMappingURL=internal.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { hrTimeToNanoseconds } from '@opentelemetry/core';\nimport { hexToBinary } from './hex-to-binary';\nexport function hrTimeToNanos(hrTime) {\n const NANOSECONDS = BigInt(1000000000);\n return (BigInt(Math.trunc(hrTime[0])) * NANOSECONDS + BigInt(Math.trunc(hrTime[1])));\n}\nexport function toLongBits(value) {\n const low = Number(BigInt.asUintN(32, value));\n const high = Number(BigInt.asUintN(32, value >> BigInt(32)));\n return { low, high };\n}\nexport function encodeAsLongBits(hrTime) {\n const nanos = hrTimeToNanos(hrTime);\n return toLongBits(nanos);\n}\nexport function encodeAsString(hrTime) {\n const nanos = hrTimeToNanos(hrTime);\n return nanos.toString();\n}\nconst encodeTimestamp = typeof BigInt !== 'undefined' ? encodeAsString : hrTimeToNanoseconds;\nfunction identity(value) {\n return value;\n}\nfunction optionalHexToBinary(str) {\n if (str === undefined)\n return undefined;\n return hexToBinary(str);\n}\n/**\n * Encoder for protobuf format.\n * Uses { high, low } timestamps and binary for span/trace IDs, leaves Uint8Array attributes as-is.\n */\nexport const PROTOBUF_ENCODER = {\n encodeHrTime: encodeAsLongBits,\n encodeSpanContext: hexToBinary,\n encodeOptionalSpanContext: optionalHexToBinary,\n encodeUint8Array: identity,\n};\n/**\n * Encoder for JSON format.\n * Uses string timestamps, hex for span/trace IDs, and base64 for Uint8Array.\n */\nexport const JSON_ENCODER = {\n encodeHrTime: encodeTimestamp,\n encodeSpanContext: identity,\n encodeOptionalSpanContext: identity,\n encodeUint8Array: (bytes) => {\n if (typeof Buffer !== 'undefined') {\n return Buffer.from(bytes).toString('base64');\n }\n // implementation note: not using spread operator and passing to\n // btoa to avoid stack overflow on large Uint8Arrays\n const chars = new Array(bytes.length);\n for (let i = 0; i < bytes.length; i++) {\n chars[i] = String.fromCharCode(bytes[i]);\n }\n return btoa(chars.join(''));\n },\n};\n//# sourceMappingURL=utils.js.map","import { createInstrumentationScope, createResource, toAttributes, } from '../common/internal';\n// Span flags constants matching the OTLP specification\nconst SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 0x100;\nconst SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 0x200;\n/**\n * Builds the 32-bit span flags value combining the low 8-bit W3C TraceFlags\n * with the HAS_IS_REMOTE and IS_REMOTE bits according to the OTLP spec.\n */\nfunction buildSpanFlagsFrom(traceFlags, isRemote) {\n // low 8 bits are W3C TraceFlags (e.g., sampled)\n let flags = (traceFlags & 0xff) | SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK;\n if (isRemote) {\n flags |= SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK;\n }\n return flags;\n}\nexport function sdkSpanToOtlpSpan(span, encoder) {\n const ctx = span.spanContext();\n const status = span.status;\n const parentSpanId = span.parentSpanContext?.spanId\n ? encoder.encodeSpanContext(span.parentSpanContext?.spanId)\n : undefined;\n return {\n traceId: encoder.encodeSpanContext(ctx.traceId),\n spanId: encoder.encodeSpanContext(ctx.spanId),\n parentSpanId: parentSpanId,\n traceState: ctx.traceState?.serialize(),\n name: span.name,\n // Span kind is offset by 1 because the API does not define a value for unset\n kind: span.kind == null ? 0 : span.kind + 1,\n startTimeUnixNano: encoder.encodeHrTime(span.startTime),\n endTimeUnixNano: encoder.encodeHrTime(span.endTime),\n attributes: toAttributes(span.attributes, encoder),\n droppedAttributesCount: span.droppedAttributesCount,\n events: span.events.map(event => toOtlpSpanEvent(event, encoder)),\n droppedEventsCount: span.droppedEventsCount,\n status: {\n // API and proto enums share the same values\n code: status.code,\n message: status.message,\n },\n links: span.links.map(link => toOtlpLink(link, encoder)),\n droppedLinksCount: span.droppedLinksCount,\n flags: buildSpanFlagsFrom(ctx.traceFlags, span.parentSpanContext?.isRemote),\n };\n}\nexport function toOtlpLink(link, encoder) {\n return {\n attributes: link.attributes ? toAttributes(link.attributes, encoder) : [],\n spanId: encoder.encodeSpanContext(link.context.spanId),\n traceId: encoder.encodeSpanContext(link.context.traceId),\n traceState: link.context.traceState?.serialize(),\n droppedAttributesCount: link.droppedAttributesCount || 0,\n flags: buildSpanFlagsFrom(link.context.traceFlags, link.context.isRemote),\n };\n}\nexport function toOtlpSpanEvent(timedEvent, encoder) {\n return {\n attributes: timedEvent.attributes\n ? toAttributes(timedEvent.attributes, encoder)\n : [],\n name: timedEvent.name,\n timeUnixNano: encoder.encodeHrTime(timedEvent.time),\n droppedAttributesCount: timedEvent.droppedAttributesCount || 0,\n };\n}\nexport function createExportTraceServiceRequest(spans, encoder) {\n return {\n resourceSpans: spanRecordsToResourceSpans(spans, encoder),\n };\n}\nfunction createResourceMap(readableSpans) {\n const resourceMap = new Map();\n for (const record of readableSpans) {\n let ilsMap = resourceMap.get(record.resource);\n if (!ilsMap) {\n ilsMap = new Map();\n resourceMap.set(record.resource, ilsMap);\n }\n // TODO this is duplicated in basic tracer. Consolidate on a common helper in core\n const instrumentationScopeKey = `${record.instrumentationScope.name}@${record.instrumentationScope.version || ''}:${record.instrumentationScope.schemaUrl || ''}`;\n let records = ilsMap.get(instrumentationScopeKey);\n if (!records) {\n records = [];\n ilsMap.set(instrumentationScopeKey, records);\n }\n records.push(record);\n }\n return resourceMap;\n}\nfunction spanRecordsToResourceSpans(readableSpans, encoder) {\n const resourceMap = createResourceMap(readableSpans);\n const out = [];\n const entryIterator = resourceMap.entries();\n let entry = entryIterator.next();\n while (!entry.done) {\n const [resource, ilmMap] = entry.value;\n const scopeResourceSpans = [];\n const ilmIterator = ilmMap.values();\n let ilmEntry = ilmIterator.next();\n while (!ilmEntry.done) {\n const scopeSpans = ilmEntry.value;\n if (scopeSpans.length > 0) {\n const spans = scopeSpans.map(readableSpan => sdkSpanToOtlpSpan(readableSpan, encoder));\n scopeResourceSpans.push({\n scope: createInstrumentationScope(scopeSpans[0].instrumentationScope),\n spans: spans,\n schemaUrl: scopeSpans[0].instrumentationScope.schemaUrl,\n });\n }\n ilmEntry = ilmIterator.next();\n }\n const processedResource = createResource(resource, encoder);\n const transformedSpans = {\n resource: processedResource,\n scopeSpans: scopeResourceSpans,\n schemaUrl: processedResource.schemaUrl,\n };\n out.push(transformedSpans);\n entry = entryIterator.next();\n }\n return out;\n}\n//# sourceMappingURL=internal.js.map","import { createExportTraceServiceRequest } from '../internal';\nimport { JSON_ENCODER } from '../../common/utils';\nimport { diag } from '@opentelemetry/api';\nexport const JsonTraceSerializer = {\n serializeRequest: (arg) => {\n const request = createExportTraceServiceRequest(arg, JSON_ENCODER);\n const encoder = new TextEncoder();\n return encoder.encode(JSON.stringify(request));\n },\n deserializeResponse: (arg) => {\n if (arg.length === 0) {\n return {};\n }\n const decoder = new TextDecoder();\n try {\n return JSON.parse(decoder.decode(arg));\n }\n catch (err) {\n diag.warn(`Failed to parse trace export response: ${err.message}. Returning empty response`);\n return {};\n }\n },\n};\n//# sourceMappingURL=trace.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\nconst MAX_ATTEMPTS = 5;\nconst INITIAL_BACKOFF = 1000;\nconst MAX_BACKOFF = 5000;\nconst BACKOFF_MULTIPLIER = 1.5;\nconst JITTER = 0.2;\n/**\n * Get a pseudo-random jitter that falls in the range of [-JITTER, +JITTER]\n */\nfunction getJitter() {\n return Math.random() * (2 * JITTER) - JITTER;\n}\nclass RetryingTransport {\n _transport;\n constructor(transport) {\n this._transport = transport;\n }\n retry(data, timeoutMillis, inMillis) {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n this._transport.send(data, timeoutMillis).then(resolve, reject);\n }, inMillis);\n });\n }\n async send(data, timeoutMillis) {\n let attempts = MAX_ATTEMPTS;\n let nextBackoff = INITIAL_BACKOFF;\n const deadline = Date.now() + timeoutMillis;\n let result = await this._transport.send(data, timeoutMillis);\n while (result.status === 'retryable' && attempts > 0) {\n attempts--;\n // use maximum of computed backoff and 0 to avoid negative timeouts\n const backoff = Math.max(Math.min(nextBackoff * (1 + getJitter()), MAX_BACKOFF), 0);\n nextBackoff = nextBackoff * BACKOFF_MULTIPLIER;\n const retryInMillis = result.retryInMillis ?? backoff;\n // return when expected retry time is after the export deadline.\n const remainingTimeoutMillis = deadline - Date.now();\n if (retryInMillis > remainingTimeoutMillis) {\n diag.info(`Export retry time ${Math.round(retryInMillis)}ms exceeds remaining timeout ${Math.round(remainingTimeoutMillis)}ms, not retrying further.`);\n return result;\n }\n diag.verbose(`Scheduling export retry in ${Math.round(retryInMillis)}ms`);\n result = await this.retry(data, remainingTimeoutMillis, retryInMillis);\n }\n if (result.status === 'success') {\n diag.verbose(`Export succeeded after ${MAX_ATTEMPTS - attempts} retry attempts.`);\n }\n else if (result.status === 'retryable') {\n diag.info(`Export failed after maximum retry attempts (${MAX_ATTEMPTS}).`);\n }\n else {\n diag.info(`Export failed with non-retryable error: ${result.error}`);\n }\n return result;\n }\n shutdown() {\n return this._transport.shutdown();\n }\n}\n/**\n * Creates an Exporter Transport that retries on 'retryable' response.\n */\nexport function createRetryingTransport(options) {\n return new RetryingTransport(options.transport);\n}\n//# sourceMappingURL=retrying-transport.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport function isExportHTTPErrorRetryable(statusCode) {\n return (statusCode === 429 ||\n statusCode === 502 ||\n statusCode === 503 ||\n statusCode === 504);\n}\nexport function parseRetryAfterToMills(retryAfter) {\n if (retryAfter == null) {\n return undefined;\n }\n const seconds = Number.parseInt(retryAfter, 10);\n if (Number.isInteger(seconds)) {\n return seconds > 0 ? seconds * 1000 : -1;\n }\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After#directives\n const delay = new Date(retryAfter).getTime() - Date.now();\n if (delay >= 0) {\n return delay;\n }\n return 0;\n}\n//# sourceMappingURL=is-export-retryable.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\nimport { isExportHTTPErrorRetryable, parseRetryAfterToMills, } from '../is-export-retryable';\n/**\n * Maximum total body size for concurrent keepalive requests.\n * Browsers enforce a 64KiB cumulative limit across all pending keepalive requests.\n * We use 60KB to leave headroom for headers.\n * @see https://github.com/whatwg/fetch/issues/679\n * @see https://blog.huli.tw/2025/01/06/en/navigator-sendbeacon-64kib-and-source-code/\n */\nconst MAX_KEEPALIVE_BODY_SIZE = 60 * 1024;\n/**\n * Maximum concurrent keepalive requests.\n * Chrome enforces 9 concurrent keepalive fetch requests per renderer process.\n * @see https://github.com/whatwg/fetch/issues/679\n * Quote: \"If the renderer process is processing more than 9 requests with keepalive set, we reject a new request\"\n */\nconst MAX_KEEPALIVE_REQUESTS = 9;\n/**\n * Track cumulative pending body size across all in-flight keepalive requests.\n * This is necessary because the 64KiB limit is cumulative, not per-request.\n */\nlet pendingBodySize = 0;\n/**\n * Track number of pending keepalive requests.\n */\nlet pendingKeepaliveCount = 0;\nclass FetchTransport {\n _parameters;\n constructor(parameters) {\n this._parameters = parameters;\n }\n async send(data, timeoutMillis) {\n const abortController = new AbortController();\n const timeout = setTimeout(() => abortController.abort(), timeoutMillis);\n // Fetch API may be wrapped by an instrumentation like `@opentelemetry/instrumentation-fetch`.\n // In that case the instrumentation would create a new Span for this request\n // because the context manager cannot keep the context after `await` calls.\n // This creates an indirect endless loop Export -> Span -> Export\n // By using the `__original` function the instrumentation can't intercept the call\n // and no Span will be created breaking the vicious cycle\n let fetchApi = globalThis.fetch;\n // @ts-expect-error -- fetch could be wrapped\n if (typeof fetchApi.__original === 'function') {\n // @ts-expect-error -- fetch could be wrapped\n fetchApi = fetchApi.__original;\n }\n const requestSize = data.byteLength;\n // Determine if we can use keepalive based on cumulative browser limits.\n // We must check BEFORE adding to pending totals to avoid exceeding limits.\n const wouldExceedSize = pendingBodySize + requestSize > MAX_KEEPALIVE_BODY_SIZE;\n const wouldExceedCount = pendingKeepaliveCount >= MAX_KEEPALIVE_REQUESTS;\n const useKeepalive = !wouldExceedSize && !wouldExceedCount;\n if (useKeepalive) {\n pendingBodySize += requestSize;\n pendingKeepaliveCount++;\n }\n else {\n const reason = wouldExceedSize ? 'size limit' : 'count limit';\n diag.debug(`keepalive disabled: ${(requestSize / 1024).toFixed(1)}KB payload, ${pendingKeepaliveCount} pending (${reason})`);\n }\n try {\n const url = new URL(this._parameters.url);\n const response = await fetchApi(url.href, {\n method: 'POST',\n headers: await this._parameters.headers(),\n body: data,\n signal: abortController.signal,\n keepalive: useKeepalive,\n mode: globalThis.location\n ? globalThis.location.origin === url.origin\n ? 'same-origin'\n : 'cors'\n : 'no-cors',\n });\n if (response.status >= 200 && response.status <= 299) {\n diag.debug(`export response success (status: ${response.status})`);\n return { status: 'success' };\n }\n else if (isExportHTTPErrorRetryable(response.status)) {\n diag.warn(`export response retryable (status: ${response.status})`);\n const retryAfter = response.headers.get('Retry-After');\n const retryInMillis = parseRetryAfterToMills(retryAfter);\n return { status: 'retryable', retryInMillis };\n }\n diag.error(`export response failure (status: ${response.status})`);\n return {\n status: 'failure',\n error: new Error(`Fetch request failed with non-retryable status ${response.status}`),\n };\n }\n catch (error) {\n if (isFetchNetworkErrorRetryable(error)) {\n diag.warn(`export request retryable (network error: ${error})`);\n return {\n status: 'retryable',\n error: new Error('Fetch request encountered a network error', {\n cause: error,\n }),\n };\n }\n diag.error(`export request failure (error: ${error})`);\n return {\n status: 'failure',\n error: new Error('Fetch request errored', { cause: error }),\n };\n }\n finally {\n clearTimeout(timeout);\n if (useKeepalive) {\n pendingBodySize -= requestSize;\n pendingKeepaliveCount--;\n }\n }\n }\n shutdown() {\n // Intentionally left empty, nothing to do.\n }\n}\n/**\n * Creates an exporter transport that uses `fetch` to send the data\n * @param parameters applied to each request made by transport\n */\nexport function createFetchTransport(parameters) {\n return new FetchTransport(parameters);\n}\nfunction isFetchNetworkErrorRetryable(error) {\n return error instanceof TypeError && !error.cause;\n}\n//# sourceMappingURL=fetch-transport.js.map","import { createRetryingTransport } from './retrying-transport';\nimport { createOtlpNetworkExportDelegate } from './otlp-network-export-delegate';\nimport { createFetchTransport } from './transport/fetch-transport';\nexport function createOtlpFetchExportDelegate(options, serializer) {\n return createOtlpNetworkExportDelegate(options, serializer, createRetryingTransport({\n transport: createFetchTransport(options),\n }));\n}\n/**\n * @deprecated Use {@link createOtlpFetchExportDelegate} instead. Modern browsers use `fetch` with `keepAlive: true` when `sendBeacon` is used. Use a `fetch` polyfill that mimics this behavior to keep using `sendBeacon`.\n */\nexport function createOtlpSendBeaconExportDelegate(options, serializer) {\n return createOtlpFetchExportDelegate(options, serializer);\n}\n//# sourceMappingURL=otlp-browser-http-export-delegate.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\n/**\n * Parses headers from config leaving only those that have defined values\n * @param partialHeaders\n */\nexport function validateAndNormalizeHeaders(partialHeaders) {\n const headers = {};\n Object.entries(partialHeaders ?? {}).forEach(([key, value]) => {\n if (typeof value !== 'undefined') {\n headers[key] = String(value);\n }\n else {\n diag.warn(`Header \"${key}\" has invalid value (${value}) and will be ignored`);\n }\n });\n return headers;\n}\n//# sourceMappingURL=util.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { getSharedConfigurationDefaults, mergeOtlpSharedConfigurationWithDefaults, } from './shared-configuration';\nimport { validateAndNormalizeHeaders } from '../util';\nfunction mergeHeaders(userProvidedHeaders, fallbackHeaders, defaultHeaders) {\n return async () => {\n const requiredHeaders = {\n ...(await defaultHeaders()),\n };\n const headers = {};\n // add fallback ones first\n if (fallbackHeaders != null) {\n Object.assign(headers, await fallbackHeaders());\n }\n // override with user-provided ones\n if (userProvidedHeaders != null) {\n Object.assign(headers, validateAndNormalizeHeaders(await userProvidedHeaders()));\n }\n // override required ones.\n return Object.assign(headers, requiredHeaders);\n };\n}\nfunction validateUserProvidedUrl(url) {\n if (url == null) {\n return undefined;\n }\n try {\n // NOTE: In non-browser environments, `globalThis.location` will be `undefined`.\n const base = globalThis.location?.href;\n return new URL(url, base).href;\n }\n catch {\n throw new Error(`Configuration: Could not parse user-provided export URL: '${url}'`);\n }\n}\n/**\n * @param userProvidedConfiguration Configuration options provided by the user in code.\n * @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.\n * @param defaultConfiguration The defaults as defined by the exporter specification\n */\nexport function mergeOtlpHttpConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration) {\n return {\n ...mergeOtlpSharedConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration),\n headers: mergeHeaders(userProvidedConfiguration.headers, fallbackConfiguration.headers, defaultConfiguration.headers),\n url: validateUserProvidedUrl(userProvidedConfiguration.url) ??\n fallbackConfiguration.url ??\n defaultConfiguration.url,\n };\n}\nexport function getHttpConfigurationDefaults(requiredHeaders, signalResourcePath) {\n return {\n ...getSharedConfigurationDefaults(),\n headers: async () => requiredHeaders,\n url: 'http://localhost:4318/' + signalResourcePath,\n };\n}\n//# sourceMappingURL=otlp-http-configuration.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { wrapStaticHeadersInFunction } from './shared-configuration';\nexport function convertLegacyHeaders(config) {\n if (typeof config.headers === 'function') {\n return config.headers;\n }\n return wrapStaticHeadersInFunction(config.headers);\n}\n//# sourceMappingURL=convert-legacy-http-options.js.map","import { getHttpConfigurationDefaults, mergeOtlpHttpConfigurationWithDefaults, } from './otlp-http-configuration';\nimport { convertLegacyHeaders } from './convert-legacy-http-options';\n/**\n * @deprecated this will be removed in 2.0\n *\n * @param config\n * @param signalResourcePath\n * @param requiredHeaders\n */\nexport function convertLegacyBrowserHttpOptions(config, signalResourcePath, requiredHeaders) {\n return mergeOtlpHttpConfigurationWithDefaults({\n url: config.url,\n timeoutMillis: config.timeoutMillis,\n headers: convertLegacyHeaders(config),\n concurrencyLimit: config.concurrencyLimit,\n }, {}, // no fallback for browser case\n getHttpConfigurationDefaults(requiredHeaders, signalResourcePath));\n}\n//# sourceMappingURL=convert-legacy-browser-http-options.js.map","import { createOtlpFetchExportDelegate } from '../otlp-browser-http-export-delegate';\nimport { convertLegacyBrowserHttpOptions } from './convert-legacy-browser-http-options';\n/**\n * @deprecated\n * @param config\n * @param serializer\n * @param signalResourcePath\n * @param requiredHeaders\n */\nexport function createLegacyOtlpBrowserExportDelegate(config, serializer, signalResourcePath, requiredHeaders) {\n const options = convertLegacyBrowserHttpOptions(config, signalResourcePath, requiredHeaders);\n return createOtlpFetchExportDelegate(options, serializer);\n}\n//# sourceMappingURL=create-legacy-browser-delegate.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base';\nimport { JsonTraceSerializer } from '@opentelemetry/otlp-transformer';\nimport { createLegacyOtlpBrowserExportDelegate } from '@opentelemetry/otlp-exporter-base/browser-http';\n/**\n * Collector Trace Exporter for Web\n */\nexport class OTLPTraceExporter extends OTLPExporterBase {\n constructor(config = {}) {\n super(createLegacyOtlpBrowserExportDelegate(config, JsonTraceSerializer, 'v1/traces', { 'Content-Type': 'application/json' }));\n }\n}\n//# sourceMappingURL=OTLPTraceExporter.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n// Event name definitions\nexport const ExceptionEventName = 'exception';\n//# sourceMappingURL=enums.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag, SpanStatusCode } from '@opentelemetry/api';\nimport { addHrTimes, millisToHrTime, hrTime, hrTimeDuration, isAttributeValue, isTimeInput, isTimeInputHrTime, otperformance, sanitizeAttributes, } from '@opentelemetry/core';\nimport { ATTR_EXCEPTION_MESSAGE, ATTR_EXCEPTION_STACKTRACE, ATTR_EXCEPTION_TYPE, } from '@opentelemetry/semantic-conventions';\nimport { ExceptionEventName } from './enums';\n/**\n * This class represents a span.\n */\nexport class SpanImpl {\n // Below properties are included to implement ReadableSpan for export\n // purposes but are not intended to be written-to directly.\n _spanContext;\n kind;\n parentSpanContext;\n attributes = {};\n links = [];\n events = [];\n startTime;\n resource;\n instrumentationScope;\n _droppedAttributesCount = 0;\n _droppedEventsCount = 0;\n _droppedLinksCount = 0;\n _attributesCount = 0;\n name;\n status = {\n code: SpanStatusCode.UNSET,\n };\n endTime = [0, 0];\n _ended = false;\n _duration = [-1, -1];\n _spanProcessor;\n _spanLimits;\n _attributeValueLengthLimit;\n _recordEndMetrics;\n _performanceStartTime;\n _performanceOffset;\n _startTimeProvided;\n /**\n * Constructs a new SpanImpl instance.\n */\n constructor(opts) {\n const now = Date.now();\n this._spanContext = opts.spanContext;\n this._performanceStartTime = otperformance.now();\n this._performanceOffset =\n now - (this._performanceStartTime + otperformance.timeOrigin);\n this._startTimeProvided = opts.startTime != null;\n this._spanLimits = opts.spanLimits;\n this._attributeValueLengthLimit =\n this._spanLimits.attributeValueLengthLimit ?? 0;\n this._spanProcessor = opts.spanProcessor;\n this.name = opts.name;\n this.parentSpanContext = opts.parentSpanContext;\n this.kind = opts.kind;\n if (opts.links) {\n for (const link of opts.links) {\n this.addLink(link);\n }\n }\n this.startTime = this._getTime(opts.startTime ?? now);\n this.resource = opts.resource;\n this.instrumentationScope = opts.scope;\n this._recordEndMetrics = opts.recordEndMetrics;\n if (opts.attributes != null) {\n this.setAttributes(opts.attributes);\n }\n this._spanProcessor.onStart(this, opts.context);\n }\n spanContext() {\n return this._spanContext;\n }\n setAttribute(key, value) {\n if (value == null || this._isSpanEnded())\n return this;\n if (key.length === 0) {\n diag.warn(`Invalid attribute key: ${key}`);\n return this;\n }\n if (!isAttributeValue(value)) {\n diag.warn(`Invalid attribute value set for key: ${key}`);\n return this;\n }\n const { attributeCountLimit } = this._spanLimits;\n const isNewKey = !Object.prototype.hasOwnProperty.call(this.attributes, key);\n if (attributeCountLimit !== undefined &&\n this._attributesCount >= attributeCountLimit &&\n isNewKey) {\n this._droppedAttributesCount++;\n return this;\n }\n this.attributes[key] = this._truncateToSize(value);\n if (isNewKey) {\n this._attributesCount++;\n }\n return this;\n }\n setAttributes(attributes) {\n for (const key in attributes) {\n if (Object.prototype.hasOwnProperty.call(attributes, key)) {\n this.setAttribute(key, attributes[key]);\n }\n }\n return this;\n }\n /**\n *\n * @param name Span Name\n * @param [attributesOrStartTime] Span attributes or start time\n * if type is {@type TimeInput} and 3rd param is undefined\n * @param [timeStamp] Specified time stamp for the event\n */\n addEvent(name, attributesOrStartTime, timeStamp) {\n if (this._isSpanEnded())\n return this;\n const { eventCountLimit } = this._spanLimits;\n if (eventCountLimit === 0) {\n diag.warn('No events allowed.');\n this._droppedEventsCount++;\n return this;\n }\n if (eventCountLimit !== undefined &&\n this.events.length >= eventCountLimit) {\n if (this._droppedEventsCount === 0) {\n diag.debug('Dropping extra events.');\n }\n this.events.shift();\n this._droppedEventsCount++;\n }\n if (isTimeInput(attributesOrStartTime)) {\n if (!isTimeInput(timeStamp)) {\n timeStamp = attributesOrStartTime;\n }\n attributesOrStartTime = undefined;\n }\n const sanitized = sanitizeAttributes(attributesOrStartTime);\n const { attributePerEventCountLimit } = this._spanLimits;\n const attributes = {};\n let droppedAttributesCount = 0;\n let eventAttributesCount = 0;\n for (const attr in sanitized) {\n if (!Object.prototype.hasOwnProperty.call(sanitized, attr)) {\n continue;\n }\n const attrVal = sanitized[attr];\n if (attributePerEventCountLimit !== undefined &&\n eventAttributesCount >= attributePerEventCountLimit) {\n droppedAttributesCount++;\n continue;\n }\n attributes[attr] = this._truncateToSize(attrVal);\n eventAttributesCount++;\n }\n this.events.push({\n name,\n attributes,\n time: this._getTime(timeStamp),\n droppedAttributesCount,\n });\n return this;\n }\n addLink(link) {\n if (this._isSpanEnded())\n return this;\n const { linkCountLimit } = this._spanLimits;\n if (linkCountLimit === 0) {\n this._droppedLinksCount++;\n return this;\n }\n if (linkCountLimit !== undefined && this.links.length >= linkCountLimit) {\n if (this._droppedLinksCount === 0) {\n diag.debug('Dropping extra links.');\n }\n this.links.shift();\n this._droppedLinksCount++;\n }\n const { attributePerLinkCountLimit } = this._spanLimits;\n const sanitized = sanitizeAttributes(link.attributes);\n const attributes = {};\n let droppedAttributesCount = 0;\n let linkAttributesCount = 0;\n for (const attr in sanitized) {\n if (!Object.prototype.hasOwnProperty.call(sanitized, attr)) {\n continue;\n }\n const attrVal = sanitized[attr];\n if (attributePerLinkCountLimit !== undefined &&\n linkAttributesCount >= attributePerLinkCountLimit) {\n droppedAttributesCount++;\n continue;\n }\n attributes[attr] = this._truncateToSize(attrVal);\n linkAttributesCount++;\n }\n const processedLink = { context: link.context };\n if (linkAttributesCount > 0) {\n processedLink.attributes = attributes;\n }\n if (droppedAttributesCount > 0) {\n processedLink.droppedAttributesCount = droppedAttributesCount;\n }\n this.links.push(processedLink);\n return this;\n }\n addLinks(links) {\n for (const link of links) {\n this.addLink(link);\n }\n return this;\n }\n setStatus(status) {\n if (this._isSpanEnded())\n return this;\n if (status.code === SpanStatusCode.UNSET)\n return this;\n if (this.status.code === SpanStatusCode.OK)\n return this;\n const newStatus = { code: status.code };\n // When using try-catch, the caught \"error\" is of type `any`. When then assigning `any` to `status.message`,\n // TypeScript will not error. While this can happen during use of any API, it is more common on Span#setStatus()\n // as it's likely used in a catch-block. Therefore, we validate if `status.message` is actually a string, null, or\n // undefined to avoid an incorrect type causing issues downstream.\n if (status.code === SpanStatusCode.ERROR) {\n if (typeof status.message === 'string') {\n newStatus.message = status.message;\n }\n else if (status.message != null) {\n diag.warn(`Dropping invalid status.message of type '${typeof status.message}', expected 'string'`);\n }\n }\n this.status = newStatus;\n return this;\n }\n updateName(name) {\n if (this._isSpanEnded())\n return this;\n this.name = name;\n return this;\n }\n end(endTime) {\n if (this._isSpanEnded()) {\n diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);\n return;\n }\n this.endTime = this._getTime(endTime);\n this._duration = hrTimeDuration(this.startTime, this.endTime);\n if (this._duration[0] < 0) {\n diag.warn('Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.', this.startTime, this.endTime);\n this.endTime = this.startTime.slice();\n this._duration = [0, 0];\n }\n if (this._droppedEventsCount > 0) {\n diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`);\n }\n if (this._droppedLinksCount > 0) {\n diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`);\n }\n if (this._spanProcessor.onEnding) {\n this._spanProcessor.onEnding(this);\n }\n this._recordEndMetrics?.();\n this._ended = true;\n this._spanProcessor.onEnd(this);\n }\n _getTime(inp) {\n if (typeof inp === 'number' && inp <= otperformance.now()) {\n // must be a performance timestamp\n // apply correction and convert to hrtime\n return hrTime(inp + this._performanceOffset);\n }\n if (typeof inp === 'number') {\n return millisToHrTime(inp);\n }\n if (inp instanceof Date) {\n return millisToHrTime(inp.getTime());\n }\n if (isTimeInputHrTime(inp)) {\n return inp;\n }\n if (this._startTimeProvided) {\n // if user provided a time for the start manually\n // we can't use duration to calculate event/end times\n return millisToHrTime(Date.now());\n }\n const msDuration = otperformance.now() - this._performanceStartTime;\n return addHrTimes(this.startTime, millisToHrTime(msDuration));\n }\n isRecording() {\n return this._ended === false;\n }\n recordException(exception, time) {\n const attributes = {};\n if (typeof exception === 'string') {\n attributes[ATTR_EXCEPTION_MESSAGE] = exception;\n }\n else if (exception) {\n if (exception.code) {\n attributes[ATTR_EXCEPTION_TYPE] = exception.code.toString();\n }\n else if (exception.name) {\n attributes[ATTR_EXCEPTION_TYPE] = exception.name;\n }\n if (exception.message) {\n attributes[ATTR_EXCEPTION_MESSAGE] = exception.message;\n }\n if (exception.stack) {\n attributes[ATTR_EXCEPTION_STACKTRACE] = exception.stack;\n }\n }\n // these are minimum requirements from spec\n if (attributes[ATTR_EXCEPTION_TYPE] || attributes[ATTR_EXCEPTION_MESSAGE]) {\n this.addEvent(ExceptionEventName, attributes, time);\n }\n else {\n diag.warn(`Failed to record an exception ${exception}`);\n }\n }\n get duration() {\n return this._duration;\n }\n get ended() {\n return this._ended;\n }\n get droppedAttributesCount() {\n return this._droppedAttributesCount;\n }\n get droppedEventsCount() {\n return this._droppedEventsCount;\n }\n get droppedLinksCount() {\n return this._droppedLinksCount;\n }\n _isSpanEnded() {\n if (this._ended) {\n const error = new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);\n diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`, error);\n }\n return this._ended;\n }\n // Utility function to truncate given value within size\n // for value type of string, will truncate to given limit\n // for type of non-string, will return same value\n _truncateToLimitUtil(value, limit) {\n if (value.length <= limit) {\n return value;\n }\n return value.substring(0, limit);\n }\n /**\n * If the given attribute value is of type string and has more characters than given {@code attributeValueLengthLimit} then\n * return string with truncated to {@code attributeValueLengthLimit} characters\n *\n * If the given attribute value is array of strings then\n * return new array of strings with each element truncated to {@code attributeValueLengthLimit} characters\n *\n * Otherwise return same Attribute {@code value}\n *\n * @param value Attribute value\n * @returns truncated attribute value if required, otherwise same value\n */\n _truncateToSize(value) {\n const limit = this._attributeValueLengthLimit;\n // Check limit\n if (limit <= 0) {\n // Negative values are invalid, so do not truncate\n diag.warn(`Attribute value limit must be positive, got ${limit}`);\n return value;\n }\n // String\n if (typeof value === 'string') {\n return this._truncateToLimitUtil(value, limit);\n }\n // Array of strings\n if (Array.isArray(value)) {\n return value.map(val => typeof val === 'string' ? this._truncateToLimitUtil(val, limit) : val);\n }\n // Other types, no need to apply value length limit\n return value;\n }\n}\n//# sourceMappingURL=Span.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * A sampling decision that determines how a {@link Span} will be recorded\n * and collected.\n */\nexport var SamplingDecision;\n(function (SamplingDecision) {\n /**\n * `Span.isRecording() === false`, span will not be recorded and all events\n * and attributes will be dropped.\n */\n SamplingDecision[SamplingDecision[\"NOT_RECORD\"] = 0] = \"NOT_RECORD\";\n /**\n * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags}\n * MUST NOT be set.\n */\n SamplingDecision[SamplingDecision[\"RECORD\"] = 1] = \"RECORD\";\n /**\n * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags}\n * MUST be set.\n */\n SamplingDecision[SamplingDecision[\"RECORD_AND_SAMPLED\"] = 2] = \"RECORD_AND_SAMPLED\";\n})(SamplingDecision || (SamplingDecision = {}));\n//# sourceMappingURL=Sampler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { SamplingDecision } from '../Sampler';\n/** Sampler that samples no traces. */\nexport class AlwaysOffSampler {\n shouldSample() {\n return {\n decision: SamplingDecision.NOT_RECORD,\n };\n }\n toString() {\n return 'AlwaysOffSampler';\n }\n}\n//# sourceMappingURL=AlwaysOffSampler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { SamplingDecision } from '../Sampler';\n/** Sampler that samples all traces. */\nexport class AlwaysOnSampler {\n shouldSample() {\n return {\n decision: SamplingDecision.RECORD_AND_SAMPLED,\n };\n }\n toString() {\n return 'AlwaysOnSampler';\n }\n}\n//# sourceMappingURL=AlwaysOnSampler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { isSpanContextValid, TraceFlags, trace } from '@opentelemetry/api';\nimport { globalErrorHandler } from '@opentelemetry/core';\nimport { AlwaysOffSampler } from './AlwaysOffSampler';\nimport { AlwaysOnSampler } from './AlwaysOnSampler';\n/**\n * A composite sampler that either respects the parent span's sampling decision\n * or delegates to `delegateSampler` for root spans.\n */\nexport class ParentBasedSampler {\n _root;\n _remoteParentSampled;\n _remoteParentNotSampled;\n _localParentSampled;\n _localParentNotSampled;\n constructor(config) {\n this._root = config.root;\n if (!this._root) {\n globalErrorHandler(new Error('ParentBasedSampler must have a root sampler configured'));\n this._root = new AlwaysOnSampler();\n }\n this._remoteParentSampled =\n config.remoteParentSampled ?? new AlwaysOnSampler();\n this._remoteParentNotSampled =\n config.remoteParentNotSampled ?? new AlwaysOffSampler();\n this._localParentSampled =\n config.localParentSampled ?? new AlwaysOnSampler();\n this._localParentNotSampled =\n config.localParentNotSampled ?? new AlwaysOffSampler();\n }\n shouldSample(context, traceId, spanName, spanKind, attributes, links) {\n const parentContext = trace.getSpanContext(context);\n if (!parentContext || !isSpanContextValid(parentContext)) {\n return this._root.shouldSample(context, traceId, spanName, spanKind, attributes, links);\n }\n if (parentContext.isRemote) {\n if (parentContext.traceFlags & TraceFlags.SAMPLED) {\n return this._remoteParentSampled.shouldSample(context, traceId, spanName, spanKind, attributes, links);\n }\n return this._remoteParentNotSampled.shouldSample(context, traceId, spanName, spanKind, attributes, links);\n }\n if (parentContext.traceFlags & TraceFlags.SAMPLED) {\n return this._localParentSampled.shouldSample(context, traceId, spanName, spanKind, attributes, links);\n }\n return this._localParentNotSampled.shouldSample(context, traceId, spanName, spanKind, attributes, links);\n }\n toString() {\n return `ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`;\n }\n}\n//# sourceMappingURL=ParentBasedSampler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { isValidTraceId } from '@opentelemetry/api';\nimport { SamplingDecision } from '../Sampler';\n/** Sampler that samples a given fraction of traces based of trace id deterministically. */\nexport class TraceIdRatioBasedSampler {\n _ratio;\n _upperBound;\n constructor(ratio = 0) {\n this._ratio = this._normalize(ratio);\n this._upperBound = Math.floor(this._ratio * 0xffffffff);\n }\n shouldSample(context, traceId) {\n return {\n decision: isValidTraceId(traceId) && this._accumulate(traceId) < this._upperBound\n ? SamplingDecision.RECORD_AND_SAMPLED\n : SamplingDecision.NOT_RECORD,\n };\n }\n toString() {\n return `TraceIdRatioBased{${this._ratio}}`;\n }\n _normalize(ratio) {\n if (typeof ratio !== 'number' || isNaN(ratio))\n return 0;\n return ratio >= 1 ? 1 : ratio <= 0 ? 0 : ratio;\n }\n _accumulate(traceId) {\n let accumulation = 0;\n for (let i = 0; i < 32; i += 8) {\n let part = 0;\n for (let j = 0; j < 8; j++) {\n const c = traceId.charCodeAt(i + j);\n // Convert hex char code to value: '0'-'9' -> 0-9, 'a'-'f' -> 10-15, 'A'-'F' -> 10-15\n const v = c < 58 ? c - 48 : c < 71 ? c - 55 : c - 87;\n part = (part << 4) | v;\n }\n accumulation = (accumulation ^ part) >>> 0;\n }\n return accumulation;\n }\n}\n//# sourceMappingURL=TraceIdRatioBasedSampler.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\nimport { getNumberFromEnv, getStringFromEnv } from '@opentelemetry/core';\nimport { AlwaysOffSampler } from './sampler/AlwaysOffSampler';\nimport { AlwaysOnSampler } from './sampler/AlwaysOnSampler';\nimport { ParentBasedSampler } from './sampler/ParentBasedSampler';\nimport { TraceIdRatioBasedSampler } from './sampler/TraceIdRatioBasedSampler';\nvar TracesSamplerValues;\n(function (TracesSamplerValues) {\n TracesSamplerValues[\"AlwaysOff\"] = \"always_off\";\n TracesSamplerValues[\"AlwaysOn\"] = \"always_on\";\n TracesSamplerValues[\"ParentBasedAlwaysOff\"] = \"parentbased_always_off\";\n TracesSamplerValues[\"ParentBasedAlwaysOn\"] = \"parentbased_always_on\";\n TracesSamplerValues[\"ParentBasedTraceIdRatio\"] = \"parentbased_traceidratio\";\n TracesSamplerValues[\"TraceIdRatio\"] = \"traceidratio\";\n})(TracesSamplerValues || (TracesSamplerValues = {}));\nconst DEFAULT_RATIO = 1;\n/**\n * Load default configuration. For fields with primitive values, any user-provided\n * value will override the corresponding default value. For fields with\n * non-primitive values (like `spanLimits`), the user-provided value will be\n * used to extend the default value.\n */\n// object needs to be wrapped in this function and called when needed otherwise\n// envs are parsed before tests are ran - causes tests using these envs to fail\nexport function loadDefaultConfig() {\n return {\n sampler: buildSamplerFromEnv(),\n forceFlushTimeoutMillis: 30000,\n generalLimits: {\n attributeValueLengthLimit: getNumberFromEnv('OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT') ?? Infinity,\n attributeCountLimit: getNumberFromEnv('OTEL_ATTRIBUTE_COUNT_LIMIT') ?? 128,\n },\n spanLimits: {\n attributeValueLengthLimit: getNumberFromEnv('OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT') ?? Infinity,\n attributeCountLimit: getNumberFromEnv('OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT') ?? 128,\n linkCountLimit: getNumberFromEnv('OTEL_SPAN_LINK_COUNT_LIMIT') ?? 128,\n eventCountLimit: getNumberFromEnv('OTEL_SPAN_EVENT_COUNT_LIMIT') ?? 128,\n attributePerEventCountLimit: getNumberFromEnv('OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT') ?? 128,\n attributePerLinkCountLimit: getNumberFromEnv('OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT') ?? 128,\n },\n };\n}\n/**\n * Based on environment, builds a sampler, complies with specification.\n */\nexport function buildSamplerFromEnv() {\n const sampler = getStringFromEnv('OTEL_TRACES_SAMPLER') ??\n TracesSamplerValues.ParentBasedAlwaysOn;\n switch (sampler) {\n case TracesSamplerValues.AlwaysOn:\n return new AlwaysOnSampler();\n case TracesSamplerValues.AlwaysOff:\n return new AlwaysOffSampler();\n case TracesSamplerValues.ParentBasedAlwaysOn:\n return new ParentBasedSampler({\n root: new AlwaysOnSampler(),\n });\n case TracesSamplerValues.ParentBasedAlwaysOff:\n return new ParentBasedSampler({\n root: new AlwaysOffSampler(),\n });\n case TracesSamplerValues.TraceIdRatio:\n return new TraceIdRatioBasedSampler(getSamplerProbabilityFromEnv());\n case TracesSamplerValues.ParentBasedTraceIdRatio:\n return new ParentBasedSampler({\n root: new TraceIdRatioBasedSampler(getSamplerProbabilityFromEnv()),\n });\n default:\n diag.error(`OTEL_TRACES_SAMPLER value \"${sampler}\" invalid, defaulting to \"${TracesSamplerValues.ParentBasedAlwaysOn}\".`);\n return new ParentBasedSampler({\n root: new AlwaysOnSampler(),\n });\n }\n}\nfunction getSamplerProbabilityFromEnv() {\n const probability = getNumberFromEnv('OTEL_TRACES_SAMPLER_ARG');\n if (probability == null) {\n diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${DEFAULT_RATIO}.`);\n return DEFAULT_RATIO;\n }\n if (probability < 0 || probability > 1) {\n diag.error(`OTEL_TRACES_SAMPLER_ARG=${probability} was given, but it is out of range ([0..1]), defaulting to ${DEFAULT_RATIO}.`);\n return DEFAULT_RATIO;\n }\n return probability;\n}\n//# sourceMappingURL=config.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { buildSamplerFromEnv, loadDefaultConfig } from './config';\nimport { getNumberFromEnv } from '@opentelemetry/core';\nexport const DEFAULT_ATTRIBUTE_COUNT_LIMIT = 128;\nexport const DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT = Infinity;\n/**\n * Function to merge Default configuration (as specified in './config') with\n * user provided configurations.\n */\nexport function mergeConfig(userConfig) {\n const perInstanceDefaults = {\n sampler: buildSamplerFromEnv(),\n };\n const DEFAULT_CONFIG = loadDefaultConfig();\n const target = Object.assign({}, DEFAULT_CONFIG, perInstanceDefaults, userConfig);\n target.generalLimits = Object.assign({}, DEFAULT_CONFIG.generalLimits, userConfig.generalLimits || {});\n target.spanLimits = Object.assign({}, DEFAULT_CONFIG.spanLimits, userConfig.spanLimits || {});\n return target;\n}\n/**\n * When general limits are provided and model specific limits are not,\n * configures the model specific limits by using the values from the general ones.\n * @param userConfig User provided tracer configuration\n */\nexport function reconfigureLimits(userConfig) {\n const spanLimits = Object.assign({}, userConfig.spanLimits);\n /**\n * Reassign span attribute count limit to use first non null value defined by user or use default value\n */\n spanLimits.attributeCountLimit =\n userConfig.spanLimits?.attributeCountLimit ??\n userConfig.generalLimits?.attributeCountLimit ??\n getNumberFromEnv('OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT') ??\n getNumberFromEnv('OTEL_ATTRIBUTE_COUNT_LIMIT') ??\n DEFAULT_ATTRIBUTE_COUNT_LIMIT;\n /**\n * Reassign span attribute value length limit to use first non null value defined by user or use default value\n */\n spanLimits.attributeValueLengthLimit =\n userConfig.spanLimits?.attributeValueLengthLimit ??\n userConfig.generalLimits?.attributeValueLengthLimit ??\n getNumberFromEnv('OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT') ??\n getNumberFromEnv('OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT') ??\n DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT;\n return Object.assign({}, userConfig, { spanLimits });\n}\n//# sourceMappingURL=utility.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { context, diag, TraceFlags } from '@opentelemetry/api';\nimport { BindOnceFuture, ExportResultCode, getNumberFromEnv, globalErrorHandler, suppressTracing, } from '@opentelemetry/core';\n/**\n * Implementation of the {@link SpanProcessor} that batches spans exported by\n * the SDK then pushes them to the exporter pipeline.\n */\nexport class BatchSpanProcessorBase {\n _maxExportBatchSize;\n _maxQueueSize;\n _scheduledDelayMillis;\n _exportTimeoutMillis;\n _exporter;\n _isExporting = false;\n _finishedSpans = [];\n _timer;\n _shutdownOnce;\n _droppedSpansCount = 0;\n constructor(exporter, config) {\n this._exporter = exporter;\n this._maxExportBatchSize =\n typeof config?.maxExportBatchSize === 'number'\n ? config.maxExportBatchSize\n : (getNumberFromEnv('OTEL_BSP_MAX_EXPORT_BATCH_SIZE') ?? 512);\n this._maxQueueSize =\n typeof config?.maxQueueSize === 'number'\n ? config.maxQueueSize\n : (getNumberFromEnv('OTEL_BSP_MAX_QUEUE_SIZE') ?? 2048);\n this._scheduledDelayMillis =\n typeof config?.scheduledDelayMillis === 'number'\n ? config.scheduledDelayMillis\n : (getNumberFromEnv('OTEL_BSP_SCHEDULE_DELAY') ?? 5000);\n this._exportTimeoutMillis =\n typeof config?.exportTimeoutMillis === 'number'\n ? config.exportTimeoutMillis\n : (getNumberFromEnv('OTEL_BSP_EXPORT_TIMEOUT') ?? 30000);\n this._shutdownOnce = new BindOnceFuture(this._shutdown, this);\n if (this._maxExportBatchSize > this._maxQueueSize) {\n diag.warn('BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize');\n this._maxExportBatchSize = this._maxQueueSize;\n }\n }\n forceFlush() {\n if (this._shutdownOnce.isCalled) {\n return this._shutdownOnce.promise;\n }\n return this._flushAll();\n }\n // does nothing.\n onStart(_span, _parentContext) { }\n onEnd(span) {\n if (this._shutdownOnce.isCalled) {\n return;\n }\n if ((span.spanContext().traceFlags & TraceFlags.SAMPLED) === 0) {\n return;\n }\n this._addToBuffer(span);\n }\n shutdown() {\n return this._shutdownOnce.call();\n }\n _shutdown() {\n return Promise.resolve()\n .then(() => {\n return this.onShutdown();\n })\n .then(() => {\n return this._flushAll();\n })\n .then(() => {\n return this._exporter.shutdown();\n });\n }\n /** Add a span in the buffer. */\n _addToBuffer(span) {\n if (this._finishedSpans.length >= this._maxQueueSize) {\n // limit reached, drop span\n if (this._droppedSpansCount === 0) {\n diag.debug('maxQueueSize reached, dropping spans');\n }\n this._droppedSpansCount++;\n return;\n }\n if (this._droppedSpansCount > 0) {\n // some spans were dropped, log once with count of spans dropped\n diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`);\n this._droppedSpansCount = 0;\n }\n this._finishedSpans.push(span);\n this._maybeStartTimer();\n }\n /**\n * Send all spans to the exporter respecting the batch size limit\n * This function is used only on forceFlush or shutdown,\n * for all other cases _flush should be used\n * */\n _flushAll() {\n return new Promise((resolve, reject) => {\n const promises = [];\n // calculate number of batches\n const count = Math.ceil(this._finishedSpans.length / this._maxExportBatchSize);\n for (let i = 0, j = count; i < j; i++) {\n promises.push(this._flushOneBatch());\n }\n Promise.all(promises)\n .then(() => {\n resolve();\n })\n .catch(reject);\n });\n }\n _flushOneBatch() {\n this._clearTimer();\n if (this._finishedSpans.length === 0) {\n return Promise.resolve();\n }\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => {\n // don't wait anymore for export, this way the next batch can start\n reject(new Error('Timeout'));\n }, this._exportTimeoutMillis);\n // prevent downstream exporter calls from generating spans\n context.with(suppressTracing(context.active()), () => {\n // Reset the finished spans buffer here because the next invocations of the _flush method\n // could pass the same finished spans to the exporter if the buffer is cleared\n // outside the execution of this callback.\n let spans;\n if (this._finishedSpans.length <= this._maxExportBatchSize) {\n spans = this._finishedSpans;\n this._finishedSpans = [];\n }\n else {\n spans = this._finishedSpans.splice(0, this._maxExportBatchSize);\n }\n const doExport = () => this._exporter.export(spans, result => {\n clearTimeout(timer);\n if (result.code === ExportResultCode.SUCCESS) {\n resolve();\n }\n else {\n reject(result.error ??\n new Error('BatchSpanProcessor: span export failed'));\n }\n });\n let pendingResources = null;\n for (let i = 0, len = spans.length; i < len; i++) {\n const span = spans[i];\n if (span.resource.asyncAttributesPending &&\n span.resource.waitForAsyncAttributes) {\n pendingResources ??= [];\n pendingResources.push(span.resource.waitForAsyncAttributes());\n }\n }\n // Avoid scheduling a promise to make the behavior more predictable and easier to test\n if (pendingResources === null) {\n doExport();\n }\n else {\n Promise.all(pendingResources).then(doExport, err => {\n globalErrorHandler(err);\n reject(err);\n });\n }\n });\n });\n }\n _maybeStartTimer() {\n if (this._isExporting)\n return;\n const flush = () => {\n this._isExporting = true;\n this._flushOneBatch()\n .finally(() => {\n this._isExporting = false;\n if (this._finishedSpans.length > 0) {\n this._clearTimer();\n this._maybeStartTimer();\n }\n })\n .catch(e => {\n this._isExporting = false;\n globalErrorHandler(e);\n });\n };\n // we only wait if the queue doesn't have enough elements yet\n if (this._finishedSpans.length >= this._maxExportBatchSize) {\n return flush();\n }\n if (this._timer !== undefined)\n return;\n this._timer = setTimeout(() => flush(), this._scheduledDelayMillis);\n // depending on runtime, this may be a 'number' or NodeJS.Timeout\n if (typeof this._timer !== 'number') {\n this._timer.unref();\n }\n }\n _clearTimer() {\n if (this._timer !== undefined) {\n clearTimeout(this._timer);\n this._timer = undefined;\n }\n }\n}\n//# sourceMappingURL=BatchSpanProcessorBase.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { BatchSpanProcessorBase } from '../../../export/BatchSpanProcessorBase';\nimport { globalErrorHandler } from '@opentelemetry/core';\nexport class BatchSpanProcessor extends BatchSpanProcessorBase {\n _visibilityChangeListener;\n _pageHideListener;\n constructor(_exporter, config) {\n super(_exporter, config);\n this.onInit(config);\n }\n onInit(config) {\n if (config?.disableAutoFlushOnDocumentHide !== true &&\n typeof document !== 'undefined') {\n this._visibilityChangeListener = () => {\n if (document.visibilityState === 'hidden') {\n this.forceFlush().catch(error => {\n globalErrorHandler(error);\n });\n }\n };\n this._pageHideListener = () => {\n this.forceFlush().catch(error => {\n globalErrorHandler(error);\n });\n };\n document.addEventListener('visibilitychange', this._visibilityChangeListener);\n // use 'pagehide' event as a fallback for Safari; see https://bugs.webkit.org/show_bug.cgi?id=116769\n document.addEventListener('pagehide', this._pageHideListener);\n }\n }\n onShutdown() {\n if (typeof document !== 'undefined') {\n if (this._visibilityChangeListener) {\n document.removeEventListener('visibilitychange', this._visibilityChangeListener);\n }\n if (this._pageHideListener) {\n document.removeEventListener('pagehide', this._pageHideListener);\n }\n }\n }\n}\n//# sourceMappingURL=BatchSpanProcessor.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nconst TRACE_ID_BYTES = 16;\nconst SPAN_ID_BYTES = 8;\nconst TRACE_BUFFER = new Uint8Array(TRACE_ID_BYTES);\nconst SPAN_BUFFER = new Uint8Array(SPAN_ID_BYTES);\n// Byte-to-hex lookup is faster than toString(16) in browsers\nconst HEX = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * Fills buffer with random bytes, ensuring at least one is non-zero\n * per W3C Trace Context spec.\n */\nfunction randomFill(buf) {\n for (let i = 0; i < buf.length; i++) {\n buf[i] = (Math.random() * 256) >>> 0;\n }\n // Ensure non-zero\n for (let i = 0; i < buf.length; i++) {\n if (buf[i] > 0)\n return;\n }\n buf[buf.length - 1] = 1;\n}\nfunction toHex(buf) {\n let hex = '';\n for (let i = 0; i < buf.length; i++) {\n hex += HEX[buf[i]];\n }\n return hex;\n}\nexport class RandomIdGenerator {\n /**\n * Returns a random 16-byte trace ID formatted/encoded as a 32 lowercase hex\n * characters corresponding to 128 bits.\n */\n generateTraceId() {\n randomFill(TRACE_BUFFER);\n return toHex(TRACE_BUFFER);\n }\n /**\n * Returns a random 8-byte span ID formatted/encoded as a 16 lowercase hex\n * characters corresponding to 64 bits.\n */\n generateSpanId() {\n randomFill(SPAN_BUFFER);\n return toHex(SPAN_BUFFER);\n }\n}\n//# sourceMappingURL=RandomIdGenerator.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n/**\n * Determines whether the span has a parent span, and if so, [whether it is a remote parent](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote)\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_OTEL_SPAN_PARENT_ORIGIN = 'otel.span.parent.origin';\n/**\n * The result value of the sampler for this span\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_OTEL_SPAN_SAMPLING_RESULT = 'otel.span.sampling_result';\n/**\n * The number of created spans with `recording=true` for which the end operation has not been called yet.\n *\n * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const METRIC_OTEL_SDK_SPAN_LIVE = 'otel.sdk.span.live';\n/**\n * The number of created spans.\n *\n * @note Implementations **MUST** record this metric for all spans, even for non-recording ones.\n *\n * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const METRIC_OTEL_SDK_SPAN_STARTED = 'otel.sdk.span.started';\n//# sourceMappingURL=semconv.js.map","import { SamplingDecision } from './Sampler';\nimport { ATTR_OTEL_SPAN_PARENT_ORIGIN, ATTR_OTEL_SPAN_SAMPLING_RESULT, METRIC_OTEL_SDK_SPAN_LIVE, METRIC_OTEL_SDK_SPAN_STARTED, } from './semconv';\n/**\n * Generates `otel.sdk.span.*` metrics.\n * https://opentelemetry.io/docs/specs/semconv/otel/sdk-metrics/#span-metrics\n */\nexport class TracerMetrics {\n startedSpans;\n liveSpans;\n constructor(meter) {\n this.startedSpans = meter.createCounter(METRIC_OTEL_SDK_SPAN_STARTED, {\n unit: '{span}',\n description: 'The number of created spans.',\n });\n this.liveSpans = meter.createUpDownCounter(METRIC_OTEL_SDK_SPAN_LIVE, {\n unit: '{span}',\n description: 'The number of currently live spans.',\n });\n }\n startSpan(parentSpanCtx, samplingDecision) {\n const samplingDecisionStr = samplingDecisionToString(samplingDecision);\n this.startedSpans.add(1, {\n [ATTR_OTEL_SPAN_PARENT_ORIGIN]: parentOrigin(parentSpanCtx),\n [ATTR_OTEL_SPAN_SAMPLING_RESULT]: samplingDecisionStr,\n });\n if (samplingDecision === SamplingDecision.NOT_RECORD) {\n return () => { };\n }\n const liveSpanAttributes = {\n [ATTR_OTEL_SPAN_SAMPLING_RESULT]: samplingDecisionStr,\n };\n this.liveSpans.add(1, liveSpanAttributes);\n return () => {\n this.liveSpans.add(-1, liveSpanAttributes);\n };\n }\n}\nfunction parentOrigin(parentSpanContext) {\n if (!parentSpanContext) {\n return 'none';\n }\n if (parentSpanContext.isRemote) {\n return 'remote';\n }\n return 'local';\n}\nfunction samplingDecisionToString(decision) {\n switch (decision) {\n case SamplingDecision.RECORD_AND_SAMPLED:\n return 'RECORD_AND_SAMPLE';\n case SamplingDecision.RECORD:\n return 'RECORD_ONLY';\n case SamplingDecision.NOT_RECORD:\n return 'DROP';\n }\n}\n//# sourceMappingURL=TracerMetrics.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '2.7.1';\n//# sourceMappingURL=version.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport * as api from '@opentelemetry/api';\nimport { sanitizeAttributes, isTracingSuppressed } from '@opentelemetry/core';\nimport { SpanImpl } from './Span';\nimport { mergeConfig } from './utility';\nimport { RandomIdGenerator } from './platform';\nimport { TracerMetrics } from './TracerMetrics';\nimport { VERSION } from './version';\n/**\n * This class represents a basic tracer.\n */\nexport class Tracer {\n _sampler;\n _generalLimits;\n _spanLimits;\n _idGenerator;\n instrumentationScope;\n _resource;\n _spanProcessor;\n _tracerMetrics;\n /**\n * Constructs a new Tracer instance.\n */\n constructor(instrumentationScope, config, resource, spanProcessor) {\n const localConfig = mergeConfig(config);\n this._sampler = localConfig.sampler;\n this._generalLimits = localConfig.generalLimits;\n this._spanLimits = localConfig.spanLimits;\n this._idGenerator = config.idGenerator || new RandomIdGenerator();\n this._resource = resource;\n this._spanProcessor = spanProcessor;\n this.instrumentationScope = instrumentationScope;\n const meter = localConfig.meterProvider\n ? localConfig.meterProvider.getMeter('@opentelemetry/sdk-trace', VERSION)\n : api.createNoopMeter();\n this._tracerMetrics = new TracerMetrics(meter);\n }\n /**\n * Starts a new Span or returns the default NoopSpan based on the sampling\n * decision.\n */\n startSpan(name, options = {}, context = api.context.active()) {\n // remove span from context in case a root span is requested via options\n if (options.root) {\n context = api.trace.deleteSpan(context);\n }\n const parentSpan = api.trace.getSpan(context);\n if (isTracingSuppressed(context)) {\n api.diag.debug('Instrumentation suppressed, returning Noop Span');\n const nonRecordingSpan = api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT);\n return nonRecordingSpan;\n }\n const parentSpanContext = parentSpan?.spanContext();\n const spanId = this._idGenerator.generateSpanId();\n let validParentSpanContext;\n let traceId;\n let traceState;\n if (!parentSpanContext ||\n !api.trace.isSpanContextValid(parentSpanContext)) {\n // New root span.\n traceId = this._idGenerator.generateTraceId();\n }\n else {\n // New child span.\n traceId = parentSpanContext.traceId;\n traceState = parentSpanContext.traceState;\n validParentSpanContext = parentSpanContext;\n }\n const spanKind = options.kind ?? api.SpanKind.INTERNAL;\n const links = (options.links ?? []).map(link => {\n return {\n context: link.context,\n attributes: sanitizeAttributes(link.attributes),\n };\n });\n const attributes = sanitizeAttributes(options.attributes);\n // make sampling decision\n const samplingResult = this._sampler.shouldSample(context, traceId, name, spanKind, attributes, links);\n const recordEndMetrics = this._tracerMetrics.startSpan(parentSpanContext, samplingResult.decision);\n traceState = samplingResult.traceState ?? traceState;\n const traceFlags = samplingResult.decision === api.SamplingDecision.RECORD_AND_SAMPLED\n ? api.TraceFlags.SAMPLED\n : api.TraceFlags.NONE;\n const spanContext = { traceId, spanId, traceFlags, traceState };\n if (samplingResult.decision === api.SamplingDecision.NOT_RECORD) {\n api.diag.debug('Recording is off, propagating context in a non-recording span');\n const nonRecordingSpan = api.trace.wrapSpanContext(spanContext);\n return nonRecordingSpan;\n }\n // Set initial span attributes. The attributes object may have been mutated\n // by the sampler, so we sanitize the merged attributes before setting them.\n const initAttributes = sanitizeAttributes(Object.assign(attributes, samplingResult.attributes));\n const span = new SpanImpl({\n resource: this._resource,\n scope: this.instrumentationScope,\n context,\n spanContext,\n name,\n kind: spanKind,\n links,\n parentSpanContext: validParentSpanContext,\n attributes: initAttributes,\n startTime: options.startTime,\n spanProcessor: this._spanProcessor,\n spanLimits: this._spanLimits,\n recordEndMetrics,\n });\n return span;\n }\n startActiveSpan(name, arg2, arg3, arg4) {\n let opts;\n let ctx;\n let fn;\n if (arguments.length < 2) {\n return;\n }\n else if (arguments.length === 2) {\n fn = arg2;\n }\n else if (arguments.length === 3) {\n opts = arg2;\n fn = arg3;\n }\n else {\n opts = arg2;\n ctx = arg3;\n fn = arg4;\n }\n const parentContext = ctx ?? api.context.active();\n const span = this.startSpan(name, opts, parentContext);\n const contextWithSpanSet = api.trace.setSpan(parentContext, span);\n return api.context.with(contextWithSpanSet, fn, undefined, span);\n }\n /** Returns the active {@link GeneralLimits}. */\n getGeneralLimits() {\n return this._generalLimits;\n }\n /** Returns the active {@link SpanLimits}. */\n getSpanLimits() {\n return this._spanLimits;\n }\n}\n//# sourceMappingURL=Tracer.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { globalErrorHandler } from '@opentelemetry/core';\n/**\n * Implementation of the {@link SpanProcessor} that simply forwards all\n * received events to a list of {@link SpanProcessor}s.\n */\nexport class MultiSpanProcessor {\n _spanProcessors;\n constructor(spanProcessors) {\n this._spanProcessors = spanProcessors;\n }\n forceFlush() {\n const promises = [];\n for (const spanProcessor of this._spanProcessors) {\n promises.push(spanProcessor.forceFlush());\n }\n return new Promise(resolve => {\n Promise.all(promises)\n .then(() => {\n resolve();\n })\n .catch(error => {\n globalErrorHandler(error || new Error('MultiSpanProcessor: forceFlush failed'));\n resolve();\n });\n });\n }\n onStart(span, context) {\n for (const spanProcessor of this._spanProcessors) {\n spanProcessor.onStart(span, context);\n }\n }\n onEnding(span) {\n for (const spanProcessor of this._spanProcessors) {\n if (spanProcessor.onEnding) {\n spanProcessor.onEnding(span);\n }\n }\n }\n onEnd(span) {\n for (const spanProcessor of this._spanProcessors) {\n spanProcessor.onEnd(span);\n }\n }\n shutdown() {\n const promises = [];\n for (const spanProcessor of this._spanProcessors) {\n promises.push(spanProcessor.shutdown());\n }\n return new Promise((resolve, reject) => {\n Promise.all(promises).then(() => {\n resolve();\n }, reject);\n });\n }\n}\n//# sourceMappingURL=MultiSpanProcessor.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { merge } from '@opentelemetry/core';\nimport { defaultResource } from '@opentelemetry/resources';\nimport { Tracer } from './Tracer';\nimport { loadDefaultConfig } from './config';\nimport { MultiSpanProcessor } from './MultiSpanProcessor';\nimport { reconfigureLimits } from './utility';\nexport var ForceFlushState;\n(function (ForceFlushState) {\n ForceFlushState[ForceFlushState[\"resolved\"] = 0] = \"resolved\";\n ForceFlushState[ForceFlushState[\"timeout\"] = 1] = \"timeout\";\n ForceFlushState[ForceFlushState[\"error\"] = 2] = \"error\";\n ForceFlushState[ForceFlushState[\"unresolved\"] = 3] = \"unresolved\";\n})(ForceFlushState || (ForceFlushState = {}));\n/**\n * This class represents a basic tracer provider which platform libraries can extend\n */\nexport class BasicTracerProvider {\n _config;\n _tracers = new Map();\n _resource;\n _activeSpanProcessor;\n constructor(config = {}) {\n const mergedConfig = merge({}, loadDefaultConfig(), reconfigureLimits(config));\n this._resource = mergedConfig.resource ?? defaultResource();\n this._config = Object.assign({}, mergedConfig, {\n resource: this._resource,\n });\n const spanProcessors = [];\n if (config.spanProcessors?.length) {\n spanProcessors.push(...config.spanProcessors);\n }\n this._activeSpanProcessor = new MultiSpanProcessor(spanProcessors);\n }\n getTracer(name, version, options) {\n const key = `${name}@${version || ''}:${options?.schemaUrl || ''}`;\n if (!this._tracers.has(key)) {\n this._tracers.set(key, new Tracer({ name, version, schemaUrl: options?.schemaUrl }, this._config, this._resource, this._activeSpanProcessor));\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._tracers.get(key);\n }\n forceFlush() {\n const timeout = this._config.forceFlushTimeoutMillis;\n const promises = this._activeSpanProcessor['_spanProcessors'].map((spanProcessor) => {\n return new Promise(resolve => {\n let state;\n const timeoutInterval = setTimeout(() => {\n resolve(new Error(`Span processor did not completed within timeout period of ${timeout} ms`));\n state = ForceFlushState.timeout;\n }, timeout);\n spanProcessor\n .forceFlush()\n .then(() => {\n clearTimeout(timeoutInterval);\n if (state !== ForceFlushState.timeout) {\n state = ForceFlushState.resolved;\n resolve(state);\n }\n })\n .catch(error => {\n clearTimeout(timeoutInterval);\n state = ForceFlushState.error;\n resolve(error);\n });\n });\n });\n return new Promise((resolve, reject) => {\n Promise.all(promises)\n .then(results => {\n const errors = results.filter(result => result !== ForceFlushState.resolved);\n if (errors.length > 0) {\n reject(errors);\n }\n else {\n resolve();\n }\n })\n .catch(error => reject([error]));\n });\n }\n shutdown() {\n return this._activeSpanProcessor.shutdown();\n }\n}\n//# sourceMappingURL=BasicTracerProvider.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { TraceFlags } from '@opentelemetry/api';\nimport { internal, ExportResultCode, globalErrorHandler, BindOnceFuture, } from '@opentelemetry/core';\n/**\n * An implementation of the {@link SpanProcessor} that converts the {@link Span}\n * to {@link ReadableSpan} and passes it to the configured exporter.\n *\n * Only spans that are sampled are converted.\n *\n * NOTE: This {@link SpanProcessor} exports every ended span individually instead of batching spans together, which causes significant performance overhead with most exporters. For production use, please consider using the {@link BatchSpanProcessor} instead.\n */\nexport class SimpleSpanProcessor {\n _exporter;\n _shutdownOnce;\n _pendingExports;\n constructor(exporter) {\n this._exporter = exporter;\n this._shutdownOnce = new BindOnceFuture(this._shutdown, this);\n this._pendingExports = new Set();\n }\n async forceFlush() {\n await Promise.all(Array.from(this._pendingExports));\n if (this._exporter.forceFlush) {\n await this._exporter.forceFlush();\n }\n }\n onStart(_span, _parentContext) { }\n onEnd(span) {\n if (this._shutdownOnce.isCalled) {\n return;\n }\n if ((span.spanContext().traceFlags & TraceFlags.SAMPLED) === 0) {\n return;\n }\n const pendingExport = this._doExport(span).catch(err => globalErrorHandler(err));\n // Enqueue this export to the pending list so it can be flushed by the user.\n this._pendingExports.add(pendingExport);\n void pendingExport.finally(() => this._pendingExports.delete(pendingExport));\n }\n async _doExport(span) {\n if (span.resource.asyncAttributesPending) {\n // Ensure resource is fully resolved before exporting.\n await span.resource.waitForAsyncAttributes?.();\n }\n const result = await internal._export(this._exporter, [span]);\n if (result.code !== ExportResultCode.SUCCESS) {\n throw (result.error ??\n new Error(`SimpleSpanProcessor: span export failed (status ${result})`));\n }\n }\n shutdown() {\n return this._shutdownOnce.call();\n }\n _shutdown() {\n return this._exporter.shutdown();\n }\n}\n//# sourceMappingURL=SimpleSpanProcessor.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ROOT_CONTEXT } from '@opentelemetry/api';\n/**\n * Stack Context Manager for managing the state in web\n * it doesn't fully support the async calls though\n */\nexport class StackContextManager {\n /**\n * whether the context manager is enabled or not\n */\n _enabled = false;\n /**\n * Keeps the reference to current context\n */\n _currentContext = ROOT_CONTEXT;\n /**\n *\n * @param context\n * @param target Function to be executed within the context\n */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n _bindFunction(context = ROOT_CONTEXT, target) {\n const manager = this;\n const contextWrapper = function (...args) {\n return manager.with(context, () => target.apply(this, args));\n };\n Object.defineProperty(contextWrapper, 'length', {\n enumerable: false,\n configurable: true,\n writable: false,\n value: target.length,\n });\n return contextWrapper;\n }\n /**\n * Returns the active context\n */\n active() {\n return this._currentContext;\n }\n /**\n * Binds a the certain context or the active one to the target function and then returns the target\n * @param context A context (span) to be bind to target\n * @param target a function or event emitter. When target or one of its callbacks is called,\n * the provided context will be used as the active context for the duration of the call.\n */\n bind(context, target) {\n // if no specific context to propagate is given, we use the current one\n if (context === undefined) {\n context = this.active();\n }\n if (typeof target === 'function') {\n return this._bindFunction(context, target);\n }\n return target;\n }\n /**\n * Disable the context manager (clears the current context)\n */\n disable() {\n this._currentContext = ROOT_CONTEXT;\n this._enabled = false;\n return this;\n }\n /**\n * Enables the context manager and creates a default(root) context\n */\n enable() {\n if (this._enabled) {\n return this;\n }\n this._enabled = true;\n this._currentContext = ROOT_CONTEXT;\n return this;\n }\n /**\n * Calls the callback function [fn] with the provided [context]. If [context] is undefined then it will use the window.\n * The context will be set as active\n * @param context\n * @param fn Callback function\n * @param thisArg optional receiver to be used for calling fn\n * @param args optional arguments forwarded to fn\n */\n with(context, fn, thisArg, ...args) {\n const previousContext = this._currentContext;\n this._currentContext = context || ROOT_CONTEXT;\n try {\n return fn.call(thisArg, ...args);\n }\n finally {\n this._currentContext = previousContext;\n }\n }\n}\n//# sourceMappingURL=StackContextManager.js.map","/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { BasicTracerProvider } from '@opentelemetry/sdk-trace-base';\nimport { StackContextManager } from './StackContextManager';\nimport { trace, context, propagation } from '@opentelemetry/api';\nimport { CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator, } from '@opentelemetry/core';\nfunction setupContextManager(contextManager) {\n // null means 'do not register'\n if (contextManager === null) {\n return;\n }\n // undefined means 'register default'\n if (contextManager === undefined) {\n const defaultContextManager = new StackContextManager();\n defaultContextManager.enable();\n context.setGlobalContextManager(defaultContextManager);\n return;\n }\n contextManager.enable();\n context.setGlobalContextManager(contextManager);\n}\nfunction setupPropagator(propagator) {\n // null means 'do not register'\n if (propagator === null) {\n return;\n }\n // undefined means 'register default'\n if (propagator === undefined) {\n propagation.setGlobalPropagator(new CompositePropagator({\n propagators: [\n new W3CTraceContextPropagator(),\n new W3CBaggagePropagator(),\n ],\n }));\n return;\n }\n propagation.setGlobalPropagator(propagator);\n}\n/**\n * This class represents a web tracer with {@link StackContextManager}\n */\nexport class WebTracerProvider extends BasicTracerProvider {\n /**\n * Constructs a new Tracer instance.\n * @param config Web Tracer config\n */\n constructor(config = {}) {\n super(config);\n }\n /**\n * Register this TracerProvider for use with the OpenTelemetry API.\n * Undefined values may be replaced with defaults, and\n * null values will be skipped.\n *\n * @param config Configuration object for SDK registration\n */\n register(config = {}) {\n trace.setGlobalTracerProvider(this);\n setupPropagator(config.propagator);\n setupContextManager(config.contextManager);\n }\n}\n//# sourceMappingURL=WebTracerProvider.js.map","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\nexport interface ActionTargetOptions {\n actionNameAttribute?: string;\n nameCollection?: 'explicit' | 'text';\n}\n\nexport interface ActionTargetSnapshot {\n name: string;\n nameSource: 'explicit' | 'accessible_name' | 'text' | 'fallback';\n tag: string;\n /** ::shadow 分隔各自根节点内唯一的 selector;它不是标准 CSS 组合符。 */\n selector?: string;\n path?: string[];\n width?: number;\n height?: number;\n x?: number;\n y?: number;\n}\n\nconst DEFAULT_NAME_ATTRIBUTE = 'data-bk-action-name';\nconst MAX_NAME_LENGTH = 100;\nconst MAX_DEPTH = 20;\nconst MAX_SELECTOR_LENGTH = 512;\nconst MAX_PATH_LENGTH = 2048;\nconst STABLE_ATTRIBUTES = ['data-testid', 'data-test', 'data-qa', 'data-cy', DEFAULT_NAME_ATTRIBUTE];\nconst normalize = (text: string) => text.replace(/\\s+/g, ' ').trim().slice(0, MAX_NAME_LENGTH);\n\nconst parentElement = (element: Element): Element | null => {\n // 隐私与命名沿组合树祖先查询,包含分配到 slot 的节点。\n // selector 构造仍沿各自实际根节点内的 DOM 结构定位。\n if (element.assignedSlot) return element.assignedSlot;\n if (element.parentElement) return element.parentElement;\n const root = element.getRootNode();\n return 'host' in root ? (root as ShadowRoot).host : null;\n};\n\nconst isHidden = (element: Element): boolean => {\n if (element.hasAttribute('hidden') || element.getAttribute('data-bk-privacy') === 'hidden') return true;\n const style = element.ownerDocument.defaultView?.getComputedStyle(element);\n return style?.display === 'none' || style?.visibility === 'hidden' || style?.visibility === 'collapse';\n};\n\nconst hasHiddenAncestor = (element: Element): boolean => {\n for (let current: Element | null = element; current; current = parentElement(current)) {\n if (isHidden(current)) return true;\n }\n return false;\n};\n\nconst blocksText = (element: Element): boolean =>\n isHidden(element) || element.getAttribute('aria-hidden') === 'true' || element.getAttribute('data-bk-privacy') === 'mask' ||\n /^(INPUT|TEXTAREA|SELECT)$/.test(element.tagName) ||\n element.getAttribute('contenteditable') !== null && element.getAttribute('contenteditable') !== 'false';\n\nconst hasTextBlockedAncestor = (element: Element): boolean => {\n for (let current: Element | null = element; current; current = parentElement(current)) {\n if (blocksText(current)) return true;\n }\n return false;\n};\n\nconst safeText = (element: Element): string => {\n if (hasTextBlockedAncestor(element)) return '';\n const queue: Node[] = [element];\n let text = '';\n let visited = 0;\n // 同时限制遍历开销和输出长度,读取文本前先跳过隐私子树。\n while (queue.length && visited++ < 200 && text.length < MAX_NAME_LENGTH * 4) {\n const node = queue.pop()!;\n if (node.nodeType === 3) {\n const textParent = (node as Text).assignedSlot ?? node.parentElement;\n if (textParent && !hasTextBlockedAncestor(textParent)) text += node.textContent ?? '';\n }\n else if (node.nodeType === 1 && !hasTextBlockedAncestor(node as Element)) {\n for (let i = node.childNodes.length - 1; i >= 0; i -= 1) queue.push(node.childNodes[i]!);\n }\n }\n return normalize(text);\n};\n\nconst collectName = (target: Element, options: ActionTargetOptions): Pick<ActionTargetSnapshot, 'name' | 'nameSource'> => {\n const attributes = options.actionNameAttribute ? [options.actionNameAttribute, DEFAULT_NAME_ATTRIBUTE] : [DEFAULT_NAME_ATTRIBUTE];\n let depth = 0;\n for (let current: Element | null = target; current && depth++ < MAX_DEPTH; current = parentElement(current)) {\n for (const attribute of attributes) {\n const explicitName = normalize(current.getAttribute(attribute) ?? '');\n if (explicitName) return { name: explicitName, nameSource: 'explicit' };\n }\n }\n if (options.nameCollection === 'text') {\n let automaticNameBlocked = false;\n for (let current: Element | null = target; current; current = parentElement(current)) {\n if (current.getAttribute('data-bk-privacy') === 'mask' || current.getAttribute('aria-hidden') === 'true' ||\n current.getAttribute('contenteditable') !== null && current.getAttribute('contenteditable') !== 'false') automaticNameBlocked = true;\n }\n if (!automaticNameBlocked) {\n depth = 0;\n for (let current: Element | null = target; current && depth++ < MAX_DEPTH; current = parentElement(current)) {\n if (/^(FORM|BODY|HTML|HEAD)$/.test(current.tagName)) break;\n // aria-hidden 可能只是可见装饰图标,不应因此丢掉整个点击。\n if (current.getAttribute('aria-hidden') === 'true') continue;\n const root = current.getRootNode() as Document | ShadowRoot;\n const labelledBy = (current.getAttribute('aria-labelledby') ?? '').split(/\\s+/).filter(Boolean).slice(0, 10)\n .map(id => root.getElementById?.(id)).filter((element): element is HTMLElement => !!element)\n .map(safeText).filter(Boolean).join(' ');\n const labels = 'labels' in current ? Array.from((current as HTMLInputElement).labels ?? []).slice(0, 10).map(safeText).filter(Boolean).join(' ') : '';\n const accessibleName = normalize(labelledBy || current.getAttribute('aria-label') || labels || current.getAttribute('alt') || current.getAttribute('title') || '');\n if (accessibleName) return { name: accessibleName, nameSource: 'accessible_name' };\n }\n const text = safeText(target);\n if (text) return { name: text, nameSource: 'text' };\n }\n }\n return { name: target.tagName.toLowerCase(), nameSource: 'fallback' };\n};\n\nconst escapeIdentifier = (value: string): string => {\n // 按码点转义,兼容没有 CSS.escape 的环境。\n return Array.from(value, character => `\\\\${character.codePointAt(0)!.toString(16)} `).join('');\n};\n\nconst cssIdentifier = (element: Element, value: string): string =>\n element.ownerDocument.defaultView?.CSS?.escape(value) ?? escapeIdentifier(value);\n\nconst attributeSelector = (element: Element, attribute: string): string | undefined => {\n const value = element.getAttribute(attribute);\n if (!value || value.length > 128 || /[\\u0000-\\u001f\\u007f]/.test(value)) return undefined;\n return `[${cssIdentifier(element, attribute)}=\"${value.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"')}\"]`;\n};\n\nconst stableId = (id: string): boolean =>\n !!id && id.length <= 128 && !/\\d{3}|[a-f0-9]{8}|[:\\s\\u0000-\\u001f\\u007f]/i.test(id);\n\nconst isMasked = (element: Element): boolean => {\n for (let current: Element | null = element; current; current = parentElement(current)) {\n if (current.getAttribute('data-bk-privacy') === 'mask') return true;\n }\n return false;\n};\n\nconst localSelector = (target: Element, root: Document | ShadowRoot, options: ActionTargetOptions): string | undefined => {\n const nameAttributes = [DEFAULT_NAME_ATTRIBUTE, ...(options.actionNameAttribute ? [options.actionNameAttribute] : [])];\n let suffix = '';\n let depth = 0;\n for (let current: Element | null = target; current && depth++ < MAX_DEPTH; current = current.parentElement) {\n const tag = cssIdentifier(current, current.tagName.toLowerCase());\n let position = 1;\n for (let sibling = current.previousElementSibling; sibling; sibling = sibling.previousElementSibling) {\n if (sibling.tagName === current.tagName) position += 1;\n }\n const structural = `${tag}:nth-of-type(${position})`;\n const masked = isMasked(current);\n // Only an explicitly provided Action label can escape node masking. Other IDs and\n // data attributes can contain user data, so masked nodes use structural selectors.\n const attributes = masked ? nameAttributes : [...STABLE_ATTRIBUTES, ...nameAttributes];\n const candidates = attributes.map(attribute => attributeSelector(current!, attribute)).filter((value): value is string => !!value);\n if (!masked && stableId(current.id)) candidates.push(`#${cssIdentifier(current, current.id)}`);\n candidates.push(structural);\n for (const candidate of candidates) {\n const selector = suffix ? `${candidate} > ${suffix}` : candidate;\n if (selector.length > MAX_SELECTOR_LENGTH) continue;\n const matches = root.querySelectorAll(selector);\n if (matches.length === 1 && matches[0] === target) return selector;\n }\n suffix = suffix ? `${structural} > ${suffix}` : structural;\n if (suffix.length > MAX_SELECTOR_LENGTH) return undefined;\n }\n return undefined;\n};\n\nconst captureSelector = (target: Element, options: ActionTargetOptions): string | undefined => {\n if (!target.isConnected) return undefined;\n const segments: string[] = [];\n let current = target;\n for (let depth = 0; depth < MAX_DEPTH; depth += 1) {\n const root = current.getRootNode() as Document | ShadowRoot;\n const selector = localSelector(current, root, options);\n if (!selector) return undefined;\n segments.unshift(selector);\n const complete = segments.join(' ::shadow ');\n if (complete.length > MAX_SELECTOR_LENGTH) return undefined;\n if (!('host' in root)) return complete;\n current = root.host;\n }\n return undefined;\n};\n\n/** 隐藏/隐私目标返回 undefined,调用方应跳过整个自动 Action。 */\nexport const captureActionTarget = (target: Element, event: Event, options: ActionTargetOptions = {}): ActionTargetSnapshot | undefined => {\n if (hasHiddenAncestor(target)) return undefined;\n const snapshot: ActionTargetSnapshot = { ...collectName(target, options), tag: target.tagName.toLowerCase() };\n const selector = captureSelector(target, options);\n if (selector) snapshot.selector = selector;\n const path: string[] = [];\n let pathLength = 0;\n for (const item of event.composedPath?.() ?? [target]) {\n if ((item as Node).nodeType !== 1 || hasHiddenAncestor(item as Element)) continue;\n const part = item === target ? selector : captureSelector(item as Element, options);\n if (!part) continue;\n if (path.length === 10 || pathLength + part.length > MAX_PATH_LENGTH) break;\n path.push(part);\n pathLength += part.length;\n }\n if (path.length) snapshot.path = path;\n const rect = target.getBoundingClientRect();\n if (Number.isFinite(rect.width)) snapshot.width = rect.width;\n if (Number.isFinite(rect.height)) snapshot.height = rect.height;\n const mouse = event as MouseEvent;\n // 键盘激活没有鼠标位置,事件中的零坐标只是占位值。\n const keyboardClick = mouse.detail === 0 && mouse.clientX === 0 && mouse.clientY === 0;\n if (!keyboardClick && Number.isFinite(mouse.clientX) && Number.isFinite(rect.left)) snapshot.x = mouse.clientX - rect.left;\n if (!keyboardClick && Number.isFinite(mouse.clientY) && Number.isFinite(rect.top)) snapshot.y = mouse.clientY - rect.top;\n return snapshot;\n};\n\nexport const getActionNameFromElement = (target: Element, actionNameAttribute = DEFAULT_NAME_ATTRIBUTE, includeText = false): string => {\n if (hasHiddenAncestor(target)) return target.tagName.toLowerCase();\n return collectName(target, { actionNameAttribute, nameCollection: includeText ? 'text' : 'explicit' }).name;\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\nconst eventTimes = new WeakMap<Event, number>();\n\n/**\n * Session、Action 和 View 使用同一事件时刻。休眠时 performance.timeOrigin 与墙上时间可能漂移,\n * 因此用当前时间减去事件已流逝时间换算;缓存同一个 Event,避免监听器之间毫秒取整的偏差。\n */\nexport const getEventEpochTime = (event: Event): number => {\n const cached = eventTimes.get(event);\n if (cached !== undefined) return cached;\n const now = Date.now();\n const timestamp = event.timeStamp;\n let occurredAt = now;\n if (Number.isFinite(timestamp) && timestamp > 0) {\n if (timestamp > 1_000_000_000_000) {\n occurredAt = Math.min(now, timestamp);\n } else if (typeof performance !== 'undefined' && typeof performance.now === 'function') {\n const elapsed = performance.now() - timestamp;\n if (Number.isFinite(elapsed) && elapsed >= 0) occurredAt = now - elapsed;\n }\n }\n // Session 历史边界与 OTLP 时间转换统一使用整数 epoch 毫秒,避免浮点回算落到边界前。\n occurredAt = Math.floor(occurredAt);\n eventTimes.set(event, occurredAt);\n return occurredAt;\n};\n\n/** Event.timeStamp 在现代浏览器中直接属于 Performance 时钟,不经墙钟回算。 */\nexport const getEventRelativeTime = (event: Event): number => {\n const now = typeof performance !== 'undefined' && typeof performance.now === 'function' ? performance.now() : 0;\n const timestamp = event.timeStamp;\n if (Number.isFinite(timestamp) && timestamp >= 0 && timestamp < 1_000_000_000_000) {\n return Math.min(now, timestamp);\n }\n return Math.max(0, now - (Date.now() - getEventEpochTime(event)));\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n/**\n * 生成随机 ID。优先用 `crypto.randomUUID`(standards-compliant UUID v4),不可用时回退到\n * `${prefix}-${timestamp}-${rand}` 形式。\n *\n * 注意:fallback 实现使用 Math.random,**不是密码学安全**,仅适用于设备/会话/事件标识等场景,\n * 不要复用此函数生成 token、CSRF 防护等安全相关的值。\n */\nexport const createRandomId = (prefix: string) => {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n return crypto.randomUUID();\n }\n return `${prefix}-${Date.now()}-${Math.random().toString(16).slice(2)}`;\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport type { BkOTUrlMatcher, ResolvedBkOTConfig } from './config';\n\n// 与浏览器 Fetch/XHR 使用同一个文档基准,包含页面目录和 <base href>。\nconst getBaseUrl = () =>\n (typeof document !== 'undefined' && document.baseURI) ||\n (typeof window !== 'undefined' && (window.location.href || window.location.origin)) ||\n 'http://localhost';\n\nexport const toAbsoluteUrl = (url: string) => {\n try {\n return new URL(url, getBaseUrl()).href;\n } catch {\n return url;\n }\n};\n\nconst DYNAMIC_PATH_SEGMENT = /^(?:\\d+|[0-9a-f]{8}-[0-9a-f-]{27,}|[0-9a-f]{16,})$/i;\n\n/**\n * 常见数字 ID、UUID 和长十六进制段统一折叠为 :id,便于服务端按路由聚合。\n * 同时服务 `view.url_template`(页面路由)与 `url.template`(请求路径)两个维度。\n */\nexport const normalizeUrlPathTemplate = (pathGroup: string) => {\n const path = pathGroup.split(/[?#]/, 1)[0];\n return path\n .split('/')\n .map(segment => (DYNAMIC_PATH_SEGMENT.test(segment) ? ':id' : segment))\n .join('/');\n};\n\n// 去掉 trailing slash,便于 path 边界对齐比较\nconst stripTrailingSlash = (value: string) => (value.length > 1 ? value.replace(/\\/+$/, '') : value);\n\n// 比较两个 URL 是否指向同一资源(忽略 query/fragment 与末尾斜杠)\nconst isSameResource = (left: string, right: string) => {\n const stripped = (value: string) => stripTrailingSlash(value.replace(/[?#].*$/, ''));\n return stripped(left) === stripped(right);\n};\n\nexport const isBkOTEndpoint = (config: ResolvedBkOTConfig, url: string) => {\n const targetUrl = toAbsoluteUrl(url);\n return isSameResource(targetUrl, toAbsoluteUrl(config.transport.endpoint));\n};\n\nexport const shouldIgnoreUrl = (config: ResolvedBkOTConfig, url: string) => isBkOTEndpoint(config, url);\n\nconst matchesUrl = (matcher: BkOTUrlMatcher, url: string) => {\n if (typeof matcher === 'function') return matcher(url);\n if (typeof matcher === 'string') return url.includes(matcher);\n matcher.lastIndex = 0;\n return matcher.test(url);\n};\n\nexport const matchesUrlList = (matchers: BkOTUrlMatcher | BkOTUrlMatcher[] | undefined, url: string) =>\n (Array.isArray(matchers) ? matchers : matchers ? [matchers] : []).some(matcher => matchesUrl(matcher, url));\n\nconst getRequestConfig = (config: ResolvedBkOTConfig) =>\n typeof config.tracking.request === 'object' ? config.tracking.request : undefined;\n\nexport const shouldIgnoreRequest = (config: ResolvedBkOTConfig, url: string) =>\n shouldIgnoreUrl(config, url) || matchesUrlList(getRequestConfig(config)?.excludedUrls, toAbsoluteUrl(url));\n\n// 注入规则是信任边界,不能复用 excludedUrls 的子串匹配:query 中出现可信 URL 不代表目标可信。\n// 字符串必须是绝对 HTTP(S) URL,仅表达 origin 与路径段;query/hash 条件请显式使用函数。\nconst matchesTracingUrl = (matcher: BkOTUrlMatcher, url: string) => {\n if (typeof matcher !== 'string') return matchesUrl(matcher, url);\n try {\n const allowed = new URL(matcher);\n const target = new URL(url);\n if (\n !['http:', 'https:'].includes(allowed.protocol) ||\n allowed.username || allowed.password || allowed.search || allowed.hash ||\n allowed.origin !== target.origin\n ) return false;\n const path = stripTrailingSlash(allowed.pathname);\n return path === '/' || target.pathname === path || target.pathname.startsWith(`${path}/`);\n } catch {\n return false;\n }\n};\n\n// Trace Header 仅向显式白名单注入,避免同源第三方路径被无意注入以及跨域 CORS 预检。\nexport const shouldPropagateTraceHeader = (config: ResolvedBkOTConfig, url: string) => {\n const allowed = getRequestConfig(config)?.allowedTracingUrls;\n const target = toAbsoluteUrl(url);\n return (Array.isArray(allowed) ? allowed : allowed ? [allowed] : []).some(matcher => matchesTracingUrl(matcher, target));\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n/**\n * RUM 上报字段 key 集中定义。\n *\n * 插件里不要散落硬编码字符串,后续字段命名调整只改这里,避免采集端与字段文档逐步漂移。\n */\nexport const RUM_ATTRIBUTES = {\n actionFrustrationType: 'action.frustration.type',\n actionId: 'action.id',\n actionIds: 'action.ids',\n actionEndReason: 'action.end_reason',\n actionLoadingTime: 'action.loading_time',\n actionName: 'action.name',\n actionNameSource: 'action.name_source',\n actionPositionX: 'action.position.x',\n actionPositionY: 'action.position.y',\n actionTargetHeight: 'action.target.height',\n actionTargetName: 'action.target.name',\n actionTargetPath: 'action.target.path',\n actionTargetSelector: 'action.target.selector',\n actionTargetTag: 'action.target.tag',\n actionTargetWidth: 'action.target.width',\n actionType: 'action.type',\n deploymentEnvironmentName: 'deployment.environment.name',\n cacheHit: 'resource.cache.hit',\n deviceType: 'device.type',\n longTaskBlockingDuration: 'long_task.blocking_duration',\n longTaskEntryType: 'long_task.entry_type',\n longTaskId: 'long_task.id',\n networkEffectiveType: 'network.effective_type',\n networkStatus: 'network.status',\n nextHopProtocol: 'resource.protocol',\n resourceInitiatorType: 'resource.initiator_type',\n outcomeType: 'outcome.type',\n resourceTimingConnectEnd: 'resource.timing.connect_end',\n resourceTimingConnectStart: 'resource.timing.connect_start',\n resourceTimingDomainLookupEnd: 'resource.timing.domain_lookup_end',\n resourceTimingDomainLookupStart: 'resource.timing.domain_lookup_start',\n resourceTimingFetchStart: 'resource.timing.fetch_start',\n resourceTimingFinalResponseHeadersStart: 'resource.timing.final_response_headers_start',\n resourceTimingRedirectEnd: 'resource.timing.redirect_end',\n resourceTimingRedirectStart: 'resource.timing.redirect_start',\n resourceTimingRequestStart: 'resource.timing.request_start',\n resourceTimingResponseEnd: 'resource.timing.response_end',\n resourceTimingResponseStart: 'resource.timing.response_start',\n resourceTimingSecureConnectionStart: 'resource.timing.secure_connection_start',\n resourceTimingStartTime: 'resource.timing.start_time',\n resourceTimingWorkerCacheLookupStart: 'resource.timing.worker_cache_lookup_start',\n resourceTimingWorkerFinalRouterSource: 'resource.timing.worker_final_router_source',\n resourceTimingWorkerMatchedRouterSource: 'resource.timing.worker_matched_router_source',\n resourceTimingWorkerRouterEvaluationStart: 'resource.timing.worker_router_evaluation_start',\n resourceTimingWorkerStart: 'resource.timing.worker_start',\n serviceName: 'service.name',\n serviceVersion: 'service.version',\n sessionHasReplay: 'session.has_replay',\n sessionId: 'session.id',\n sessionStartTime: 'session.start_time',\n sessionLastActivityTime: 'session.last_activity_time',\n sessionSampleRate: 'session.sample_rate',\n sessionPhase: 'session.phase',\n sessionType: 'session.type',\n spanType: 'span_type',\n tabId: 'tab.id',\n timingActivationStart: 'timing.activation_start',\n timingConnectEnd: 'timing.connect_end',\n timingConnectStart: 'timing.connect_start',\n timingDomContentLoadedEventEnd: 'timing.dom_content_loaded_event_end',\n timingDomContentLoadedEventStart: 'timing.dom_content_loaded_event_start',\n timingDomainLookupEnd: 'timing.domain_lookup_end',\n timingDomainLookupStart: 'timing.domain_lookup_start',\n timingFetchStart: 'timing.fetch_start',\n timingFinalResponseHeadersStart: 'timing.final_response_headers_start',\n timingLoadEventEnd: 'timing.load_event_end',\n timingLoadEventStart: 'timing.load_event_start',\n timingRedirectEnd: 'timing.redirect_end',\n timingRedirectStart: 'timing.redirect_start',\n timingRequestStart: 'timing.request_start',\n timingResponseEnd: 'timing.response_end',\n timingResponseStart: 'timing.response_start',\n timingSecureConnectionStart: 'timing.secure_connection_start',\n timingStartTime: 'timing.start_time',\n timingUnloadEventEnd: 'timing.unload_event_end',\n timingUnloadEventStart: 'timing.unload_event_start',\n timingWorkerCacheLookupStart: 'timing.worker_cache_lookup_start',\n timingWorkerRouterEvaluationStart: 'timing.worker_router_evaluation_start',\n timingWorkerStart: 'timing.worker_start',\n userId: 'user.id',\n userAgentName: 'user_agent.name',\n userAgentOsName: 'user_agent.os.name',\n userAgentVersion: 'user_agent.version',\n vitalMetric: 'vital.metric',\n vitalId: 'vital.id',\n vitalScope: 'vital.scope',\n vitalValue: 'vital.value',\n vitalVersion: 'vital.version',\n viewDomComplete: 'view.dom_complete',\n viewDomContentLoaded: 'view.dom_content_loaded',\n viewDomInteractive: 'view.dom_interactive',\n viewFirstByte: 'view.first_byte',\n viewEndReason: 'view.end_reason',\n viewForegroundTime: 'view.foreground_time',\n viewId: 'view.id',\n viewIsActive: 'view.is_active',\n viewLoadEvent: 'view.load_event',\n viewLoadingTime: 'view.loading_time',\n viewLoadingTimeSource: 'view.loading_time_source',\n viewLoadingType: 'view.loading_type',\n viewName: 'view.name',\n viewPhase: 'view.phase',\n viewPageStates: 'view.page_states',\n viewPrevious: 'view.previous',\n viewPreviousUrlTemplate: 'view.previous_url_template',\n viewReferrer: 'view.referrer',\n viewStartedAt: 'view.started_at',\n viewTimeSpent: 'view.time_spent',\n viewUrl: 'view.url',\n viewUrlTemplate: 'view.url_template',\n viewVersion: 'view.version',\n websocketPhase: 'websocket.phase',\n} as const;\n\nexport type RumAttributeKey = (typeof RUM_ATTRIBUTES)[keyof typeof RUM_ATTRIBUTES];\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\nimport { RUM_ATTRIBUTES } from './attributes';\n\nimport type { Attributes } from '@opentelemetry/api';\n\n// 所有插件通过同一分类模型生成检索字段,保证错误、资源、Action 等信号可按统一维度聚合。\nexport const RUM_SPAN_OUTCOME = {\n abort: 'abort',\n error: 'error',\n success: 'success',\n timeout: 'timeout',\n unknown: 'unknown',\n warning: 'warning',\n} as const;\n\nexport const RUM_SPAN_TYPE = {\n action: 'action',\n custom: 'custom',\n error: 'error',\n longTask: 'long_task',\n resource: 'resource',\n session: 'session',\n vital: 'vital',\n view: 'view',\n websocket: 'websocket',\n} as const;\n\nexport type RumRequestOutcome =\n | { error?: unknown; type: 'network_error' }\n | { error?: unknown; type: 'timeout' }\n | { statusCode?: number; type: 'response' }\n | { type: 'abort' };\n\nexport interface RumResourceSpanInput {\n initiatorType?: string;\n method?: string;\n outcome?: RumRequestOutcome;\n url: string;\n}\n\nexport interface RumSpanClassification {\n outcome?: RumSpanOutcome;\n spanType: RumSpanType;\n}\n\nexport type RumSpanOutcome = (typeof RUM_SPAN_OUTCOME)[keyof typeof RUM_SPAN_OUTCOME];\n\nexport type RumSpanType = (typeof RUM_SPAN_TYPE)[keyof typeof RUM_SPAN_TYPE];\n\ninterface RumSpanNameInput {\n attributes: Attributes;\n nameHint?: string;\n spanType: RumSpanType;\n}\n\nconst getStringAttribute = (attributes: Attributes, key: string) => {\n const value = attributes[key];\n return typeof value === 'string' && value.trim() ? value.trim() : undefined;\n};\n\n/**\n * 使用稳定的领域字段生成可读 Span 名称。唯一 ID、完整 URL、错误消息和数值不参与命名,避免抬高基数。\n */\nexport const buildRumSpanName = ({ attributes, nameHint, spanType }: RumSpanNameInput): string => {\n if (spanType === RUM_SPAN_TYPE.session) {\n const phase = getStringAttribute(attributes, RUM_ATTRIBUTES.sessionPhase);\n return phase ? `session.${phase}` : 'session';\n }\n if (spanType === RUM_SPAN_TYPE.view) {\n return (\n getStringAttribute(attributes, RUM_ATTRIBUTES.viewName) ??\n getStringAttribute(attributes, RUM_ATTRIBUTES.viewUrlTemplate) ??\n 'view'\n );\n }\n if (spanType === RUM_SPAN_TYPE.resource) {\n const method = getStringAttribute(attributes, 'http.request.method')?.toUpperCase();\n const urlTemplate = getStringAttribute(attributes, 'url.template');\n if (method && urlTemplate) return `${method} ${urlTemplate}`;\n const resourceType = getStringAttribute(attributes, 'resource.type');\n return resourceType ? `resource.${resourceType}` : 'resource';\n }\n if (spanType === RUM_SPAN_TYPE.action) {\n return (\n getStringAttribute(attributes, RUM_ATTRIBUTES.actionName) ??\n getStringAttribute(attributes, RUM_ATTRIBUTES.actionType) ??\n 'action'\n );\n }\n if (spanType === RUM_SPAN_TYPE.error) {\n const blankScreenReason = getStringAttribute(attributes, 'blank_screen.reason');\n if (blankScreenReason) return `blank_screen.${blankScreenReason}`;\n const cspDirective = getStringAttribute(attributes, 'csp.effective_directive');\n if (cspDirective) return `csp.${cspDirective}`;\n return nameHint?.trim() || getStringAttribute(attributes, 'error.source') || 'error';\n }\n if (spanType === RUM_SPAN_TYPE.vital) {\n return getStringAttribute(attributes, RUM_ATTRIBUTES.vitalMetric)?.toUpperCase() ?? 'vital';\n }\n if (spanType === RUM_SPAN_TYPE.longTask) {\n return getStringAttribute(attributes, RUM_ATTRIBUTES.longTaskEntryType) ?? 'long-task';\n }\n if (spanType === RUM_SPAN_TYPE.websocket) {\n const phase = getStringAttribute(attributes, RUM_ATTRIBUTES.websocketPhase);\n return phase ? `websocket.${phase}` : 'websocket';\n }\n if (spanType === RUM_SPAN_TYPE.custom) {\n return nameHint === undefined ? 'custom' : `custom.${nameHint}`;\n }\n return spanType;\n};\n\nexport interface RumUrlTarget {\n serverAddress?: string;\n serverPort?: number;\n}\n\nexport const getHttpOutcome = (statusCode: number | undefined): RumSpanOutcome => {\n if (statusCode === 408 || statusCode === 504) return RUM_SPAN_OUTCOME.timeout;\n if (typeof statusCode === 'number' && statusCode >= 400) return RUM_SPAN_OUTCOME.error;\n return RUM_SPAN_OUTCOME.success;\n};\n\n/** 请求来源与资源内容分类分开;CSS 也能发起图片/字体,不能将 initiator 当作内容类型。 */\nexport const getResourceType = (initiatorType: string, url: string) => {\n if (initiatorType === 'xmlhttprequest' || initiatorType === 'xhr') return 'xhr';\n if (initiatorType === 'fetch' || initiatorType === 'beacon') return initiatorType;\n if (['navigation', 'iframe', 'frame'].includes(initiatorType)) return 'document';\n let path = '';\n try { path = new URL(url, 'http://localhost').pathname; } catch { /* 无法解析的 URL 仅按明确的 initiator 分类。 */ }\n if (/\\.css$/i.test(path)) return 'css';\n if (/\\.(?:m?js)$/i.test(path) || initiatorType === 'script') return 'js';\n if (/\\.(?:png|jpe?g|gif|svg|ico|webp|avif|bmp|tiff?)$/i.test(path) || ['image', 'img', 'icon'].includes(initiatorType)) return 'image';\n if (/\\.(?:woff2?|ttf|otf|eot)$/i.test(path)) return 'font';\n if (/\\.(?:mp[34]|webm|ogg|wav|aac|m4[av]|mov)$/i.test(path) || ['audio', 'video'].includes(initiatorType)) return 'media';\n return 'other';\n};\n\nexport const getVitalOutcome = (rating: string | undefined): RumSpanOutcome =>\n rating === 'good' ? RUM_SPAN_OUTCOME.success : RUM_SPAN_OUTCOME.warning;\n\nexport const getUrlTarget = (url: string | undefined): RumUrlTarget => {\n if (!url) {\n return {};\n }\n try {\n const parsed = new URL(url, typeof location === 'undefined' ? 'http://localhost' : location.href);\n return {\n serverAddress: parsed.hostname,\n serverPort: parsed.port ? Number(parsed.port) : undefined,\n };\n } catch {\n return {};\n }\n};\n\nexport const buildRumSpanAttributes = ({\n outcome = RUM_SPAN_OUTCOME.success,\n spanType,\n}: RumSpanClassification): Attributes => ({\n [RUM_ATTRIBUTES.spanType]: spanType,\n [RUM_ATTRIBUTES.outcomeType]: outcome,\n});\n\nexport const buildRumResourceSpanAttributes = ({\n initiatorType = 'other',\n method,\n outcome,\n url,\n}: RumResourceSpanInput): Attributes => {\n const target = getUrlTarget(url);\n const responseStatus =\n outcome?.type === 'response' && typeof outcome.statusCode === 'number' && outcome.statusCode > 0\n ? outcome.statusCode\n : undefined;\n const outcomeType =\n outcome?.type === 'abort'\n ? RUM_SPAN_OUTCOME.abort\n : outcome?.type === 'timeout'\n ? RUM_SPAN_OUTCOME.timeout\n : outcome?.type === 'network_error'\n ? RUM_SPAN_OUTCOME.error\n : typeof responseStatus === 'number'\n ? getHttpOutcome(responseStatus)\n : // 状态不可见可能是 opaque 成功响应,也可能是静态资源网络失败,不能据此确认成功。\n RUM_SPAN_OUTCOME.unknown;\n const normalizedMethod = method?.toUpperCase();\n return {\n ...buildRumSpanAttributes({\n outcome: outcomeType,\n spanType: RUM_SPAN_TYPE.resource,\n }),\n ...(target.serverAddress ? { 'server.address': target.serverAddress } : {}),\n ...(target.serverPort !== undefined ? { 'server.port': target.serverPort } : {}),\n 'resource.type': getResourceType(initiatorType, url),\n [RUM_ATTRIBUTES.resourceInitiatorType]: initiatorType,\n ...(normalizedMethod ? { 'http.request.method': normalizedMethod } : {}),\n ...(typeof responseStatus === 'number' ? { 'http.response.status_code': responseStatus } : {}),\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { captureActionTarget } from '../core/action-target';\nimport type { ActionTargetSnapshot } from '../core/action-target';\nimport { getEventEpochTime } from '../core/event-time';\nimport { createRandomId } from '../core/id';\nimport { matchesUrlList } from '../core/url';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_OUTCOME, RUM_SPAN_TYPE } from '../schema/span';\n\nimport type { BkOTActivityEvent } from '../core/action-activity';\nimport type { BkOTPlugin, BkOTRuntimeContext } from '../core/plugin';\nimport type { Attributes } from '@opentelemetry/api';\n\nexport { getActionNameFromElement } from '../core/action-target';\n\n/**\n * 用户点击采集以“点击后产生的副作用”为 Action 生命周期:请求、资源和 DOM 变化用于判断页面稳定,\n * 错误仅参与关联和挫败判定。完成后的 Action 暂缓至连击窗口结束再上报,保留每次点击的身份。\n */\nconst ACTION_VALIDATION_DELAY = 100;\nconst ACTION_END_DELAY = 100;\nconst CLICK_CHAIN_DURATION = 1_000;\nconst CLICK_CHAIN_MAX_DISTANCE = 100;\nconst DEFAULT_ACTION_MAX_DURATION = 10_000;\nconst DEFAULT_ACTION_NAME_ATTRIBUTE = 'data-bk-action-name';\n\nexport interface BkOTActionPluginOptions {\n actionNameAttribute?: string;\n maxDuration?: number;\n /** 默认仅采集显式 data 属性;设为 text 才会读取可访问名称和 DOM 文本。 */\n nameCollection?: 'explicit' | 'text';\n}\n\ntype ActionFrustrationType = 'dead_click' | 'error_click' | 'rage_click';\ntype ActionEndReason =\n | 'activity_end' | 'no_activity' | 'timeout' | 'view_change'\n | 'session_expired' | 'page_hidden' | 'page_exit' | 'shutdown';\n\ninterface ActiveAction {\n completed?: { endTime: number; loadingTime?: number; reason: ActionEndReason };\n frustrations: Set<ActionFrustrationType>;\n hadActivity: boolean;\n hadError: boolean;\n id: string;\n lastActivityTime: number;\n maxDurationTimer: ReturnType<typeof setTimeout>;\n pendingRequests: Set<string>;\n pendingViews?: Array<{ id: string; time: number; relativeTime?: number }>;\n waitingForAssociation?: boolean;\n quietTimer?: ReturnType<typeof setTimeout>;\n reportTimer?: ReturnType<typeof setTimeout>;\n runtimeAttributes: Attributes;\n startTime: number;\n target: Element;\n targetSnapshot: ActionTargetSnapshot;\n userActivity: { input: boolean; scroll: boolean; selection: boolean };\n validationTimer: ReturnType<typeof setTimeout>;\n}\n\ninterface RecentClick {\n action: ActiveAction;\n target: Element;\n x: number;\n y: number;\n}\n\nconst getParentElement = (element: Element) => {\n if (element.parentElement) {\n return element.parentElement;\n }\n const root = element.getRootNode?.();\n return typeof ShadowRoot !== 'undefined' && root instanceof ShadowRoot ? root.host : null;\n};\n\nconst getElement = (event: Event) => {\n const composedTarget = event.composedPath?.()[0];\n if (composedTarget instanceof Element) return composedTarget;\n return event.target instanceof Element ? event.target : undefined;\n};\n\nconst positiveNumber = (value: number | undefined, fallback: number) =>\n typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : fallback;\n\nexport const isDeadClickExcluded = (target: Element) => {\n let current: Element | null = target;\n if (current.tagName.toLowerCase() === 'label' && current.hasAttribute('for')) {\n current = document.getElementById(current.getAttribute('for') ?? '');\n }\n\n while (current) {\n const tagName = current.tagName.toLowerCase();\n if (\n current.hasAttribute('contenteditable') ||\n tagName === 'canvas' ||\n tagName === 'select' ||\n tagName === 'textarea'\n ) {\n return true;\n }\n if (tagName === 'a' && current.hasAttribute('href')) return true;\n if (tagName === 'input') {\n return !['button', 'checkbox', 'radio', 'range', 'reset', 'submit'].includes(\n current.getAttribute('type')?.toLowerCase() ?? 'text',\n );\n }\n current = getParentElement(current);\n }\n return false;\n};\n\nexport const createActionPlugin = (options: BkOTActionPluginOptions = {}): BkOTPlugin => {\n const teardownCallbacks: Array<() => void> = [];\n const activeActions = new Map<string, ActiveAction>();\n const pendingActions = new Set<ActiveAction>();\n const actionNameAttribute = options.actionNameAttribute || DEFAULT_ACTION_NAME_ATTRIBUTE;\n const maxDuration = positiveNumber(options.maxDuration, DEFAULT_ACTION_MAX_DURATION);\n let recentClicks: RecentClick[] = [];\n let runtimeContext: BkOTRuntimeContext | undefined;\n\n const isDeadAction = (action: ActiveAction) =>\n !action.hadActivity &&\n !action.userActivity.input &&\n !action.userActivity.scroll &&\n !action.userActivity.selection &&\n !isDeadClickExcluded(action.target);\n\n const reportAction = (action: ActiveAction) => {\n if (!pendingActions.has(action) || !runtimeContext || !action.completed) return;\n if (runtimeContext.isSessionTransitionPending?.()) {\n if (!action.waitingForAssociation) {\n action.waitingForAssociation = true;\n runtimeContext.afterSessionTransition(() => {\n // 同一轮待定 Error 也要完成过滤/关联,再确定最终挫败字段。\n queueMicrotask(() => { action.waitingForAssociation = false; reportAction(action); });\n }, true);\n }\n return;\n }\n pendingActions.delete(action);\n clearTimeout(action.reportTimer);\n if (action.hadError) action.frustrations.add('error_click');\n if (isDeadAction(action)) action.frustrations.add('dead_click');\n const frustrationTypes = ['rage_click', 'dead_click', 'error_click'].filter(type =>\n action.frustrations.has(type as ActionFrustrationType),\n ) as ActionFrustrationType[];\n const { endTime, loadingTime, reason } = action.completed;\n const target = action.targetSnapshot;\n const hasWarning = action.hadError || frustrationTypes.length > 0;\n const actionName = `click ${target.name}`;\n const attributes = {\n ...runtimeContext.config.hooks.getPageAttributes(),\n ...buildRumSpanAttributes({\n outcome: hasWarning ? RUM_SPAN_OUTCOME.warning : RUM_SPAN_OUTCOME.success,\n spanType: RUM_SPAN_TYPE.action,\n }),\n ...action.runtimeAttributes,\n [RUM_ATTRIBUTES.actionId]: action.id,\n [RUM_ATTRIBUTES.actionName]: actionName,\n [RUM_ATTRIBUTES.actionType]: 'click',\n [RUM_ATTRIBUTES.actionTargetName]: target.name,\n [RUM_ATTRIBUTES.actionTargetTag]: target.tag,\n [RUM_ATTRIBUTES.actionNameSource]: target.nameSource,\n [RUM_ATTRIBUTES.actionEndReason]: reason,\n ...(loadingTime === undefined ? {} : { [RUM_ATTRIBUTES.actionLoadingTime]: loadingTime }),\n ...(target.selector === undefined ? {} : { [RUM_ATTRIBUTES.actionTargetSelector]: target.selector }),\n ...(target.path === undefined ? {} : { [RUM_ATTRIBUTES.actionTargetPath]: target.path }),\n ...(target.width === undefined ? {} : { [RUM_ATTRIBUTES.actionTargetWidth]: target.width }),\n ...(target.height === undefined ? {} : { [RUM_ATTRIBUTES.actionTargetHeight]: target.height }),\n ...(target.x === undefined ? {} : { [RUM_ATTRIBUTES.actionPositionX]: target.x }),\n ...(target.y === undefined ? {} : { [RUM_ATTRIBUTES.actionPositionY]: target.y }),\n ...(frustrationTypes.length ? { [RUM_ATTRIBUTES.actionFrustrationType]: frustrationTypes } : {}),\n };\n delete attributes[RUM_ATTRIBUTES.actionIds];\n const span = runtimeContext.startSpan(\n buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.action }),\n attributes,\n { rumSpanType: RUM_SPAN_TYPE.action, startTime: action.startTime },\n );\n span.end(endTime);\n };\n\n const finishAction = (\n action: ActiveAction,\n endTime: number,\n reason: ActionEndReason,\n associationEnd = Date.now(),\n relativeAssociationEnd?: number,\n ) => {\n if (!activeActions.delete(action.id) || !runtimeContext) return;\n clearTimeout(action.validationTimer);\n clearTimeout(action.quietTimer);\n clearTimeout(action.maxDurationTimer);\n // 关联窗口到确认结束时关闭;loading_time 只到最后一次页面活动。\n // 分开二者,避免等待安静期间已关联的 Error 在历史查询中突然失去归属。\n runtimeContext.endActionContext(action.id, Math.max(action.startTime, associationEnd), relativeAssociationEnd);\n action.completed = {\n endTime: Math.max(action.startTime, associationEnd),\n ...(reason === 'activity_end' ? { loadingTime: Math.max(0, endTime - action.startTime) } : {}),\n reason,\n };\n pendingActions.add(action);\n // 延迟发送以便给同一连击窗口中的各次点击标记 rage;不删除单次点击 ID。\n const reportDelay = Math.max(0, action.startTime + CLICK_CHAIN_DURATION - Date.now());\n action.reportTimer = setTimeout(() => reportAction(action), reportDelay);\n };\n\n const flushPendingActions = () => {\n [...pendingActions].forEach(reportAction);\n };\n\n const scheduleActionEnd = (action: ActiveAction) => {\n clearTimeout(action.quietTimer);\n if (!action.hadActivity || action.pendingRequests.size) return;\n const delay = Math.max(0, action.lastActivityTime + ACTION_END_DELAY - Date.now());\n action.quietTimer = setTimeout(() => finishAction(action, action.lastActivityTime, 'activity_end'), delay);\n };\n\n const markActivity = (action: ActiveAction, time: number) => {\n action.hadActivity = true;\n action.lastActivityTime = Math.max(action.lastActivityTime, time);\n scheduleActionEnd(action);\n };\n\n const isInActionWindow = (action: ActiveAction, time: number) =>\n time >= action.startTime && time <= action.startTime + maxDuration;\n\n const onActivity = (event: BkOTActivityEvent) => {\n if (event.type === 'error') {\n // 只消费过滤后 Error 的同一关联结果,不再向所有窗口广播错误归属。\n const ids = new Set(event.actionIds);\n for (const action of [...activeActions.values(), ...pendingActions]) {\n if (ids.has(action.id)) action.hadError = true;\n }\n return;\n }\n if (event.type === 'long_task') return;\n for (const action of activeActions.values()) {\n const deadline = action.startTime + maxDuration;\n if (Date.now() >= deadline) {\n finishAction(action, deadline, 'timeout', deadline);\n continue;\n }\n if (event.type === 'request_start') {\n if (event.url && matchesUrlList(runtimeContext?.config.view?.excludedActivityUrls, event.url)) continue;\n if (!isInActionWindow(action, event.time)) continue;\n action.pendingRequests.add(event.id);\n markActivity(action, event.time);\n continue;\n }\n if (event.type === 'request_end') {\n if (!action.pendingRequests.delete(event.id)) continue;\n markActivity(action, event.time);\n continue;\n }\n if (event.type === 'resource') {\n if (event.url && matchesUrlList(runtimeContext?.config.view?.excludedActivityUrls, event.url)) continue;\n if (!isInActionWindow(action, event.startTime)) continue;\n markActivity(action, Math.min(event.endTime, deadline));\n continue;\n }\n if (isInActionWindow(action, event.time)) markActivity(action, event.time);\n }\n };\n\n const finishActiveActions = (reason: ActionEndReason, endTime = Date.now(), sessionId?: string) => {\n [...activeActions.values()].forEach(action => {\n // 待定的新点击还没有 Session,不能被旧 Session 的迟到过期通知一并结束。\n if (sessionId && action.runtimeAttributes[RUM_ATTRIBUTES.sessionId] !== sessionId) return;\n finishAction(action, endTime, reason, endTime);\n });\n };\n\n const registerClick = (action: ActiveAction, event: Event) => {\n const x = 'clientX' in event && typeof event.clientX === 'number' ? event.clientX : 0;\n const y = 'clientY' in event && typeof event.clientY === 'number' ? event.clientY : 0;\n recentClicks = recentClicks.filter(click => action.startTime - click.action.startTime <= CLICK_CHAIN_DURATION);\n const lastClick = recentClicks.at(-1);\n const hasInterruptedChain = recentClicks.some(\n click => click.action.userActivity.scroll || click.action.userActivity.selection,\n );\n // 只有同一目标附近、未被滚动或选中文本打断的连续点击才视为同一连击链。\n const isSimilar =\n lastClick?.target === action.target && Math.hypot(lastClick.x - x, lastClick.y - y) <= CLICK_CHAIN_MAX_DISTANCE;\n if (hasInterruptedChain || (lastClick && !isSimilar)) recentClicks = [];\n recentClicks.push({ action, target: action.target, x, y });\n if (\n recentClicks.length >= 3 &&\n action.startTime - recentClicks[recentClicks.length - 3].action.startTime <= CLICK_CHAIN_DURATION\n ) {\n const rageSources = recentClicks.slice(-3).map(click => click.action);\n rageSources.forEach(source => source.frustrations.add('rage_click'));\n recentClicks = [];\n }\n };\n\n return {\n name: 'action',\n init(context) {\n if (typeof window === 'undefined' || typeof document === 'undefined') {\n return;\n }\n runtimeContext = context;\n\n const listenerOptions: AddEventListenerOptions = { capture: true, passive: true };\n\n const startAction = (event: Event) => {\n if (!event.isTrusted || document.visibilityState !== 'visible' || !context.isSampled()) return;\n if ('button' in event && typeof event.button === 'number' && event.button !== 0) return;\n const element = getElement(event);\n if (!element) return;\n const targetSnapshot = captureActionTarget(element, event, { actionNameAttribute, nameCollection: options.nameCollection });\n if (!targetSnapshot) return;\n const startTime = getEventEpochTime(event);\n const id = createRandomId('action');\n const action: ActiveAction = {\n frustrations: new Set(),\n hadActivity: false,\n hadError: false,\n id,\n lastActivityTime: startTime,\n maxDurationTimer: setTimeout(() => finishAction(action, startTime + maxDuration, 'timeout', startTime + maxDuration), Math.max(0, startTime + maxDuration - Date.now())),\n pendingRequests: new Set(),\n runtimeAttributes: context.getRuntimeAttributesAt(startTime),\n startTime,\n target: element,\n targetSnapshot,\n userActivity: { input: false, scroll: false, selection: false },\n validationTimer: setTimeout(() => {\n if (!action.hadActivity) finishAction(action, action.startTime, 'no_activity');\n }, ACTION_VALIDATION_DELAY),\n };\n activeActions.set(id, action);\n registerClick(action, event);\n context.registerActionContext(id, startTime, action.runtimeAttributes);\n if (context.isSessionTransitionPending?.()) {\n context.afterSessionTransition(() => {\n if (!activeActions.has(id) && !pendingActions.has(action)) return;\n const viewId = action.runtimeAttributes[RUM_ATTRIBUTES.viewId];\n const boundary = typeof viewId === 'string'\n ? action.pendingViews?.find(view => view.time >= startTime && view.id !== viewId)\n : undefined;\n action.pendingViews = undefined;\n if (!boundary || action.completed && action.completed.endTime <= boundary.time) return;\n if (activeActions.has(id)) finishAction(action, boundary.time, 'view_change', boundary.time, boundary.relativeTime);\n else {\n action.completed = { endTime: boundary.time, reason: 'view_change' };\n context.endActionContext(id, boundary.time, boundary.relativeTime);\n }\n // View callbacks 在 Session 身份回填前执行;回填后重放捕获期间的导航边界。\n queueMicrotask(() => reportAction(action));\n }, true);\n }\n };\n\n window.addEventListener('click', startAction, listenerOptions);\n teardownCallbacks.push(() => window.removeEventListener('click', startAction, listenerOptions));\n\n const unsubscribeActivity = context.onActivity(onActivity);\n const unsubscribeSession = context.onSessionLifecycle(event => {\n if (event.type !== 'expired') return;\n if (event.endTimeKnown === false) {\n // 未完成动作缺少可信结束边界,取消采集;已完成的动作仍保留自身确定的时间。\n for (const action of activeActions.values()) {\n if (action.runtimeAttributes[RUM_ATTRIBUTES.sessionId] !== event.id) continue;\n activeActions.delete(action.id);\n context.endActionContext(action.id, action.startTime);\n clearTimeout(action.validationTimer);\n clearTimeout(action.quietTimer);\n clearTimeout(action.maxDurationTimer);\n }\n } else finishActiveActions('session_expired', event.expiredAt, event.id);\n recentClicks = recentClicks.filter(click => click.action.runtimeAttributes[RUM_ATTRIBUTES.sessionId] !== event.id);\n flushPendingActions();\n });\n const unsubscribeView = context.onViewChange(view => {\n // Session 解绑会先清空 View,再派发 expired;由后者提供可信结束时刻或取消信号。\n if (!view.id) return;\n for (const action of [...activeActions.values(), ...pendingActions]) {\n const viewId = action.runtimeAttributes[RUM_ATTRIBUTES.viewId];\n const endedAt = view.startedAt ?? Date.now();\n if (typeof viewId !== 'string') {\n // 待定首击先保留边界,不能在不知道起始 View 时把初始化当作导航。\n (action.pendingViews ??= []).push({ id: view.id, time: endedAt, relativeTime: view.relativeStartedAt });\n continue;\n }\n if (viewId !== view.id && activeActions.has(action.id)) finishAction(action, endedAt, 'view_change', endedAt, view.relativeStartedAt);\n }\n for (const action of pendingActions) {\n const viewId = action.runtimeAttributes[RUM_ATTRIBUTES.viewId];\n if (typeof viewId === 'string' && viewId !== view.id) reportAction(action);\n }\n recentClicks = recentClicks.filter(click => !click.action.runtimeAttributes[RUM_ATTRIBUTES.viewId] || click.action.runtimeAttributes[RUM_ATTRIBUTES.viewId] === view.id);\n });\n teardownCallbacks.push(unsubscribeActivity, unsubscribeSession, unsubscribeView);\n\n const finishOnHidden = () => {\n if (document.visibilityState === 'hidden') {\n recentClicks = [];\n finishActiveActions('page_hidden');\n flushPendingActions();\n }\n };\n const finishOnPageHide = () => {\n recentClicks = [];\n finishActiveActions('page_exit');\n flushPendingActions();\n };\n window.addEventListener('pagehide', finishOnPageHide);\n document.addEventListener('visibilitychange', finishOnHidden);\n teardownCallbacks.push(\n () => window.removeEventListener('pagehide', finishOnPageHide),\n () => document.removeEventListener('visibilitychange', finishOnHidden),\n );\n\n const markUserActivity = (type: keyof ActiveAction['userActivity']) => {\n const actions = new Set([\n ...activeActions.values(),\n ...pendingActions,\n ...recentClicks.map(click => click.action),\n ]);\n actions.forEach(action => {\n action.userActivity[type] = true;\n // 滚动/选择表明用户仍在正常交互,撤销尚未上报的 rage click 判定。\n if (type !== 'input') action.frustrations.delete('rage_click');\n });\n };\n const onInput = (event: Event) => { if (event.isTrusted) markUserActivity('input'); };\n const onScroll = (event: Event) => { if (event.isTrusted) markUserActivity('scroll'); };\n const onSelectionChange = (event: Event) => { if (event.isTrusted) markUserActivity('selection'); };\n window.addEventListener('input', onInput, listenerOptions);\n window.addEventListener('scroll', onScroll, listenerOptions);\n document.addEventListener('selectionchange', onSelectionChange, listenerOptions);\n teardownCallbacks.push(\n () => window.removeEventListener('input', onInput, listenerOptions),\n () => window.removeEventListener('scroll', onScroll, listenerOptions),\n () => document.removeEventListener('selectionchange', onSelectionChange, listenerOptions),\n );\n },\n shutdown() {\n finishActiveActions('shutdown');\n flushPendingActions();\n while (teardownCallbacks.length) {\n teardownCallbacks.pop()?.();\n }\n recentClicks = [];\n runtimeContext = undefined;\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\nimport type { BkOTPlugin } from '../core/plugin';\n\nexport const EXCLUDED_ACTIVITY_MUTATIONS_ATTRIBUTE = 'data-bk-excluded-activity-mutations';\n\nconst isExcludedMutation = (mutation: MutationRecord) => {\n const target = mutation.type === 'characterData' ? mutation.target.parentElement : mutation.target;\n return target instanceof Element && Boolean(target.closest(`[${EXCLUDED_ACTIVITY_MUTATIONS_ATTRIBUTE}]`));\n};\n\n/**\n * 页面级 DOM 活动只观察一次,再通过运行时活动总线分发给 View、Action 和白屏检测。\n */\nexport const createActivityPlugin = (): BkOTPlugin => {\n let mutationObserver: MutationObserver | undefined;\n const teardownCallbacks: Array<() => void> = [];\n\n return {\n name: 'activity',\n init(context) {\n if (typeof document !== 'undefined' && typeof MutationObserver !== 'undefined') {\n mutationObserver = new MutationObserver(mutations => {\n if (mutations.length && !mutations.every(isExcludedMutation)) {\n context.notifyActivity({ time: Date.now(), type: 'dom_mutation' });\n }\n });\n mutationObserver.observe(document, { attributes: true, characterData: true, childList: true, subtree: true });\n }\n\n if (typeof window === 'undefined') return;\n\n if (typeof window.open === 'function') {\n const originalOpen = window.open;\n const patchedOpen = ((...args: Parameters<typeof window.open>) => {\n context.notifyActivity({ time: Date.now(), type: 'window_open' });\n return Reflect.apply(originalOpen, window, args);\n }) as typeof window.open;\n window.open = patchedOpen;\n teardownCallbacks.push(() => {\n if (window.open === patchedOpen) window.open = originalOpen;\n });\n }\n\n },\n shutdown() {\n mutationObserver?.disconnect();\n mutationObserver = undefined;\n while (teardownCallbacks.length) teardownCallbacks.pop()?.();\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n/*\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport interface BlankScreenDetection {\n contentCount: number;\n emptyCount: number;\n ignoredCount: number;\n reason: 'empty_viewport' | 'missing_root';\n score: number;\n state: 'blank' | 'content' | 'loading' | 'unknown';\n unknownCount: number;\n validCount: number;\n}\n\ntype PointState = 'blank' | 'content' | 'loading' | 'unknown';\nconst RATIOS = [0.2, 0.5, 0.8];\nconst MAX_DEPTH = 24;\nconst MAX_LAYERS = 32;\nconst MAX_TEXT_NODES = 32;\nconst MAX_TEXT_RECTS = 32;\n\nconst parentOf = (element: Element): Element | null =>\n element.parentElement ?? (element.getRootNode?.() as ShadowRoot | undefined)?.host ?? null;\n\nconst styleOf = (element: Element) => (typeof getComputedStyle === 'function' ? getComputedStyle(element) : undefined);\nconst alpha = (color: string | undefined) => {\n if (!color || color === 'transparent') return 0;\n const slashAlpha = color.match(/\\/\\s*([\\d.]+)(%)?\\s*\\)$/);\n if (slashAlpha) return Number(slashAlpha[1]) / (slashAlpha[2] ? 100 : 1);\n const rgba = color.match(/^rgba\\([^,]+,[^,]+,[^,]+,\\s*([\\d.]+)\\)$/);\n return rgba ? Number(rgba[1]) : 1;\n};\n\n/** Computed opacity does not include ancestors; a transparent app shell hides its children too. */\nconst visibility = (element: Element): 'hidden' | 'unknown' | 'visible' => {\n let current: Element | null = element;\n for (let depth = 0; current && depth < MAX_DEPTH; depth++, current = parentOf(current)) {\n const style = styleOf(current);\n if (\n style &&\n (style.display === 'none' ||\n style.contentVisibility === 'hidden' ||\n (depth === 0 && (style.visibility === 'hidden' || style.visibility === 'collapse')) ||\n Number(style.opacity || 1) === 0)\n )\n return 'hidden';\n }\n return current ? 'unknown' : 'visible';\n};\n\nconst isIgnored = (element: Element, selectors: string[]) =>\n selectors.some(selector => {\n try {\n return element.matches(selector) || Boolean(element.closest(selector));\n } catch {\n return false;\n }\n });\n\nconst directTextAtPoint = (element: Element, x: number, y: number): boolean | undefined => {\n const nodes = element.childNodes;\n if (!nodes) return false;\n for (let index = 0; index < Math.min(nodes.length, MAX_TEXT_NODES); index++) {\n const node = nodes[index];\n if (node.nodeType !== 3 || !node.textContent?.trim()) continue;\n // Range checks the rendered text, including text owned by the configured root itself.\n if (typeof document.createRange !== 'function') return true;\n const range = document.createRange();\n range.selectNodeContents(node);\n const rects = range.getClientRects();\n for (let rectIndex = 0; rectIndex < Math.min(rects.length, MAX_TEXT_RECTS); rectIndex++) {\n const rect = rects[rectIndex];\n if (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom) return true;\n }\n if (rects.length > MAX_TEXT_RECTS) return undefined;\n }\n return nodes.length > MAX_TEXT_NODES ? undefined : false;\n};\n\nconst samplePoint = (root: Element, selectors: string[], x: number, y: number): PointState => {\n const layers =\n typeof document.elementsFromPoint === 'function'\n ? document.elementsFromPoint(x, y)\n : [document.elementFromPoint(x, y)].filter((element): element is Element => Boolean(element));\n for (const element of layers.slice(0, MAX_LAYERS)) {\n const visible = visibility(element);\n if (visible === 'hidden') continue;\n if (visible === 'unknown') return 'unknown';\n const withinRoot = element === root || root.contains(element);\n // Only an actually exposed layer can suppress sampling. A spinner underneath a white\n // overlay must not hide the overlay's blank evidence.\n if (withinRoot && isIgnored(element, selectors)) return 'loading';\n const style = styleOf(element);\n const tag = element.tagName.toLowerCase();\n if (['canvas', 'iframe', 'object', 'embed', 'video', 'svg'].includes(tag) || element.shadowRoot) return 'unknown';\n if (typeof getComputedStyle === 'function') {\n for (const pseudo of ['::before', '::after']) {\n const pseudoStyle = getComputedStyle(element, pseudo);\n if (pseudoStyle.content && !['none', 'normal', '\"\"'].includes(pseudoStyle.content)) return 'unknown';\n }\n }\n if (style?.backgroundImage && style.backgroundImage !== 'none') return 'unknown';\n if (tag === 'img') {\n const image = element as HTMLImageElement;\n return image.complete && image.naturalWidth > 0 && withinRoot ? 'content' : 'unknown';\n }\n if (withinRoot && ['input', 'textarea', 'select'].includes(tag)) return 'content';\n const text = directTextAtPoint(element, x, y);\n if (text === undefined) return 'unknown';\n if (text && (!style?.color || alpha(style.color) > 0)) return withinRoot ? 'content' : 'unknown';\n // An opaque empty top layer covers everything below. Transparent layout wrappers alone\n // are never content, regardless of their size or the number of nested elements.\n if (alpha(style?.backgroundColor) >= 1) {\n let opacity = 1;\n let ancestor: Element | null = element;\n for (let depth = 0; ancestor && depth < MAX_DEPTH; depth++, ancestor = parentOf(ancestor)) {\n opacity *= Number(styleOf(ancestor)?.opacity || 1);\n }\n if (opacity >= 1) return 'blank';\n }\n }\n return layers.length > MAX_LAYERS ? 'unknown' : 'blank';\n};\n\nexport const detectBlankScreen = (\n rootSelector: string,\n ignoredSelectors: string[],\n threshold = 0.8,\n): BlankScreenDetection => {\n const configuredRoot = document.querySelector(rootSelector);\n const root = configuredRoot ?? document.body ?? document.documentElement;\n const counts = { blank: 0, content: 0, loading: 0, unknown: 0 };\n const rect = root?.getBoundingClientRect?.();\n // A scoped content root is sampled inside its visible rectangle; empty zero-size roots\n // still use the viewport so an unmounted app does not silently become unobservable.\n const left = rect && rect.width > 0 ? Math.max(0, rect.left) : 0;\n const top = rect && rect.height > 0 ? Math.max(0, rect.top) : 0;\n const right = rect && rect.width > 0 ? Math.min(window.innerWidth, rect.right) : window.innerWidth;\n const bottom = rect && rect.height > 0 ? Math.min(window.innerHeight, rect.bottom) : window.innerHeight;\n for (const y of RATIOS)\n for (const x of RATIOS) {\n const state =\n root && right > left && bottom > top\n ? samplePoint(root, ignoredSelectors, left + (right - left) * x, top + (bottom - top) * y)\n : 'unknown';\n counts[state]++;\n }\n const validCount = counts.blank + counts.content;\n const score = validCount ? counts.blank / validCount : 0;\n // At least half the sample needs interpretable evidence. Unknown media/mostly covered\n // loading regions cannot turn one remaining empty point into a white-screen incident.\n const state: PointState =\n validCount >= 5\n ? score >= threshold\n ? 'blank'\n : 'content'\n : counts.loading > counts.unknown\n ? 'loading'\n : 'unknown';\n return {\n contentCount: counts.content,\n emptyCount: counts.blank,\n ignoredCount: counts.loading,\n unknownCount: counts.unknown,\n reason: configuredRoot ? 'empty_viewport' : 'missing_root',\n score,\n state,\n validCount,\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\nimport { createRandomId } from '../core/id';\nimport { matchesUrlList } from '../core/url';\nimport { buildRumSpanAttributes, RUM_SPAN_OUTCOME, RUM_SPAN_TYPE } from '../schema/span';\nimport { detectBlankScreen } from './blank-screen-detection';\n\nimport type { BkOTPlugin } from '../core/plugin';\nimport type { BlankScreenDetection } from './blank-screen-detection';\nimport type { Attributes } from '@opentelemetry/api';\n\nexport { detectBlankScreen } from './blank-screen-detection';\n\nexport interface BkOTBlankScreenPluginOptions {\n /** 每次页面活动后的稳定等待,默认 1000ms。 */\n checkDelay?: number;\n /** 空白候选连续确认的间隔,默认 200ms;新活动会取消确认。 */\n confirmationDelay?: number;\n /** loading、骨架屏选择器;追加到内置规则。 */\n ignoreSelectors?: string[];\n /** 文档启动或活动持续未稳定的最长等待,默认 10000ms。超时仅报告 unknown/loading。 */\n maxWait?: number;\n /** 主要业务内容根节点,默认 body;缺失时回退到视口。 */\n rootSelector?: string;\n /** 有效采样点中的空白比例,默认 0.8;有效点至少 5 个才作结论。 */\n threshold?: number;\n}\n\nconst IGNORED_SELECTORS = [\n '[data-loading=\"true\"]',\n '[aria-busy=\"true\"]',\n '.loading',\n '.is-loading',\n '.spinner',\n '.skeleton',\n '.bk-loading',\n];\nconst numberOption = (value: number | undefined, fallback: number) =>\n typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : fallback;\n\n/** Sampling and scheduling share one View-scoped state machine. A healthy or unknown sample\n * is not terminal: subsequent activity, visibility restoration and bounded probes can retry. */\nexport const createBlankScreenPlugin = (options: BkOTBlankScreenPluginOptions = {}): BkOTPlugin => {\n const checkDelay = numberOption(options.checkDelay, 1000);\n const confirmationDelay = numberOption(options.confirmationDelay, 200);\n const maxWait = Math.max(100, numberOption(options.maxWait, 10_000));\n const threshold = Math.min(1, numberOption(options.threshold, 0.8));\n const rootSelector = options.rootSelector || 'body';\n const ignoredSelectors = [...IGNORED_SELECTORS, ...(options.ignoreSelectors ?? [])];\n let cleanup: (() => void) | undefined;\n\n return {\n name: 'blank-screen',\n init(context) {\n if (typeof window === 'undefined' || typeof document === 'undefined') return;\n let disposed = false;\n let frozen = false;\n let viewId: string | undefined;\n let viewSessionId: string | undefined;\n let timer: ReturnType<typeof setTimeout> | undefined;\n let cycleStartedAt = Date.now();\n let lastActivityAt = cycleStartedAt;\n let trigger = 'view';\n let candidateAt: number | undefined;\n let incident:\n | undefined\n | { detectedAt: number; firstDetectedAt: number; id: string; reason: BlankScreenDetection['reason'] };\n let lastObservation: string | undefined;\n const pending = new Set<string>();\n const clearTimer = () => {\n clearTimeout(timer);\n timer = undefined;\n };\n const visible = () => !frozen && document.visibilityState !== 'hidden';\n const ready = () => document.readyState !== 'loading';\n const emit = (\n phase: 'detected' | 'observation' | 'recovered',\n result: Partial<BlankScreenDetection>,\n reason: string | undefined = result.reason,\n ) => {\n const capturedId = viewId;\n if (!capturedId || disposed || !context.isSampled() || viewId !== capturedId) return;\n const at = Date.now();\n const runtime = context.getRuntimeAttributesAt?.(at) ?? context.getRuntimeAttributes();\n // 即时观测不能沿用 View 创建时的 user/activity 元数据;Session 校验可能\n // 触发切换,所以在读完动态上下文后再次核对归属,旧故障不能写入新 View。\n if (\n viewId !== capturedId ||\n runtime['view.id'] !== capturedId ||\n typeof runtime['session.id'] !== 'string' ||\n runtime['session.id'] !== viewSessionId\n )\n return;\n const error = phase === 'detected';\n const spanType = error ? RUM_SPAN_TYPE.error : RUM_SPAN_TYPE.custom;\n const attributes: Attributes = {\n ...runtime,\n ...buildRumSpanAttributes({\n spanType,\n outcome: error\n ? RUM_SPAN_OUTCOME.error\n : phase === 'recovered'\n ? RUM_SPAN_OUTCOME.success\n : RUM_SPAN_OUTCOME.unknown,\n }),\n 'blank_screen.phase': phase,\n 'blank_screen.state': result.state ?? 'unknown',\n 'blank_screen.strategy_version': 2,\n 'blank_screen.trigger': trigger,\n ...(reason ? { 'blank_screen.reason': reason } : {}),\n ...(result.score === undefined ? {} : { 'blank_screen.empty_ratio': result.score }),\n ...(result.validCount === undefined\n ? {}\n : {\n 'blank_screen.empty_sample_count': result.emptyCount,\n 'blank_screen.valid_sample_count': result.validCount,\n 'blank_screen.ignored_sample_count': result.ignoredCount,\n 'blank_screen.unknown_sample_count': result.unknownCount,\n }),\n ...(incident\n ? {\n 'blank_screen.id': incident.id,\n 'blank_screen.first_detected_at': incident.firstDetectedAt,\n 'blank_screen.detected_at': incident.detectedAt,\n ...(phase === 'recovered'\n ? {\n 'blank_screen.duration': Math.max(0, at - incident.firstDetectedAt),\n 'blank_screen.recovered_at': at,\n }\n : {}),\n }\n : {}),\n };\n const name = phase === 'detected' ? `blank_screen.${reason}` : `blank_screen.${phase}`;\n const span = context.startSpan(name, attributes, { startTime: at });\n span.end(at);\n };\n const observe = (result: Partial<BlankScreenDetection>, reason?: string) => {\n const key = `${result.state}:${reason ?? result.reason}`;\n if (key !== lastObservation) {\n emit('observation', result, reason);\n lastObservation = key;\n }\n };\n const schedule = () => {\n clearTimer();\n if (disposed || !viewId || !visible()) return;\n const now = Date.now();\n const deadline = Math.max(0, cycleStartedAt + maxWait - now);\n const delay =\n !ready() || pending.size ? deadline : Math.min(deadline, Math.max(0, lastActivityAt + checkDelay - now));\n timer = setTimeout(check, delay);\n };\n const retryLater = () => {\n clearTimer();\n if (!disposed && viewId && visible())\n timer = setTimeout(() => {\n cycleStartedAt = Date.now();\n check();\n }, maxWait);\n };\n const check = () => {\n timer = undefined;\n if (disposed || !viewId || !visible()) return;\n const now = Date.now();\n if (!ready() || pending.size || now - lastActivityAt < checkDelay) {\n candidateAt = undefined;\n if (now - cycleStartedAt >= maxWait) {\n observe({ state: ready() ? 'loading' : 'unknown' }, ready() ? 'activity_timeout' : 'document_not_ready');\n retryLater();\n } else schedule();\n return;\n }\n let result: BlankScreenDetection;\n try {\n result = detectBlankScreen(rootSelector, ignoredSelectors, threshold);\n } catch (error) {\n if (context.config.debug) globalThis.console?.warn('[bk-ot][blank-screen] detection failed:', error);\n observe({ state: 'unknown' }, 'detection_unavailable');\n retryLater();\n return;\n }\n if (result.state === 'blank') {\n if (!incident && candidateAt === undefined) {\n candidateAt = now;\n timer = setTimeout(check, confirmationDelay);\n return;\n }\n if (!incident) {\n incident = {\n id: createRandomId('blank'),\n firstDetectedAt: candidateAt!,\n detectedAt: now,\n reason: result.reason,\n };\n emit('detected', result);\n }\n } else {\n candidateAt = undefined;\n if (result.state === 'content') {\n if (incident) emit('recovered', result, incident.reason);\n incident = undefined;\n lastObservation = undefined;\n } else observe(result, result.state === 'loading' ? 'loading_visible' : 'insufficient_evidence');\n }\n // Bounded probes also cover stylesheet changes/animations without DOM mutation.\n retryLater();\n };\n const changed = (source: string) => {\n candidateAt = undefined;\n trigger = source;\n lastActivityAt = Date.now();\n // A new cycle after a completed/probed sample must get its own bounded wait.\n if (!timer || lastActivityAt - cycleStartedAt >= maxWait) cycleStartedAt = lastActivityAt;\n schedule();\n };\n const unsubscribeActivity = context.onActivity(event => {\n if (disposed || event.type === 'long_task') return;\n if (\n (event.type === 'request_start' || event.type === 'resource') &&\n event.url &&\n matchesUrlList(context.config.view?.excludedActivityUrls, event.url)\n )\n return;\n if (event.type === 'request_start') pending.add(event.id);\n if (event.type === 'request_end' && !pending.delete(event.id)) return;\n if (viewId) changed(event.type);\n });\n const unsubscribeView = context.onViewChange(view => {\n if (view.id === viewId) return;\n clearTimer();\n viewId = view.id;\n const session = context.getRuntimeAttributes()['session.id'];\n viewSessionId = typeof session === 'string' ? session : undefined;\n candidateAt = undefined;\n incident = undefined;\n lastObservation = undefined;\n cycleStartedAt = lastActivityAt = Date.now();\n trigger = 'view';\n schedule();\n });\n const onVisibility = () => {\n clearTimer();\n candidateAt = undefined;\n if (visible()) {\n cycleStartedAt = Date.now();\n changed('visible');\n }\n };\n const onReady = () => {\n cycleStartedAt = Date.now();\n changed('document_ready');\n };\n const onFreeze = () => {\n frozen = true;\n clearTimer();\n candidateAt = undefined;\n };\n const onResume = () => {\n frozen = false;\n onVisibility();\n };\n document.addEventListener('visibilitychange', onVisibility);\n document.addEventListener('DOMContentLoaded', onReady);\n document.addEventListener('freeze', onFreeze);\n document.addEventListener('resume', onResume);\n cleanup = () => {\n disposed = true;\n clearTimer();\n unsubscribeActivity();\n unsubscribeView();\n pending.clear();\n document.removeEventListener('visibilitychange', onVisibility);\n document.removeEventListener('DOMContentLoaded', onReady);\n document.removeEventListener('freeze', onFreeze);\n document.removeEventListener('resume', onResume);\n };\n },\n shutdown() {\n cleanup?.();\n cleanup = undefined;\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\n\nimport type { Attributes } from '@opentelemetry/api';\n\nexport type BkOTSessionLifecycleEvent =\n | {\n /** false 表示仅截断本地关联,expiredAt 不是已确认的全局结束时间,不能据此生成结束遥测。 */\n endTimeKnown?: boolean;\n expiredAt: number;\n id: string;\n reason: 'external' | 'inactivity' | 'maxLifetime';\n type: 'expired';\n }\n | {\n /** 本 Tab 绑定该 Session 的生效时间,不等同于共享 Session 的创建时间。 */\n activatedAt?: number;\n id: string;\n previousId?: string;\n reason: 'inactivity' | 'init' | 'maxLifetime' | 'shared';\n startedAt: number;\n type: 'renewed';\n };\n\nexport interface BkOTStartViewOptions {\n attributes?: Attributes;\n name?: string;\n url?: string;\n /** 框架路由定义中的低基数路径,例如 /orders/:orderId;优先于 URL 推断。 */\n urlTemplate?: string;\n}\n\nexport interface BkOTUserContext {\n /** 由接入方传入并由 SDK 原样透传;SDK 不 hash、不脱敏、不改写。 */\n id?: string;\n}\n\nexport type BkOTViewCommand =\n | { attributes: Attributes; type: 'set_context' }\n | { elapsed?: number; name: string; time: number; type: 'add_timing' }\n | { key: string; type: 'set_context_property'; value: Attributes[string] }\n | { name: string; type: 'set_name' }\n | { options: BkOTStartViewOptions; relativeStartedAt?: number; startedAt?: number; type: 'start' }\n | { time: number; type: 'set_loading_time' };\n\nexport interface BkOTViewContext {\n attributes?: Attributes;\n /** 清空 View 时传递已确认的结束边界,供迟到指标归属;不是接收通知的时间。 */\n endedAt?: number;\n id?: string;\n interactionCountAtEnd?: number;\n /** 原生交互计数在 View 边界的快照,供迟安装的 INP 采集器恢复分位数基线。 */\n interactionCountAtStart?: number;\n loadingType?: 'bf_cache' | 'initial_load' | 'route_change' | 'session_renewal';\n name?: string;\n relativeEndedAt?: number;\n /** 与 PerformanceEntry.startTime 同一时钟;不能由 timeOrigin 与墙钟差值推导。 */\n relativeStartedAt?: number;\n startedAt?: number;\n url?: string;\n urlTemplate?: string;\n}\n\nconst PROTECTED_VIEW_ATTRIBUTE_KEYS = new Set<string>(Object.values(RUM_ATTRIBUTES));\n\n/** OTel 属性只允许标量和标量数组;复制数组即可隔离调用方、当前状态与历史快照。 */\nexport const copyAttributes = (attributes: Attributes = {}): Attributes =>\n Object.fromEntries(\n Object.entries(attributes).map(([key, value]) => [key, Array.isArray(value) ? value.slice() : value]),\n );\nconst SESSION_ATTRIBUTE_KEYS = [\n RUM_ATTRIBUTES.sessionId,\n RUM_ATTRIBUTES.sessionHasReplay,\n RUM_ATTRIBUTES.sessionType,\n RUM_ATTRIBUTES.sessionStartTime,\n RUM_ATTRIBUTES.sessionLastActivityTime,\n];\n\n// 只在捕获/结束 Action 时换算一次;迟到 RT 不能再用恢复后的墙钟反推旧动作边界。\nconst captureRelativeTime = (epoch: number) =>\n typeof performance !== 'undefined' ? performance.now() - (Date.now() - epoch) : undefined;\n\n/**\n * 管理 SDK 运行期公共属性快照。\n *\n * 这里仅保存“后续事件都需要带上”的低成本上下文,Session/View/用户切换时更新快照,\n * 插件发 Span 时读取当前快照即可,避免每个插件重复维护公共字段。\n */\nexport class RumRuntimeContext {\n // 每个 Action 独立保留关联区间,结束较早的动作不能截断仍在进行的重叠动作。\n private readonly actionHistory = new Map<\n string,\n {\n attributes: Attributes;\n endedAt?: number;\n relativeEndedAt?: number;\n relativeStartedAt?: number;\n startedAt: number;\n }\n >();\n private appendActionIds = (attributes: Attributes, timestamp: number, relative = false): Attributes => {\n const sessionId = attributes[RUM_ATTRIBUTES.sessionId];\n const viewId = attributes[RUM_ATTRIBUTES.viewId];\n if (typeof sessionId !== 'string' || typeof viewId !== 'string') return attributes;\n const actionIds = [...this.actionHistory]\n .filter(\n ([, entry]) =>\n (relative ? (entry.relativeStartedAt ?? Infinity) : entry.startedAt) <= timestamp &&\n ((relative ? entry.relativeEndedAt : entry.endedAt) === undefined ||\n timestamp < (relative ? entry.relativeEndedAt! : entry.endedAt!)) &&\n entry.attributes[RUM_ATTRIBUTES.sessionId] === sessionId &&\n entry.attributes[RUM_ATTRIBUTES.viewId] === viewId,\n )\n .map(([id]) => id);\n if (actionIds.length) attributes[RUM_ATTRIBUTES.actionIds] = actionIds;\n return attributes;\n };\n private readonly attributes: Attributes = {};\n private readonly queuedViewCommands: BkOTViewCommand[] = [];\n\n // 保存关联关系的生效区间,供延迟到达的 PerformanceEntry 按事件时间回查原 Session/View/Action。\n private recordAssociation = (\n history: Array<{ attributes: Attributes; endedAt?: number; startedAt: number }>,\n keys: Iterable<string>,\n changedAt: number,\n active: boolean,\n ) => {\n const previous = history.at(-1);\n if (previous && previous.endedAt === undefined) previous.endedAt = Math.max(previous.startedAt, changedAt);\n if (active) {\n const associationAttributes: Attributes = {};\n for (const key of keys) {\n const value = this.attributes[key];\n if (value !== undefined) associationAttributes[key] = value;\n }\n history.push({ attributes: associationAttributes, startedAt: changedAt });\n }\n if (history.length > 100) history.splice(0, history.length - 100);\n };\n private sampled = false;\n private readonly samplingHistory: Array<{ endedAt?: number; sampled: boolean; startedAt: number }> = [];\n private readonly sessionHistory: Array<{\n activityTimes?: number[];\n attributes: Attributes;\n endedAt?: number;\n startedAt: number;\n }> = [];\n private readonly sessionLifecycleListeners = new Set<(event: BkOTSessionLifecycleEvent) => void>();\n private readonly setOptionalAttribute = (key: string, value: string | undefined) => {\n if (value === undefined) {\n delete this.attributes[key];\n return;\n }\n this.attributes[key] = value;\n };\n private user: BkOTUserContext = {};\n private view: BkOTViewContext = {};\n private readonly viewAttributeKeys = new Set<string>();\n private readonly viewChangeListeners = new Set<(view: BkOTViewContext) => void>();\n private readonly viewCommandListeners = new Set<(command: BkOTViewCommand) => void>();\n\n private readonly viewHistory: Array<{ attributes: Attributes; endedAt?: number; startedAt: number }> = [];\n\n private readonly viewLifecycles = new Map<string, { runtimeAttributes: Attributes; view: BkOTViewContext }>();\n\n private readonly viewScopedAttributeKeys = new Set<string>();\n\n public dispatchViewCommand = (command: BkOTViewCommand) => {\n if (command.type === 'start')\n command = { ...command, options: { ...command.options, attributes: copyAttributes(command.options.attributes) } };\n else if (command.type === 'set_context') command = { ...command, attributes: copyAttributes(command.attributes) };\n else if (command.type === 'set_context_property' && Array.isArray(command.value))\n command = { ...command, value: command.value.slice() };\n // autoStart 下调用方可能早于 page-view 插件发命令,先排队可避免 startView/setViewName 丢失。\n if (this.viewCommandListeners.size === 0) {\n if (command.type === 'start') {\n const previous = this.queuedViewCommands.findIndex(item => item.type === 'start');\n if (previous >= 0) this.queuedViewCommands.splice(previous, 1);\n }\n this.queuedViewCommands.push(command);\n return;\n }\n this.viewCommandListeners.forEach(listener => listener(command));\n };\n\n public endActionContext = (id: string, endedAt: number, relativeEndedAt?: number) => {\n const entry = this.actionHistory.get(id);\n if (!entry) return;\n // 待定身份回填后可能发现更早的 View 边界,只能进一步截断,不重新开放旧窗口。\n entry.endedAt = Math.min(entry.endedAt ?? Infinity, Math.max(entry.startedAt, endedAt));\n // 历史 View 边界使用当时捕获的相对时刻;普通超时的回填基于动作起点,\n // 且不越过当前相对时间,避免休眠后用新 offset 把旧窗口截到起点。\n const relativeEnd =\n relativeEndedAt ??\n (entry.relativeStartedAt === undefined || typeof performance === 'undefined'\n ? undefined\n : Math.min(performance.now(), entry.relativeStartedAt + endedAt - entry.startedAt));\n if (relativeEnd !== undefined && entry.relativeStartedAt !== undefined) {\n entry.relativeEndedAt = Math.min(\n entry.relativeEndedAt ?? Infinity,\n Math.max(entry.relativeStartedAt, relativeEnd),\n );\n }\n // 只裁剪已关闭的历史;仍在进行的动作不会因为其他动作结束而丢失关联。\n const closed = [...this.actionHistory]\n .filter(([, value]) => value.endedAt !== undefined)\n .sort(([, left], [, right]) => left.endedAt! - right.endedAt!);\n for (const [key] of closed.slice(0, Math.max(0, closed.length - 100))) this.actionHistory.delete(key);\n };\n\n public getAttributes = (): Attributes => this.appendActionIds(copyAttributes(this.attributes), Date.now());\n\n public getAttributesAt = (timestamp: number): Attributes => {\n if (!Number.isFinite(timestamp)) return this.getAttributes();\n const result = { ...this.attributes };\n const applyHistory = <T extends { attributes: Attributes; endedAt?: number; startedAt: number }>(\n history: T[],\n keys: Iterable<string>,\n ) => {\n // 先移除当前关联字段,再用目标时间所在的历史快照覆盖,避免把旧事件错误归到当前 View。\n for (const key of keys) delete result[key];\n const matched = [...history]\n .reverse()\n .find(entry => entry.startedAt <= timestamp && (entry.endedAt === undefined || timestamp < entry.endedAt));\n if (matched) Object.assign(result, matched.attributes);\n return matched;\n };\n const session = applyHistory(this.sessionHistory, SESSION_ATTRIBUTE_KEYS);\n // 活动时间与 Session 身份分别保存,续期不切分身份区间,也不让迟到事件携带未来活动。\n delete result[RUM_ATTRIBUTES.sessionLastActivityTime];\n const lastActivityTime = [...(session?.activityTimes ?? [])].reverse().find(time => time <= timestamp);\n if (lastActivityTime !== undefined) result[RUM_ATTRIBUTES.sessionLastActivityTime] = lastActivityTime;\n applyHistory(this.viewHistory, this.viewScopedAttributeKeys);\n return this.appendActionIds(copyAttributes(result), timestamp);\n };\n\n /** PerformanceEntry 按相对区间选择身份;epoch 只用于最终 Span 时间,不再反查身份。 */\n public getRuntimeContextAtRelativeTime = (\n relativeTime: number,\n ): undefined | { attributes: Attributes; time: number } => {\n if (!Number.isFinite(relativeTime)) return;\n const owner = [...this.viewLifecycles.values()]\n .reverse()\n .find(\n ({ view }) =>\n view.relativeStartedAt !== undefined &&\n view.relativeStartedAt <= relativeTime &&\n (view.relativeEndedAt === undefined || relativeTime < view.relativeEndedAt),\n );\n if (owner?.view.startedAt === undefined) return;\n const time = owner.view.startedAt + relativeTime - owner.view.relativeStartedAt!;\n // 与 getAttributesAt 一样保留当前用户/业务属性,仅按历史固定身份与 View 范围字段。\n // 不能把用户登录后的资源永久绑定到 View 初始化时的匿名快照。\n const attributes = copyAttributes(this.attributes);\n for (const key of [...SESSION_ATTRIBUTE_KEYS, ...this.viewScopedAttributeKeys]) {\n delete attributes[key];\n const value = owner.runtimeAttributes[key];\n if (value !== undefined) attributes[key] = Array.isArray(value) ? value.slice() : value;\n }\n delete attributes[RUM_ATTRIBUTES.sessionLastActivityTime];\n const session = [...this.sessionHistory]\n .reverse()\n .find(entry => entry.attributes[RUM_ATTRIBUTES.sessionId] === attributes[RUM_ATTRIBUTES.sessionId]);\n const activityTime = [...(session?.activityTimes ?? [])].reverse().find(value => value <= time);\n if (activityTime !== undefined) attributes[RUM_ATTRIBUTES.sessionLastActivityTime] = activityTime;\n // View 快照可能在另一个 Action 执行时刷新;资源只能关联其自身起点的动作集合。\n delete attributes[RUM_ATTRIBUTES.actionIds];\n return {\n attributes: this.appendActionIds(attributes, relativeTime, true),\n time,\n };\n };\n\n public getUser = (): BkOTUserContext => ({ ...this.user });\n\n public getView = (): BkOTViewContext => ({ ...this.view, attributes: copyAttributes(this.view.attributes) });\n\n /** 指标插件可能晚于首个路由安装,只保留每个 View 的最后快照与原始边界。 */\n public getViewHistory = () =>\n [...this.viewLifecycles.values()].map(({ view, runtimeAttributes }) => ({\n view: { ...view, attributes: copyAttributes(view.attributes) },\n runtimeAttributes: copyAttributes(runtimeAttributes),\n }));\n\n public isSessionActive = () => typeof this.attributes[RUM_ATTRIBUTES.sessionId] === 'string';\n\n public isSessionSampledAt = (timestamp: number) => {\n if (!Number.isFinite(timestamp)) return this.sampled;\n return (\n [...this.samplingHistory]\n .reverse()\n .find(entry => entry.startedAt <= timestamp && (entry.endedAt === undefined || timestamp < entry.endedAt))\n ?.sampled ?? false\n );\n };\n\n public isViewActive = () => typeof this.attributes[RUM_ATTRIBUTES.viewId] === 'string';\n\n public notifySessionLifecycle = (event: BkOTSessionLifecycleEvent) => {\n this.sessionLifecycleListeners.forEach(listener => listener(event));\n };\n\n public onSessionLifecycle = (listener: (event: BkOTSessionLifecycleEvent) => void) => {\n this.sessionLifecycleListeners.add(listener);\n return () => this.sessionLifecycleListeners.delete(listener);\n };\n\n public onViewChange = (listener: (view: BkOTViewContext) => void) => {\n this.viewChangeListeners.add(listener);\n if (this.view.id) listener(this.getView());\n return () => this.viewChangeListeners.delete(listener);\n };\n\n public onViewCommand = (listener: (command: BkOTViewCommand) => void) => {\n this.viewCommandListeners.add(listener);\n while (this.queuedViewCommands.length) {\n listener(this.queuedViewCommands.shift()!);\n }\n return () => this.viewCommandListeners.delete(listener);\n };\n\n public registerActionContext = (id: string, startedAt: number, attributes: Attributes) => {\n // 保留捕获对象引用:Session 待定期间首次点击的身份会在提交后原地回填。\n if (!this.actionHistory.has(id))\n this.actionHistory.set(id, {\n attributes,\n startedAt,\n relativeStartedAt: captureRelativeTime(startedAt),\n });\n };\n\n public setAttributes = (attributes: Attributes, changedAt = Date.now()) => {\n const previousSessionId = this.attributes[RUM_ATTRIBUTES.sessionId];\n if (RUM_ATTRIBUTES.sessionId in attributes && attributes[RUM_ATTRIBUTES.sessionId] !== previousSessionId) {\n // 新身份和未绑定状态不能继承旧 Session 的起点、活动时间或类型。\n SESSION_ATTRIBUTE_KEYS.forEach(key => delete this.attributes[key]);\n }\n for (const [key, value] of Object.entries(attributes)) {\n // 动作身份属于独立时间区间,禁止通过全局属性入口写入或恢复旧单值关联。\n if (key === RUM_ATTRIBUTES.actionId || key === RUM_ATTRIBUTES.actionIds) continue;\n if (value === undefined) {\n delete this.attributes[key];\n continue;\n }\n this.attributes[key] = Array.isArray(value) ? value.slice() : value;\n }\n const sessionId = this.attributes[RUM_ATTRIBUTES.sessionId];\n if (sessionId !== previousSessionId) {\n this.recordAssociation(this.sessionHistory, SESSION_ATTRIBUTE_KEYS, changedAt, typeof sessionId === 'string');\n }\n if (typeof sessionId === 'string') {\n const session = this.sessionHistory.at(-1);\n const lastActivityTime = this.attributes[RUM_ATTRIBUTES.sessionLastActivityTime];\n if (session && typeof lastActivityTime === 'number' && Number.isFinite(lastActivityTime)) {\n const activityTimes = (session.activityTimes ??= []);\n if (activityTimes.at(-1) !== lastActivityTime) {\n activityTimes.push(lastActivityTime);\n // 长会话仅保留近期活动明细;被裁剪的历史元数据省略,不伪造时间。\n if (activityTimes.length > 100) activityTimes.splice(0, activityTimes.length - 100);\n }\n }\n } else {\n SESSION_ATTRIBUTE_KEYS.forEach(key => delete this.attributes[key]);\n }\n };\n\n public setSessionSampled = (sampled: boolean, changedAt = Date.now()) => {\n if (sampled === this.sampled) return;\n const previous = this.samplingHistory.at(-1);\n if (previous && previous.endedAt === undefined) previous.endedAt = Math.max(previous.startedAt, changedAt);\n this.sampled = sampled;\n if (sampled) this.samplingHistory.push({ sampled, startedAt: changedAt });\n if (this.samplingHistory.length > 100) {\n this.samplingHistory.splice(0, this.samplingHistory.length - 100);\n }\n };\n\n public setUser = (user: BkOTUserContext) => {\n this.user = {\n ...this.user,\n ...user,\n };\n\n if ('id' in user) {\n if (user.id === undefined) {\n delete this.attributes[RUM_ATTRIBUTES.userId];\n return;\n }\n this.attributes[RUM_ATTRIBUTES.userId] = user.id;\n }\n };\n\n public setView = (\n view: BkOTViewContext,\n changedAt = view.id !== this.view.id ? (view.startedAt ?? Date.now()) : Date.now(),\n ) => {\n const previous = this.view.id ? this.viewLifecycles.get(this.view.id) : undefined;\n if (previous && view.id !== this.view.id) {\n previous.view.endedAt = view.endedAt ?? changedAt;\n previous.view.relativeEndedAt = view.relativeEndedAt ?? view.relativeStartedAt;\n previous.view.interactionCountAtEnd = view.interactionCountAtEnd ?? view.interactionCountAtStart;\n const latest = this.getAttributes();\n // Session 可能已经切换或解绑;冻结最新用户/业务属性时保留该 View 原本的身份。\n for (const key of Object.keys(latest)) {\n if (key.startsWith('session.') || key.startsWith('view.') || key === RUM_ATTRIBUTES.tabId) delete latest[key];\n }\n for (const [key, value] of Object.entries(previous.runtimeAttributes)) {\n if (key.startsWith('session.') || key.startsWith('view.') || key === RUM_ATTRIBUTES.tabId) latest[key] = value;\n }\n previous.runtimeAttributes = latest;\n }\n this.viewAttributeKeys.forEach(key => delete this.attributes[key]);\n this.viewAttributeKeys.clear();\n const viewAttributes: Attributes = {};\n for (const [key, value] of Object.entries(copyAttributes(view.attributes))) {\n // 自定义 View 属性不能覆盖 SDK 维护的关联和语义字段。\n if (value === undefined || PROTECTED_VIEW_ATTRIBUTE_KEYS.has(key) || key.startsWith('view.custom_timings.'))\n continue;\n viewAttributes[key] = value;\n this.attributes[key] = value;\n this.viewAttributeKeys.add(key);\n this.viewScopedAttributeKeys.add(key);\n }\n this.view = { ...view, attributes: viewAttributes };\n this.setOptionalAttribute(RUM_ATTRIBUTES.viewId, view.id);\n this.setOptionalAttribute(RUM_ATTRIBUTES.viewUrl, view.url);\n this.setOptionalAttribute(RUM_ATTRIBUTES.viewUrlTemplate, view.urlTemplate);\n this.setOptionalAttribute(RUM_ATTRIBUTES.viewLoadingType, view.loadingType);\n this.setOptionalAttribute(RUM_ATTRIBUTES.viewName, view.name);\n [\n RUM_ATTRIBUTES.viewId,\n RUM_ATTRIBUTES.viewUrl,\n RUM_ATTRIBUTES.viewUrlTemplate,\n RUM_ATTRIBUTES.viewLoadingType,\n RUM_ATTRIBUTES.viewName,\n ].forEach(key => this.viewScopedAttributeKeys.add(key));\n this.recordAssociation(\n this.viewHistory,\n this.viewScopedAttributeKeys,\n changedAt,\n typeof view.id === 'string' && view.id.length > 0,\n );\n if (view.id) {\n this.viewLifecycles.set(view.id, { view: this.getView(), runtimeAttributes: this.getAttributes() });\n if (this.viewLifecycles.size > 100) this.viewLifecycles.delete(this.viewLifecycles.keys().next().value!);\n }\n this.viewChangeListeners.forEach(listener => listener(this.getView()));\n };\n\n public constructor(initialAttributes: Attributes = {}, user?: BkOTUserContext) {\n this.setAttributes(initialAttributes);\n if (user) {\n this.setUser(user);\n }\n }\n}\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { createContextKey } from '@opentelemetry/api';\n\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { RUM_SPAN_TYPE } from '../schema/span';\nimport { copyAttributes } from './runtime-context';\nimport { isBkOTEndpoint } from './url';\n\nimport type { BkOTActivityEvent } from './action-activity';\nimport type { ResolvedBkOTConfig } from './config';\nimport type { Span as ApiSpan, Attributes, Context } from '@opentelemetry/api';\nimport type { ReadableSpan, Span, SpanProcessor } from '@opentelemetry/sdk-trace-base';\n\n// 仅在 SDK 到 processor 之间传递关联时刻,不进入 Span 属性或公开 API。\nexport const RUM_CONTEXT_TIME = createContextKey('bk-rum-context-time');\n// 指标等显式快照的缺失字段同样具有语义,不能再次用当前/历史属性补齐。\nexport const RUM_CONTEXT_SNAPSHOT = createContextKey('bk-rum-context-snapshot');\n\nconst SELF_TELEMETRY_URL_KEYS = ['http.url', 'url.full'];\nconst discardedSpans = new WeakSet<object>();\nconst attributeReplacements = new WeakMap<object, { attributes: Attributes; keys: Set<string> }>();\n\n/** 请求先创建 Span、后得到最终字段;setAttributes 的合并语义无法表达 Hook 删除。 */\nexport const replaceSpanAttributes = (span: ApiSpan, attributes: Attributes, replacedKeys: Iterable<string>) => {\n attributeReplacements.set(span, { attributes: copyAttributes(attributes), keys: new Set(replacedKeys) });\n};\n\nexport const markSpanDiscarded = (span: ApiSpan) => {\n discardedSpans.add(span);\n};\n\nconst getSpanUrl = (span: ReadableSpan): string | undefined => {\n for (const key of SELF_TELEMETRY_URL_KEYS) {\n const value = span.attributes?.[key];\n if (typeof value === 'string') {\n return value;\n }\n }\n return undefined;\n};\n\nconst hasSessionId = (attributes: Record<string, unknown> | undefined) => {\n const sessionId = attributes?.[RUM_ATTRIBUTES.sessionId];\n return typeof sessionId === 'string' && sessionId.length > 0;\n};\n\nconst hasViewId = (attributes: Record<string, unknown> | undefined) => {\n const viewId = attributes?.[RUM_ATTRIBUTES.viewId];\n return typeof viewId === 'string' && viewId.length > 0;\n};\n\nconst hasRumContext = (attributes: Record<string, unknown> | undefined) =>\n hasSessionId(attributes) && hasViewId(attributes);\n\nconst isSessionSpan = (attributes: Record<string, unknown> | undefined) =>\n attributes?.[RUM_ATTRIBUTES.spanType] === RUM_SPAN_TYPE.session;\n\nconst canAssociateAction = (attributes: Attributes) =>\n [RUM_SPAN_TYPE.resource, RUM_SPAN_TYPE.error, RUM_SPAN_TYPE.longTask].some(\n type => attributes[RUM_ATTRIBUTES.spanType] === type,\n );\n\n/** Action 自身用单值身份,只有有明确类型的子事件携带多 Action 关联。 */\nexport const filterActionAttributes = (attributes: Attributes): Attributes => {\n if (\n attributes[RUM_ATTRIBUTES.spanType] !== RUM_SPAN_TYPE.action ||\n typeof attributes[RUM_ATTRIBUTES.actionId] !== 'string'\n ) {\n delete attributes[RUM_ATTRIBUTES.actionId];\n }\n if (!canAssociateAction(attributes)) delete attributes[RUM_ATTRIBUTES.actionIds];\n return attributes;\n};\n\nconst withAttributes = (span: ReadableSpan, attributes: Attributes): ReadableSpan => ({\n ...span,\n attributes,\n duration: span.duration,\n ended: span.ended,\n droppedAttributesCount: span.droppedAttributesCount,\n droppedEventsCount: span.droppedEventsCount,\n droppedLinksCount: span.droppedLinksCount,\n spanContext: () => span.spanContext(),\n});\n\ninterface SessionAssociation {\n checkSession: () => void;\n getAttributesAt: (at: number) => Attributes;\n isPending: (at?: number) => boolean;\n isSampled: (attributes: Attributes) => boolean;\n whenReady: (callback: () => void) => void;\n}\n\nconst getStartTime = (span: ReadableSpan | Span) =>\n span.startTime ? span.startTime[0] * 1_000 + span.startTime[1] / 1_000_000 : Date.now();\n\n/**\n * 给所有 span 固化创建时的运行时上下文,并在 onEnd 阶段过滤自身上报请求和无 RUM 上下文 span。\n */\nexport class FilteringSpanProcessor implements SpanProcessor {\n // 即使 instrumentation 在结束前才声明 span_type,也按创建时的窗口关联,而不是导出时的当前动作。\n private readonly actionContexts = new WeakMap<object, Attributes>();\n private readonly pending = new WeakMap<object, { attributes?: Attributes; ended?: ReadableSpan }>();\n private redactEnvelope(span: ReadableSpan): ReadableSpan {\n const redact = (attributes?: Attributes) => {\n const copy = copyAttributes(attributes);\n return this.config.hooks?.redactAttributes?.(copy) ?? copy;\n };\n return {\n ...span,\n attributes: redact(span.attributes),\n links: (span.links ?? []).map(link => ({\n ...link,\n context: { ...link.context },\n attributes: redact(link.attributes),\n })),\n events: (span.events ?? []).map(event => ({\n ...event,\n time: [...event.time],\n attributes: redact(event.attributes),\n })),\n spanContext: () => span.spanContext(),\n };\n }\n\n public constructor(\n private readonly inner: SpanProcessor,\n private readonly config: ResolvedBkOTConfig,\n private readonly getRuntimeAttributes: () => Attributes,\n private readonly association?: SessionAssociation,\n private readonly onError?: (event: Extract<BkOTActivityEvent, { type: 'error' }>) => void,\n ) {}\n\n public forceFlush(): Promise<void> {\n return this.inner.forceFlush();\n }\n\n public onEnd(span: ReadableSpan): void {\n const originalSpan = span;\n const pending = this.pending.get(span);\n if (pending) {\n if (!pending.attributes) {\n pending.ended = span;\n return;\n }\n this.pending.delete(span);\n // 已结束的 OTel Span 不可变;仅为导出构建一个带最终关联的只读快照。\n span = withAttributes(span, { ...pending.attributes, ...span.attributes });\n }\n const attributes = copyAttributes(span.attributes);\n const replacement = attributeReplacements.get(originalSpan);\n attributeReplacements.delete(originalSpan);\n if (replacement) {\n for (const key of replacement.keys) delete attributes[key];\n Object.assign(attributes, replacement.attributes);\n }\n filterActionAttributes(attributes);\n if (isSessionSpan(attributes)) {\n for (const key of Object.keys(attributes)) if (key.startsWith('view.')) delete attributes[key];\n }\n const actionContext = this.actionContexts.get(originalSpan);\n this.actionContexts.delete(originalSpan);\n if (canAssociateAction(attributes) && actionContext) {\n delete attributes[RUM_ATTRIBUTES.actionIds];\n if (\n attributes[RUM_ATTRIBUTES.sessionId] === actionContext[RUM_ATTRIBUTES.sessionId] &&\n attributes[RUM_ATTRIBUTES.viewId] === actionContext[RUM_ATTRIBUTES.viewId] &&\n actionContext[RUM_ATTRIBUTES.actionIds] !== undefined\n ) {\n attributes[RUM_ATTRIBUTES.actionIds] = actionContext[RUM_ATTRIBUTES.actionIds];\n }\n }\n span = withAttributes(span, attributes);\n const url = getSpanUrl(span);\n if (\n discardedSpans.delete(originalSpan) ||\n (url && isBkOTEndpoint(this.config, url)) ||\n (!hasRumContext(span.attributes) && !(isSessionSpan(span.attributes) && hasSessionId(span.attributes))) ||\n (this.association && !this.association.isSampled(span.attributes))\n ) {\n return;\n }\n try {\n // instrumentation 可在创建后添加 Event/Link 属性;最终出口统一脱敏,\n // 同时复制数组,避免 Hook 修改已结束 Span 或调用方持有的上下文。\n span = this.redactEnvelope(span);\n const event = {\n attributes: span.attributes,\n events: span.events,\n links: span.links,\n name: span.name,\n signal: 'span' as const,\n };\n if (this.config.hooks?.beforeSend?.(event) === false) return;\n span = this.redactEnvelope({\n ...span,\n attributes: event.attributes,\n name: event.name,\n events: event.events ?? [],\n links: event.links ?? [],\n });\n } catch (error) {\n if (this.config.debug) globalThis.console?.warn('[bk-ot] span filtering failed:', error);\n // 脱敏/过滤失败不能回退发送原始事件,也不能向业务调用栈抛出异常。\n return;\n }\n filterActionAttributes(span.attributes);\n // 错误挫败只统计真正通过采样/过滤的 Error,关联使用事件创建时的动作集合。\n if (span.attributes[RUM_ATTRIBUTES.spanType] === RUM_SPAN_TYPE.error) {\n const ids = span.attributes[RUM_ATTRIBUTES.actionIds];\n this.onError?.({\n type: 'error',\n time: getStartTime(span),\n actionIds: Array.isArray(ids) ? ids.filter((id): id is string => typeof id === 'string') : [],\n });\n }\n this.inner.onEnd(span);\n }\n\n public onStart(span: Span, parentContext: Context): void {\n this.association?.checkSession();\n const existingAttributes = (span as Span & { attributes?: Attributes }).attributes ?? {};\n if (parentContext.getValue?.(RUM_CONTEXT_SNAPSHOT) === true) {\n this.actionContexts.set(span, { ...existingAttributes });\n this.inner.onStart(span, parentContext);\n return;\n }\n const contextTime = parentContext.getValue?.(RUM_CONTEXT_TIME);\n const occurredAt = typeof contextTime === 'number' ? contextTime : getStartTime(span);\n if (!hasSessionId(existingAttributes) && this.association?.isPending(occurredAt)) {\n const snapshot = { ...this.getRuntimeAttributes() };\n for (const key of Object.keys(snapshot)) {\n if (\n key.startsWith('session.') ||\n key.startsWith('view.') ||\n key === RUM_ATTRIBUTES.actionId ||\n key === RUM_ATTRIBUTES.actionIds ||\n key in existingAttributes\n )\n delete snapshot[key];\n }\n span.setAttributes(snapshot);\n const pending: { attributes?: Attributes; ended?: ReadableSpan } = {};\n this.pending.set(span, pending);\n this.association.whenReady(() => {\n pending.attributes = this.association!.getAttributesAt(occurredAt);\n this.actionContexts.set(span, pending.attributes);\n if (pending.ended) this.onEnd(pending.ended);\n });\n this.inner.onStart(span, parentContext);\n return;\n }\n const missingRuntimeAttributes: Attributes = {};\n // instrumentation 显式写入的属性优先,只补齐创建时缺失的运行时上下文。\n const historical = this.association?.getAttributesAt(occurredAt);\n const runtimeAttributes = historical\n ? { ...this.getRuntimeAttributes(), ...historical }\n : this.getRuntimeAttributes();\n if (historical) {\n for (const key of Object.keys(runtimeAttributes)) {\n if (\n (key.startsWith('session.') ||\n key.startsWith('view.') ||\n key === RUM_ATTRIBUTES.actionId ||\n key === RUM_ATTRIBUTES.actionIds) &&\n !(key in historical)\n )\n delete runtimeAttributes[key];\n }\n }\n this.actionContexts.set(span, runtimeAttributes);\n for (const [key, value] of Object.entries(runtimeAttributes)) {\n if (\n key === RUM_ATTRIBUTES.actionId ||\n (key === RUM_ATTRIBUTES.actionIds && !canAssociateAction(existingAttributes))\n )\n continue;\n if (isSessionSpan(existingAttributes) && key.startsWith('view.')) continue;\n if (existingAttributes[key] === undefined && value !== undefined) missingRuntimeAttributes[key] = value;\n }\n span.setAttributes(missingRuntimeAttributes);\n this.inner.onStart(span, parentContext);\n }\n\n public shutdown(): Promise<void> {\n return this.inner.shutdown();\n }\n}\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\ninterface PendingRequestTiming {\n callEnd?: number;\n entry?: PerformanceResourceTiming;\n finished: boolean;\n initiatorType: string;\n startTime: number;\n timer?: ReturnType<typeof setTimeout>;\n url: string;\n callback?: (entry?: PerformanceResourceTiming) => void;\n}\n\nconst MAX_REQUESTS = 1000;\nconst RESOURCE_TIMING_WAIT_MS = 200;\n// 对未结束的流、缺失 RT 或浏览器观察器异常提供有界回退,不主动读取/克隆业务响应体。\nconst RESOURCE_BODY_WAIT_MS = 60_000;\nconst requests: PendingRequestTiming[] = [];\nconst normalizeUrl = (url: string) => url.replace(/#.*$/, '');\n\nconst finish = (pending: PendingRequestTiming) => {\n pending.finished = true;\n if (pending.timer !== undefined) clearTimeout(pending.timer);\n const callback = pending.callback;\n pending.callback = undefined;\n // 容量回收也会从另一条业务请求的调用栈进入这里,采集回调异常不能阻断原生请求。\n try {\n callback?.(pending.entry);\n } catch {\n /* 完成清理由请求采集端负责。 */\n }\n};\n\nexport const notifyRequestTiming = (entry: PerformanceResourceTiming) => {\n // 同一 performance 时钟坐标,避免 Date.now 的毫秒取整和系统时钟校准污染匹配。\n // 原生调用窗口之外的条目绝不借给仍在飞行的同 URL 请求。\n const candidates = requests\n .filter(\n pending =>\n normalizeUrl(pending.url) === normalizeUrl(entry.name) &&\n pending.initiatorType === entry.initiatorType &&\n entry.startTime >= pending.startTime &&\n entry.startTime <= (pending.callEnd ?? performance.now()) + 0.1,\n )\n .sort((left, right) => right.startTime - left.startTime);\n const candidate = candidates[0];\n if (!candidate || candidate.finished || candidate.entry) return;\n // 浏览器降低时钟精度时不能凭入队顺序猜测;已结束记录也参与消歧,防止迟到条目被再次认领。\n if (candidates[1]?.startTime === candidate.startTime) return;\n candidate.entry = entry;\n if (candidate.callback) finish(candidate);\n};\n\nexport const trackRequestTiming = (url: string, startTime = performance.now(), initiatorType = 'fetch') => {\n const pending: PendingRequestTiming = { startTime, url, initiatorType, finished: false };\n requests.push(pending);\n if (requests.length > MAX_REQUESTS) finish(requests.shift()!);\n return {\n // 紧贴原生 fetch/send 调用后执行,而非等待 Promise resolve 或响应结束。\n sent: () => {\n pending.callEnd = performance.now();\n },\n cancel: () => {\n finish(pending);\n },\n complete: (callback: (entry?: PerformanceResourceTiming) => void, waitForBody = false) => {\n pending.callback = callback;\n if (pending.finished || pending.entry) {\n finish(pending);\n return;\n }\n // 成功 Fetch 的 resolve 仅代表响应头可用;XHR 终止/失败才可使用短 observer 等待窗口。\n pending.timer = setTimeout(() => finish(pending), waitForBody ? RESOURCE_BODY_WAIT_MS : RESOURCE_TIMING_WAIT_MS);\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n/**\n * 被观测请求的 Trace Context 规划。\n *\n * 后端 APM 只解析 W3C `traceparent`,并且要求一个后端 trace 只对应一个 API 请求,因此这里不复用\n * RUM Span 自身的 trace context,而是为每个命中白名单的请求生成独立的 trace-id/span-id,再通过\n * Span Link 把后端 trace 关联回 RUM Span。\n *\n * 如果业务已经自行设置了 trace header(`traceparent`、`sentry-trace`、b3、Datadog、sw8),则完全\n * 不注入,避免破坏业务既有的传播方式;只有可映射的合法链路才建 Link。\n *\n * `context` 承载 trace-id/span-id,`attributes` 只记录命中的格式和是否由 SDK 注入。\n * 原始厂商 header 可能包含业务标签、服务地址等内容,不进入遥测事件。\n * sw8 这类无法映射为合法 OTel id 的格式不建 Link,避免把不存在的链路提供给检索端。\n */\n\nimport { TraceFlags } from '@opentelemetry/api';\n\nimport type { Attributes, Link } from '@opentelemetry/api';\n\n/** 大小写不敏感地读取一个请求 header */\nexport type BkOTHeaderReader = (name: string) => string | undefined;\n\nexport interface BkOTRequestTracePlan {\n /** 关联后端 trace 的 Span Link;既有厂商上下文无法映射时为空 */\n links: Link[];\n /** 需要注入的 traceparent;业务已有 trace header 时为 undefined */\n traceparent?: string;\n}\n\nexport type BkOTUpstreamTraceFormat = 'b3' | 'b3-multi' | 'datadog' | 'sentry-trace' | 'sw8' | 'traceparent';\n\nexport const TRACEPARENT_HEADER = 'traceparent';\n\nconst TRACE_ID_LENGTH = 32;\nconst SPAN_ID_LENGTH = 16;\n\nconst HEX_DIGITS = '0123456789abcdef';\nconst HEX_PATTERN = /^[\\da-f]+$/;\nconst ZERO_PATTERN = /^0+$/;\nconst DECIMAL_PATTERN = /^\\d+$/;\n\n// W3C 已知前缀;是否允许追加字段还要按 version 检查,不能把 00 当作未来版本。\nconst TRACEPARENT_PATTERN = /^([\\da-f]{2})-([\\da-f]{32})-([\\da-f]{16})-([\\da-f]{2})(?:-.*)?$/;\nconst SENTRY_TRACE_PATTERN = /^([\\da-f]{32})-([\\da-f]{16})(?:-([01]))?$/;\n// Datadog 128 位 trace-id 的高 64 位放在 x-datadog-tags 的 _dd.p.tid 里\nconst DATADOG_TRACE_ID_HIGH_PATTERN = /(?:^|,)_dd\\.p\\.tid=([\\da-f]{16})(?:,|$)/;\nconst DATADOG_TRACE_ID_HIGH_DEFAULT = '0000000000000000';\n\n/** OTel 要求 id 为定长小写 hex 且不能全零 */\nconst isValidHexId = (value: string, length: number) =>\n value.length === length && HEX_PATTERN.test(value) && !ZERO_PATTERN.test(value);\n\n// b3 与 Datadog 允许 64 位 trace-id,映射到 OTel 的 128 位时按规范左侧补零\nconst normalizeTraceId = (value: string) => {\n const lower = value.toLowerCase();\n if (isValidHexId(lower, TRACE_ID_LENGTH)) return lower;\n return isValidHexId(lower, SPAN_ID_LENGTH) ? lower.padStart(TRACE_ID_LENGTH, '0') : undefined;\n};\n\nconst normalizeSpanId = (value: string) => {\n const lower = value.toLowerCase();\n return isValidHexId(lower, SPAN_ID_LENGTH) ? lower : undefined;\n};\n\nconst createRandomHexId = (length: number) => {\n const bytes = new Uint8Array(length / 2);\n if (typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function') {\n crypto.getRandomValues(bytes);\n } else {\n for (let index = 0; index < bytes.length; index += 1) bytes[index] = Math.floor(Math.random() * 256);\n }\n let hex = '';\n for (const byte of bytes) {\n hex += HEX_DIGITS[byte >> 4] + HEX_DIGITS[byte & 15];\n }\n // 全零是 OTel 的非法 id,概率极低但必须排除\n return ZERO_PATTERN.test(hex) ? `${hex.slice(1)}1` : hex;\n};\n\n/**\n * Datadog 用十进制字符串传 64 位 id。构建目标是 es2015,不能依赖 BigInt,\n * 这里用逐位进位的方式把十进制换算成 16 位 hex。\n */\nconst decimalToHexId = (value: string) => {\n if (!DECIMAL_PATTERN.test(value)) return undefined;\n const nibbles: number[] = [];\n for (let index = 0; index < value.length; index += 1) {\n let carry = value.charCodeAt(index) - 48;\n for (let position = 0; position < nibbles.length; position += 1) {\n const product = nibbles[position] * 10 + carry;\n nibbles[position] = product % 16;\n carry = (product - (product % 16)) / 16;\n }\n while (carry > 0) {\n nibbles.push(carry % 16);\n carry = (carry - (carry % 16)) / 16;\n }\n }\n if (nibbles.length > SPAN_ID_LENGTH) return undefined;\n let hex = '';\n for (let position = nibbles.length - 1; position >= 0; position -= 1) hex += HEX_DIGITS[nibbles[position]];\n return hex.padStart(SPAN_ID_LENGTH, '0');\n};\n\ninterface UpstreamTrace {\n format: BkOTUpstreamTraceFormat;\n sampled?: boolean;\n /** 规范化后的合法 OTel id;无法映射时两者同时缺失 */\n spanId?: string;\n traceId?: string;\n}\n\n/**\n * `traceparent` 与 SDK 注入的是同一个 header,因此格式非法时视作没有既有链路:\n * 这种值后端同样无法接续,覆盖注入比保留它更有价值。\n */\nconst parseTraceparent = (getHeader: BkOTHeaderReader): undefined | UpstreamTrace => {\n // Header 名大小写不敏感,但 W3C 的 hex 值只允许小写,不能替业务修正非法值。\n const value = getHeader(TRACEPARENT_HEADER)?.trim();\n if (!value) return undefined;\n const matched = TRACEPARENT_PATTERN.exec(value);\n if (!matched || matched[1] === 'ff' || (matched[1] === '00' && value.length !== 55)) return undefined;\n const [, , traceId, spanId, flags] = matched;\n if (!isValidHexId(traceId, TRACE_ID_LENGTH) || !isValidHexId(spanId, SPAN_ID_LENGTH)) return undefined;\n return {\n format: 'traceparent',\n sampled: (Number.parseInt(flags, 16) & 1) === 1,\n spanId,\n traceId,\n };\n};\n\nconst parseSentryTrace = (getHeader: BkOTHeaderReader): undefined | UpstreamTrace => {\n const value = getHeader('sentry-trace')?.trim().toLowerCase();\n if (!value) return undefined;\n const matched = SENTRY_TRACE_PATTERN.exec(value);\n if (!matched) return { format: 'sentry-trace' };\n const [, traceId, spanId, sampled] = matched;\n return {\n format: 'sentry-trace',\n ...(sampled === undefined ? {} : { sampled: sampled === '1' }),\n ...(isValidHexId(traceId, TRACE_ID_LENGTH) && isValidHexId(spanId, SPAN_ID_LENGTH) ? { spanId, traceId } : {}),\n };\n};\n\n// b3 单头:{trace-id}-{span-id}[-{sampling-state}[-{parent-span-id}]],也允许只有 0 / 1 / d\nconst parseB3Single = (getHeader: BkOTHeaderReader): undefined | UpstreamTrace => {\n const value = getHeader('b3')?.trim().toLowerCase();\n if (!value) return undefined;\n const [rawTraceId, rawSpanId, samplingState] = value.split('-');\n const traceId = rawTraceId ? normalizeTraceId(rawTraceId) : undefined;\n const spanId = rawSpanId ? normalizeSpanId(rawSpanId) : undefined;\n return {\n format: 'b3',\n ...(traceId && spanId ? { spanId, traceId } : {}),\n ...(samplingState ? { sampled: samplingState === '1' || samplingState === 'd' } : {}),\n };\n};\n\nconst parseB3Multi = (getHeader: BkOTHeaderReader): undefined | UpstreamTrace => {\n const rawTraceId = getHeader('x-b3-traceid')?.trim().toLowerCase();\n const rawSpanId = getHeader('x-b3-spanid')?.trim().toLowerCase();\n const samplingState = getHeader('x-b3-sampled')?.trim().toLowerCase();\n if (!rawTraceId && !rawSpanId && !samplingState) return undefined;\n const traceId = rawTraceId ? normalizeTraceId(rawTraceId) : undefined;\n const spanId = rawSpanId ? normalizeSpanId(rawSpanId) : undefined;\n return {\n format: 'b3-multi',\n ...(traceId && spanId ? { spanId, traceId } : {}),\n ...(samplingState ? { sampled: samplingState === '1' || samplingState === 'd' } : {}),\n };\n};\n\nconst parseDatadog = (getHeader: BkOTHeaderReader): undefined | UpstreamTrace => {\n const rawTraceId = getHeader('x-datadog-trace-id')?.trim();\n const rawSpanId = getHeader('x-datadog-parent-id')?.trim();\n const samplingPriority = getHeader('x-datadog-sampling-priority')?.trim();\n if (!rawTraceId && !rawSpanId && !samplingPriority) return undefined;\n const tags = getHeader('x-datadog-tags')?.trim().toLowerCase();\n const traceIdHigh =\n (tags ? DATADOG_TRACE_ID_HIGH_PATTERN.exec(tags)?.[1] : undefined) ?? DATADOG_TRACE_ID_HIGH_DEFAULT;\n const traceIdLow = rawTraceId ? decimalToHexId(rawTraceId) : undefined;\n const traceId = traceIdLow ? normalizeTraceId(`${traceIdHigh}${traceIdLow}`) : undefined;\n const spanIdHex = rawSpanId ? decimalToHexId(rawSpanId) : undefined;\n const spanId = spanIdHex ? normalizeSpanId(spanIdHex) : undefined;\n return {\n format: 'datadog',\n ...(traceId && spanId ? { spanId, traceId } : {}),\n ...(samplingPriority ? { sampled: Number(samplingPriority) > 0 } : {}),\n };\n};\n\n/**\n * sw8:{sample}-{trace-id}-{segment-id}-{span-id}-{service}-{instance}-{endpoint}-{peer},\n * 其中 trace-id 与 segment-id 是 base64 后的 SkyWalking id。它们不是 16 字节 hex,无法映射为\n * 合法的 OTel SpanContext,因此只用来阻止重复注入,不产出 traceId/spanId。\n */\nconst parseSw8 = (getHeader: BkOTHeaderReader): undefined | UpstreamTrace => {\n const value = getHeader('sw8')?.trim();\n if (!value) return undefined;\n const samplingState = value.split('-')[0];\n return {\n format: 'sw8',\n ...(samplingState ? { sampled: samplingState === '1' } : {}),\n };\n};\n\n// 按格式明确度排序:先看与 SDK 同名的 traceparent,再看其他厂商格式\nconst UPSTREAM_PARSERS = [parseTraceparent, parseSentryTrace, parseB3Single, parseB3Multi, parseDatadog, parseSw8];\n\nexport const detectUpstreamTrace = (getHeader: BkOTHeaderReader) => {\n for (const parse of UPSTREAM_PARSERS) {\n const upstream = parse(getHeader);\n if (upstream) return upstream;\n }\n return undefined;\n};\n\nconst toLink = (traceId: string, spanId: string, attributes: Attributes, sampled?: boolean): Link => ({\n attributes,\n context: {\n spanId,\n traceFlags: sampled === false ? TraceFlags.NONE : TraceFlags.SAMPLED,\n traceId,\n },\n});\n\nexport const planRequestTrace = (getHeader: BkOTHeaderReader): BkOTRequestTracePlan => {\n const upstream = detectUpstreamTrace(getHeader);\n if (!upstream) {\n // 与 RUM Span 无关的独立 trace,保证后端按 trace-id 检索时只命中这一个 API 请求\n const traceId = createRandomHexId(TRACE_ID_LENGTH);\n const spanId = createRandomHexId(SPAN_ID_LENGTH);\n const traceparent = `00-${traceId}-${spanId}-01`;\n return {\n links: [toLink(traceId, spanId, { format: 'traceparent', injected: true })],\n traceparent,\n };\n }\n // 保留既有传播方式,但绝不能用随机 id 冒充后端可查询的链路。\n if (!upstream.traceId || !upstream.spanId) return { links: [] };\n return {\n links: [\n toLink(\n upstream.traceId,\n upstream.spanId,\n // injected 恒定写出:业务自带的合法 traceparent 与 SDK 注入的 format 同值,只靠 format 无法区分\n { format: upstream.format, injected: false },\n upstream.sampled,\n ),\n ],\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\n\ntype NavigationTimingPoints = PerformanceNavigationTiming & {\n activationStart?: number;\n};\n\ntype TimingPoints = PerformanceResourceTiming & {\n finalResponseHeadersStart?: number;\n workerCacheLookupStart?: number;\n workerRouterEvaluationStart?: number;\n};\n\n/** 原样写入有限、非负的浏览器时间点。 */\nconst setTimingPoint = (attributes: Record<string, number>, key: string, value: number | undefined) => {\n if (typeof value === 'number' && Number.isFinite(value) && value >= 0) {\n attributes[key] = value;\n }\n};\n\n/** 采集 Resource 与 Navigation 共用的浏览器原始时间点。 */\nexport const getTimingPointAttributes = (entry: TimingPoints) => {\n const attributes: Record<string, number> = {};\n if (!Number.isFinite(entry.startTime) || entry.startTime < 0) return attributes;\n const setTiming = (key: string, value: number | undefined) => setTimingPoint(attributes, key, value);\n setTiming(RUM_ATTRIBUTES.timingStartTime, entry.startTime);\n setTiming(RUM_ATTRIBUTES.timingRedirectStart, entry.redirectStart);\n setTiming(RUM_ATTRIBUTES.timingRedirectEnd, entry.redirectEnd);\n setTiming(RUM_ATTRIBUTES.timingFetchStart, entry.fetchStart);\n setTiming(RUM_ATTRIBUTES.timingWorkerStart, entry.workerStart);\n setTiming(RUM_ATTRIBUTES.timingWorkerRouterEvaluationStart, entry.workerRouterEvaluationStart);\n setTiming(RUM_ATTRIBUTES.timingWorkerCacheLookupStart, entry.workerCacheLookupStart);\n setTiming(RUM_ATTRIBUTES.timingDomainLookupStart, entry.domainLookupStart);\n setTiming(RUM_ATTRIBUTES.timingDomainLookupEnd, entry.domainLookupEnd);\n setTiming(RUM_ATTRIBUTES.timingConnectStart, entry.connectStart);\n setTiming(RUM_ATTRIBUTES.timingSecureConnectionStart, entry.secureConnectionStart);\n setTiming(RUM_ATTRIBUTES.timingConnectEnd, entry.connectEnd);\n setTiming(RUM_ATTRIBUTES.timingRequestStart, entry.requestStart);\n setTiming(RUM_ATTRIBUTES.timingResponseStart, entry.responseStart);\n setTiming(RUM_ATTRIBUTES.timingFinalResponseHeadersStart, entry.finalResponseHeadersStart);\n setTiming(RUM_ATTRIBUTES.timingResponseEnd, entry.responseEnd);\n return attributes;\n};\n\n/** Navigation 专属时间点,原样上报;请求阶段由 getTimingPointAttributes 提供。 */\nexport const getNavigationTimingPointAttributes = (entry: NavigationTimingPoints) => {\n const attributes: Record<string, number> = {};\n if (!Number.isFinite(entry.startTime) || entry.startTime < 0) return attributes;\n const setTiming = (key: string, value: number | undefined) => setTimingPoint(attributes, key, value);\n setTiming(RUM_ATTRIBUTES.timingUnloadEventStart, entry.unloadEventStart);\n setTiming(RUM_ATTRIBUTES.timingUnloadEventEnd, entry.unloadEventEnd);\n setTiming(RUM_ATTRIBUTES.timingDomContentLoadedEventStart, entry.domContentLoadedEventStart);\n setTiming(RUM_ATTRIBUTES.timingDomContentLoadedEventEnd, entry.domContentLoadedEventEnd);\n setTiming(RUM_ATTRIBUTES.timingLoadEventStart, entry.loadEventStart);\n setTiming(RUM_ATTRIBUTES.timingLoadEventEnd, entry.loadEventEnd);\n setTiming(RUM_ATTRIBUTES.timingActivationStart, entry.activationStart);\n return attributes;\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { SpanKind } from '@opentelemetry/api';\n\nimport { getTimingPointAttributes } from '../core/performance-timing';\nimport { notifyRequestTiming } from '../core/request-timing';\nimport { shouldIgnoreRequest, shouldIgnoreUrl } from '../core/url';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { buildRumResourceSpanAttributes, buildRumSpanName, RUM_SPAN_TYPE } from '../schema/span';\n\nimport type { BkOTPlugin } from '../core/plugin';\n\n/**\n * Resource Timing 的统一消费端:静态资源按配置生成 span;Fetch/XHR timing 转交 request 插件,\n * 与其已创建的请求 span 合并,避免同一次网络请求重复计数。\n * worker 路由相关字段与 finalResponseHeadersStart 为浏览器已提供、但 TS lib.dom 尚未声明的 Resource Timing 字段。\n */\ntype ResourceTimingWithStatus = PerformanceResourceTiming & {\n deliveryType?: string;\n finalResponseHeadersStart?: number;\n renderBlockingStatus?: string;\n responseStatus?: number;\n workerCacheLookupStart?: number;\n workerFinalRouterSource?: string;\n workerFinalSourceType?: string;\n workerMatchedRouterSource?: string;\n workerMatchedSourceType?: string;\n workerRouterEvaluationStart?: number;\n};\n\n// Chromium 的 SourceType 与规范的 RouterSource 表达同一来源;统一读取,避免上报与缓存判断口径不一致。\nconst getWorkerRouterSources = (entry: ResourceTimingWithStatus) => ({\n matched: entry.workerMatchedRouterSource || entry.workerMatchedSourceType,\n final: entry.workerFinalRouterSource || entry.workerFinalSourceType,\n});\n\n/**\n * HTTP 缓存三态语义(含协商缓存):true = 确定使用缓存,false = 确定未使用,undefined = 不确定。\n * 当前只返回 true / undefined;未确认命中不等于确认未命中,不能据此写入 false。\n * SDK 应通过采集浏览器的 deliveryType 与大小字段作为缓存命中事实来源,本字段保留为兼容性的保守判断。\n * 官方缓存观测介绍:https://www.datadoghq.com/blog/javascript-cache/#use-datadog-rum-to-improve-your-cache-setup\n * 不应叠加更复杂的启发式兜底;后续浏览器的 deliveryType 或许能更精确地表达来源,届时优先跟进原生信号。\n */\nconst getCacheHit = (entry: ResourceTimingWithStatus): true | undefined => {\n const workerSources = getWorkerRouterSources(entry);\n // SW 转发网络、合成响应也可能报告 deliveryType=cache,需先排除 SW 路径。\n if (\n entry.workerStart > 0 ||\n (entry.workerRouterEvaluationStart ?? 0) > 0 ||\n (entry.workerCacheLookupStart ?? 0) > 0 ||\n workerSources.matched ||\n workerSources.final\n ) {\n return undefined;\n }\n\n // 保留 HTTP 缓存语义:包含经过网络校验后复用正文的协商缓存。\n if (entry.deliveryType === 'cache') return true;\n if (entry.deliveryType) return undefined;\n\n // 传输量为 0 也可能来自 TAO 限制;仅在正文大小和请求时序可见时采用此兜底。\n return entry.transferSize === 0 && entry.decodedBodySize > 0 && entry.requestStart > 0 && entry.responseStart > 0\n ? true\n : undefined;\n};\n\nconst hasUnavailableResourceDetails = (entry: ResourceTimingWithStatus) =>\n entry.transferSize === 0 &&\n entry.encodedBodySize === 0 &&\n entry.decodedBodySize === 0 &&\n entry.requestStart === 0 &&\n entry.responseStart === 0 &&\n !entry.nextHopProtocol;\n\nconst areInOrder = (...values: number[]) => values.every((value, index) => index === 0 || values[index - 1] <= value);\n\nconst setTiming = (attributes: Record<string, number>, name: string, origin: number, start: number, end: number) => {\n if (!areInOrder(origin, start, end)) return;\n attributes[`resource.${name}.start`] = start - origin;\n attributes[`resource.${name}.duration`] = end - start;\n};\n\nexport const getResourceTimingAttributes = (entry: ResourceTimingWithStatus) => {\n const attributes: Record<string, number> = {};\n const commonTimings = [\n entry.startTime,\n entry.fetchStart,\n entry.domainLookupStart,\n entry.domainLookupEnd,\n entry.connectStart,\n entry.connectEnd,\n entry.requestStart,\n entry.responseStart,\n entry.responseEnd,\n ];\n // 浏览器因 TAO 或实现差异可能返回缺失/乱序时间点;整组校验可避免产生负 duration。\n if (!commonTimings.every(Number.isFinite) || !areInOrder(...commonTimings)) return attributes;\n\n setTiming(attributes, 'first_byte', entry.startTime, entry.requestStart, entry.responseStart);\n setTiming(attributes, 'download', entry.startTime, entry.responseStart, entry.responseEnd);\n if (entry.workerStart > 0 && entry.workerStart < entry.fetchStart) {\n setTiming(attributes, 'worker', entry.startTime, entry.workerStart, entry.fetchStart);\n }\n if (entry.fetchStart < entry.domainLookupEnd) {\n setTiming(attributes, 'dns', entry.startTime, entry.domainLookupStart, entry.domainLookupEnd);\n }\n if (entry.fetchStart < entry.connectEnd) {\n setTiming(attributes, 'connect', entry.startTime, entry.connectStart, entry.connectEnd);\n if (entry.connectStart <= entry.secureConnectionStart && entry.secureConnectionStart <= entry.connectEnd) {\n setTiming(attributes, 'ssl', entry.startTime, entry.secureConnectionStart, entry.connectEnd);\n }\n }\n if (\n entry.redirectEnd > entry.startTime &&\n areInOrder(entry.startTime, entry.redirectStart, entry.redirectEnd, entry.fetchStart)\n ) {\n setTiming(attributes, 'redirect', entry.startTime, entry.redirectStart, entry.redirectEnd);\n }\n return attributes;\n};\n\n/**\n * 瀑布图用:浏览器 Resource Timing 属性 → `resource.timing.*`,按协议字段表顺序排列。\n */\nconst RESOURCE_TIMING_RAW_ATTRIBUTES: ReadonlyArray<readonly [keyof ResourceTimingWithStatus, string]> = [\n ['startTime', RUM_ATTRIBUTES.resourceTimingStartTime],\n ['redirectStart', RUM_ATTRIBUTES.resourceTimingRedirectStart],\n ['redirectEnd', RUM_ATTRIBUTES.resourceTimingRedirectEnd],\n ['fetchStart', RUM_ATTRIBUTES.resourceTimingFetchStart],\n ['workerStart', RUM_ATTRIBUTES.resourceTimingWorkerStart],\n ['workerRouterEvaluationStart', RUM_ATTRIBUTES.resourceTimingWorkerRouterEvaluationStart],\n ['workerCacheLookupStart', RUM_ATTRIBUTES.resourceTimingWorkerCacheLookupStart],\n ['domainLookupStart', RUM_ATTRIBUTES.resourceTimingDomainLookupStart],\n ['domainLookupEnd', RUM_ATTRIBUTES.resourceTimingDomainLookupEnd],\n ['connectStart', RUM_ATTRIBUTES.resourceTimingConnectStart],\n ['secureConnectionStart', RUM_ATTRIBUTES.resourceTimingSecureConnectionStart],\n ['connectEnd', RUM_ATTRIBUTES.resourceTimingConnectEnd],\n ['requestStart', RUM_ATTRIBUTES.resourceTimingRequestStart],\n ['responseStart', RUM_ATTRIBUTES.resourceTimingResponseStart],\n ['finalResponseHeadersStart', RUM_ATTRIBUTES.resourceTimingFinalResponseHeadersStart],\n ['responseEnd', RUM_ATTRIBUTES.resourceTimingResponseEnd],\n];\n\n/**\n * 原样上报 RT 时间点:数值保留 0(未发生或 TAO 不可见,消费端据此选瀑布图);\n * 浏览器未提供(undefined)或空字符串不写入。\n */\nexport const getResourceTimingRawAttributes = (entry: ResourceTimingWithStatus) => {\n const attributes: Record<string, number | string> = {};\n for (const [field, key] of RESOURCE_TIMING_RAW_ATTRIBUTES) {\n const value = entry[field];\n if ((typeof value === 'number' && Number.isFinite(value)) || (typeof value === 'string' && value !== '')) {\n attributes[key] = value;\n }\n }\n const workerSources = getWorkerRouterSources(entry);\n if (workerSources.matched) attributes[RUM_ATTRIBUTES.resourceTimingWorkerMatchedRouterSource] = workerSources.matched;\n if (workerSources.final) attributes[RUM_ATTRIBUTES.resourceTimingWorkerFinalRouterSource] = workerSources.final;\n return attributes;\n};\n\nexport const getResourceDuration = (entry: ResourceTimingWithStatus) =>\n entry.duration === 0 && entry.responseEnd > entry.startTime ? entry.responseEnd - entry.startTime : entry.duration;\n\nexport const getResourcePerformanceAttributes = (entry: ResourceTimingWithStatus) => {\n const detailsUnavailable = hasUnavailableResourceDetails(entry);\n const deliveryType = entry.deliveryType === '' ? 'other' : entry.deliveryType;\n return {\n [RUM_ATTRIBUTES.cacheHit]: getCacheHit(entry),\n ...(entry.nextHopProtocol ? { [RUM_ATTRIBUTES.nextHopProtocol]: entry.nextHopProtocol } : {}),\n ...getResourceTimingAttributes(entry),\n ...getResourceTimingRawAttributes(entry),\n ...getTimingPointAttributes(entry),\n ...(deliveryType ? { 'resource.delivery_type': deliveryType } : {}),\n ...(entry.renderBlockingStatus ? { 'resource.render_blocking_status': entry.renderBlockingStatus } : {}),\n ...(detailsUnavailable\n ? {}\n : {\n // 对齐 Datadog:resource.size 取解压后 body 体积,缓存命中也能反映真实大小;\n // 网络传输量单独用 resource.transfer_size 表达(受缓存/TAO 影响可能为 0)。\n 'resource.size': entry.decodedBodySize,\n 'resource.encoded_body_size': entry.encodedBodySize,\n 'resource.decoded_body_size': entry.decodedBodySize,\n 'resource.transfer_size': entry.transferSize,\n }),\n };\n};\n\n// The runtime getter is stable for an SDK instance across consent cycles. A WeakSet\n// remembers browser entry identity without retaining entries or conflating simultaneous\n// requests that happen to share URL and rounded timestamps.\nconst consumedResources = new WeakMap<object, WeakSet<PerformanceEntry>>();\n\nexport const createResourcePlugin = (emitResourceSpans = true): BkOTPlugin => {\n let observer: PerformanceObserver | undefined;\n let disposed = false;\n let drain = () => {};\n\n return {\n name: 'resource',\n drain: () => drain(),\n flush: () => drain(),\n init(context) {\n if (typeof PerformanceObserver === 'undefined') {\n return;\n }\n if (!PerformanceObserver.supportedEntryTypes?.includes('resource')) {\n return;\n }\n\n const owner = context.getRuntimeAttributes ?? context;\n const consumed = consumedResources.get(owner) ?? new WeakSet<PerformanceEntry>();\n consumedResources.set(owner, consumed);\n const scheduled = new WeakSet<PerformanceEntry>();\n const collection = context.collectionStart;\n // The first authorized document can recover pre-installation timings. Later\n // grants start a new interval; neither old sent entries nor denied-time entries\n // may be replayed merely because the browser still has them buffered.\n const allowHistory = collection?.allowInitialResourceHistory ?? collection?.isInitialDocument ?? true;\n const cutoff = allowHistory ? 0 : collection?.relativeStartedAt ?? performance.now();\n const requestOptions = typeof context.config.tracking?.request === 'object' ? context.config.tracking.request : undefined;\n const processEntry = (entry: ResourceTimingWithStatus) => {\n if (disposed) return;\n if (!entry.name || shouldIgnoreUrl(context.config, entry.name)) {\n return;\n }\n const isApi = entry.initiatorType === 'fetch' || entry.initiatorType === 'xmlhttprequest';\n if (isApi) {\n notifyRequestTiming(entry);\n // Only requests predating the first collection could never have been\n // intercepted. A runtime miss may be an intentional filter or an already\n // exported fallback, so it must never become a second Resource span.\n if (!allowHistory || !collection || entry.startTime >= collection.relativeStartedAt ||\n context.config.tracking?.request === false || shouldIgnoreRequest(context.config, entry.name) || requestOptions?.beforeSend) return;\n }\n if (!Number.isFinite(entry.startTime) || entry.startTime < cutoff || consumed.has(entry) ||\n !Number.isFinite(entry.duration) || entry.duration < 0) return;\n // 查询可能发现 Session 已过期并启动异步提交。此时身份仍未稳定,\n // 必须等 View 结束边界提交后重新查询,不能提前锁定旧快照或标记已消费。\n const resolved = context.getRuntimeContextAtRelativeTime?.(entry.startTime);\n if (context.isSessionTransitionPending?.()) {\n if (!scheduled.has(entry)) {\n scheduled.add(entry);\n context.afterSessionTransition(() => { scheduled.delete(entry); emitEntry(entry); }, true);\n }\n return;\n }\n const history = context.getRuntimeContextAtRelativeTime ? undefined : context.getViewHistory?.();\n const association = history?.slice().reverse().find(({ view }) =>\n view.relativeStartedAt !== undefined && view.relativeStartedAt <= entry.startTime &&\n (view.relativeEndedAt === undefined || entry.startTime < view.relativeEndedAt));\n // An entry outside retained/authorized View history stays unassociated; it\n // cannot be assigned to the current View just to make it exportable.\n if (context.getRuntimeContextAtRelativeTime ? !resolved : history && !association) return;\n consumed.add(entry);\n const redactedUrl = context.config.hooks.redactUrl(entry.name);\n const duration = getResourceDuration(entry);\n const startTime = resolved?.time ?? (association\n ? association.view.startedAt! + (entry.startTime - association.view.relativeStartedAt!)\n : performance.timeOrigin + entry.startTime);\n const contextAttributes = resolved?.attributes ?? association?.runtimeAttributes;\n const endTime = startTime + duration;\n // PerformanceObserver 可以迟到;由 startSpan 按条目时间查找原 Session 并采样。\n // 当前 Session 的采样结果也不能阻断旧 Fetch/XHR 的 timing 回填。\n if (emitResourceSpans || isApi) {\n const attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...buildRumResourceSpanAttributes({\n initiatorType: entry.initiatorType || 'other',\n outcome:\n typeof entry.responseStatus === 'number'\n ? { statusCode: entry.responseStatus, type: 'response' as const }\n : undefined,\n url: redactedUrl,\n }),\n 'url.full': redactedUrl,\n 'url.template': context.config.hooks.getRequestUrlTemplate(redactedUrl),\n ...getResourcePerformanceAttributes(entry),\n };\n const span = context.startSpan(\n buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.resource }),\n attributes,\n {\n kind: SpanKind.CLIENT, rumSpanType: RUM_SPAN_TYPE.resource, startTime,\n ...(contextAttributes ? { contextTime: startTime, contextAttributes } : {}),\n },\n );\n span.end(endTime);\n }\n context.notifyActivity({ endTime, startTime, type: 'resource', url: entry.name });\n };\n const emitEntry = (entry: ResourceTimingWithStatus) => {\n try {\n processEntry(entry);\n } catch {\n // 用户 Hook 的单条异常不能中断其他条目或阻止 shutdown 清理观察器。\n }\n };\n\n drain = () => {\n if (disposed) return;\n for (const entry of (observer?.takeRecords?.() ?? []) as ResourceTimingWithStatus[]) emitEntry(entry);\n };\n\n try {\n observer = new PerformanceObserver(list => {\n for (const entry of list.getEntries() as ResourceTimingWithStatus[]) {\n emitEntry(entry);\n }\n });\n observer.observe({ type: 'resource', buffered: true });\n } catch {\n observer = undefined;\n }\n },\n shutdown() {\n if (disposed) return;\n drain();\n disposed = true;\n observer?.disconnect();\n observer = undefined;\n drain = () => {};\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\n/**\n * Fetch/XHR 请求统一采集入口。\n *\n * 同一层 patch 负责请求 span、Trace Header、页面活动与 beforeSend,避免多套 patch\n * 重复计数,也不依赖 OpenTelemetry instrumentation 的私有方法。\n */\n\nimport { SpanKind, SpanStatusCode } from '@opentelemetry/api';\n\nimport { createRandomId } from '../core/id';\nimport { markSpanDiscarded, replaceSpanAttributes } from '../core/processor';\nimport { trackRequestTiming } from '../core/request-timing';\nimport { detectUpstreamTrace, planRequestTrace, TRACEPARENT_HEADER } from '../core/trace-context';\nimport {\n matchesUrlList,\n shouldIgnoreRequest,\n shouldIgnoreUrl,\n shouldPropagateTraceHeader,\n toAbsoluteUrl,\n} from '../core/url';\nimport { buildRumResourceSpanAttributes, buildRumSpanName, RUM_SPAN_TYPE } from '../schema/span';\nimport { getResourceDuration, getResourcePerformanceAttributes } from './resource';\n\nimport type { BkOTRequestConfig, BkOTRequestContext, BkOTRequestOutcome } from '../core/config';\nimport type { BkOTPlugin, BkOTRuntimeContext } from '../core/plugin';\nimport type { BkOTHeaderReader, BkOTRequestTracePlan } from '../core/trace-context';\nimport type { Attributes, Span } from '@opentelemetry/api';\n\ninterface RequestDetails {\n method?: string;\n ownedAttributeKeys?: string[];\n relativeStartedAt?: number;\n startedAt?: number;\n url?: string;\n}\n\nconst getRequestOptions = (context: BkOTRuntimeContext) =>\n typeof context.config.tracking.request === 'object' ? context.config.tracking.request : undefined;\n\n// 没有白名单时不会注入任何 header,也就不需要为探测既有 trace header 付出 patch 成本。\nconst hasTracingAllowlist = (context: BkOTRuntimeContext) => {\n const allowed = getRequestOptions(context)?.allowedTracingUrls;\n return Array.isArray(allowed) ? allowed.length > 0 : allowed !== undefined;\n};\n\nconst getErrorName = (error: unknown) =>\n typeof error === 'object' && error && 'name' in error && typeof error.name === 'string' ? error.name : '';\n\nconst getFetchFailureOutcome = (signal: AbortSignal | null | undefined, error: unknown): BkOTRequestOutcome => {\n if (getErrorName(signal?.reason) === 'TimeoutError' || getErrorName(error) === 'TimeoutError') {\n return { error, type: 'timeout' };\n }\n if (signal?.aborted || getErrorName(error) === 'AbortError') return { type: 'abort' };\n return { error, type: 'network_error' };\n};\n\nconst getXhrOutcome = (\n completionType: 'abort' | 'error' | 'load' | 'timeout',\n xhr: Pick<XMLHttpRequest, 'status'>,\n): BkOTRequestOutcome => {\n if (completionType === 'abort') return { type: 'abort' };\n if (completionType === 'timeout') return { type: 'timeout' };\n if (completionType === 'error' || xhr.status === 0) return { type: 'network_error' };\n return { statusCode: xhr.status, type: 'response' };\n};\n\nconst isErrorOutcome = (outcome: BkOTRequestOutcome) =>\n outcome.type === 'network_error' ||\n outcome.type === 'timeout' ||\n (outcome.type === 'response' && typeof outcome.statusCode === 'number' && outcome.statusCode >= 400);\n\nconst getFetchUrl = (input: RequestInfo | URL) => {\n if (typeof input === 'string' || input instanceof URL) return toAbsoluteUrl(String(input));\n return toAbsoluteUrl(input.url);\n};\n\nconst getFetchMethod = (input: RequestInfo | URL, init?: RequestInit) =>\n (init?.method ?? (typeof Request !== 'undefined' && input instanceof Request ? input.method : 'GET')).toUpperCase();\n\nconst getFetchRequestContext = (input: RequestInfo | URL, init?: RequestInit): Request | RequestInit =>\n typeof Request !== 'undefined' && input instanceof Request ? input : (init ?? {});\n\n// RequestInit.signal 覆盖 Request.signal;null 表示明确移除原来的 signal。\nconst getFetchSignal = (input: RequestInfo | URL, init?: RequestInit) =>\n init?.signal !== undefined ? init.signal : typeof Request !== 'undefined' && input instanceof Request ? input.signal : undefined;\nconst relativeNow = () => typeof performance !== 'undefined' ? performance.now() : Date.now();\nconst requestEndTime = (details: RequestDetails, entry?: PerformanceResourceTiming, endedAt = relativeNow()) =>\n details.startedAt! + Math.max(0, (entry ? entry.startTime + getResourceDuration(entry) : endedAt) - details.relativeStartedAt!);\nconst discardRequest = (span: Span | undefined, endActivity: () => void) => {\n if (span) markSpanDiscarded(span);\n try { endActivity(); } catch { /* 采集清理失败不能阻断原生请求。 */ }\n try { span?.end(); } catch { /* 保留原生调用及其异常。 */ }\n};\n\n/** 取本次请求最终会发出的 header 集合:init.headers 一旦存在就会整体覆盖 Request 上的 header。 */\nconst getFetchRequestHeaders = (input: RequestInfo | URL, init: RequestInit | undefined) => {\n const requestHeaders = typeof Request !== 'undefined' && input instanceof Request ? input.headers : undefined;\n return new Headers(init?.headers ?? requestHeaders);\n};\n\nconst applyFetchTracePlan = (init: RequestInit | undefined, headers: Headers, plan: BkOTRequestTracePlan) => {\n if (!plan.traceparent) return init;\n headers.set(TRACEPARENT_HEADER, plan.traceparent);\n return { ...init, headers };\n};\n\nconst createHeaderReader =\n (headers: Record<string, string> | undefined): BkOTHeaderReader =>\n name =>\n headers?.[name.toLowerCase()];\n\nconst planCollectedRequestTrace = (context: BkOTRuntimeContext, getHeader: BkOTHeaderReader) => {\n // Session 提交前先采集请求,待最终归属确定后再决定是否上报;此时不能替未确定的采样结果注入后端链路。\n // 业务已有的 Trace Header 不受影响,仍保留其 Link,也不阻塞真实网络请求。\n if (context.isSessionTransitionPending?.() && !detectUpstreamTrace(getHeader)) return undefined;\n return planRequestTrace(getHeader);\n};\n\nconst isActivityExcluded = (context: BkOTRuntimeContext, url: string) =>\n shouldIgnoreUrl(context.config, url) || matchesUrlList(context.config.view.excludedActivityUrls, url);\n\nconst startRequestActivity = (context: BkOTRuntimeContext, url: string) => {\n if (isActivityExcluded(context, url)) return () => {};\n const id = createRandomId('request');\n try { context.notifyActivity({ id, time: Date.now(), type: 'request_start', url }); } catch { /* 活动订阅异常不能改变请求结果。 */ }\n let ended = false;\n return () => {\n if (ended) return;\n ended = true;\n try { context.notifyActivity({ id, time: Date.now(), type: 'request_end' }); } catch { /* 保证后续 Span 清理和原生回调继续执行。 */ }\n };\n};\n\nconst trackRequestSpanTiming = (url: string, initiatorType: 'fetch' | 'xmlhttprequest') =>\n typeof PerformanceObserver === 'undefined' || !PerformanceObserver.supportedEntryTypes?.includes('resource')\n ? {\n sent() {},\n cancel() {},\n complete(callback: (entry?: PerformanceResourceTiming) => void, _waitForBody = false) {\n callback();\n },\n }\n : trackRequestTiming(url, performance.now(), initiatorType);\n\nconst startRequestSpan = (\n context: BkOTRuntimeContext,\n subtype: 'fetch' | 'xhr',\n details: RequestDetails,\n tracePlan?: BkOTRequestTracePlan,\n) => {\n const startedAt = details.startedAt ?? Date.now();\n const attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...buildRumResourceSpanAttributes({\n initiatorType: subtype === 'xhr' ? 'xmlhttprequest' : subtype,\n method: details.method,\n url: details.url ?? '',\n }),\n ...(details.url\n ? {\n 'url.full': context.config.hooks.redactUrl(details.url),\n 'url.template': context.config.hooks.getRequestUrlTemplate(details.url),\n }\n : {}),\n };\n details.ownedAttributeKeys = Object.keys(attributes);\n return context.startSpan(buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.resource }), attributes, {\n kind: SpanKind.CLIENT,\n rumSpanType: RUM_SPAN_TYPE.resource,\n startTime: startedAt,\n ...(tracePlan ? { links: tracePlan.links } : {}),\n });\n};\n\nexport const decorateRequestSpan = (\n context: BkOTRuntimeContext,\n span: Span,\n subtype: 'fetch' | 'xhr',\n domainContext: BkOTRequestContext,\n outcome: BkOTRequestOutcome,\n details: RequestDetails = {},\n performanceAttributes: Attributes = {},\n) => {\n const sourceUrl = details.url;\n const redactedUrl = sourceUrl ? context.config.hooks.redactUrl(sourceUrl) : undefined;\n const method = details.method;\n const attributes: Attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...buildRumResourceSpanAttributes({\n initiatorType: subtype === 'xhr' ? 'xmlhttprequest' : subtype,\n method,\n outcome,\n url: redactedUrl ?? '',\n }),\n ...(redactedUrl ? { 'url.full': redactedUrl } : {}),\n // 模板由原始 URL 推导:Hook 可能需要 query 才能判断路由,产出的模板本身是低基数的\n ...(sourceUrl ? { 'url.template': context.config.hooks.getRequestUrlTemplate(sourceUrl) } : {}),\n ...performanceAttributes,\n };\n\n const replacedKeys = new Set([...(details.ownedAttributeKeys ?? []), ...Object.keys(attributes)]);\n const event = {\n attributes,\n resource: {\n method,\n outcome,\n transport: subtype,\n url: redactedUrl,\n },\n type: 'resource' as const,\n };\n let shouldSend: boolean | void = true;\n try {\n shouldSend = getRequestOptions(context)?.beforeSend?.(event, domainContext);\n } catch (error) {\n if (context.config.debug) globalThis.console?.warn('[bk-ot] request.beforeSend failed:', error);\n }\n const redactedAttributes = context.applyRedact(event.attributes);\n span.setAttributes(redactedAttributes);\n replaceSpanAttributes(span, redactedAttributes, replacedKeys);\n span.updateName(buildRumSpanName({ attributes: redactedAttributes, spanType: RUM_SPAN_TYPE.resource }));\n if (shouldSend === false) {\n // SpanProcessor 在 onEnd 统一识别内部状态,避免这里绕过正常的 span 结束流程。\n markSpanDiscarded(span);\n return;\n }\n if (isErrorOutcome(outcome)) span.setStatus({ code: SpanStatusCode.ERROR });\n};\n\nexport const createCommonInstrumentationsPlugin = (option: BkOTRequestConfig | boolean | undefined): BkOTPlugin => {\n const teardownCallbacks: Array<() => void> = [];\n const activeRequestEnds = new Set<() => void>();\n\n return {\n name: 'request',\n enabled: option !== false,\n init(context) {\n if (typeof window === 'undefined') return;\n\n if (typeof window.fetch === 'function') {\n const originalFetch = window.fetch;\n const patchedFetch: typeof window.fetch = async function (this: Window, input, init) {\n let url = '';\n let details: RequestDetails = {};\n let span: Span | undefined;\n let endActivity = () => {};\n let requestContext: Request | RequestInit = {};\n let requestInit = init;\n let signal: AbortSignal | null | undefined;\n try {\n url = getFetchUrl(input);\n if (context.isSampled() && !shouldIgnoreRequest(context.config, url)) {\n details = { method: getFetchMethod(input, init), startedAt: Date.now(), relativeStartedAt: relativeNow(), url };\n const headers = shouldPropagateTraceHeader(context.config, url) ? getFetchRequestHeaders(input, init) : undefined;\n const tracePlan = headers ? planCollectedRequestTrace(context, name => headers.get(name) ?? undefined) : undefined;\n span = startRequestSpan(context, 'fetch', details, tracePlan);\n endActivity = startRequestActivity(context, url);\n requestContext = getFetchRequestContext(input, init);\n signal = getFetchSignal(input, init);\n requestInit = headers && tracePlan ? applyFetchTracePlan(init, headers, tracePlan) : init;\n }\n } catch {\n discardRequest(span, endActivity);\n return originalFetch.call(this, input, init);\n }\n if (!span) return originalFetch.call(this, input, init);\n let ended = false;\n let domainContext: BkOTRequestContext | undefined;\n let outcome: BkOTRequestOutcome | undefined;\n let completedAt = relativeNow();\n let removeAbortListener = () => {};\n const endSpan = (entry?: PerformanceResourceTiming, fallbackEndTime = relativeNow()) => {\n if (ended) return;\n ended = true;\n activeRequestEnds.delete(forceEnd);\n removeAbortListener();\n try {\n const performanceAttributes = entry\n ? getResourcePerformanceAttributes(entry)\n : { 'resource.timing.incomplete': true };\n if (domainContext && outcome) {\n decorateRequestSpan(context, span, 'fetch', domainContext, outcome, details, performanceAttributes);\n } else {\n span.setAttributes(context.applyRedact(performanceAttributes));\n }\n } catch {\n // 脱敏或页面属性 Hook 失败时丢弃此条采集,不能发送未脱敏数据或影响业务 Promise。\n markSpanDiscarded(span);\n } finally {\n endActivity();\n span.end(requestEndTime(details, entry, fallbackEndTime));\n }\n };\n const forceEnd = () => {\n // shutdown 不再等待异步 ResourceTiming,立即结束仍在飞行中的 span。\n completedAt = relativeNow();\n timing.cancel();\n endSpan();\n };\n const timing = trackRequestSpanTiming(url, 'fetch');\n activeRequestEnds.add(forceEnd);\n try {\n let responsePromise: Promise<Response>;\n try {\n responsePromise = originalFetch.call(this, input, requestInit);\n } finally {\n timing.sent();\n }\n const response = await responsePromise;\n if (ended) return response;\n outcome = {\n ...(response.status > 0 ? { statusCode: response.status } : {}),\n type: 'response',\n };\n domainContext = { request: requestContext, response, type: 'fetch' };\n completedAt = relativeNow();\n timing.complete(entry => endSpan(entry, completedAt), true);\n // Response 仅能证明响应头已到达;等待 RT 期间观察显式取消,\n // 不克隆或读取业务响应流来推断正文是否完整。\n const onAbort = () => {\n if (ended) return;\n completedAt = relativeNow();\n outcome = getFetchFailureOutcome(signal, signal?.reason);\n timing.cancel();\n };\n if (!ended && signal) {\n signal.addEventListener('abort', onAbort, { once: true });\n removeAbortListener = () => signal?.removeEventListener('abort', onAbort);\n if (signal.aborted) onAbort();\n }\n return response;\n } catch (error) {\n if (!ended) {\n outcome = getFetchFailureOutcome(signal, error);\n domainContext = { error, request: requestContext, type: 'fetch' };\n if (outcome.type !== 'abort' && error instanceof Error) span.recordException(error);\n completedAt = relativeNow();\n timing.complete(entry => endSpan(entry, completedAt));\n }\n throw error;\n }\n };\n window.fetch = patchedFetch;\n teardownCallbacks.push(() => {\n if (window.fetch === patchedFetch) window.fetch = originalFetch;\n });\n }\n\n if (typeof XMLHttpRequest !== 'undefined') {\n const requests = new WeakMap<XMLHttpRequest, RequestDetails>();\n const activeXhrs = new WeakMap<XMLHttpRequest, () => void>();\n // 浏览器不提供读取 XHR 请求头的 API,只能自己快照业务设置的 header 以便探测既有链路。\n const authorHeaders = new WeakMap<XMLHttpRequest, Record<string, string>>();\n const originalOpen = XMLHttpRequest.prototype.open;\n const originalSend = XMLHttpRequest.prototype.send;\n const originalAbort = XMLHttpRequest.prototype.abort;\n const patchedOpen: typeof XMLHttpRequest.prototype.open = function (\n this: XMLHttpRequest,\n method: string,\n url: string | URL,\n async = true,\n username?: null | string,\n password?: null | string,\n ) {\n // 业务完成回调可能立即复用实例;在原生 open 清空响应信息前,\n // 先结算上一轮 send,并让异步 Hook 使用该轮响应快照。\n try {\n activeXhrs.get(this)?.();\n requests.set(this, { method: method.toUpperCase(), url: toAbsoluteUrl(String(url)) });\n } catch {\n // 请求元数据采集失败时仍由浏览器决定原生 open 的返回值或异常。\n requests.delete(this);\n }\n // open() 会清空已设置的请求头,快照必须同步失效。\n authorHeaders.delete(this);\n return originalOpen.call(this, method, url as string, async, username, password);\n };\n const patchedAbort: typeof XMLHttpRequest.prototype.abort = function (this: XMLHttpRequest) {\n // 比 SDK 更早注册的 DONE 回调可以先执行 abort;原生 abort 会清空状态且\n // 不保证再发终止事件,因此与 open 重用一样,先结算上一轮可见的结果。\n try { activeXhrs.get(this)?.(); } catch { /* 采集不能阻止真实取消。 */ }\n return originalAbort.call(this);\n };\n const patchedSend: typeof XMLHttpRequest.prototype.send = function (this: XMLHttpRequest, body) {\n const details = { ...requests.get(this) };\n let span: Span | undefined;\n let endActivity = () => {};\n try {\n if (context.isSampled() && details.url && !shouldIgnoreRequest(context.config, details.url)) {\n details.startedAt = Date.now();\n details.relativeStartedAt = relativeNow();\n const tracePlan = shouldPropagateTraceHeader(context.config, details.url)\n ? planCollectedRequestTrace(context, createHeaderReader(authorHeaders.get(this))) : undefined;\n span = startRequestSpan(context, 'xhr', details, tracePlan);\n endActivity = startRequestActivity(context, details.url);\n if (tracePlan?.traceparent) this.setRequestHeader(TRACEPARENT_HEADER, tracePlan.traceparent);\n }\n } catch {\n discardRequest(span, endActivity);\n return originalSend.call(this, body);\n }\n if (!span || !details.url) return originalSend.call(this, body);\n let finishing = false;\n let ended = false;\n let removeTerminalListeners = () => {};\n let responseSnapshot: Extract<BkOTRequestContext, { type: 'xhr' }>['responseSnapshot'];\n let completedAt: number | undefined;\n const captureResponse = () => {\n if (responseSnapshot) return;\n completedAt = relativeNow();\n responseSnapshot = { status: this.status, statusText: this.statusText, responseURL: this.responseURL, responseType: this.responseType };\n };\n const forceEnd = () => {\n // XHR 可能永不触发终止事件;SDK 停止时必须清理活动计数并结束 span。\n removeTerminalListeners();\n timing.cancel();\n if (ended) return;\n ended = true;\n activeRequestEnds.delete(forceEnd);\n endActivity();\n span.setAttribute('resource.timing.incomplete', true);\n span.end(requestEndTime(details));\n };\n const complete = (completionType: 'abort' | 'error' | 'load' | 'timeout') => {\n if (finishing || ended) return;\n finishing = true;\n removeTerminalListeners();\n captureResponse();\n const outcome = getXhrOutcome(completionType, responseSnapshot!);\n timing.complete(entry => {\n if (ended) return;\n ended = true;\n activeRequestEnds.delete(forceEnd);\n try {\n decorateRequestSpan(\n context,\n span,\n 'xhr',\n { type: 'xhr', xhr: this, responseSnapshot },\n outcome,\n details,\n entry ? getResourcePerformanceAttributes(entry) : { 'resource.timing.incomplete': true },\n );\n } catch {\n markSpanDiscarded(span);\n } finally {\n endActivity();\n span.end(requestEndTime(details, entry, completedAt));\n }\n });\n };\n const beforeReopen = () => complete(this.readyState === 4 ? 'load' : 'abort');\n const onReadyStateChange = () => {\n if (this.readyState !== 4) return;\n captureResponse();\n // DONE 时已有 HTTP 状态即代表响应完成。业务 onreadystatechange 可能\n // 随即 abort 并清空状态,且浏览器不再发送 load;此时必须先结算。\n // status=0 仍等待 error/abort/timeout,保留失败原因的区别。\n if (responseSnapshot!.status > 0) complete('load');\n };\n const onAbort = () => complete('abort');\n const onError = () => complete('error');\n const onLoad = () => complete('load');\n const onTimeout = () => complete('timeout');\n removeTerminalListeners = () => {\n if (activeXhrs.get(this) === beforeReopen) activeXhrs.delete(this);\n this.removeEventListener('readystatechange', onReadyStateChange, true);\n this.removeEventListener('abort', onAbort, true);\n this.removeEventListener('error', onError, true);\n this.removeEventListener('load', onLoad, true);\n this.removeEventListener('timeout', onTimeout, true);\n };\n activeXhrs.set(this, beforeReopen);\n this.addEventListener('readystatechange', onReadyStateChange, true);\n this.addEventListener('abort', onAbort, { capture: true, once: true });\n this.addEventListener('error', onError, { capture: true, once: true });\n this.addEventListener('load', onLoad, { capture: true, once: true });\n this.addEventListener('timeout', onTimeout, { capture: true, once: true });\n const timing = trackRequestSpanTiming(details.url, 'xmlhttprequest');\n activeRequestEnds.add(forceEnd);\n try {\n return originalSend.call(this, body);\n } catch (error) {\n if (error instanceof Error) span.recordException(error);\n complete('error');\n throw error;\n } finally {\n timing.sent();\n }\n };\n XMLHttpRequest.prototype.open = patchedOpen;\n XMLHttpRequest.prototype.send = patchedSend;\n if (typeof originalAbort === 'function') XMLHttpRequest.prototype.abort = patchedAbort;\n teardownCallbacks.push(() => {\n if (XMLHttpRequest.prototype.open === patchedOpen) XMLHttpRequest.prototype.open = originalOpen;\n if (XMLHttpRequest.prototype.send === patchedSend) XMLHttpRequest.prototype.send = originalSend;\n if (XMLHttpRequest.prototype.abort === patchedAbort) XMLHttpRequest.prototype.abort = originalAbort;\n });\n\n if (hasTracingAllowlist(context) && typeof XMLHttpRequest.prototype.setRequestHeader === 'function') {\n const originalSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader;\n const patchedSetRequestHeader: typeof XMLHttpRequest.prototype.setRequestHeader = function (\n this: XMLHttpRequest,\n name: string,\n value: string,\n ) {\n const key = name.toLowerCase();\n const headers = authorHeaders.get(this) ?? {};\n // 浏览器对重复设置的同名 header 做 \", \" 合并,快照保持一致才能正确解析。\n headers[key] = key in headers ? `${headers[key]}, ${value}` : value;\n authorHeaders.set(this, headers);\n return originalSetRequestHeader.call(this, name, value);\n };\n XMLHttpRequest.prototype.setRequestHeader = patchedSetRequestHeader;\n teardownCallbacks.push(() => {\n if (XMLHttpRequest.prototype.setRequestHeader === patchedSetRequestHeader)\n XMLHttpRequest.prototype.setRequestHeader = originalSetRequestHeader;\n });\n }\n }\n },\n shutdown() {\n for (const end of [...activeRequestEnds]) end();\n while (teardownCallbacks.length) teardownCallbacks.pop()?.();\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_OUTCOME, RUM_SPAN_TYPE } from '../schema/span';\n\nimport type { BkOTPlugin } from '../core/plugin';\n\n// blockedURI 除了 URL 还可能是 'inline' / 'eval' / 'wasm-eval' / 'self' 等关键字(CSP spec),\n// 这些不是 URL,不应该走 redactUrl\nconst URL_LIKE_BLOCKED_URI = /^https?:|^\\/\\//i;\n\nconst redactBlockedUri = (redactUrl: (url: string) => string, blockedURI: string | undefined) => {\n if (!blockedURI) return undefined;\n return URL_LIKE_BLOCKED_URI.test(blockedURI) ? redactUrl(blockedURI) : blockedURI;\n};\n\n/**\n * CSP 违规事件采集插件,通过监听 `securitypolicyviolation` 事件捕获被 CSP 策略拦截的脚本/资源,\n * 以 error span 上报,进入统一错误分析口径。\n *\n * URL 处理:\n * - `blockedURI` / `sourceFile` 中的 URL 类值会经 `redactUrl` 脱敏。\n * - `blockedURI` 是 'inline' / 'eval' 等 CSP 关键字时直接保留,不调用 redactUrl。\n */\nexport const createCspViolationPlugin = (): BkOTPlugin => {\n let teardown: (() => void) | undefined;\n\n return {\n name: 'csp-violation',\n init(context) {\n if (typeof window === 'undefined' || typeof document === 'undefined') {\n return;\n }\n\n const handler = (event: SecurityPolicyViolationEvent) => {\n if (!context.isSampled()) return;\n const occurredAt = Date.now();\n const blockedUri = redactBlockedUri(context.config.hooks.redactUrl, event.blockedURI);\n const sourceFile = event.sourceFile ? context.config.hooks.redactUrl(event.sourceFile) : undefined;\n const attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...buildRumSpanAttributes({\n outcome: RUM_SPAN_OUTCOME.error,\n spanType: RUM_SPAN_TYPE.error,\n }),\n 'csp.blocked_uri': blockedUri,\n 'csp.violated_directive': event.violatedDirective,\n 'csp.effective_directive': event.effectiveDirective,\n 'csp.disposition': event.disposition,\n 'csp.source_file': sourceFile,\n 'csp.line_number': event.lineNumber,\n 'csp.column_number': event.columnNumber,\n 'csp.status_code': event.statusCode,\n 'csp.original_policy': event.originalPolicy,\n 'error.source': 'csp',\n };\n const span = context.startSpan(buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.error }), attributes, {\n startTime: occurredAt,\n });\n span.end(occurredAt);\n };\n\n document.addEventListener('securitypolicyviolation', handler);\n teardown = () => document.removeEventListener('securitypolicyviolation', handler);\n },\n shutdown() {\n teardown?.();\n teardown = undefined;\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\n/** 非密码学稳定 hash,仅用于生成浏览器本地 storage key。 */\nexport const hashString = (input: string): string => {\n let hash = 5381;\n for (let index = 0; index < input.length; index++) {\n hash = (hash * 33) ^ input.charCodeAt(index);\n }\n return (hash >>> 0).toString(36);\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { hashString } from '../core/hash';\nimport { createRandomId } from '../core/id';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\n\nimport type { BkOTPlugin } from '../core/plugin';\nimport type { Attributes } from '@opentelemetry/api';\n\nexport interface BkOTDevicePluginOptions {\n /** 是否跨页面持久化匿名设备 ID,默认 false。 */\n persistentId?: boolean;\n storageKey?: string;\n}\n\nconst DEFAULT_DEVICE_STORAGE_KEY = 'BK_RUM_DEVICE_ID';\n// 用户拖窗口时 resize 高频触发,debounce 静默期内只在最后一次更新,避免无谓的 setRuntimeAttributes 风暴\nconst VIEWPORT_DEBOUNCE_MS = 250;\n\ninterface NetworkInformationLike {\n effectiveType?: string;\n type?: string;\n addEventListener?: (type: 'change', listener: () => void) => void;\n removeEventListener?: (type: 'change', listener: () => void) => void;\n}\n\ninterface UserAgentDataLike {\n mobile?: boolean;\n platform?: string;\n}\n\nconst getConnection = (): NetworkInformationLike | undefined =>\n (\n navigator as Navigator & {\n connection?: NetworkInformationLike;\n }\n ).connection;\n\nconst getUserAgentData = (): undefined | UserAgentDataLike =>\n (\n navigator as Navigator & {\n userAgentData?: UserAgentDataLike;\n }\n ).userAgentData;\n\nconst getBrowserInfo = (ua: string) => {\n const matchers: Array<[string, RegExp]> = [\n ['Edge', /Edg\\/([\\d.]+)/],\n ['Chrome', /Chrome\\/([\\d.]+)/],\n ['Firefox', /Firefox\\/([\\d.]+)/],\n ['Safari', /Version\\/([\\d.]+).*Safari/],\n ];\n for (const [name, pattern] of matchers) {\n const matched = ua.match(pattern);\n if (matched?.[1]) {\n return { name, version: matched[1].split('.')[0] };\n }\n }\n return { name: 'Other', version: undefined };\n};\n\nconst getOsName = (ua: string, platform?: string) => {\n const value = `${platform ?? ''} ${ua}`;\n if (/iphone|ipad|ipod/i.test(value)) return 'iOS';\n if (/android/i.test(value)) return 'Android';\n if (/mac/i.test(value)) return 'macOS';\n if (/win/i.test(value)) return 'Windows';\n if (/linux/i.test(value)) return 'Linux';\n return 'Other';\n};\n\nconst readDeviceId = (storageKey: string) => {\n let existed: null | string = null;\n try {\n existed = window.localStorage.getItem(storageKey);\n } catch {\n /* localStorage 不可用(隐私模式 / sandbox iframe),下面会创建一个 in-memory id */\n }\n if (existed) {\n return existed;\n }\n const deviceId = createRandomId('device');\n try {\n window.localStorage.setItem(storageKey, deviceId);\n } catch {\n /* 写不进去也行,至少本次 SDK 生命周期内 deviceId 仍然稳定 */\n }\n return deviceId;\n};\n\n// 视口尺寸:随窗口大小 / 屏幕旋转变化,需要在 resize / orientationchange 时刷新\nconst getViewportAttributes = (): Attributes => {\n if (typeof window === 'undefined') {\n return {};\n }\n return {\n 'browser.viewport.width': window.innerWidth,\n 'browser.viewport.height': window.innerHeight,\n 'browser.screen.width': window.screen?.width,\n 'browser.screen.height': window.screen?.height,\n };\n};\n\n// 网络信息:随 online / offline / connection.change 变化\nconst getNetworkAttributes = (): Attributes => {\n if (typeof navigator === 'undefined') {\n return {};\n }\n const connection = getConnection();\n return {\n [RUM_ATTRIBUTES.networkStatus]: navigator.onLine ? 'connected' : 'not_connected',\n 'network.effective_type': connection?.effectiveType,\n 'network.connection.type': connection?.type,\n };\n};\n\n// 设备与 User Agent 信息:进入页面时一次性读取,运行期不会变化,适合作为 Resource 公共属性。\nexport const getDeviceResourceAttributes = (): Attributes => {\n if (typeof navigator === 'undefined') {\n return {};\n }\n const uaData = getUserAgentData();\n const ua = navigator.userAgent;\n const browser = getBrowserInfo(ua);\n const osName = getOsName(ua, uaData?.platform);\n const deviceType = uaData?.mobile || /mobi|android|iphone|ipad|ipod/i.test(ua) ? 'mobile' : 'desktop';\n return {\n [RUM_ATTRIBUTES.deviceType]: deviceType,\n [RUM_ATTRIBUTES.userAgentName]: browser.name,\n [RUM_ATTRIBUTES.userAgentVersion]: browser.version,\n [RUM_ATTRIBUTES.userAgentOsName]: osName,\n };\n};\n\n// trailing debounce:windowMs 静默期内的多次触发只执行最后一次。\n// 适合 resize 这类\"用户停下来后才需要拿到最终值\"的场景。\nconst createDebounce = (fn: () => void, windowMs: number) => {\n let timer: number | undefined;\n return () => {\n if (timer !== undefined) {\n window.clearTimeout(timer);\n }\n timer = window.setTimeout(() => {\n timer = undefined;\n fn();\n }, windowMs);\n };\n};\n\n/**\n * 设备元数据采集插件。稳定的设备能力由 SDK 写入 Resource;这里只维护设备 ID 和运行期动态属性。\n *\n * 上报字段:\n * - `device.id`:设备级永久标识,存于 localStorage(默认 key 复用旧 session 插件以保留现网用户)。\n * - `user_agent.name` / `user_agent.version` / `user_agent.os.name`:User Agent 信息,写入 Resource。\n * - `browser.viewport.*` / `browser.screen.*`:视口与屏幕尺寸。\n * - `network.status` / `network.effective_type` / `network.connection.type`:网络信息。\n *\n * 实时更新:\n * - viewport 监听 `resize` / `orientationchange`,并经 250ms debounce 合并,避免拖窗口时高频触发;\n * 静默期结束后用最终值刷新 runtimeAttributes。\n * - network 监听 `online` / `offline` / `connection.change`(本身低频,不需要 throttle)。\n * - 二者只更新 in-memory 的 runtimeAttributes,不会主动产生新的 Span;\n * 更新后续生成的 Span 会带最新值。\n *\n * 与 session 插件的关系:device 跨会话持久(终身),session 有过期与续期(连续访问语义)。\n */\nexport const createDevicePlugin = (options: BkOTDevicePluginOptions = {}): BkOTPlugin => {\n const teardownCallbacks: Array<() => void> = [];\n return {\n name: 'device',\n init(context) {\n const storageKey =\n options.storageKey ?? `${DEFAULT_DEVICE_STORAGE_KEY}_${hashString(context.config.application.name)}`;\n const deviceId =\n typeof window === 'undefined' || options.persistentId !== true\n ? createRandomId('device')\n : readDeviceId(storageKey);\n\n context.setRuntimeAttributes({\n 'device.id': deviceId,\n // createDevicePlugin 作为扩展单独启用时,Resource 没有设备字段,仍回退到原有 runtime attributes 行为。\n ...(context.config.tracking.device === false ? getDeviceResourceAttributes() : {}),\n ...getViewportAttributes(),\n ...getNetworkAttributes(),\n });\n\n if (typeof window === 'undefined') {\n return;\n }\n\n const refreshViewport = createDebounce(() => {\n context.setRuntimeAttributes(getViewportAttributes());\n }, VIEWPORT_DEBOUNCE_MS);\n window.addEventListener('resize', refreshViewport);\n window.addEventListener('orientationchange', refreshViewport);\n teardownCallbacks.push(\n () => window.removeEventListener('resize', refreshViewport),\n () => window.removeEventListener('orientationchange', refreshViewport),\n );\n\n const refreshNetwork = () => {\n context.setRuntimeAttributes(getNetworkAttributes());\n };\n window.addEventListener('online', refreshNetwork);\n window.addEventListener('offline', refreshNetwork);\n teardownCallbacks.push(\n () => window.removeEventListener('online', refreshNetwork),\n () => window.removeEventListener('offline', refreshNetwork),\n );\n\n const connection = getConnection();\n // NetworkInformation 实现了 EventTarget;旧浏览器或某些 polyfill 可能没有 addEventListener,做能力检测\n if (connection && typeof connection.addEventListener === 'function') {\n connection.addEventListener('change', refreshNetwork);\n teardownCallbacks.push(() => {\n connection.removeEventListener?.('change', refreshNetwork);\n });\n }\n },\n shutdown() {\n while (teardownCallbacks.length) {\n teardownCallbacks.pop()?.();\n }\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n/**\n * 浏览器错误采集插件,负责捕获 JS 运行时错误、未处理的 Promise rejection、资源加载失败三类错误。\n *\n * 上报策略:\n * - 错误分析主数据统一使用 `span_type=error` 的 error span。\n * - 每个浏览器错误只生成一条原始 error Span,错误分组和风暴控制由服务端完成。\n *\n * 关键 attribute:\n * - `error.source`:错误来源,取值 `window.error` / `unhandledrejection` / `resource`。\n * - 资源错误额外带 `url.full`(经 redactUrl 脱敏)。\n * - JS 错误额外带 `code.filepath` / `code.lineno` / `code.column`。\n */\n\nimport { SpanStatusCode } from '@opentelemetry/api';\n\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_OUTCOME, RUM_SPAN_TYPE } from '../schema/span';\n\nimport type { BkOTPlugin, BkOTRuntimeContext } from '../core/plugin';\n\nconst getErrorMessage = (value: unknown) => {\n if (value instanceof Error) {\n return value.message;\n }\n if (typeof value === 'string') {\n return value;\n }\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n};\n\ninterface EmitErrorOptions {\n context: BkOTRuntimeContext;\n error: unknown;\n exceptionType?: string;\n extra?: Record<string, unknown>;\n source: string;\n}\n\nconst emitError = ({ context, error, exceptionType, extra = {}, source }: EmitErrorOptions) => {\n if (!context.isSampled()) return;\n const occurredAt = Date.now();\n const message = getErrorMessage(error);\n\n const resolvedExceptionType = exceptionType ?? (error instanceof Error ? error.name || 'Error' : source);\n const exceptionLike = error instanceof Error ? error : { message, name: resolvedExceptionType };\n const attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...context.config.hooks.getErrorAttributes(),\n ...buildRumSpanAttributes({\n outcome: RUM_SPAN_OUTCOME.error,\n spanType: RUM_SPAN_TYPE.error,\n }),\n 'error.message': message,\n 'error.handled': false,\n 'error.source': source,\n ...extra,\n };\n // 错误分析统一沉淀为 error span;若当前存在 active context,OTel 会自动建立父子关系。\n const errorSpan = context.startSpan(\n buildRumSpanName({ attributes, nameHint: resolvedExceptionType, spanType: RUM_SPAN_TYPE.error }),\n attributes,\n { startTime: occurredAt },\n );\n errorSpan.recordException(exceptionLike);\n errorSpan.setStatus({ code: SpanStatusCode.ERROR, message });\n errorSpan.end();\n};\n\nexport const createErrorPlugin = (): BkOTPlugin => {\n const listeners: Array<() => void> = [];\n\n return {\n name: 'error',\n init(context) {\n if (typeof window === 'undefined') {\n return;\n }\n\n const onError = (event: ErrorEvent) => {\n emitError({\n context,\n source: 'window.error',\n error: event.error ?? event.message,\n extra: {\n 'code.filepath': event.filename,\n 'code.lineno': event.lineno,\n 'code.column': event.colno,\n },\n });\n };\n const onUnhandledRejection = (event: PromiseRejectionEvent) => {\n emitError({\n context,\n source: 'unhandledrejection',\n error: event.reason,\n exceptionType: event.reason instanceof Error ? event.reason.name : 'UnhandledRejection',\n });\n };\n const onResourceError = (event: Event) => {\n // JS 运行时错误是 ErrorEvent,已由 bubble 阶段的 onError 处理;这里只关心资源加载失败\n if (event instanceof ErrorEvent) return;\n const target = event.target;\n if (!(target instanceof Element)) return;\n const elementWithUrl = target as Element & { href?: string; src?: string };\n const resourceUrl = elementWithUrl.src || elementWithUrl.href || (target as HTMLMediaElement).currentSrc || '';\n emitError({\n context,\n source: 'resource',\n error: new Error(`Resource load failed: ${target.tagName.toLowerCase()} ${resourceUrl}`),\n exceptionType: 'ResourceError',\n extra: {\n 'url.full': context.config.hooks.redactUrl(resourceUrl),\n },\n });\n };\n\n window.addEventListener('error', onError);\n window.addEventListener('unhandledrejection', onUnhandledRejection);\n window.addEventListener('error', onResourceError, true);\n listeners.push(\n () => window.removeEventListener('error', onError),\n () => window.removeEventListener('unhandledrejection', onUnhandledRejection),\n () => window.removeEventListener('error', onResourceError, true),\n );\n },\n shutdown() {\n while (listeners.length) {\n listeners.pop()?.();\n }\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\nimport { createRandomId } from '../core/id';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_TYPE } from '../schema/span';\n\nimport type { BkOTPlugin } from '../core/plugin';\nimport type { Attributes } from '@opentelemetry/api';\n\n/**\n * 主线程阻塞优先使用 Long Animation Frame API 获取脚本归因,不支持时回退到 Long Tasks API;\n * span 保留单次诊断详情,分布与计数由服务端从原始事件计算。\n */\nexport interface BkOTLongTaskPluginOptions {\n /** 采集阈值,默认 50ms。Performance API 本身通常只产生大于 50ms 的条目。 */\n threshold?: number;\n}\n\ninterface LegacyLongTaskEntry extends PerformanceEntry {\n attribution?: Array<{\n containerId?: string;\n containerName?: string;\n containerSrc?: string;\n containerType?: string;\n name?: string;\n }>;\n}\n\ninterface LongAnimationFrameEntry extends PerformanceEntry {\n blockingDuration: number;\n firstUIEventTimestamp: number;\n renderStart: number;\n scripts: ScriptTiming[];\n styleAndLayoutStart: number;\n}\n\ninterface ScriptTiming {\n duration: number;\n executionStart: number;\n forcedStyleAndLayoutDuration: number;\n invoker: string;\n invokerType: string;\n pauseDuration: number;\n sourceCharPosition: number;\n sourceFunctionName: string;\n sourceURL: string;\n startTime: number;\n windowAttribution: string;\n}\n\nconst DEFAULT_THRESHOLD = 50;\n\nconst nonNegativeNumber = (value: number | undefined, fallback: number) =>\n typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : fallback;\n\nconst finiteNumber = (value: number | undefined) => (Number.isFinite(value) ? value : undefined);\n\nconst getLegacyAttributionAttributes = (\n attribution: NonNullable<LegacyLongTaskEntry['attribution']>[number],\n redactUrl: (url: string) => string,\n): Attributes => ({\n ...(attribution.containerId ? { 'long_task.attribution.container_id': attribution.containerId } : {}),\n ...(attribution.containerName ? { 'long_task.attribution.container_name': attribution.containerName } : {}),\n ...(attribution.containerSrc ? { 'long_task.attribution.container_src': redactUrl(attribution.containerSrc) } : {}),\n ...(attribution.containerType ? { 'long_task.attribution.container_type': attribution.containerType } : {}),\n ...(attribution.name ? { 'long_task.attribution.name': attribution.name } : {}),\n});\n\nconst getScriptAttributes = (script: ScriptTiming, redactUrl: (url: string) => string): Attributes => ({\n 'long_task.script.duration': script.duration,\n 'long_task.script.execution_start': script.executionStart,\n 'long_task.script.forced_style_and_layout_duration': script.forcedStyleAndLayoutDuration,\n 'long_task.script.invoker': script.invoker,\n 'long_task.script.invoker_type': script.invokerType,\n 'long_task.script.pause_duration': script.pauseDuration,\n 'long_task.script.source_char_position': script.sourceCharPosition,\n 'long_task.script.source_function_name': script.sourceFunctionName,\n 'long_task.script.source_url': script.sourceURL ? redactUrl(script.sourceURL) : '',\n 'long_task.script.start_time': script.startTime,\n 'long_task.script.window_attribution': script.windowAttribution,\n});\n\nexport const createLongTaskPlugin = (options: BkOTLongTaskPluginOptions = {}): BkOTPlugin => {\n const threshold = nonNegativeNumber(options.threshold, DEFAULT_THRESHOLD);\n let observer: PerformanceObserver | undefined;\n let initialBatchTimer: ReturnType<typeof setTimeout> | undefined;\n let initialEntries: PerformanceEntry[] = [];\n let disposed = false;\n\n return {\n name: 'long-task',\n init(context) {\n if (typeof PerformanceObserver === 'undefined' || typeof performance === 'undefined') return;\n const supportedEntryTypes = PerformanceObserver.supportedEntryTypes ?? [];\n // LoAF 提供脚本归因与 blockingDuration,支持时优先使用;旧浏览器回退到 longtask。\n const entryType = supportedEntryTypes.includes('long-animation-frame')\n ? 'long-animation-frame'\n : supportedEntryTypes.includes('longtask')\n ? 'longtask'\n : undefined;\n if (!entryType) return;\n\n const emitEntry = (entry: LegacyLongTaskEntry | LongAnimationFrameEntry) => {\n if (disposed) return;\n if (!Number.isFinite(entry.duration) || entry.duration < threshold) return;\n const isLoaf = entry.entryType === 'long-animation-frame';\n const loaf = isLoaf ? (entry as LongAnimationFrameEntry) : undefined;\n const scripts = loaf?.scripts ?? [];\n const id = createRandomId('long-task');\n const startTime = performance.timeOrigin + entry.startTime;\n const endTime = startTime + entry.duration;\n const entryTypeAttribute = isLoaf ? 'long-animation-frame' : 'long-task';\n const legacyAttributions = isLoaf ? [] : ((entry as LegacyLongTaskEntry).attribution ?? []);\n const attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...buildRumSpanAttributes({\n spanType: RUM_SPAN_TYPE.longTask,\n }),\n ...(finiteNumber(loaf?.blockingDuration) !== undefined\n ? { [RUM_ATTRIBUTES.longTaskBlockingDuration]: loaf!.blockingDuration }\n : {}),\n [RUM_ATTRIBUTES.longTaskEntryType]: entryTypeAttribute,\n [RUM_ATTRIBUTES.longTaskId]: id,\n 'long_task.name': entry.name,\n ...(finiteNumber(loaf?.firstUIEventTimestamp) !== undefined\n ? { 'long_task.first_ui_event_timestamp': loaf!.firstUIEventTimestamp }\n : {}),\n ...(finiteNumber(loaf?.renderStart) !== undefined ? { 'long_task.render_start': loaf!.renderStart } : {}),\n ...(finiteNumber(loaf?.styleAndLayoutStart) !== undefined\n ? { 'long_task.style_and_layout_start': loaf!.styleAndLayoutStart }\n : {}),\n };\n // 迟到条目的采样归属取发生时的 Session,不取 observer 回调时的当前 Session。\n const span = context.startSpan(buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.longTask }), attributes, {\n startTime,\n });\n scripts.forEach(script => {\n span.addEvent(\n 'long_task.script',\n context.applyRedact(getScriptAttributes(script, context.config.hooks.redactUrl)),\n performance.timeOrigin + script.startTime,\n );\n });\n legacyAttributions.forEach((attribution, index) => {\n span.addEvent(\n 'long_task.attribution',\n context.applyRedact({\n 'long_task.attribution.index': index,\n ...getLegacyAttributionAttributes(attribution, context.config.hooks.redactUrl),\n }),\n startTime,\n );\n });\n span.end(endTime);\n context.notifyActivity({ endTime, startTime, type: 'long_task' });\n };\n\n const emitEntries = (entries: PerformanceEntry[]) =>\n entries.forEach(entry => emitEntry(entry as LegacyLongTaskEntry));\n try {\n let initializing = true;\n observer = new PerformanceObserver(list => {\n if (disposed) return;\n const entries = list.getEntries();\n if (initializing) {\n // buffered 条目可能在 observe() 内同步回调,先合并到下一宏任务,等 Session/View 上下文就绪后再归属。\n initialEntries.push(...entries);\n if (!initialBatchTimer) {\n initialBatchTimer = setTimeout(() => {\n const entriesToEmit = initialEntries;\n initialEntries = [];\n initialBatchTimer = undefined;\n emitEntries(entriesToEmit);\n });\n }\n } else {\n emitEntries(entries);\n }\n });\n observer.observe({ type: entryType, buffered: true });\n initializing = false;\n } catch {\n observer = undefined;\n }\n },\n shutdown() {\n disposed = true;\n observer?.disconnect();\n observer = undefined;\n clearTimeout(initialBatchTimer);\n initialBatchTimer = undefined;\n initialEntries = [];\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\nimport { matchesUrlList } from './url';\n\nimport type { BkOTActivityEvent } from './action-activity';\nimport type { BkOTRuntimeContext } from './plugin';\n\nexport const PAGE_ACTIVITY_VALIDATION_DELAY = 100;\nexport const PAGE_ACTIVITY_END_DELAY = 100;\n\nexport type PageActivityEnd = { endTime: number; hadActivity: true } | { hadActivity: false };\n\nconst isActivityUrlExcluded = (context: BkOTRuntimeContext, url: string | undefined) =>\n Boolean(url && matchesUrlList(context.config.view.excludedActivityUrls, url));\n\n/**\n * 等待 View/Action 启动后的请求、静态资源和 DOM 变更全部安静 100ms。\n * 请求用 id 精确配对,避免并发请求提前结束等待。\n */\nexport const waitForPageActivityEnd = (\n context: BkOTRuntimeContext,\n startTime: number,\n callback: (result: PageActivityEnd) => void,\n) => {\n const pendingRequests = new Set<string>();\n let completed = false;\n let hadActivity = false;\n let lastActivityTime = startTime;\n let quietTimer: ReturnType<typeof setTimeout> | undefined;\n\n const complete = (result: PageActivityEnd) => {\n if (completed) return;\n completed = true;\n clearTimeout(validationTimer);\n clearTimeout(quietTimer);\n unsubscribe();\n callback(result);\n };\n\n const scheduleEnd = () => {\n clearTimeout(quietTimer);\n if (!hadActivity || pendingRequests.size) return;\n quietTimer = setTimeout(\n () => complete({ endTime: lastActivityTime, hadActivity: true }),\n Math.max(0, lastActivityTime + PAGE_ACTIVITY_END_DELAY - Date.now()),\n );\n };\n\n const markActivity = (time: number) => {\n hadActivity = true;\n lastActivityTime = Math.max(lastActivityTime, time);\n scheduleEnd();\n };\n\n const onActivity = (event: BkOTActivityEvent) => {\n if (event.type === 'error' || event.type === 'long_task') return;\n if (event.type === 'request_start') {\n if (event.time < startTime || isActivityUrlExcluded(context, event.url)) return;\n pendingRequests.add(event.id);\n markActivity(event.time);\n return;\n }\n if (event.type === 'request_end') {\n if (!pendingRequests.delete(event.id)) return;\n markActivity(event.time);\n return;\n }\n if (event.type === 'resource') {\n if (event.endTime < startTime || isActivityUrlExcluded(context, event.url)) return;\n markActivity(event.endTime);\n return;\n }\n if (event.time >= startTime) markActivity(event.time);\n };\n\n const unsubscribe = context.onActivity(onActivity);\n const validationTimer = setTimeout(() => {\n if (!hadActivity) complete({ hadActivity: false });\n }, PAGE_ACTIVITY_VALIDATION_DELAY);\n\n return () => {\n if (completed) return;\n completed = true;\n clearTimeout(validationTimer);\n clearTimeout(quietTimer);\n unsubscribe();\n };\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nexport interface RouteChangeEvent {\n fromUrl: string;\n source: RouteChangeSource;\n toUrl: string;\n}\n\nexport type RouteChangeSource = 'hashchange' | 'popstate' | 'pushState' | 'replaceState';\n\ntype RouteChangeHandler = (event: RouteChangeEvent) => void;\n\nconst subscribers = new Set<RouteChangeHandler>();\n\n// History 只 patch 一次,多个插件/实例共用订阅集合;最后一个订阅者退出时恢复原方法。\nlet lastUrl = '';\nlet restoreHistory: (() => void) | undefined;\n\nconst getCurrentUrl = () => (typeof location === 'undefined' ? '' : location.href);\n\nconst emitRouteChange = (source: RouteChangeSource, fromUrl: string) => {\n const toUrl = getCurrentUrl();\n lastUrl = toUrl;\n if (fromUrl === toUrl) return;\n const event: RouteChangeEvent = { fromUrl, source, toUrl };\n\n for (const subscriber of Array.from(subscribers)) {\n try {\n subscriber(event);\n } catch {\n // 采集失败不能改变原生 History 调用结果,也不能阻止其它 SDK 实例收到导航。\n }\n }\n};\n\nconst patchHistory = () => {\n if (restoreHistory || typeof window === 'undefined' || typeof history === 'undefined') {\n return;\n }\n\n const target = history;\n const eventTarget = window;\n // 第三方可能永久保存这层 wrapper,关闭采集后也必须能继续调用原方法。\n const originalPushState = target.pushState;\n const originalReplaceState = target.replaceState;\n let active = true;\n lastUrl = getCurrentUrl();\n\n const patchedPushState = (target.pushState = function (\n this: History,\n data: any,\n title: string,\n url?: null | string | URL,\n ) {\n const fromUrl = lastUrl || getCurrentUrl();\n // 先执行原方法,让订阅者读取到的 location 与浏览器最终状态一致。\n const result = originalPushState.apply(this, [data, title, url]);\n if (active) emitRouteChange('pushState', fromUrl);\n return result;\n });\n const patchedReplaceState = (target.replaceState = function (\n this: History,\n data: any,\n title: string,\n url?: null | string | URL,\n ) {\n const fromUrl = lastUrl || getCurrentUrl();\n const result = originalReplaceState.apply(this, [data, title, url]);\n if (active) emitRouteChange('replaceState', fromUrl);\n return result;\n });\n const onPopState = () => {\n if (active) emitRouteChange('popstate', lastUrl || getCurrentUrl());\n };\n const onHashChange = () => {\n if (active) emitRouteChange('hashchange', lastUrl || getCurrentUrl());\n };\n eventTarget.addEventListener('popstate', onPopState);\n eventTarget.addEventListener('hashchange', onHashChange);\n restoreHistory = () => {\n active = false;\n if (target.pushState === patchedPushState) target.pushState = originalPushState;\n if (target.replaceState === patchedReplaceState) target.replaceState = originalReplaceState;\n eventTarget.removeEventListener('popstate', onPopState);\n eventTarget.removeEventListener('hashchange', onHashChange);\n restoreHistory = undefined;\n lastUrl = '';\n };\n};\n\nexport const subscribeRouteChange = (handler: RouteChangeHandler) => {\n if (typeof window === 'undefined' || typeof history === 'undefined') {\n return () => {};\n }\n\n patchHistory();\n subscribers.add(handler);\n\n return () => {\n subscribers.delete(handler);\n if (subscribers.size === 0) {\n restoreHistory?.();\n }\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type BkOTViewRouteMode = 'auto' | 'document' | 'hash' | 'history';\n\nconst parseUrl = (url: string) => {\n try {\n return new URL(url, typeof location === 'undefined' ? 'http://localhost' : location.href);\n } catch {\n return undefined;\n }\n};\n\nconst hasHashRoutePrefix = (hash: string) => /^#!?\\//.test(hash);\n\n// Hash 中的 query 与页内 fragment 不属于路由路径,不能混进页面模板。\nconst getHashRoutePath = (hash: string) => {\n const path = hash.replace(/^#!/, '').replace(/^#/, '').split(/[?#]/, 1)[0];\n return path.startsWith('/') ? path : `/${path}`;\n};\n\n/** 仅用于身份比较与模板生成;routePath 仍可能含业务 ID,不能当作已脱敏 URL 直接上报。 */\nexport const getViewLocation = (url: string, mode: BkOTViewRouteMode = 'auto') => {\n const parsed = parseUrl(url);\n const pathname = parsed?.pathname || '/';\n const hash = parsed?.hash ?? '';\n const kind: 'hash' | 'history' =\n mode === 'hash' || (mode === 'auto' && hasHashRoutePrefix(hash)) ? 'hash' : 'history';\n return { hash, kind, pathname, routePath: kind === 'hash' ? getHashRoutePath(hash) : pathname };\n};\n\nconst isHashAnchor = (hash: string) => {\n if (!hash || typeof document === 'undefined' || typeof document.getElementById !== 'function') return false;\n try {\n return Boolean(document.getElementById(decodeURIComponent(hash.slice(1))));\n } catch {\n return Boolean(document.getElementById(hash.slice(1)));\n }\n};\n\n/** 同文档导航边界;整页导航由新 Document 初始化产生 initial_load,不经过此比较。 */\nexport const isViewLocationChange = (fromUrl: string, toUrl: string, mode: BkOTViewRouteMode = 'auto') => {\n if (mode === 'document') return false;\n const from = getViewLocation(fromUrl, mode);\n const to = getViewLocation(toUrl, mode);\n if (from.pathname !== to.pathname) return true;\n if (mode === 'history') return false;\n if (mode === 'hash' || from.kind === 'hash' || to.kind === 'hash') {\n return from.kind !== to.kind || from.routePath !== to.routePath;\n }\n // auto 为无框架接入保留非标准 hash 路由的启发式;明确模式/Router 集成无需依赖 DOM。\n if (from.hash === to.hash || isHashAnchor(to.hash) || (!to.hash && isHashAnchor(from.hash))) return false;\n return getHashRoutePath(from.hash) !== getHashRoutePath(to.hash);\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n/**\n * Page View 插件\n *\n * 自动模式监听初始加载、SPA 路由和 BFCache;手动模式仅由 startView() 划分 View。\n *\n * 上报形态:使用 view.name 命名的 start/update/end 原始生命周期事件 span。\n *\n * 自动边界与 Datadog 对齐:pathname 或非锚点 hash path 改变才创建 View,query-only 变化不创建。\n *\n * 关键属性:\n * - view.url:当前页面 URL(经 redactUrl 脱敏)\n * - view.previous:跳转前的 URL(来自 route-observer 的 fromUrl,初始 load 为空字符串)\n * - view.previous_url_template:跳转前 URL 的低基数路由模板,初始 load 为空字符串\n * - view.referrer:仅初始加载且值非空时携带\n */\n\nimport { getEventEpochTime, getEventRelativeTime } from '../core/event-time';\nimport { createRandomId } from '../core/id';\nimport { waitForPageActivityEnd } from '../core/page-activity';\nimport { getNavigationTimingPointAttributes, getTimingPointAttributes } from '../core/performance-timing';\nimport { subscribeRouteChange } from '../core/route-observer';\nimport { copyAttributes } from '../core/runtime-context';\nimport { isViewLocationChange } from '../core/view-location';\n\nexport { isViewLocationChange } from '../core/view-location';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_TYPE } from '../schema/span';\n\nimport type { BkOTPlugin } from '../core/plugin';\nimport type { BkOTStartViewOptions, BkOTViewContext } from '../core/runtime-context';\nimport type { Attributes } from '@opentelemetry/api';\n\ninterface ActiveView {\n attributes: Attributes;\n customTimings: Attributes;\n foregroundBase: number;\n id: string;\n interactionCountAtStart?: number;\n loadingTime?: number;\n loadingTimeSource?: 'auto' | 'manual';\n loadingType: ViewLoadingType;\n /** 业务显式命名优先;未命名时使用 view.url_template */\n name?: string;\n pageStates: Array<{ start: number; state: PageState }>;\n rawUrl: string;\n relativeStartedAt: number;\n snapshotAttributes: Attributes;\n startedAt: number;\n url: string;\n urlTemplate: string;\n version: number;\n stopLoadingTime?: () => void;\n}\n\ntype ViewLoadingType = NonNullable<BkOTViewContext['loadingType']>;\n\nconst PROTECTED_ATTRIBUTE_KEYS = new Set<string>(Object.values(RUM_ATTRIBUTES));\n\nconst interactionCount = () => {\n const count = typeof performance === 'undefined' ? undefined : (performance as Performance & { interactionCount?: number }).interactionCount;\n return typeof count === 'number' && Number.isFinite(count) && count >= 0 ? count : undefined;\n};\n\nconst relativeNow = () => (typeof performance !== 'undefined' && typeof performance.now === 'function' ? performance.now() : 0);\n\nconst getCurrentUrl = () => {\n if (typeof location === 'undefined') {\n return '';\n }\n return location.href;\n};\n\nconst getNavigationTimingAttributes = (): Attributes => {\n if (typeof performance === 'undefined') return {};\n const navigation = performance.getEntriesByType('navigation')[0] as PerformanceNavigationTiming | undefined;\n if (!navigation) return {};\n const attributes: Attributes = {};\n const setTiming = (key: string, value: number) => {\n if (Number.isFinite(value) && value > 0) attributes[key] = value;\n };\n setTiming(RUM_ATTRIBUTES.viewFirstByte, navigation.responseStart);\n setTiming(RUM_ATTRIBUTES.viewDomInteractive, navigation.domInteractive);\n setTiming(RUM_ATTRIBUTES.viewDomContentLoaded, navigation.domContentLoadedEventEnd);\n setTiming(RUM_ATTRIBUTES.viewDomComplete, navigation.domComplete);\n setTiming(RUM_ATTRIBUTES.viewLoadEvent, navigation.loadEventEnd);\n return {\n ...attributes,\n ...getTimingPointAttributes(navigation),\n ...getNavigationTimingPointAttributes(navigation),\n };\n};\n\ntype PageState = 'active' | 'frozen' | 'hidden' | 'passive';\nconst getPageState = (): PageState =>\n document.visibilityState === 'hidden' ? 'hidden' : document.hasFocus?.() === false ? 'passive' : 'active';\nconst isForeground = (state: PageState) => state === 'active' || state === 'passive';\n\nexport const createPageViewPlugin = (): BkOTPlugin => {\n const teardownCallbacks: Array<() => void> = [];\n let checkpoint: (() => void) | undefined;\n\n return {\n name: 'page-view',\n flush() {\n checkpoint?.();\n },\n init(context) {\n if (typeof window === 'undefined') {\n return;\n }\n\n let activeView: ActiveView | undefined;\n let bfCacheView: Omit<ActiveView, 'stopLoadingTime'> | undefined;\n let renewalView: Omit<ActiveView, 'stopLoadingTime'> | undefined;\n let manualNavigationFrom: string | undefined;\n let manualIntent: BkOTStartViewOptions | undefined;\n const queuedStarts = new Set<{ interactionCountAtStart?: number; relativeStartedAt: number; startedAt: number }>();\n let sessionActivatedAt: number | undefined;\n let sessionActivatedRelativeAt: number | undefined;\n let manualRestoreAt: number | undefined;\n let manualRestoreRelativeAt: number | undefined;\n let manualRestoreInteractionCount: number | undefined;\n\n let hasCreatedView = false;\n const clearViewContext = (changedAt = Date.now(), relativeEndedAt = relativeNow(), interactionCountAtEnd = interactionCount()) =>\n context.setView({ endedAt: changedAt, relativeEndedAt, interactionCountAtEnd }, changedAt);\n // 历史 Session deadline 只有墙钟时间。时钟已漂移时无法重建休眠期间的相对位置,\n // 此时以本次观察边界关闭,不能用 timeOrigin 把有效的旧条目移到新 View。\n const relativeBoundary = (epoch: number) => {\n const now = relativeNow();\n const wallNow = Date.now();\n const drift = activeView ? wallNow - activeView.startedAt - (now - activeView.relativeStartedAt) : 0;\n return Math.max(activeView?.relativeStartedAt ?? 0, Math.min(now, Math.abs(drift) > 2 ? now : now - (wallNow - epoch)));\n };\n const publishViewContext = (view: ActiveView, changedAt = Date.now()) =>\n context.setView(\n {\n attributes: view.attributes,\n id: view.id,\n interactionCountAtStart: view.interactionCountAtStart,\n loadingType: view.loadingType,\n name: view.name,\n startedAt: view.startedAt,\n relativeStartedAt: view.relativeStartedAt,\n url: view.url,\n urlTemplate: view.urlTemplate,\n },\n changedAt,\n );\n const recordPageState = (state: PageState) => {\n if (!activeView) return;\n const states = activeView.pageStates;\n if (states.at(-1)?.state === state) return;\n states.push({ state, start: Math.max(0, Date.now() - activeView.startedAt) });\n // 保留近期状态明细,同时保留已裁剪区间的前台总时长。\n if (states.length > 100) {\n const first = states.shift()!;\n if (isForeground(first.state)) activeView.foregroundBase += states[0].start - first.start;\n }\n };\n\n const emitViewEvent = (\n view: ActiveView,\n phase: 'end' | 'start' | 'update',\n timestamp = Date.now(),\n reason?: string,\n ) => {\n if (view.loadingType === 'initial_load') {\n Object.assign(view.snapshotAttributes, getNavigationTimingAttributes());\n }\n view.version += 1;\n const duration = Math.max(0, timestamp - view.startedAt);\n const pageStates = view.pageStates.filter(state => state.start <= duration);\n const foregroundTime =\n view.foregroundBase +\n pageStates.reduce(\n (sum, state, index) =>\n sum +\n (isForeground(state.state) ? Math.max(0, (pageStates[index + 1]?.start ?? duration) - state.start) : 0),\n 0,\n );\n const attributes: Attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...view.attributes,\n ...view.snapshotAttributes,\n [RUM_ATTRIBUTES.viewPhase]: phase,\n [RUM_ATTRIBUTES.viewStartedAt]: view.startedAt,\n [RUM_ATTRIBUTES.viewVersion]: view.version,\n [RUM_ATTRIBUTES.viewTimeSpent]: duration,\n [RUM_ATTRIBUTES.viewForegroundTime]: Math.min(duration, foregroundTime),\n [RUM_ATTRIBUTES.viewIsActive]: phase !== 'end',\n [RUM_ATTRIBUTES.viewPageStates]: JSON.stringify(pageStates),\n ...view.customTimings,\n ...(reason ? { [RUM_ATTRIBUTES.viewEndReason]: reason } : {}),\n ...(view.loadingTime === undefined\n ? {}\n : {\n [RUM_ATTRIBUTES.viewLoadingTime]: view.loadingTime,\n [RUM_ATTRIBUTES.viewLoadingTimeSource]: view.loadingTimeSource,\n }),\n };\n const sessionId = attributes[RUM_ATTRIBUTES.sessionId];\n const associationTime = phase === 'end' ? Math.max(view.startedAt, timestamp - 0.001) : timestamp;\n // Reading the history may itself discover an expired Session and begin its transition.\n context.getRuntimeAttributesAt?.(associationTime);\n const send = () => {\n const session = context.getRuntimeAttributesAt?.(associationTime);\n if (phase !== 'end' && session && (!sessionId || session[RUM_ATTRIBUTES.sessionId] !== sessionId)) return;\n if (session && session[RUM_ATTRIBUTES.sessionId] === sessionId) {\n // View identity is fixed, but activity metadata advances within that same Session.\n for (const key of [RUM_ATTRIBUTES.sessionStartTime, RUM_ATTRIBUTES.sessionLastActivityTime]) {\n if (session[key] === undefined) delete attributes[key];\n else attributes[key] = session[key];\n }\n }\n const span = context.startSpan(buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.view }), attributes, {\n contextTime: timestamp,\n rumSpanType: RUM_SPAN_TYPE.view,\n startTime: timestamp,\n });\n span.end(timestamp);\n };\n // Version, attributes and timestamp were captured above; queued updates cannot observe\n // a later rename/version or bypass expiry by carrying their old explicit Session ID.\n if (phase !== 'end' && context.isSessionTransitionPending?.()) context.afterSessionTransition(send);\n else send();\n };\n\n const endActiveView = (reason: string, clearContext = true, endedAt = Date.now(), endTimeKnown = true, relativeEndedAt = relativeBoundary(endedAt), interactionCountAtEnd = interactionCount()) => {\n if (!activeView) {\n if (clearContext) clearViewContext(endedAt, relativeEndedAt, interactionCountAtEnd);\n return undefined;\n }\n const snapshot = { ...activeView };\n activeView.stopLoadingTime?.();\n // 缺少共享结束快照时仍解绑本地 View,但不能把保守截断时间上报成真实结束时间。\n if (endTimeKnown) emitViewEvent(activeView, 'end', endedAt, reason);\n activeView = undefined;\n if (clearContext) clearViewContext(endedAt, relativeEndedAt, interactionCountAtEnd);\n const { stopLoadingTime: _stopLoadingTime, ...rest } = snapshot;\n return rest;\n };\n\n const setLoadingTime = (view: ActiveView, duration: number, source: 'auto' | 'manual') => {\n if (activeView !== view || !Number.isFinite(duration) || duration < 0) return;\n const updatedAttributes = {\n [RUM_ATTRIBUTES.viewLoadingTime]: duration,\n [RUM_ATTRIBUTES.viewLoadingTimeSource]: source,\n };\n Object.assign(view.snapshotAttributes, updatedAttributes);\n view.loadingTime = duration;\n view.loadingTimeSource = source;\n emitViewEvent(view, 'update');\n };\n\n const startLoadingTimeTracking = (view: ActiveView) => {\n if (!context.config.view.loadingTime || document.visibilityState === 'hidden') return;\n let activityResolved = false;\n let activityCandidate: number | undefined;\n let loadResolved = view.loadingType !== 'initial_load';\n let loadCandidate: number | undefined;\n let loadListener: (() => void) | undefined;\n let hidden = false;\n let visibilityListener: (() => void) | undefined;\n\n const tryComplete = () => {\n if (hidden || !activityResolved || !loadResolved || !frameResolved || activeView !== view) return;\n const candidates = [activityCandidate, loadCandidate, frameCandidate].filter(\n (candidate): candidate is number => candidate !== undefined,\n );\n if (candidates.length) setLoadingTime(view, Math.max(...candidates), 'auto');\n view.stopLoadingTime?.();\n view.stopLoadingTime = undefined;\n };\n\n const readLoadEvent = () => {\n const navigation = performance.getEntriesByType?.('navigation')[0] as PerformanceNavigationTiming | undefined;\n if (!navigation?.loadEventEnd) return false;\n loadCandidate = Math.max(0, performance.timeOrigin + navigation.loadEventEnd - view.startedAt);\n loadResolved = true;\n return true;\n };\n\n // BFCache 恢复不会重新触发 load,恢复后也常常没有请求/资源/DOM 变化;\n // 以恢复后首帧(双 rAF,与 web-vitals、Datadog 的 restored FCP 口径一致)作为兜底候选,\n // 保证 bf_cache View 总能产出 loading_time。\n let frameResolved = view.loadingType !== 'bf_cache';\n let frameCandidate: number | undefined;\n let frameListener: (() => void) | undefined;\n if (!frameResolved) {\n if (typeof requestAnimationFrame === 'function') {\n let rafId = requestAnimationFrame(() => {\n rafId = requestAnimationFrame(() => {\n frameListener = undefined;\n frameCandidate = Math.max(0, Date.now() - view.startedAt);\n frameResolved = true;\n tryComplete();\n });\n });\n frameListener = () => cancelAnimationFrame(rafId);\n } else {\n frameResolved = true;\n }\n }\n\n if (!loadResolved && !readLoadEvent()) {\n const onLoad = () => {\n setTimeout(() => {\n if (activeView !== view) return;\n readLoadEvent();\n loadResolved = true;\n tryComplete();\n });\n };\n window.addEventListener('load', onLoad, { once: true });\n loadListener = () => window.removeEventListener('load', onLoad);\n }\n\n const stopActivity = waitForPageActivityEnd(context, view.startedAt, result => {\n activityResolved = true;\n if (result.hadActivity) activityCandidate = Math.max(0, result.endTime - view.startedAt);\n tryComplete();\n });\n const onVisibilityChange = () => {\n if (document.visibilityState !== 'hidden') return;\n hidden = true;\n view.stopLoadingTime?.();\n view.stopLoadingTime = undefined;\n };\n document.addEventListener('visibilitychange', onVisibilityChange);\n visibilityListener = () => document.removeEventListener('visibilitychange', onVisibilityChange);\n view.stopLoadingTime = () => {\n stopActivity();\n loadListener?.();\n loadListener = undefined;\n frameListener?.();\n frameListener = undefined;\n visibilityListener?.();\n visibilityListener = undefined;\n };\n tryComplete();\n };\n\n const sanitizeViewAttributes = (attributes: Attributes | undefined) => {\n const redacted = copyAttributes(context.applyRedact(copyAttributes(attributes)));\n return Object.fromEntries(\n Object.entries(redacted).filter(\n ([key, value]) =>\n value !== undefined && !PROTECTED_ATTRIBUTE_KEYS.has(key) && !key.startsWith('view.custom_timings.'),\n ),\n ) as Attributes;\n };\n\n const startView = (\n options: BkOTStartViewOptions,\n source: string,\n loadingType: ViewLoadingType,\n previousUrl = manualNavigationFrom ?? activeView?.rawUrl ?? '',\n /** 仅供内部使用:BFCache 恢复传入 pageshow 事件时刻 */\n startedAtOverride?: number,\n renewedSessionId?: string,\n relativeStartedAtOverride?: number,\n interactionCountAtStartOverride?: number,\n ) => {\n const capturedCount = interactionCountAtStartOverride ?? interactionCount();\n const capturedAt = startedAtOverride ?? Date.now();\n const capturedRelativeAt = relativeStartedAtOverride ?? (startedAtOverride === undefined ? relativeNow() : relativeBoundary(startedAtOverride));\n const sessionIsActive = context.isSessionActive();\n if (context.isSessionTransitionPending?.() && !renewedSessionId) {\n const captured = { ...options, url: options.url ?? getCurrentUrl() };\n const queuedStart = { startedAt: capturedAt, relativeStartedAt: capturedRelativeAt, interactionCountAtStart: capturedCount };\n queuedStarts.add(queuedStart);\n context.afterSessionTransition(() => {\n queuedStarts.delete(queuedStart);\n startView(captured, source, loadingType, previousUrl, capturedAt, undefined, capturedRelativeAt, capturedCount);\n });\n return;\n }\n if (!sessionIsActive) return;\n if (startedAtOverride !== undefined && sessionActivatedAt !== undefined && startedAtOverride < sessionActivatedAt) {\n startedAtOverride = sessionActivatedAt;\n relativeStartedAtOverride = sessionActivatedRelativeAt;\n }\n const currentUrl = options.url ?? getCurrentUrl();\n const urlTemplate = options.urlTemplate || context.config.hooks.getViewUrlTemplate(currentUrl);\n const previousUrlTemplate = previousUrl\n ? (activeView?.urlTemplate ?? context.config.hooks.getViewUrlTemplate(previousUrl))\n : '';\n const name = options.name ?? urlTemplate;\n const customAttributes = sanitizeViewAttributes(options.attributes);\n\n const viewId = createRandomId('view');\n const redactedCurrentUrl = context.config.hooks.redactUrl(currentUrl);\n const redactedPreviousUrl = context.config.hooks.redactUrl(previousUrl);\n const origin = typeof performance !== 'undefined' ? performance.timeOrigin : Date.now();\n const sessionNow = context.getRuntimeAttributes?.()[RUM_ATTRIBUTES.sessionId];\n const originSession = context.getRuntimeAttributesAt?.(origin)?.[RUM_ATTRIBUTES.sessionId];\n // 只有仍属于当前 Session 的首次文档体验可以回溯导航起点。\n // manual 首次调用可能已跨 Session,不能删除历史校验来伪造导航归属。\n if (loadingType === 'initial_load' && (hasCreatedView || context.collectionStart?.isInitialDocument === false || originSession !== sessionNow))\n loadingType = 'route_change';\n const isInitialLoad = loadingType === 'initial_load';\n const startedAt = startedAtOverride ?? (isInitialLoad ? origin : capturedAt);\n const relativeStartedAt = relativeStartedAtOverride ?? (isInitialLoad && startedAtOverride === undefined ? 0 : capturedRelativeAt);\n const interactionCountAtStart = isInitialLoad ? 0 : capturedCount;\n endActiveView(source, false, startedAt, true, relativeStartedAt, interactionCountAtStart);\n hasCreatedView = true;\n manualNavigationFrom = undefined;\n manualRestoreAt = undefined;\n manualRestoreRelativeAt = undefined;\n manualRestoreInteractionCount = undefined;\n\n context.setView(\n {\n attributes: customAttributes,\n id: viewId,\n interactionCountAtStart,\n loadingType,\n name,\n relativeStartedAt,\n startedAt,\n url: redactedCurrentUrl,\n urlTemplate,\n },\n startedAt,\n );\n\n const viewAttributes = {\n ...Object.fromEntries(\n Object.entries(context.getRuntimeAttributes?.() ?? {}).filter(\n ([key]) => key.startsWith('session.') || key === RUM_ATTRIBUTES.tabId,\n ),\n ),\n ...(renewedSessionId ? { [RUM_ATTRIBUTES.sessionId]: renewedSessionId } : {}),\n ...customAttributes,\n ...context.config.hooks.getPageAttributes(),\n ...buildRumSpanAttributes({\n spanType: RUM_SPAN_TYPE.view,\n }),\n [RUM_ATTRIBUTES.viewId]: viewId,\n ...(name ? { [RUM_ATTRIBUTES.viewName]: name } : {}),\n [RUM_ATTRIBUTES.viewUrl]: redactedCurrentUrl,\n [RUM_ATTRIBUTES.viewUrlTemplate]: urlTemplate,\n [RUM_ATTRIBUTES.viewLoadingType]: loadingType,\n [RUM_ATTRIBUTES.viewPrevious]: redactedPreviousUrl,\n [RUM_ATTRIBUTES.viewPreviousUrlTemplate]: previousUrlTemplate,\n ...(isInitialLoad && document.referrer\n ? { [RUM_ATTRIBUTES.viewReferrer]: context.config.hooks.redactUrl(document.referrer) }\n : {}),\n };\n activeView = {\n attributes: customAttributes,\n customTimings: {},\n pageStates: [{ state: getPageState(), start: Math.max(0, Date.now() - startedAt) }],\n foregroundBase: 0,\n version: 0,\n id: viewId,\n interactionCountAtStart,\n loadingType,\n name,\n rawUrl: currentUrl,\n snapshotAttributes: viewAttributes,\n relativeStartedAt,\n startedAt,\n url: redactedCurrentUrl,\n urlTemplate,\n };\n emitViewEvent(activeView, 'start', startedAt);\n startLoadingTimeTracking(activeView);\n };\n\n const unsubscribeViewCommands = context.onViewCommand(command => {\n if (command.type === 'start') {\n manualIntent = { ...command.options, url: command.options.url ?? getCurrentUrl() };\n const restoredAt = manualRestoreAt;\n const restoredRelativeAt = manualRestoreRelativeAt;\n const restoredInteractionCount = manualRestoreInteractionCount;\n manualRestoreAt = undefined;\n manualRestoreRelativeAt = undefined;\n manualRestoreInteractionCount = undefined;\n if (restoredAt !== undefined) bfCacheView = undefined;\n startView(\n command.options,\n 'manual',\n restoredAt !== undefined\n ? 'bf_cache'\n : activeView || command.startedAt !== undefined\n ? 'route_change'\n : 'initial_load',\n undefined,\n restoredAt ?? command.startedAt,\n undefined,\n restoredRelativeAt ?? command.relativeStartedAt,\n restoredInteractionCount,\n );\n return;\n }\n if (!activeView) return;\n if (command.type === 'set_loading_time') {\n activeView.stopLoadingTime?.();\n activeView.stopLoadingTime = undefined;\n setLoadingTime(activeView, Math.max(0, command.time - activeView.startedAt), 'manual');\n return;\n }\n if (command.type === 'add_timing') {\n const name = command.name\n .trim()\n .replace(/[^a-zA-Z0-9_.-]/g, '_')\n .slice(0, 100);\n const elapsed = command.elapsed ?? command.time - activeView.startedAt;\n if (\n !name ||\n !Number.isFinite(elapsed) ||\n elapsed < 0 ||\n elapsed > Math.max(0, command.time - activeView.startedAt)\n )\n return;\n const key = `view.custom_timings.${name}`;\n if (!(key in activeView.customTimings) && Object.keys(activeView.customTimings).length >= 100) return;\n activeView.customTimings[key] = elapsed;\n } else if (command.type === 'set_context' || command.type === 'set_context_property') {\n const next =\n command.type === 'set_context'\n ? command.attributes\n : { ...activeView.attributes, [command.key]: command.value };\n for (const key of Object.keys(activeView.attributes)) delete activeView.snapshotAttributes[key];\n activeView.attributes = sanitizeViewAttributes(next);\n Object.assign(activeView.snapshotAttributes, activeView.attributes);\n publishViewContext(activeView);\n } else {\n if (activeView.name === command.name) return;\n activeView.name = command.name;\n activeView.snapshotAttributes[RUM_ATTRIBUTES.viewName] = command.name;\n publishViewContext(activeView);\n }\n emitViewEvent(activeView, 'update');\n });\n\n if (context.config.view.tracking === 'auto' && !activeView) {\n const resumed = context.collectionStart?.isInitialDocument === false ? context.collectionStart : undefined;\n startView({}, 'load', 'initial_load', undefined, resumed?.startedAt, undefined, resumed?.relativeStartedAt);\n }\n // URL 变化与 View 身份变化独立;manual 模式更新 URL,只有 startView 创建边界。\n const unsubscribeRoute = subscribeRouteChange(event => {\n const changesView = isViewLocationChange(event.fromUrl, event.toUrl, context.config.view.routeMode);\n if (context.config.view.tracking === 'auto' && changesView) {\n startView({}, event.source, 'route_change', event.fromUrl);\n } else if (activeView) {\n // Router 通常先改地址再提交 View。保留原页面,不能让新 View 的 previous 指向自己。\n if (context.config.view.tracking === 'manual' && changesView) manualNavigationFrom ??= event.fromUrl;\n activeView.rawUrl = event.toUrl;\n const url = context.config.hooks.redactUrl(event.toUrl);\n if (url === activeView.url) return;\n activeView.url = url;\n activeView.snapshotAttributes[RUM_ATTRIBUTES.viewUrl] = url;\n publishViewContext(activeView);\n emitViewEvent(activeView, 'update');\n }\n });\n\n checkpoint = () => {\n if (activeView && context.isSessionActive()) emitViewEvent(activeView, 'update');\n };\n const onVisibility = () => {\n recordPageState(getPageState());\n checkpoint?.();\n };\n const onFocus = () => recordPageState(getPageState());\n const onFreeze = () => {\n recordPageState('frozen');\n checkpoint?.();\n };\n const checkpointTimer = setInterval(() => checkpoint?.(), 60_000);\n document.addEventListener?.('visibilitychange', onVisibility);\n document.addEventListener?.('freeze', onFreeze);\n document.addEventListener?.('resume', onVisibility);\n window.addEventListener('focus', onFocus);\n window.addEventListener('blur', onFocus);\n teardownCallbacks.push(\n () => clearInterval(checkpointTimer),\n () => document.removeEventListener?.('visibilitychange', onVisibility),\n () => document.removeEventListener?.('freeze', onFreeze),\n () => document.removeEventListener?.('resume', onVisibility),\n () => window.removeEventListener('focus', onFocus),\n () => window.removeEventListener('blur', onFocus),\n );\n\n const onPageHide = (event: PageTransitionEvent) => {\n if (event.persisted) {\n bfCacheView = endActiveView('bfcache', true, getEventEpochTime(event), true, getEventRelativeTime(event));\n return;\n }\n bfCacheView = undefined;\n endActiveView('pagehide', true, getEventEpochTime(event), true, getEventRelativeTime(event));\n };\n const onPageShow = (event: PageTransitionEvent) => {\n if (event.persisted && context.config.view.tracking === 'manual') {\n // 手动模式仍由集成显式创建边界,只在它消费恢复意图时标记正确的激活作用域。\n manualRestoreAt = activeView ? undefined : getEventEpochTime(event);\n manualRestoreRelativeAt = activeView ? undefined : getEventRelativeTime(event);\n manualRestoreInteractionCount = activeView ? undefined : interactionCount();\n return;\n }\n if (event.persisted && context.config.view.tracking === 'auto') {\n const restoredAt = getEventEpochTime(event);\n const restoredView = bfCacheView;\n bfCacheView = undefined;\n if (!context.isSessionActive()) {\n renewalView = restoredView;\n return;\n }\n startView(\n restoredView\n ? {\n attributes: restoredView.attributes,\n name: restoredView.name,\n url: restoredView.rawUrl,\n urlTemplate: restoredView.urlTemplate,\n }\n : {},\n 'bfCache',\n 'bf_cache',\n restoredView?.rawUrl,\n restoredAt,\n undefined,\n getEventRelativeTime(event),\n );\n }\n };\n const unsubscribeSessionLifecycle = context.onSessionLifecycle(event => {\n if (event.type === 'expired') {\n if (activeView && manualNavigationFrom) {\n // Router 已更新地址,但新 View 还在等待 Session 提交;结束与恢复的是原页面。\n // 只修正待结束的快照,不回溯 setView,避免覆盖已经记录的 URL 时间历史。\n activeView.rawUrl = manualNavigationFrom;\n activeView.url = context.config.hooks.redactUrl(manualNavigationFrom);\n activeView.snapshotAttributes[RUM_ATTRIBUTES.viewUrl] = activeView.url;\n }\n manualNavigationFrom = undefined;\n renewalView = endActiveView('session_expired', true, event.expiredAt, event.endTimeKnown) ?? bfCacheView;\n bfCacheView = undefined;\n return;\n }\n sessionActivatedAt = event.activatedAt ?? event.startedAt;\n sessionActivatedRelativeAt = [...queuedStarts].find(start => start.startedAt === sessionActivatedAt)?.relativeStartedAt ?? relativeBoundary(sessionActivatedAt);\n const firstQueuedStartAt = Math.min(...Array.from(queuedStarts, start => start.startedAt));\n if (queuedStarts.size && (!renewalView || firstQueuedStartAt <= sessionActivatedAt)) {\n // 与激活同时发生的首个恢复/手动意图由队列消费,避免重复建立 View。\n // 但点击先激活 Session、随后才跳路由时,要保留两者之间的原页面区间,\n // 否则首个 Action 无 View 可关联,不能用未来的路由 View 回填它。\n renewalView = undefined;\n return;\n }\n if (renewalView) {\n startView(\n {\n attributes: renewalView.attributes,\n name: renewalView.name,\n url: renewalView.rawUrl,\n urlTemplate: renewalView.urlTemplate,\n },\n 'sessionRenewal',\n 'session_renewal',\n renewalView.rawUrl,\n event.activatedAt,\n event.id,\n sessionActivatedRelativeAt,\n );\n renewalView = undefined;\n } else if (!activeView && manualIntent) {\n startView(manualIntent, 'manual', 'initial_load', '', event.activatedAt, event.id, sessionActivatedRelativeAt);\n } else if (!activeView && context.config.view.tracking === 'auto') {\n startView({}, 'load', 'initial_load', '', event.activatedAt, event.id, sessionActivatedRelativeAt);\n }\n });\n window.addEventListener('pagehide', onPageHide);\n window.addEventListener('pageshow', onPageShow);\n\n teardownCallbacks.push(\n unsubscribeRoute,\n unsubscribeSessionLifecycle,\n unsubscribeViewCommands,\n () => window.removeEventListener('pagehide', onPageHide),\n () => window.removeEventListener('pageshow', onPageShow),\n () => endActiveView('shutdown'),\n );\n },\n shutdown() {\n checkpoint = undefined;\n while (teardownCallbacks.length) {\n teardownCallbacks.pop()?.();\n }\n },\n };\n};\n","export interface ActiveSessionRecord {\n endedSessions?: SessionEndSnapshot[];\n expiresAt: number;\n id: string;\n lastActivityAt: number;\n previous?: ExpiredSessionRecord;\n schemaVersion: 2;\n startedAt: number;\n status: 'active';\n}\n\nexport interface ExpiredSessionRecord extends SessionEndSnapshot {\n endedSessions?: SessionEndSnapshot[];\n schemaVersion: 2;\n status: 'expired';\n}\n\nexport interface SessionEndSnapshot {\n expiredAt: number;\n previousId: string;\n reason: SessionExpireReason;\n}\n\n/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\nexport type SessionExpireReason = 'inactivity' | 'maxLifetime';\n\nexport type SessionRecord = ActiveSessionRecord | ExpiredSessionRecord;\n\nconst FUTURE_CLOCK_TOLERANCE_MS = 5_000;\n// Frozen documents may miss several rotations. Retain only compact boundaries, not nested records.\nexport const MAX_SESSION_END_SNAPSHOTS = 100;\n\nconst isTimestamp = (value: unknown): value is number =>\n typeof value === 'number' && Number.isFinite(value) && value > 0;\n\nconst readEndSnapshot = (value: unknown, now: number): SessionEndSnapshot | undefined => {\n if (!value || typeof value !== 'object') return;\n const entry = value as Partial<SessionEndSnapshot>;\n if (\n typeof entry.previousId === 'string' &&\n entry.previousId.length > 0 &&\n (entry.reason === 'inactivity' || entry.reason === 'maxLifetime') &&\n isTimestamp(entry.expiredAt) &&\n entry.expiredAt <= now + FUTURE_CLOCK_TOLERANCE_MS\n )\n return { previousId: entry.previousId, expiredAt: entry.expiredAt, reason: entry.reason };\n};\n\nconst compactEndSnapshots = (entries: SessionEndSnapshot[]) => {\n const byId = new Map<string, SessionEndSnapshot>();\n for (const entry of entries) {\n byId.delete(entry.previousId);\n byId.set(entry.previousId, entry);\n }\n return [...byId.values()].slice(-MAX_SESSION_END_SNAPSHOTS);\n};\n\n/** A known boundary must come from the committed shared state, never a stale local deadline. */\nexport const findSessionEnd = (record: null | SessionRecord, id: string): SessionEndSnapshot | undefined => {\n if (record?.status === 'expired' && record.previousId === id) return record;\n if (record?.status === 'active' && record.previous?.previousId === id) return record.previous;\n return record?.endedSessions?.find(entry => entry.previousId === id);\n};\n\nexport const expireSessionRecord = (record: ActiveSessionRecord, reason: SessionExpireReason): ExpiredSessionRecord => {\n const end = { previousId: record.id, expiredAt: record.expiresAt, reason };\n const previous = record.previous;\n return {\n ...end,\n schemaVersion: 2,\n status: 'expired',\n endedSessions: compactEndSnapshots([\n ...(record.endedSessions ?? []),\n ...(previous\n ? [{ previousId: previous.previousId, expiredAt: previous.expiredAt, reason: previous.reason }]\n : []),\n end,\n ]),\n };\n};\n\nexport const createActiveSessionRecord = (\n id: string,\n now: number,\n idleTimeoutMs: number,\n maxDurationMs: number,\n): ActiveSessionRecord => ({\n schemaVersion: 2,\n expiresAt: Math.min(now + idleTimeoutMs, now + maxDurationMs),\n id,\n lastActivityAt: now,\n startedAt: now,\n status: 'active',\n});\n\nexport const getSessionExpireReason = (\n record: ActiveSessionRecord,\n now: number,\n maxDurationMs: number,\n): SessionExpireReason | undefined => {\n if (now >= record.expiresAt)\n return record.expiresAt >= record.startedAt + maxDurationMs ? 'maxLifetime' : 'inactivity';\n return undefined;\n};\n\nexport const expandActiveSession = (\n record: ActiveSessionRecord,\n now: number,\n idleTimeoutMs: number,\n maxDurationMs: number,\n): ActiveSessionRecord => ({\n ...record,\n lastActivityAt: Math.max(record.lastActivityAt, now),\n expiresAt: Math.min(Math.max(record.lastActivityAt, now) + idleTimeoutMs, record.startedAt + maxDurationMs),\n});\n\nexport const parseSessionRecord = (raw: null | string, now: number, maxDurationMs: number): null | SessionRecord => {\n if (!raw) return null;\n try {\n const parsed = JSON.parse(raw) as Partial<SessionRecord>;\n if (!parsed || typeof parsed !== 'object') return null;\n // Invalid history cannot invalidate an otherwise healthy active Session. Bound work and\n // strip nested/unknown fields so a persisted record cannot grow with each rotation.\n const endedSessions = Array.isArray(parsed.endedSessions)\n ? compactEndSnapshots(\n parsed.endedSessions\n .slice(-MAX_SESSION_END_SNAPSHOTS)\n .map(entry => readEndSnapshot(entry, now))\n .filter((entry): entry is SessionEndSnapshot => !!entry),\n )\n : undefined;\n delete parsed.endedSessions;\n if (endedSessions?.length) parsed.endedSessions = endedSessions;\n if (\n parsed.schemaVersion === 2 &&\n parsed.status === 'active' &&\n typeof parsed.id === 'string' &&\n parsed.id.length > 0 &&\n isTimestamp(parsed.startedAt) &&\n // 容忍轻微时钟漂移,但拒绝远期时间与超出最大生命周期的记录,避免脏 storage 永久续期。\n parsed.startedAt <= now + FUTURE_CLOCK_TOLERANCE_MS &&\n isTimestamp(parsed.lastActivityAt) &&\n parsed.lastActivityAt >= parsed.startedAt &&\n parsed.lastActivityAt <= now + FUTURE_CLOCK_TOLERANCE_MS &&\n isTimestamp(parsed.expiresAt) &&\n parsed.expiresAt >= parsed.lastActivityAt &&\n parsed.expiresAt === Math.min(parsed.lastActivityAt + 15 * 60 * 1000, parsed.startedAt + maxDurationMs)\n ) {\n const previous = readEndSnapshot(parsed.previous, now);\n delete parsed.previous;\n if (previous) parsed.previous = { ...previous, schemaVersion: 2, status: 'expired' };\n return parsed as ActiveSessionRecord;\n }\n if (\n parsed.schemaVersion === 2 &&\n parsed.status === 'expired' &&\n typeof parsed.previousId === 'string' &&\n parsed.previousId.length > 0 &&\n (parsed.reason === 'inactivity' || parsed.reason === 'maxLifetime') &&\n isTimestamp(parsed.expiredAt) &&\n parsed.expiredAt <= now + FUTURE_CLOCK_TOLERANCE_MS\n ) {\n return parsed as ExpiredSessionRecord;\n }\n } catch {\n /* JSON 损坏视为无记录 */\n }\n return null;\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\nimport { parseSessionRecord } from './session-state';\n\nimport type { SessionRecord } from './session-state';\n\n/** Shared writes are serialized by the browser, never by a localStorage pseudo-lock. */\nexport const createSessionStore = (owner: Window, key: string, maxDuration: number) => {\n let shared = false;\n let memory: null | SessionRecord = null;\n let storage: Storage | undefined;\n let stopped = false;\n const pending = new Set<AbortController>();\n try {\n storage = owner.localStorage;\n shared = !!owner.navigator?.locks;\n if (shared) storage.getItem(key);\n } catch {\n shared = false;\n }\n\n const read = () => {\n if (!shared) return memory ? parseSessionRecord(JSON.stringify(memory), Date.now(), maxDuration) : null;\n try {\n return parseSessionRecord(storage!.getItem(key), Date.now(), maxDuration);\n } catch {\n shared = false;\n return memory;\n }\n };\n\n return {\n isShared: () => shared,\n matches: (event: StorageEvent) =>\n shared && event.storageArea === storage && (event.key === key || event.key === null),\n read,\n async transact<T>(\n operation: (record: null | SessionRecord) => { record: null | SessionRecord; result: T },\n ): Promise<T | undefined> {\n if (stopped) return;\n const apply = () => {\n if (stopped) return;\n const before = read();\n const update = operation(before);\n if (shared) {\n if (update.record !== before) {\n if (update.record) storage!.setItem(key, JSON.stringify(update.record));\n else storage!.removeItem(key);\n }\n } else {\n memory = update.record;\n }\n return update.result;\n };\n if (!shared) return apply();\n const controller = new AbortController();\n pending.add(controller);\n // A frozen lock owner must not indefinitely retain the next page's pending events.\n const timeout = setTimeout(() => controller.abort(), 1000);\n try {\n return await owner.navigator.locks.request(key, { signal: controller.signal }, () => {\n clearTimeout(timeout);\n if (controller.signal.aborted || stopped) return;\n return apply();\n });\n } catch {\n if (stopped) return;\n shared = false;\n return apply();\n } finally {\n clearTimeout(timeout);\n pending.delete(controller);\n }\n },\n stop() {\n stopped = true;\n pending.forEach(controller => controller.abort());\n pending.clear();\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n/** Session shared state is independent of this document's View/Action binding. */\nimport { getEventEpochTime } from '../core/event-time';\nimport { hashString } from '../core/hash';\nimport { createRandomId } from '../core/id';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_TYPE } from '../schema/span';\nimport {\n createActiveSessionRecord,\n expandActiveSession,\n expireSessionRecord,\n findSessionEnd,\n getSessionExpireReason,\n parseSessionRecord,\n} from './session-state';\nimport { createSessionStore } from './session-store';\n\nimport type { BkOTPlugin, BkOTRuntimeContext } from '../core/plugin';\nimport type { ActiveSessionRecord, SessionExpireReason, SessionRecord } from './session-state';\n\nexport interface BkOTSessionConfig {\n /** 以 0~1 表示的 Session 采样率,默认 1。 */\n sampleRate?: number;\n /** 应用隔离 key;实际存储增加协议版本后缀,避免旧 SDK 继续续期。 */\n storageKey?: string;\n}\nconst IDLE_TIMEOUT = 15 * 60 * 1000;\nconst MAX_DURATION = 4 * 60 * 60 * 1000;\nconst ACTIVITY_THROTTLE = 1000;\nconst ACTIVITY_EVENTS = ['click', 'pointerdown', 'keydown', 'wheel', 'touchstart', 'touchmove'] as const;\n\nconst buildStorageKey = (endpoint: string, applicationName: string) => {\n let host = endpoint;\n try {\n host = new URL(endpoint).host;\n } catch {\n /* Use the configured endpoint if it is not a URL. */\n }\n return `bk_ot_session__${hashString(`${applicationName}\\0${host || 'default'}`)}`;\n};\nconst sessionAttributes = (record: ActiveSessionRecord) => ({\n [RUM_ATTRIBUTES.sessionId]: record.id,\n [RUM_ATTRIBUTES.sessionType]: 'user',\n [RUM_ATTRIBUTES.sessionHasReplay]: false,\n [RUM_ATTRIBUTES.sessionStartTime]: record.startedAt,\n [RUM_ATTRIBUTES.sessionLastActivityTime]: record.lastActivityAt,\n});\nconst emitSessionEvent = (\n context: BkOTRuntimeContext,\n phase: 'end' | 'rotate' | 'start',\n record: ActiveSessionRecord,\n at: number,\n) => {\n const attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...buildRumSpanAttributes({ spanType: RUM_SPAN_TYPE.session }),\n ...sessionAttributes(record),\n [RUM_ATTRIBUTES.sessionPhase]: phase,\n };\n context\n .startSpan(buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.session }), attributes, {\n contextTime: at,\n startTime: at,\n })\n .end(at);\n};\ninterface Transition {\n activate?: boolean;\n created?: boolean;\n ended?: ActiveSessionRecord;\n reason?: SessionExpireReason;\n record: null | SessionRecord;\n}\n\nexport const createSessionPlugin = (options: BkOTSessionConfig = {}): BkOTPlugin => {\n const teardown: Array<() => void> = [];\n return {\n name: 'session',\n async init(context) {\n if (typeof window === 'undefined' || typeof document === 'undefined') {\n context.setRuntimeAttributes(\n sessionAttributes(\n createActiveSessionRecord(createRandomId('session'), Date.now(), IDLE_TIMEOUT, MAX_DURATION),\n ),\n );\n return;\n }\n const owner = window;\n const page = document;\n const initializedAt = Date.now();\n const navigationAt = typeof performance !== 'undefined' ? performance.timeOrigin : undefined;\n // Only the initial visible visit owns its navigation entries. Later activations must\n // never fill an inactive/background interval with a newly created Session.\n let initialNavigationAt =\n page.visibilityState === 'visible' &&\n navigationAt !== undefined &&\n Number.isFinite(navigationAt) &&\n navigationAt <= initializedAt &&\n initializedAt - navigationAt < IDLE_TIMEOUT\n ? navigationAt\n : undefined;\n const key = `${options.storageKey ?? buildStorageKey(context.config.transport.endpoint, context.config.application.name)}__v2`;\n const store = createSessionStore(owner, key, MAX_DURATION);\n let active: ActiveSessionRecord | undefined;\n let initialized = false;\n let stopped = false;\n let checking = false;\n let expiryTimer: ReturnType<typeof setTimeout> | undefined;\n let activityTimer: ReturnType<typeof setTimeout> | undefined;\n let lastSubmittedAt = -Infinity;\n let pendingActivityAt: number | undefined;\n let pendingActivityId: string | undefined;\n let transactionCount = 0;\n\n const clearExpiry = () => {\n clearTimeout(expiryTimer);\n expiryTimer = undefined;\n };\n const deactivate = (\n id: string,\n reason: 'external' | SessionExpireReason,\n endedAt: number,\n endTimeKnown = true,\n ) => {\n if (active?.id !== id) return;\n active = undefined;\n clearExpiry();\n // Clear the local guard first; listeners may synchronously create final View/Action spans.\n context.notifySessionLifecycle({ id, reason, expiredAt: endedAt, endTimeKnown, type: 'expired' });\n context.setRuntimeAttributes(\n {\n [RUM_ATTRIBUTES.sessionId]: undefined,\n [RUM_ATTRIBUTES.sessionType]: undefined,\n [RUM_ATTRIBUTES.sessionHasReplay]: undefined,\n [RUM_ATTRIBUTES.sessionStartTime]: undefined,\n [RUM_ATTRIBUTES.sessionLastActivityTime]: undefined,\n },\n endedAt,\n );\n void context.flush();\n };\n const previousOf = (record: null | SessionRecord) => {\n if (record?.status === 'expired') return record;\n const previous = record?.previous;\n if (!previous) return;\n const parsed = parseSessionRecord(JSON.stringify(previous), Date.now(), MAX_DURATION);\n return parsed?.status === 'expired' ? parsed : undefined;\n };\n const schedule = (record: ActiveSessionRecord) => {\n clearExpiry();\n expiryTimer = setTimeout(\n () => {\n void reconcile();\n },\n Math.max(0, record.expiresAt - Date.now()),\n );\n };\n const activate = (record: ActiveSessionRecord, at: number, transition: Transition) => {\n const changed = active?.id !== record.id;\n active = record;\n if (changed) {\n const activatedAt = initialNavigationAt ?? at;\n initialNavigationAt = undefined;\n context.setRuntimeAttributes(sessionAttributes(record), activatedAt);\n context.notifySessionLifecycle({\n id: record.id,\n previousId: previousOf(record)?.previousId,\n reason: transition.created ? (transition.reason ?? 'init') : 'shared',\n startedAt: record.startedAt,\n activatedAt,\n type: 'renewed',\n });\n } else {\n // Updating the deadline must not create another Session history interval.\n context.setRuntimeAttributes({ [RUM_ATTRIBUTES.sessionLastActivityTime]: record.lastActivityAt }, at);\n }\n schedule(record);\n };\n const apply = (transition: Transition, at: number) => {\n if (stopped) return;\n const record = transition.record;\n if (active && (record?.status !== 'active' || record.id !== active.id)) {\n const ended = findSessionEnd(record, active.id);\n const known = ended && ended.expiredAt >= active.startedAt;\n // A cleared/evicted boundary is unknown. Locally truncate association at the last\n // known validity limit; consumers must not publish it as an exact global end.\n deactivate(\n active.id,\n known ? ended.reason : 'external',\n known ? ended.expiredAt : Math.min(at, active.expiresAt),\n !!known,\n );\n }\n if (transition.ended) emitSessionEvent(context, 'end', transition.ended, transition.ended.expiresAt);\n if (record?.status === 'active' && (transition.activate || active?.id === record.id)) {\n activate(record, at, transition);\n if (transition.created)\n emitSessionEvent(context, transition.reason ? 'rotate' : 'start', record, record.startedAt);\n }\n };\n const reconcile = async (activityAt?: number, expectedId?: string) => {\n if (stopped) return;\n const at = activityAt ?? Date.now();\n const finish = context.beginSessionTransition(Math.min(at, active?.expiresAt ?? at));\n transactionCount++;\n try {\n const result = await store.transact<Transition>(stored => {\n let record = stored;\n let ended: ActiveSessionRecord | undefined;\n let reason: SessionExpireReason | undefined;\n const now = Date.now();\n if (record?.status === 'active') {\n // A trusted input just before the deadline may be delivered a few milliseconds late.\n // It can extend an unclosed record, but can never cross the four-hour hard limit.\n if (\n activityAt !== undefined &&\n (!expectedId || expectedId === record.id) &&\n activityAt >= record.startedAt &&\n activityAt < record.expiresAt &&\n now < Math.min(activityAt + IDLE_TIMEOUT, record.startedAt + MAX_DURATION)\n ) {\n record = expandActiveSession(record, activityAt, IDLE_TIMEOUT, MAX_DURATION);\n }\n reason = getSessionExpireReason(record, now, MAX_DURATION);\n if (reason) {\n ended = record;\n record = expireSessionRecord(record, reason);\n }\n }\n // A queued trailing write cannot resurrect an expired/replaced Session.\n const canActivate =\n activityAt !== undefined &&\n (!expectedId || (record?.status === 'active' && record.id === expectedId)) &&\n !(record?.status === 'expired' && activityAt < record.expiredAt) &&\n !(record?.status === 'active' && activityAt < record.startedAt);\n if (canActivate) {\n if (record?.status === 'active')\n record = expandActiveSession(record, activityAt, IDLE_TIMEOUT, MAX_DURATION);\n else {\n const previous = record?.status === 'expired' ? record : undefined;\n // Old inputs delivered after their own idle window cannot start an already-expired record.\n if (now - activityAt >= IDLE_TIMEOUT) return { record, result: { record, ended } };\n record = {\n ...createActiveSessionRecord(createRandomId('session'), activityAt, IDLE_TIMEOUT, MAX_DURATION),\n endedSessions: previous?.endedSessions,\n previous: previous\n ? {\n schemaVersion: 2,\n status: 'expired',\n previousId: previous.previousId,\n expiredAt: previous.expiredAt,\n reason: previous.reason,\n }\n : undefined,\n };\n return { record, result: { record, ended, activate: true, created: true, reason: previous?.reason } };\n }\n }\n return { record, result: { record, ended, activate: canActivate } };\n });\n if (result && !stopped) {\n if (context.config.debug) {\n globalThis.console?.debug('[bk-ot] session', {\n trigger: activityAt === undefined ? 'check' : expectedId ? 'activity_flush' : 'activity',\n mode: store.isShared() ? 'shared' : 'memory',\n previousId: active?.id,\n sessionId: result.record?.status === 'active' ? result.record.id : undefined,\n lastActivityAt: result.record?.status === 'active' ? result.record.lastActivityAt : undefined,\n deadline: result.record?.status === 'active' ? result.record.expiresAt : result.record?.expiredAt,\n detectedAt: Date.now(),\n });\n }\n apply(result, at);\n }\n } finally {\n transactionCount--;\n finish();\n }\n };\n const check = () => {\n if (stopped || transactionCount || checking || !active) return;\n const latest = store.read();\n if (\n latest?.status === 'active' &&\n latest.id === active.id &&\n !getSessionExpireReason(latest, Date.now(), MAX_DURATION)\n ) {\n if (latest.lastActivityAt !== active.lastActivityAt) activate(latest, Date.now(), { record: latest });\n return;\n }\n checking = true;\n void reconcile().finally(() => {\n checking = false;\n });\n };\n teardown.push(context.registerSessionCheck(check));\n const onActivity = (event: Event) => {\n if (page.visibilityState !== 'visible' || !event.isTrusted || stopped) return;\n const at = getEventEpochTime(event);\n initialized = true;\n const latest = store.read();\n if (\n !active ||\n latest?.status !== 'active' ||\n latest.id !== active.id ||\n getSessionExpireReason(latest, Date.now(), MAX_DURATION) ||\n at - lastSubmittedAt >= ACTIVITY_THROTTLE\n ) {\n clearTimeout(activityTimer);\n activityTimer = undefined;\n pendingActivityAt = undefined;\n lastSubmittedAt = at;\n void reconcile(at);\n } else {\n pendingActivityAt = at;\n pendingActivityId = active.id;\n if (activityTimer === undefined)\n activityTimer = setTimeout(\n () => {\n activityTimer = undefined;\n const pending = pendingActivityAt;\n pendingActivityAt = undefined;\n if (pending !== undefined) {\n lastSubmittedAt = pending;\n void reconcile(pending, pendingActivityId);\n }\n },\n Math.max(0, lastSubmittedAt + ACTIVITY_THROTTLE - Date.now()),\n );\n }\n };\n const onVisible = () => {\n if (page.visibilityState !== 'visible') return;\n if (!initialized) {\n initialized = true;\n void reconcile(Date.now());\n } else check();\n };\n const onStorage = (event: StorageEvent) => {\n if (store.matches(event)) check();\n };\n const listenerOptions = { capture: true, passive: true };\n ACTIVITY_EVENTS.forEach(type => owner.addEventListener(type, onActivity, listenerOptions));\n page.addEventListener('visibilitychange', onVisible);\n owner.addEventListener('pageshow', onVisible);\n owner.addEventListener('focus', check);\n owner.addEventListener('resume', check);\n owner.addEventListener('storage', onStorage);\n teardown.push(() => {\n stopped = true;\n store.stop();\n clearExpiry();\n clearTimeout(activityTimer);\n ACTIVITY_EVENTS.forEach(type => owner.removeEventListener(type, onActivity, listenerOptions));\n page.removeEventListener('visibilitychange', onVisible);\n owner.removeEventListener('pageshow', onVisible);\n owner.removeEventListener('focus', check);\n owner.removeEventListener('resume', check);\n owner.removeEventListener('storage', onStorage);\n });\n if (page.visibilityState === 'visible') {\n initialized = true;\n await reconcile(Date.now());\n }\n },\n shutdown() {\n while (teardown.length) teardown.pop()?.();\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport interface DocumentVitalMetric {\n activationStart: number;\n attribution: Record<string, number | string | undefined>;\n entries: PerformanceEntry[];\n kind: 'activation' | 'document';\n name: 'FCP' | 'LCP' | 'TTFB';\n rating: 'good' | 'needs-improvement' | 'poor';\n value: number;\n}\n\ninterface DocumentVitalsOptions {\n collectInitialDocument: boolean;\n getTarget: (element: Element) => string | undefined;\n onChange?: () => void;\n onMetric: (metric: DocumentVitalMetric) => void;\n}\n\ntype NavigationEntry = PerformanceNavigationTiming & { activationStart?: number };\ntype LcpEntry = PerformanceEntry & { element?: Element | null; url?: string };\nconst thresholds = { FCP: [1800, 3000], LCP: [2500, 4000], TTFB: [800, 1800] };\n\n/**\n * Each collector owns its observers and listeners, so revoking consent or stopping an\n * SDK actually releases them. Document identity is independent of plugin lifetime;\n * BFCache callbacks carry their activation time instead of consulting a mutable View.\n */\nexport const startDocumentVitals = ({ collectInitialDocument, getTarget, onChange, onMetric }: DocumentVitalsOptions) => {\n let stopped = false;\n let initialStarted = false;\n let initialFinished = false;\n let fcpRecorded = false;\n let ttfbRecorded = false;\n let lcpFinished = false;\n let firstHiddenTime = Infinity;\n let lcpCandidate: DocumentVitalMetric | undefined;\n let lcpPublished: DocumentVitalMetric | undefined;\n let loadTask: ReturnType<typeof setTimeout> | undefined;\n const removers: Array<() => void> = [];\n const frames = new Set<number>();\n const observers: Array<{ observer: PerformanceObserver; process: (entries: PerformanceEntry[]) => void; type: string }> = [];\n const prerendering = () => Boolean((document as Document & { prerendering?: boolean }).prerendering);\n const entries = (type: string) => performance.getEntriesByType(type);\n const navigation = () => {\n const entry = entries('navigation')[0] as NavigationEntry | undefined;\n return entry && Number.isFinite(entry.responseStart) && entry.responseStart > 0 && entry.responseStart < performance.now()\n ? entry\n : undefined;\n };\n const supports = (type: string) =>\n typeof PerformanceObserver !== 'undefined' && PerformanceObserver.supportedEntryTypes?.includes(type);\n let canObserveFcp = Boolean(supports('paint'));\n let canObserveLcp = Boolean(supports('largest-contentful-paint'));\n const listen = (target: Window | Document, type: string, handler: (event: Event) => void) => {\n target.addEventListener(type, handler, true);\n removers.push(() => target.removeEventListener(type, handler, true));\n };\n const makeMetric = (\n name: DocumentVitalMetric['name'], value: number, metricEntries: PerformanceEntry[] = [],\n attribution: DocumentVitalMetric['attribution'] = {}, activationStart = 0,\n kind: DocumentVitalMetric['kind'] = 'document',\n ): DocumentVitalMetric => {\n const [good, poor] = thresholds[name];\n return { name, value, rating: value <= good ? 'good' : value <= poor ? 'needs-improvement' : 'poor',\n entries: metricEntries, attribution, activationStart, kind };\n };\n const emit = (metric: DocumentVitalMetric) => {\n if (!stopped && Number.isFinite(metric.value) && metric.value >= 0) onMetric(metric);\n };\n const publishLcp = () => {\n if (lcpCandidate && lcpCandidate !== lcpPublished) {\n lcpPublished = lcpCandidate;\n emit(lcpCandidate);\n }\n };\n const drain = () => {\n for (const { observer, process } of observers) process(observer.takeRecords());\n };\n const observe = (type: string, process: (entries: PerformanceEntry[]) => void) => {\n let observer: PerformanceObserver | undefined;\n try {\n observer = new PerformanceObserver(list => {\n if (!stopped) process(list.getEntries());\n });\n observer.observe({ type, buffered: true });\n observers.push({ observer, process, type });\n return observer;\n } catch {\n observer?.disconnect();\n return undefined;\n }\n };\n const readTtfb = () => {\n if (stopped || initialFinished || !initialStarted || ttfbRecorded || prerendering() || document.readyState !== 'complete') return;\n const nav = navigation();\n if (!nav) return;\n ttfbRecorded = true;\n const activation = nav.activationStart ?? 0;\n const value = Math.max(0, nav.responseStart - activation);\n // Clamp adjacent boundaries once so all subparts are non-negative, including\n // prerendering and browsers with coarsened/partially unavailable timestamps.\n const boundary = (time: number, floor = 0) => Math.min(value, Math.max(floor, time - activation));\n const waiting = boundary(nav.workerStart || nav.fetchStart);\n const dnsStart = boundary(nav.domainLookupStart, waiting);\n const connectionStart = boundary(nav.connectStart, dnsStart);\n const connectionEnd = boundary(nav.connectEnd, connectionStart);\n emit(makeMetric('TTFB', value, [nav], {\n waitingDuration: waiting, cacheDuration: dnsStart - waiting, dnsDuration: connectionStart - dnsStart,\n connectionDuration: connectionEnd - connectionStart, requestDuration: value - connectionEnd,\n }));\n };\n const queueTtfb = () => {\n if (loadTask === undefined && !ttfbRecorded) {\n loadTask = setTimeout(() => { loadTask = undefined; readTtfb(); }, 0);\n }\n };\n const startInitial = () => {\n if (stopped || initialStarted || initialFinished || !collectInitialDocument || prerendering()) return;\n initialStarted = true;\n const activation = (entries('navigation')[0] as NavigationEntry | undefined)?.activationStart ?? 0;\n firstHiddenTime = entries('visibility-state').find(entry => entry.name === 'hidden' && entry.startTime >= activation)?.startTime\n ?? (document.visibilityState === 'hidden' ? 0 : Infinity);\n if (canObserveFcp) {\n const paint = observe('paint', list => {\n if (initialFinished || fcpRecorded) return;\n const entry = list.find(item => item.name === 'first-contentful-paint');\n if (!entry) return;\n fcpRecorded = true;\n paint?.disconnect();\n if (entry.startTime < firstHiddenTime) emit(makeMetric('FCP', Math.max(0, entry.startTime - activation), [entry]));\n });\n canObserveFcp = Boolean(paint);\n }\n if (canObserveLcp) {\n canObserveLcp = Boolean(observe('largest-contentful-paint', list => {\n if (initialFinished || lcpFinished) return;\n for (const entry of list as LcpEntry[]) {\n if (!Number.isFinite(entry.startTime) || entry.startTime >= firstHiddenTime) continue;\n const value = Math.max(0, entry.startTime - activation);\n const attribution: DocumentVitalMetric['attribution'] = {\n timeToFirstByte: 0, resourceLoadDelay: 0, resourceLoadDuration: 0, elementRenderDelay: value,\n };\n // Capture only the caller's privacy-filtered selector while the element\n // exists. Never fall back to entry.id after it has left the document.\n if (entry.element) attribution.target = getTarget(entry.element);\n if (entry.url) attribution.url = entry.url;\n const nav = navigation();\n if (nav) {\n const resource = entry.url ? entries('resource').filter(item => item.name === entry.url && item.startTime <= entry.startTime)\n .sort((left, right) => right.startTime - left.startTime)[0] as PerformanceResourceTiming | undefined : undefined;\n const ttfb = Math.min(value, Math.max(0, nav.responseStart - activation));\n const requestStart = Math.min(value, Math.max(ttfb, resource ? (resource.requestStart || resource.startTime) - activation : 0));\n const responseEnd = Math.min(value, Math.max(requestStart, resource ? resource.responseEnd - activation : 0));\n Object.assign(attribution, { timeToFirstByte: ttfb, resourceLoadDelay: requestStart - ttfb,\n resourceLoadDuration: responseEnd - requestStart, elementRenderDelay: value - responseEnd });\n }\n lcpCandidate = makeMetric('LCP', value, [entry], attribution);\n onChange?.();\n }\n }));\n }\n if (document.readyState === 'complete') queueTtfb();\n };\n const flush = () => {\n if (stopped) return;\n drain();\n readTtfb();\n publishLcp();\n };\n const finishLcp = () => {\n if (lcpFinished) return;\n drain();\n publishLcp();\n lcpFinished = true;\n // Input ends the LCP observation window, but FCP may not have occurred yet.\n for (const item of observers) if (item.type === 'largest-contentful-paint') item.observer.disconnect();\n };\n const cancelFrames = () => {\n for (const frame of frames) cancelAnimationFrame(frame);\n frames.clear();\n };\n const afterFrame = (callback: () => void) => {\n const id = requestAnimationFrame(() => { frames.delete(id); if (!stopped) callback(); });\n frames.add(id);\n };\n const finishInitial = () => {\n flush();\n initialFinished = true;\n for (const { observer } of observers) observer.disconnect();\n if (loadTask !== undefined) clearTimeout(loadTask);\n loadTask = undefined;\n };\n listen(document, 'prerenderingchange', startInitial);\n listen(window, 'load', queueTtfb);\n listen(document, 'visibilitychange', event => {\n if (document.visibilityState !== 'hidden' || prerendering()) return;\n firstHiddenTime = Math.min(firstHiddenTime, event.timeStamp);\n finishLcp();\n });\n for (const type of ['click', 'keydown']) listen(window, type, event => {\n if (event.isTrusted && initialStarted) finishLcp();\n });\n listen(window, 'pagehide', () => { finishInitial(); cancelFrames(); });\n listen(window, 'pageshow', event => {\n if (!(event as PageTransitionEvent).persisted) return;\n finishInitial();\n cancelFrames();\n const activationStart = event.timeStamp;\n if (!Number.isFinite(activationStart) || activationStart < 0) return;\n if (navigation()) emit(makeMetric('TTFB', 0, [], {\n waitingDuration: 0, cacheDuration: 0, dnsDuration: 0, connectionDuration: 0, requestDuration: 0,\n }, activationStart, 'activation'));\n if ((canObserveFcp || canObserveLcp) && typeof requestAnimationFrame === 'function') afterFrame(() => afterFrame(() => {\n if (document.visibilityState === 'hidden') return;\n const duration = Math.max(0, performance.now() - activationStart);\n if (canObserveFcp) emit(makeMetric('FCP', duration, [], {}, activationStart, 'activation'));\n if (canObserveLcp) emit(makeMetric('LCP', duration, [], {\n timeToFirstByte: 0, resourceLoadDelay: 0, resourceLoadDuration: 0, elementRenderDelay: duration,\n }, activationStart, 'activation'));\n }));\n });\n startInitial();\n return {\n flush,\n stop() {\n if (stopped) return;\n finishInitial();\n stopped = true;\n cancelFrames();\n removers.forEach(remove => remove());\n observers.length = removers.length = 0;\n lcpCandidate = lcpPublished = undefined;\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { type Attributes } from '@opentelemetry/api';\n\nimport { captureActionTarget } from '../core/action-target';\n\nexport interface EventTimingEntry extends PerformanceEntry {\n interactionId?: number;\n processingEnd?: number;\n processingStart?: number;\n target?: EventTarget | null;\n}\n\nexport interface InpCandidate {\n duration: number;\n inputDelay: number;\n interactionId: number;\n interactionTarget?: string;\n interactionType: string;\n presentationDelay: number;\n processingDuration: number;\n rawDuration: number;\n startTime: number;\n targetSelector?: string;\n}\n\ninterface InpProcessingGroup {\n processingEnd: number;\n processingStart: number;\n referenceRenderTime: number;\n startTime: number;\n}\n\nexport type VitalTargetResolver = (\n target: EventTarget | Node | null | undefined,\n entry: EventTimingEntry,\n) => { name?: string; selector?: string } | undefined;\n\nexport interface LayoutShiftEntry extends PerformanceEntry {\n hadRecentInput?: boolean;\n sources?: Array<{ currentRect?: DOMRectReadOnly; node?: Node; previousRect?: DOMRectReadOnly }>;\n value?: number;\n}\n\nexport interface ViewVitalState {\n cls: number;\n clsAttribution?: Attributes;\n clsMaxWindowValue?: number;\n clsWindowEnd?: number;\n clsWindowStart?: number;\n clsWindowValue: number;\n clsWindowLargestShift?: { attribution: Attributes; value: number };\n endedAt?: number;\n foreignInteractionCount?: number;\n id: string;\n inpCandidates: InpCandidate[];\n inpGroups?: Map<number, InpProcessingGroup>;\n interactionCountAtEnd?: number;\n interactionCountAtStart?: number;\n interactionIdMax: number;\n interactionIdMin: number;\n metrics: Map<string, { id: string; signature: string; version: number }>;\n nativeLateCount?: number;\n /** 与 PerformanceEntry.startTime 共用相对时钟;epoch 时间仅用于事件上下文。 */\n relativeEndedAt?: number;\n relativeStartedAt: number;\n retainedUntil?: number;\n runtimeAttributes: Attributes;\n startedAt: number;\n}\nconst MAX_INP_CANDIDATES = 10;\nconst MAX_INP_VALUE = 60_000;\nconst MAX_CLS_WINDOW_DURATION = 5_000;\nconst MAX_CLS_UPDATE_GAP = 1_000;\n\nexport const getRating = (name: 'CLS' | 'INP', value: number): 'good' | 'needs-improvement' | 'poor' => {\n const [good, poor] = name === 'CLS' ? [0.1, 0.25] : [200, 500];\n return value <= good ? 'good' : value <= poor ? 'needs-improvement' : 'poor';\n};\n\n// Use the same node privacy and structural selector policy as automatic Actions.\nexport const getTarget = (target: EventTarget | Node | null | undefined) => {\n if (typeof Element === 'undefined' || !(target instanceof Element)) return undefined;\n try {\n return captureActionTarget(target, new Event('vital'), { nameCollection: 'explicit' });\n } catch {\n return undefined;\n }\n};\n\nexport const countInteraction = (view: ViewVitalState, entry: EventTimingEntry) => {\n if (!Number.isFinite(entry.interactionId) || !entry.interactionId || entry.interactionId < 0) return;\n view.interactionIdMin = Math.min(view.interactionIdMin, entry.interactionId);\n view.interactionIdMax = Math.max(view.interactionIdMax, entry.interactionId);\n};\n\nexport const getInteractionCount = () => {\n if (typeof performance === 'undefined') return undefined;\n const value = (performance as Performance & { interactionCount?: number }).interactionCount;\n return typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : undefined;\n};\n\nconst rectArea = (rect: DOMRectReadOnly | undefined): number =>\n rect && [rect.x, rect.y, rect.width, rect.height].every(Number.isFinite) && rect.width >= 0 && rect.height >= 0\n ? rect.width * rect.height\n : 0;\n\nconst impactedArea = (source: NonNullable<LayoutShiftEntry['sources']>[number]): number => {\n const previousArea = rectArea(source.previousRect);\n const currentArea = rectArea(source.currentRect);\n if (!previousArea || !currentArea) return previousArea + currentArea;\n const previous = source.previousRect!;\n const current = source.currentRect!;\n const overlapWidth = Math.max(0, Math.min(previous.x + previous.width, current.x + current.width) - Math.max(previous.x, current.x));\n const overlapHeight = Math.max(0, Math.min(previous.y + previous.height, current.y + current.height) - Math.max(previous.y, current.y));\n // 位移中真正受影响的是两个矩形的并集,不能将包围盒中间的空白算作影响面积。\n return previousArea + currentArea - overlapWidth * overlapHeight;\n};\n\nconst getClsAttribution = (view: ViewVitalState, entry: LayoutShiftEntry): Attributes => {\n const source = entry.sources?.reduce((largest, item) => impactedArea(item) > impactedArea(largest) ? item : largest, entry.sources[0]);\n const selector = getTarget(source?.node)?.selector;\n const dpr = typeof window === 'undefined' ? undefined : window.devicePixelRatio;\n const attribution: Attributes = {\n 'vital.cls.time': Math.max(0, entry.startTime - view.relativeStartedAt),\n ...(selector ? { 'vital.cls.target_selector': selector } : {}),\n ...(typeof dpr === 'number' && Number.isFinite(dpr) && dpr > 0 ? { 'vital.cls.device_pixel_ratio': dpr } : {}),\n };\n for (const [name, rect] of [\n ['previous_rect', source?.previousRect],\n ['current_rect', source?.currentRect],\n ] as const) {\n if (!rect) continue;\n for (const key of ['x', 'y', 'width', 'height'] as const) {\n if (Number.isFinite(rect[key])) attribution[`vital.cls.${name}.${key}`] = rect[key];\n }\n }\n return attribution;\n};\n\nexport const updateViewCls = (view: ViewVitalState, entry: LayoutShiftEntry) => {\n const value = entry.value ?? 0;\n if (entry.hadRecentInput || !Number.isFinite(value) || value < 0 || !Number.isFinite(entry.startTime) || entry.startTime < 0) return;\n const shouldCreateWindow =\n view.clsWindowStart === undefined ||\n entry.startTime - (view.clsWindowEnd ?? entry.startTime) >= MAX_CLS_UPDATE_GAP ||\n entry.startTime - view.clsWindowStart >= MAX_CLS_WINDOW_DURATION;\n if (shouldCreateWindow) {\n view.clsWindowStart = entry.startTime;\n view.clsWindowValue = value;\n view.clsWindowLargestShift = undefined;\n } else {\n view.clsWindowValue += value;\n }\n view.clsWindowEnd = entry.startTime;\n if (!view.clsWindowLargestShift || value > view.clsWindowLargestShift.value) {\n // 立即快照经过隐私策略的归因,不保留 DOM 节点;较小 shift 不能覆盖主要位移来源。\n view.clsWindowLargestShift = { attribution: getClsAttribution(view, entry), value };\n }\n if (view.clsWindowValue > (view.clsMaxWindowValue ?? 0)) {\n view.clsMaxWindowValue = view.clsWindowValue;\n view.cls = Math.round(view.clsWindowValue * 10_000) / 10_000;\n view.clsAttribution = view.clsWindowLargestShift.attribution;\n }\n};\n\nexport const updateViewInp = (\n view: ViewVitalState,\n entries: EventTimingEntry | readonly EventTimingEntry[],\n resolveTarget: VitalTargetResolver = getTarget,\n) => {\n const groups = view.inpGroups ??= new Map();\n const batch: readonly EventTimingEntry[] = Array.isArray(entries) ? entries : [entries as EventTimingEntry];\n for (const entry of batch) {\n const processingStart = entry.processingStart ?? entry.startTime;\n const processingEnd = entry.processingEnd ?? processingStart;\n if (!entry.interactionId || entry.interactionId < 0 || !Number.isFinite(entry.interactionId) ||\n ![entry.duration, entry.startTime, processingStart, processingEnd].every(Number.isFinite) || entry.duration < 0 || entry.startTime < 0) continue;\n countInteraction(view, entry);\n const renderTime = entry.startTime + entry.duration;\n let group = groups.get(entry.interactionId);\n if (!group) group = Array.from(groups.values()).find(item => Math.abs(renderTime - item.referenceRenderTime) <= 8);\n if (group) {\n group.startTime = Math.min(group.startTime, entry.startTime);\n group.processingStart = Math.min(group.processingStart, processingStart);\n group.processingEnd = Math.max(group.processingEnd, processingEnd);\n } else {\n group = { startTime: entry.startTime, processingStart, processingEnd, referenceRenderTime: renderTime };\n }\n // referenceRenderTime 固定在建组时,防止连续相邻事件将 ±8ms 窗口不断拖长。\n groups.set(entry.interactionId, group);\n const index = view.inpCandidates.findIndex(item => item.interactionId === entry.interactionId);\n if (index >= 0 && entry.duration <= view.inpCandidates[index].rawDuration) continue;\n let target: ReturnType<VitalTargetResolver>;\n try { target = resolveTarget(entry.target, entry); } catch { /* 归因失败仅省略目标,不回退到未经过隐私策略的 DOM。 */ }\n const candidate: InpCandidate = {\n startTime: entry.startTime,\n duration: Math.min(entry.duration, MAX_INP_VALUE),\n rawDuration: entry.duration,\n inputDelay: 0,\n interactionId: entry.interactionId,\n interactionTarget: target?.name,\n targetSelector: target?.selector,\n interactionType: entry.name,\n presentationDelay: 0,\n processingDuration: 0,\n };\n if (index >= 0) view.inpCandidates[index] = candidate;\n else view.inpCandidates.push(candidate);\n view.inpCandidates.sort((left, right) => right.rawDuration - left.rawDuration).splice(MAX_INP_CANDIDATES);\n }\n for (const candidate of view.inpCandidates) {\n const group = groups.get(candidate.interactionId)!;\n const nextPaint = group.startTime + candidate.duration;\n const processingStart = Math.max(group.startTime, Math.min(group.processingStart, nextPaint));\n const processingEnd = Math.max(processingStart, Math.min(group.processingEnd, nextPaint));\n candidate.startTime = group.startTime;\n // 上限和三段归因共用一个终点,包括模态对话框使 processingEnd 晚于绘制的情况。\n candidate.inputDelay = processingStart - group.startTime;\n candidate.processingDuration = processingEnd - processingStart;\n candidate.presentationDelay = nextPaint - processingEnd;\n }\n // 同一 observer 批次内,短事件也可影响长事件的处理区间;只在批末清理未保留的交互。\n const tracked = new Set(view.inpCandidates.map(candidate => candidate.interactionId));\n for (const id of groups.keys()) if (!tracked.has(id)) groups.delete(id);\n};\n\nexport const getViewInteractionCount = (view: ViewVitalState) => {\n const nativeCount = view.endedAt === undefined ? getInteractionCount() : view.interactionCountAtEnd;\n const observedCount =\n view.interactionIdMin === Infinity ? 0 : (view.interactionIdMax - view.interactionIdMin) / 7 + 1;\n // Freeze native totals at the View boundary; late entries can reveal an interaction\n // whose rendering finished after that boundary without counting the next View.\n return nativeCount !== undefined && view.interactionCountAtStart !== undefined\n ? Math.max(observedCount, nativeCount - view.interactionCountAtStart - (view.foreignInteractionCount ?? 0))\n : observedCount;\n};\n\nexport const getViewInp = (view: ViewVitalState): InpCandidate | undefined => {\n if (!view.inpCandidates.length) return undefined;\n return view.inpCandidates[Math.min(view.inpCandidates.length - 1, Math.floor(getViewInteractionCount(view) / 50))];\n};\n\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n/**\n * PerformanceEntry 与 View 使用同一相对时钟;epoch 仅用于 Session 身份和 OTLP 时间。\n * 文档 / BFCache 指标保留独立生命周期,View 指标按稳定 id + version 修订。\n */\nimport { type Attributes } from '@opentelemetry/api';\n\nimport { createRandomId } from '../core/id';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { buildRumSpanAttributes, buildRumSpanName, getVitalOutcome, RUM_SPAN_TYPE } from '../schema/span';\nimport { startDocumentVitals } from './document-vitals';\nimport { countInteraction, getInteractionCount, getRating, getTarget, getViewInp, updateViewCls, updateViewInp } from './web-vitals-metrics';\n\nimport type { BkOTPlugin } from '../core/plugin';\nimport type { BkOTViewContext } from '../core/runtime-context';\nimport type { DocumentVitalMetric } from './document-vitals';\nimport type { EventTimingEntry, ViewVitalState } from './web-vitals-metrics';\n\nexport { getViewInp, updateViewCls, updateViewInp } from './web-vitals-metrics';\nexport const isSameViewId = (current: string | undefined, next: string | undefined) => Boolean(next) && current === next;\n\ninterface MetricScope {\n kind: 'activation' | 'document' | 'view';\n metrics: ViewVitalState['metrics'];\n runtimeAttributes: Attributes;\n startedAt: number;\n view?: ViewVitalState;\n}\ninterface VitalLike {\n name: string;\n value: number;\n rating: 'good' | 'needs-improvement' | 'poor';\n attribution: Record<string, unknown>;\n}\nconst ENDED_VIEW_RETENTION = 5 * 60_000;\nconst MAX_RETAINED_VIEWS = 100;\nconst CHECKPOINT_INTERVAL = 3_000;\n\n// 把 attribution 中价值最高的字段抽出来写入 Span。\nconst pickAttribution = (metric: VitalLike, redactUrl: (url: string) => string): Attributes => {\n const attr = metric.attribution ?? {};\n const result: Attributes = {};\n const getAttrValue = (key: string) => (attr as Record<string, unknown>)[key];\n\n const setIfDefined = (key: string, value: unknown, transform?: (value: string) => string) => {\n if (value === undefined || value === null || value === '') return;\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n result[key] = typeof value === 'string' && transform ? transform(value) : value;\n }\n };\n\n switch (metric.name) {\n case 'LCP':\n setIfDefined('vital.lcp.url', getAttrValue('url'), redactUrl);\n setIfDefined('vital.lcp.target', getAttrValue('target'));\n setIfDefined('vital.lcp.element_render_delay', getAttrValue('elementRenderDelay'));\n setIfDefined('vital.lcp.resource_load_delay', getAttrValue('resourceLoadDelay'));\n setIfDefined('vital.lcp.time_to_first_byte', getAttrValue('timeToFirstByte'));\n setIfDefined('vital.lcp.resource_load_duration', getAttrValue('resourceLoadDuration'));\n break;\n case 'CLS':\n setIfDefined('vital.cls.load_state', getAttrValue('loadState'));\n break;\n case 'INP':\n setIfDefined('vital.inp.interaction_target', getAttrValue('interactionTarget'));\n setIfDefined('vital.inp.target_selector', getAttrValue('targetSelector'));\n setIfDefined('vital.inp.time', getAttrValue('time'));\n setIfDefined('vital.inp.interaction_type', getAttrValue('interactionType'));\n setIfDefined('vital.inp.input_delay', getAttrValue('inputDelay'));\n setIfDefined('vital.inp.processing_duration', getAttrValue('processingDuration'));\n setIfDefined('vital.inp.presentation_delay', getAttrValue('presentationDelay'));\n break;\n case 'TTFB':\n setIfDefined('vital.ttfb.waiting_duration', getAttrValue('waitingDuration'));\n setIfDefined('vital.ttfb.cache_duration', getAttrValue('cacheDuration'));\n setIfDefined('vital.ttfb.dns_duration', getAttrValue('dnsDuration'));\n setIfDefined('vital.ttfb.connection_duration', getAttrValue('connectionDuration'));\n setIfDefined('vital.ttfb.request_duration', getAttrValue('requestDuration'));\n break;\n default:\n break;\n }\n return result;\n};\n\nexport const createWebVitalsPlugin = (): BkOTPlugin => {\n let cleanup: (() => void) | undefined;\n let checkpoint = () => {};\n let disposed = false;\n return {\n name: 'web-vitals',\n flush: () => checkpoint(),\n init(context) {\n if (disposed || typeof window === 'undefined') return;\n const collectDocument = context.collectionStart?.isInitialDocument !== false;\n const views: ViewVitalState[] = [];\n const activationScopes = new Map<number, MetricScope>();\n const pendingDuration = new Map<string, DocumentVitalMetric>();\n let documentScope: MetricScope | undefined;\n let currentView: ViewVitalState | undefined;\n let timer: ReturnType<typeof setTimeout> | undefined;\n let documentCollector: ReturnType<typeof startDocumentVitals> | undefined;\n const observers: Array<{ observer: PerformanceObserver; process: (entries: PerformanceEntry[]) => void }> = [];\n const supports = (type: string) =>\n typeof PerformanceObserver !== 'undefined' && PerformanceObserver.supportedEntryTypes?.includes(type);\n const supportsCls = supports('layout-shift');\n let refreshing = false;\n const refreshCurrent = () => {\n if (!currentView || refreshing) return;\n refreshing = true;\n try {\n const attributes = context.getRuntimeAttributes();\n // Reading attributes can synchronously expire a Session and close the View.\n if (currentView && attributes[RUM_ATTRIBUTES.viewId] === currentView.id &&\n attributes[RUM_ATTRIBUTES.sessionId] === currentView.runtimeAttributes[RUM_ATTRIBUTES.sessionId])\n currentView.runtimeAttributes = attributes;\n } finally { refreshing = false; }\n };\n const recordSpan = (metric: VitalLike, scope: MetricScope, extra: Attributes = {}) => {\n const runtimeAttributes = scope.view?.runtimeAttributes ?? scope.runtimeAttributes;\n if (disposed || !Number.isFinite(metric.value) || metric.value < 0 || !runtimeAttributes[RUM_ATTRIBUTES.viewId]) return;\n const attribution = { ...pickAttribution(metric, context.config.hooks.redactUrl), ...extra };\n const signature = JSON.stringify([metric.value, attribution, runtimeAttributes]);\n const previous = scope.metrics.get(metric.name);\n if (previous?.signature === signature) return;\n const snapshot = { id: previous?.id ?? createRandomId('vital'), version: (previous?.version ?? 0) + 1, signature };\n scope.metrics.set(metric.name, snapshot);\n const attributes = {\n ...context.config.hooks.getPageAttributes(),\n ...runtimeAttributes,\n ...buildRumSpanAttributes({ outcome: getVitalOutcome(metric.rating), spanType: RUM_SPAN_TYPE.vital }),\n [RUM_ATTRIBUTES.vitalMetric]: metric.name.toLowerCase(),\n [RUM_ATTRIBUTES.vitalValue]: metric.value,\n [RUM_ATTRIBUTES.vitalId]: snapshot.id,\n [RUM_ATTRIBUTES.vitalVersion]: snapshot.version,\n [RUM_ATTRIBUTES.vitalScope]: scope.kind,\n ...attribution,\n };\n const observedAt = Date.now();\n const span = context.startSpan(buildRumSpanName({ attributes, spanType: RUM_SPAN_TYPE.vital }), attributes, {\n contextAttributes: runtimeAttributes,\n contextTime: scope.startedAt,\n startTime: observedAt,\n });\n span.end(observedAt);\n };\n const publish = (view: ViewVitalState) => {\n const scope: MetricScope = { ...view, kind: 'view' };\n if (supportsCls)\n recordSpan({ name: 'CLS', rating: getRating('CLS', view.cls), value: view.cls, attribution: {} }, scope, view.clsAttribution);\n const inp = getViewInp(view);\n if (inp)\n recordSpan({\n name: 'INP', rating: getRating('INP', inp.duration), value: inp.duration,\n attribution: {\n inputDelay: inp.inputDelay, interactionTarget: inp.interactionTarget, interactionType: inp.interactionType,\n presentationDelay: inp.presentationDelay, processingDuration: inp.processingDuration,\n targetSelector: inp.targetSelector, time: Math.max(0, inp.startTime - view.relativeStartedAt),\n },\n }, scope);\n else if (supports('event') && view.interactionIdMin !== Infinity)\n recordSpan({ name: 'INP', rating: 'good', value: 0, attribution: {} }, scope);\n };\n const schedule = () => {\n if (disposed || timer !== undefined) return;\n timer = setTimeout(() => { timer = undefined; checkpoint(); }, CHECKPOINT_INTERVAL);\n };\n const prune = () => {\n const now = Date.now();\n for (let index = views.length - 1; index >= 0; index--)\n if (views[index].retainedUntil !== undefined && views[index].retainedUntil! <= now) views.splice(index, 1);\n if (views.length > MAX_RETAINED_VIEWS) views.splice(0, views.length - MAX_RETAINED_VIEWS);\n for (const [key, scope] of activationScopes)\n if (scope.view?.retainedUntil !== undefined && scope.view.retainedUntil <= now) activationScopes.delete(key);\n while (activationScopes.size > MAX_RETAINED_VIEWS) activationScopes.delete(activationScopes.keys().next().value!);\n };\n const findView = (entry: PerformanceEntry) => [...views].reverse().find(view =>\n view.relativeStartedAt <= entry.startTime && (view.relativeEndedAt === undefined || entry.startTime < view.relativeEndedAt));\n\n // Capture only privacy-processed strings before application handlers can remove the\n // target. No DOM nodes are retained, and ambiguous event timestamps are not guessed.\n const targets: Array<{ name: string; time: number; target: ReturnType<typeof getTarget> }> = [];\n const targetEvents = ['pointerdown', 'pointerup', 'mousedown', 'mouseup', 'click', 'keydown', 'keyup'];\n const captureTarget = (event: Event) => {\n if (!event.isTrusted) return;\n const node = event.composedPath?.()[0] ?? event.target;\n targets.push({ name: event.type, time: event.timeStamp, target: getTarget(node) });\n const cutoff = performance.now() - 10_000;\n while (targets.length > 100 || (targets[0] && targets[0].time < cutoff)) targets.shift();\n };\n targetEvents.forEach(type => window.addEventListener(type, captureTarget, true));\n const resolveTarget = (target: EventTarget | null | undefined, entry: EventTimingEntry) => {\n const matches = targets.filter(item => item.name === entry.name && Math.abs(item.time - entry.startTime) <= 8 && performance.now() - item.time <= 10_000);\n const exact = matches.filter(item => item.time === entry.startTime);\n const matched = exact.length === 1 ? exact[0] : matches.length === 1 ? matches[0] : undefined;\n // A captured undefined is an intentional privacy decision, not a fallback signal.\n return matched ? matched.target : getTarget(target);\n };\n const pendingEntries: Array<{ entry: PerformanceEntry; type: string }> = [];\n const processEntries = (entries: PerformanceEntry[], type: string) => {\n if (disposed || entries.length === 0) return;\n refreshCurrent();\n prune();\n const grouped = new Map<ViewVitalState, PerformanceEntry[]>();\n for (const entry of entries) {\n const view = findView(entry);\n if (!view) {\n // Manual tracking can establish the first document View after observers run.\n if (collectDocument && !documentScope && views.length === 0) {\n pendingEntries.push({ entry, type });\n if (pendingEntries.length > 200) pendingEntries.shift();\n }\n continue;\n }\n const batch = grouped.get(view) ?? [];\n batch.push(entry);\n grouped.set(view, batch);\n }\n const changed = new Set<ViewVitalState>();\n for (const [view, batch] of grouped) {\n if (type === 'inp') updateViewInp(view, batch as EventTimingEntry[], resolveTarget);\n else for (const entry of batch) (type === 'count' ? countInteraction : updateViewCls)(view, entry);\n if (view.endedAt === undefined) { schedule(); continue; }\n changed.add(view);\n if (view.interactionCountAtEnd === undefined || view.interactionCountAtStart === undefined || view.interactionIdMin === Infinity) continue;\n const observed = (view.interactionIdMax - view.interactionIdMin) / 7 + 1;\n const frozen = view.interactionCountAtEnd - view.interactionCountAtStart - (view.foreignInteractionCount ?? 0);\n const late = Math.max(0, observed - frozen);\n const newlyCounted = Math.max(0, late - (view.nativeLateCount ?? 0));\n view.nativeLateCount = Math.max(view.nativeLateCount ?? 0, late);\n if (newlyCounted) for (const later of views) {\n // Only a unique, unambiguous completion View gets a native-count correction.\n const completions = batch.map(entry => entry.startTime + entry.duration);\n if (later.relativeStartedAt >= view.relativeEndedAt! && later.relativeStartedAt < Math.min(...completions) - 4 &&\n (later.relativeEndedAt === undefined || Math.max(...completions) + 4 < later.relativeEndedAt)) {\n later.foreignInteractionCount = (later.foreignInteractionCount ?? 0) + newlyCounted;\n if (later.endedAt !== undefined) changed.add(later);\n }\n }\n }\n for (const view of changed) publish(view);\n };\n const observe = (type: string, update: string, durationThreshold?: number) => {\n if (!supports(type)) return;\n const process = (entries: PerformanceEntry[]) => processEntries(entries, update);\n const observer = new PerformanceObserver(list => process(list.getEntries()));\n observers.push({ observer, process });\n observer.observe({ type, buffered: true, ...(durationThreshold === undefined ? {} : { durationThreshold }) });\n };\n const drain = () => observers.forEach(({ observer, process }) => process(observer.takeRecords?.() ?? []));\n const recordDurationVital = (metric: DocumentVitalMetric) => {\n if (disposed) return;\n refreshCurrent();\n const scope = metric.kind === 'document' ? documentScope : activationScopes.get(metric.activationStart);\n if (scope) recordSpan(metric, scope);\n else {\n // Three scalar metrics per activation; do not retain entry DOM references.\n pendingDuration.set(`${metric.kind}:${metric.activationStart}:${metric.name}`, { ...metric, entries: [] });\n while (pendingDuration.size > 30) pendingDuration.delete(pendingDuration.keys().next().value!);\n }\n };\n const makeView = (view: BkOTViewContext, runtimeAttributes: Attributes): ViewVitalState => ({\n id: view.id!, startedAt: view.startedAt ?? Date.now(),\n relativeStartedAt: view.relativeStartedAt ?? (view.loadingType === 'initial_load' ? 0 : performance.now()),\n endedAt: view.endedAt, relativeEndedAt: view.relativeEndedAt,\n retainedUntil: view.endedAt === undefined ? undefined : Date.now() + ENDED_VIEW_RETENTION,\n runtimeAttributes, cls: 0, clsWindowValue: 0, inpCandidates: [], metrics: new Map(),\n interactionCountAtStart: view.interactionCountAtStart ?? (view.loadingType === 'initial_load' ? 0 : undefined),\n interactionCountAtEnd: view.interactionCountAtEnd,\n interactionIdMin: Infinity, interactionIdMax: 0,\n });\n const bindScope = (view: BkOTViewContext, state: ViewVitalState) => {\n if (view.loadingType === 'initial_load' && !documentScope && collectDocument)\n documentScope = { ...state, metrics: new Map(), kind: 'document', view: state };\n if (view.loadingType === 'bf_cache')\n activationScopes.set(state.relativeStartedAt, { ...state, metrics: new Map(), kind: 'activation', view: state });\n for (const [key, metric] of pendingDuration) {\n const scope = metric.kind === 'document' ? documentScope : activationScopes.get(metric.activationStart);\n if (scope) { pendingDuration.delete(key); recordSpan(metric, scope); }\n }\n };\n // Restore bounded lifecycle snapshots before requesting buffered performance entries.\n for (const historical of context.getViewHistory?.() ?? []) {\n if (!historical.view.id) continue;\n if (!collectDocument && (historical.view.relativeStartedAt ?? -Infinity) < context.collectionStart!.relativeStartedAt) continue;\n const state = makeView(historical.view, historical.runtimeAttributes);\n views.push(state);\n if (state.endedAt === undefined) currentView = state;\n bindScope(historical.view, state);\n }\n const unsubscribeView = context.onViewChange(view => {\n if (disposed) return;\n if (currentView && isSameViewId(currentView.id, view.id)) { refreshCurrent(); return; }\n drain();\n if (currentView) {\n const previous = currentView;\n previous.endedAt = Math.max(previous.startedAt, view.endedAt ?? view.startedAt ?? Date.now());\n previous.relativeEndedAt = Math.max(previous.relativeStartedAt, view.relativeEndedAt ?? view.relativeStartedAt ?? performance.now());\n previous.retainedUntil = Date.now() + ENDED_VIEW_RETENTION;\n const final = context.getViewHistory?.().find(item => item.view.id === previous.id);\n previous.interactionCountAtEnd = final?.view.interactionCountAtEnd ?? view.interactionCountAtEnd ?? view.interactionCountAtStart ?? getInteractionCount();\n if (final) previous.runtimeAttributes = final.runtimeAttributes;\n publish(previous);\n }\n currentView = view.id ? makeView(view, context.getRuntimeAttributes()) : undefined;\n if (currentView) {\n currentView.interactionCountAtStart ??= getInteractionCount();\n views.push(currentView);\n bindScope(view, currentView);\n const pending = pendingEntries.splice(0);\n for (const type of ['count', 'inp', 'cls']) processEntries(pending.filter(item => item.type === type).map(item => item.entry), type);\n }\n prune();\n });\n checkpoint = () => {\n if (disposed) return;\n if (timer !== undefined) clearTimeout(timer);\n timer = undefined;\n drain();\n if (timer !== undefined) clearTimeout(timer);\n timer = undefined;\n refreshCurrent();\n documentCollector?.flush();\n // Entries drained by either collector are included in this checkpoint already.\n if (timer !== undefined) clearTimeout(timer);\n timer = undefined;\n prune();\n for (const view of views) publish(view);\n };\n const onHidden = () => { if (document.visibilityState === 'hidden') checkpoint(); };\n document.addEventListener?.('visibilitychange', onHidden);\n document.addEventListener?.('freeze', checkpoint);\n const stopFreeze = checkpoint;\n // Install cleanup before collectors: an unsupported observer must not leave listeners.\n cleanup = () => {\n checkpoint();\n documentCollector?.stop();\n unsubscribeView();\n observers.forEach(({ observer }) => observer.disconnect());\n document.removeEventListener?.('visibilitychange', onHidden);\n document.removeEventListener?.('freeze', stopFreeze);\n targetEvents.forEach(type => window.removeEventListener(type, captureTarget, true));\n if (timer !== undefined) clearTimeout(timer);\n views.length = targets.length = pendingEntries.length = 0;\n activationScopes.clear(); pendingDuration.clear();\n currentView = undefined; documentScope = undefined;\n };\n observe('event', 'count', 0);\n observe('event', 'inp', 40);\n observe('first-input', 'inp');\n observe('layout-shift', 'cls');\n documentCollector = startDocumentVitals({ collectInitialDocument: collectDocument, getTarget: target => getTarget(target)?.selector, onMetric: recordDurationVital, onChange: schedule });\n },\n shutdown() {\n if (disposed) return;\n cleanup?.();\n disposed = true;\n cleanup = undefined;\n checkpoint = () => {};\n },\n };\n};\n\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\nimport { SpanKind } from '@opentelemetry/api';\n\nimport { createRandomId } from '../core/id';\nimport { shouldIgnoreUrl } from '../core/url';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_OUTCOME, RUM_SPAN_TYPE } from '../schema/span';\n\nimport type { BkOTPlugin, BkOTRuntimeContext } from '../core/plugin';\nimport type { Attributes } from '@opentelemetry/api';\n\nconst buildWebSocketAttributes = (url: string, redactUrl: (url: string) => string): Attributes => {\n const attributes: Attributes = {\n 'network.protocol.name': 'websocket',\n 'url.full': redactUrl(url),\n };\n try {\n const parsed = new URL(url, typeof location === 'undefined' ? 'http://localhost' : location.href);\n attributes['server.address'] = parsed.hostname;\n if (parsed.port) attributes['server.port'] = Number(parsed.port);\n attributes['url.scheme'] = parsed.protocol.replace(':', '');\n } catch {\n // 非法 URL 仍保留脱敏后的原始字符串。\n }\n return attributes;\n};\n\nconst instrumentSocket = (socket: WebSocket, context: BkOTRuntimeContext, url: string, isDisposed: () => boolean) => {\n const connectionId = createRandomId('websocket');\n const baseAttributes = buildWebSocketAttributes(url, context.config.hooks.redactUrl);\n let opened = false;\n\n const emit = (phase: 'close' | 'connect' | 'error' | 'open', timestamp: number, attributes: Attributes = {}) => {\n if (isDisposed() || !context.isSampled()) return;\n const isError = phase === 'error';\n const spanAttributes = {\n ...baseAttributes,\n ...buildRumSpanAttributes({\n outcome: isError ? RUM_SPAN_OUTCOME.error : RUM_SPAN_OUTCOME.success,\n spanType: RUM_SPAN_TYPE.websocket,\n }),\n [RUM_ATTRIBUTES.websocketPhase]: phase,\n 'websocket.connection.id': connectionId,\n ...attributes,\n };\n const span = context.startSpan(\n buildRumSpanName({ attributes: spanAttributes, spanType: RUM_SPAN_TYPE.websocket }),\n spanAttributes,\n { kind: SpanKind.CLIENT, startTime: timestamp },\n );\n span.end(timestamp);\n };\n\n emit('connect', Date.now());\n socket.addEventListener('open', () => {\n opened = true;\n emit('open', Date.now());\n });\n socket.addEventListener('error', () => {\n emit('error', Date.now(), { 'websocket.error.phase': opened ? 'runtime' : 'connect' });\n });\n socket.addEventListener('close', event => {\n emit('close', Date.now(), {\n 'websocket.close.code': event.code,\n 'websocket.close.reason': event.reason,\n 'websocket.close.was_clean': event.wasClean,\n });\n });\n};\n\nexport const createWebSocketPlugin = (): BkOTPlugin => {\n let originalWebSocket: typeof WebSocket | undefined;\n let patchedProxy: typeof WebSocket | undefined;\n let disposed = false;\n\n return {\n name: 'websocket',\n init(context) {\n if (typeof window === 'undefined' || typeof window.WebSocket === 'undefined') return;\n const nativeWebSocket = window.WebSocket;\n originalWebSocket = nativeWebSocket;\n patchedProxy = new Proxy(nativeWebSocket, {\n construct(target, args, newTarget) {\n const socket = Reflect.construct(target, args, newTarget) as WebSocket;\n if (disposed || !context.isSampled()) return socket;\n const url = args[0] == null ? '' : String(args[0]);\n if (url && !shouldIgnoreUrl(context.config, url)) {\n instrumentSocket(socket, context, url, () => disposed);\n }\n return socket;\n },\n });\n window.WebSocket = patchedProxy;\n },\n shutdown() {\n disposed = true;\n if (typeof window !== 'undefined' && originalWebSocket && window.WebSocket === patchedProxy) {\n window.WebSocket = originalWebSocket;\n }\n patchedProxy = undefined;\n originalWebSocket = undefined;\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n */\n\nexport type BkOTActivityEvent =\n | { endTime: number; startTime: number; type: 'long_task'; url?: never }\n | { endTime: number; startTime: number; type: 'resource'; url?: string }\n | { id: string; time: number; type: 'request_end' }\n | { id: string; time: number; type: 'request_start'; url?: string }\n | { actionIds: string[]; time: number; type: 'error' }\n | { time: number; type: 'dom_mutation' | 'window_open' };\n\nexport class RumActivityObserver {\n private readonly listeners = new Set<(event: BkOTActivityEvent) => void>();\n\n public notify = (event: BkOTActivityEvent) => {\n this.listeners.forEach(listener => listener(event));\n };\n\n public subscribe = (listener: (event: BkOTActivityEvent) => void) => {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n };\n}\n","{\n \"name\": \"@blueking/open-telemetry\",\n \"version\": \"0.0.35-beta.1\",\n \"description\": \"OpenTelemetry browser SDK for BK RUM\",\n \"author\": \"TencentCloud Real User Monitoring\",\n \"main\": \"dist/index.js\",\n \"unpkg\": \"dist/bk-rum.global.js\",\n \"jsdelivr\": \"dist/bk-rum.global.js\",\n \"license\": \"MIT\",\n \"files\": [\n \"dist\",\n \"skills\"\n ],\n \"scripts\": {\n \"prepublishOnly\": \"pnpm build && pnpm dts && pnpm skill:refs\",\n \"skill:refs\": \"node scripts/gen-skill-references.mjs\",\n \"test:skill-refs\": \"node --test tests/gen-skill-references.test.mjs\",\n \"build\": \"vite build && vite build --mode cdn && pnpm dts\",\n \"build:cdn\": \"vite build --mode cdn\",\n \"build:esm\": \"vite build\",\n \"docs:build\": \"vitepress build wikis\",\n \"docs:dev\": \"vitepress dev wikis\",\n \"docs:preview\": \"vitepress preview wikis\",\n \"dev\": \"vite dev\",\n \"dts\": \"vue-tsc --project tsconfig.dts.json\",\n \"test:rum-context\": \"node --experimental-strip-types --test tests/action-plugin.test.mjs tests/action-lifecycle.test.mjs tests/action-transition.test.mjs tests/consent.test.mjs tests/event-time.test.mjs tests/experience-plugins.test.mjs tests/init-cancellation.test.mjs tests/late-performance.test.mjs tests/request-model.test.mjs tests/request-lifecycle-regressions.test.mjs tests/request-export-lifecycle.test.mjs tests/resource-context.test.mjs tests/resource-lifecycle.test.mjs tests/request-timing.test.mjs tests/request-capacity.test.mjs tests/resource-fields.test.mjs tests/resource-url.test.mjs tests/runtime-context.test.mjs tests/sampling.test.mjs tests/session-state.test.ts tests/session-plugin.test.mjs tests/session-page-view.test.mjs tests/session-processors.test.mjs tests/session-sdk.test.mjs tests/session-view-metadata.test.mjs tests/trace-context.test.mjs tests/web-vitals.test.mjs tests/web-vitals-metrics.test.mjs tests/web-vitals-context.test.mjs tests/document-vitals.test.mjs tests/view-routing.test.mjs tests/view-lifecycle.test.mjs tests/view-vitals-lifecycle.test.mjs tests/blank-screen-detection.test.mjs tests/blank-screen-lifecycle.test.mjs tests/vue-router-views.test.mjs tests/manual-view-sdk.test.mjs\",\n \"test:action-browser\": \"node node_modules/vite/bin/vite.js build --mode cdn && node --test tests/action-target.test.mjs && node scripts/verify-action-browser.mjs\",\n \"test:request-browser\": \"node node_modules/vite/bin/vite.js build --mode cdn && node scripts/verify-request-browser.mjs\",\n \"test:resource-browser\": \"node node_modules/vite/bin/vite.js build --mode cdn && node scripts/verify-resource-browser.mjs\",\n \"test:vitals-browser\": \"node node_modules/vite/bin/vite.js build --mode cdn && node scripts/verify-vitals-browser.mjs\",\n \"test:view-browser\": \"node node_modules/vite/bin/vite.js build --mode cdn && node scripts/verify-view-browser.mjs\",\n \"test:session-browser\": \"node node_modules/vite/bin/vite.js build --mode cdn && node scripts/verify-session-browser.mjs\"\n },\n \"dependencies\": {\n \"@opentelemetry/api\": \"^1.9.1\",\n \"@opentelemetry/context-zone\": \"2.7.1\",\n \"@opentelemetry/core\": \"^2.7.1\",\n \"@opentelemetry/exporter-trace-otlp-http\": \"^0.217.0\",\n \"@opentelemetry/instrumentation\": \"^0.217.0\",\n \"@opentelemetry/resources\": \"^2.7.1\",\n \"@opentelemetry/sdk-trace-base\": \"^2.7.1\",\n \"@opentelemetry/sdk-trace-web\": \"^2.7.1\",\n \"@opentelemetry/semantic-conventions\": \"^1.38.0\"\n },\n \"devDependencies\": {\n \"@vitejs/plugin-vue\": \"^6.0.6\",\n \"@vue/test-utils\": \"^2.4.6\",\n \"@vue/tsconfig\": \"^0.9.0\",\n \"oxc-minify\": \"^0.133.0\",\n \"vite\": \"^8.0.2\",\n \"vite-bundle-analyzer\": \"^1.3.2\",\n \"vitepress\": \"2.0.0-alpha.16\",\n \"vue\": \"^3.5.34\",\n \"vue-router\": \"^5.0.6\",\n \"vue-tsc\": \"^3.1.4\"\n }\n}\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { version as packageVersion } from '../../package.json';\nimport { getDeviceResourceAttributes } from '../plugins/device';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { normalizeUrlPathTemplate } from './url';\nimport { getViewLocation } from './view-location';\n\nimport type { BkOTActionPluginOptions } from '../plugins/action';\nimport type { BkOTBlankScreenPluginOptions } from '../plugins/blank-screen';\nimport type { BkOTDevicePluginOptions } from '../plugins/device';\nimport type { BkOTLongTaskPluginOptions } from '../plugins/long-task';\nimport type { BkOTSessionConfig } from '../plugins/session';\nimport type { RumRequestOutcome } from '../schema/span';\nimport type { BkOTPlugin } from './plugin';\nimport type { BkOTUserContext } from './runtime-context';\nimport type { BkOTViewRouteMode } from './view-location';\nimport type { Attributes, Link } from '@opentelemetry/api';\nimport type { Instrumentation } from '@opentelemetry/instrumentation';\nimport type { TimedEvent } from '@opentelemetry/sdk-trace-base';\n\nexport interface BkOTActionEventPayload {\n attributes?: Attributes;\n name: string;\n}\n\nexport interface BkOTApplicationConfig {\n environment?: string;\n name: string;\n version?: string;\n}\n\nexport interface BkOTAttributesConfig {\n custom?: () => Attributes;\n error?: () => Attributes;\n page?: () => Attributes;\n}\n\nexport type BkOTAttributeValue = boolean | number | string;\n\nexport interface BkOTBatchConfig {\n exportTimeoutMillis?: number;\n maxExportBatchSize?: number;\n maxQueueSize?: number;\n scheduledDelayMillis?: number;\n}\n\nexport interface BkOTBeforeSendEvent {\n attributes: Record<string, unknown>;\n /** 脱敏后的导出副本,可原地修改或移除;不改变已结束的原 Span。 */\n events?: TimedEvent[];\n links?: Link[];\n name: string;\n signal: 'span';\n}\n\nexport interface BkOTContextConfig {\n attributes?: BkOTAttributesConfig;\n user?: BkOTUserContext;\n}\n\nexport interface BkOTCustomEventPayload {\n attributes?: Attributes;\n error?: Error;\n name: string;\n}\n\nexport interface BkOTExtensionsConfig {\n instrumentations?: Instrumentation[];\n plugins?: BkOTPlugin[];\n}\n\nexport interface BkOTOptions {\n application: BkOTApplicationConfig;\n autoStart?: boolean;\n context?: BkOTContextConfig;\n debug?: boolean;\n enabled?: boolean;\n extensions?: BkOTExtensionsConfig;\n privacy?: BkOTPrivacyConfig;\n session?: BkOTSessionConfig;\n tracking?: BkOTTrackingConfig;\n transport: BkOTTransportConfig;\n}\n\nexport interface BkOTPrivacyConfig {\n /** 初始化时的采集授权状态;运行期可通过 setTrackingConsent 更新。 */\n trackingConsent?: BkOTTrackingConsent;\n /** 过滤 Span、Event、Link 属性;导出前再次执行,应保持幂等。抛错时丢弃该条遥测。 */\n redactAttributes?: (attributes: Attributes) => Attributes;\n /** 所有写入 attribute 的 URL 都会先经过此函数。 */\n redactUrl?: (url: string) => string;\n}\n\nexport interface BkOTRequestConfig {\n allowedTracingUrls?: BkOTUrlMatcher | BkOTUrlMatcher[];\n excludedUrls?: BkOTUrlMatcher | BkOTUrlMatcher[];\n beforeSend?: (event: BkOTRequestEvent, context: BkOTRequestContext) => boolean | void;\n /** 返回请求 URL 的低基数模板,例如 `/api/orders/{id}`;返回空值时回退到默认折叠规则。 */\n getUrlTemplate?: (url: string) => string | undefined;\n}\n\nexport type BkOTRequestContext =\n | {\n /** 本次 send 的终态快照;xhr 原实例可能已被业务复用,不保存正文。 */\n responseSnapshot?: Readonly<Pick<XMLHttpRequest, 'responseType' | 'responseURL' | 'status' | 'statusText'>>;\n type: 'xhr';\n xhr: XMLHttpRequest;\n }\n | { error?: unknown; request: Request | RequestInit; response?: Response; type: 'fetch' };\n\nexport interface BkOTRequestEvent {\n attributes: Attributes;\n type: 'resource';\n resource: {\n method?: string;\n outcome: BkOTRequestOutcome;\n transport: 'fetch' | 'xhr';\n url?: string;\n };\n}\n\nexport type BkOTRequestOutcome = RumRequestOutcome;\n\nexport type BkOTSpanProcessorMode = 'batch' | 'simple';\n\nexport interface BkOTTrackingConfig {\n action?: BkOTActionPluginOptions | boolean;\n blankScreen?: BkOTBlankScreenPluginOptions | boolean;\n cspViolation?: boolean;\n device?: BkOTDevicePluginOptions | boolean;\n error?: boolean;\n longTask?: BkOTLongTaskPluginOptions | boolean;\n request?: BkOTRequestConfig | boolean;\n resource?: boolean;\n view?: BkOTViewConfig;\n websocket?: boolean;\n webVitals?: boolean;\n beforeSend?: (event: BkOTBeforeSendEvent) => boolean | void;\n}\n\nexport type BkOTTrackingConsent = 'granted' | 'not-granted';\n\nexport interface BkOTTransportConfig {\n batch?: BkOTBatchConfig;\n concurrencyLimit?: number;\n endpoint: string;\n headers?: Record<string, string>;\n processor?: BkOTSpanProcessorMode;\n timeoutMillis?: number;\n token?: string;\n}\n\nexport type BkOTUrlMatcher = ((url: string) => boolean) | RegExp | string;\n\nexport interface BkOTViewConfig {\n /** 不参与 View loading time 的长轮询、流式请求或埋点 URL。 */\n excludedActivityUrls?: BkOTUrlMatcher | BkOTUrlMatcher[];\n /** 自动计算初始加载与 SPA 路由的页面稳定耗时,默认开启。 */\n loadingTime?: boolean;\n /** auto 识别 #/ 与 #!/;history 忽略片段,hash 使用片段内路径,document 不自动划分同文档 View。 */\n routeMode?: BkOTViewRouteMode;\n tracking?: 'auto' | 'manual';\n /** 返回页面路由的低基数模板,例如 `/trace/:id`;返回空值时回退到默认折叠规则。 */\n getUrlTemplate?: (url: string) => string | undefined;\n}\n\nexport interface ResolvedApplicationConfig {\n environment: string;\n name: string;\n version?: string;\n}\n\nexport interface ResolvedBkOTConfig {\n application: ResolvedApplicationConfig;\n autoStart: boolean;\n debug: boolean;\n enabled: boolean;\n extensions: BkOTExtensionsConfig;\n hooks: ResolvedConfigHooks;\n resourceAttributes: Attributes;\n session: ResolvedSessionConfig;\n spanBatch?: BkOTBatchConfig;\n spanProcessor: BkOTSpanProcessorMode;\n tracking: BkOTTrackingConfig;\n trackingConsent: BkOTTrackingConsent;\n transport: ResolvedTransportConfig;\n user?: BkOTUserContext;\n view: ResolvedViewConfig;\n}\n\nexport interface ResolvedConfigHooks {\n beforeSend?: (event: BkOTBeforeSendEvent) => boolean | void;\n getCustomAttributes: () => Attributes;\n getErrorAttributes: () => Attributes;\n getPageAttributes: () => Attributes;\n getRequestUrlTemplate: (url: string) => string;\n getViewUrlTemplate: (url: string) => string;\n redactAttributes: (attributes: Attributes) => Attributes;\n redactUrl: (url: string) => string;\n}\n\nexport interface ResolvedSessionConfig extends BkOTSessionConfig {\n sampleRate: number;\n}\n\nexport interface ResolvedTransportConfig {\n concurrencyLimit?: number;\n endpoint: string;\n headers?: Record<string, string>;\n timeoutMillis?: number;\n}\n\nexport interface ResolvedViewConfig {\n excludedActivityUrls?: BkOTUrlMatcher | BkOTUrlMatcher[];\n loadingTime: boolean;\n routeMode: BkOTViewRouteMode;\n tracking: 'auto' | 'manual';\n}\n\nconst trimTrailingSlash = (value: string) => value.trim().replace(/\\/+$/, '');\n\nconst resolveTransportConfig = (transport: BkOTTransportConfig): ResolvedTransportConfig => {\n // token 只负责提供默认鉴权头;headers 保持显式配置优先,便于特殊场景覆盖。\n const mergedHeaders =\n transport.token || transport.headers\n ? {\n ...(transport.token ? { Authorization: `Bearer ${transport.token}` } : {}),\n ...(transport.headers ?? {}),\n }\n : undefined;\n\n return {\n concurrencyLimit: transport.concurrencyLimit,\n endpoint: `${trimTrailingSlash(transport.endpoint)}/v1/rum`,\n headers: mergedHeaders,\n timeoutMillis: transport.timeoutMillis,\n };\n};\n\nconst clampSampleRate = (sampleRate?: number) => {\n if (typeof sampleRate !== 'number' || !Number.isFinite(sampleRate)) {\n return 1;\n }\n return Math.max(0, Math.min(1, sampleRate));\n};\n\nconst identityRedactAttributes = (attributes: Attributes) => attributes;\n\n// 默认只保留 URL 的定位信息;认证信息、查询参数和 fragment 可能携带用户数据,统一移除。\nconst defaultRedactUrl = (url: string) => {\n if (!url) return url;\n try {\n const parsed = new URL(url, typeof location === 'undefined' ? 'http://localhost' : location.href);\n parsed.username = '';\n parsed.password = '';\n parsed.search = '';\n parsed.hash = '';\n return parsed.href;\n } catch {\n return url.replace(/[?#].*$/, '');\n }\n};\n\nconst getUrlPathname = (url: string) => {\n try {\n return new URL(url, typeof location === 'undefined' ? 'http://localhost' : location.href).pathname || '/';\n } catch {\n return url || '/';\n }\n};\n\n/**\n * 低基数路径模板,供 `view.url_template` 与 `url.template` 共用同一套折叠规则。\n * 只保留 path:host 维度由 `server.address` 表达,query 由 `normalizeUrlPathTemplate` 去掉。\n */\nconst templatizeUrlPath = (url: string) => normalizeUrlPathTemplate(getUrlPathname(url));\n\n/** 模板 Hook 在每个请求/导航上都会跑,抛错不能影响追踪本身 */\nconst resolveTemplateHook =\n (config: BkOTOptions, custom: ((url: string) => string | undefined) | undefined, fallback = templatizeUrlPath) =>\n (url: string) => {\n try {\n const templated = custom?.(url);\n if (templated) return templated;\n } catch (error) {\n if (config.debug) globalThis.console?.warn('[bk-ot] url template hook failed:', error);\n }\n return fallback(url);\n };\n\nconst resolveApplicationConfig = (application: BkOTOptions['application']): ResolvedApplicationConfig => ({\n environment: application.environment ?? 'production',\n name: application.name,\n version: application.version,\n});\n\nconst resolveResourceAttributes = (\n application: ResolvedApplicationConfig,\n device: BkOTTrackingConfig['device'],\n sampleRate: number,\n): Attributes => ({\n [RUM_ATTRIBUTES.deploymentEnvironmentName]: application.environment,\n ...(device === false ? {} : getDeviceResourceAttributes()),\n [RUM_ATTRIBUTES.serviceName]: application.name,\n ...(application.version ? { [RUM_ATTRIBUTES.serviceVersion]: application.version } : {}),\n [RUM_ATTRIBUTES.sessionSampleRate]: sampleRate,\n 'telemetry.sdk.language': 'webjs',\n 'telemetry.sdk.name': 'blueking',\n 'telemetry.sdk.version': packageVersion,\n});\n\nconst validateTransportConfig = (transport: BkOTTransportConfig | undefined) => {\n if (!transport) throw new Error('[bk-ot] transport is required.');\n if (!transport.endpoint?.trim()) throw new Error('[bk-ot] transport.endpoint is required.');\n};\n\nconst resolveHooks = (config: BkOTOptions): ResolvedConfigHooks => ({\n beforeSend: config.tracking?.beforeSend,\n getPageAttributes: config.context?.attributes?.page ?? (() => ({})),\n getErrorAttributes: config.context?.attributes?.error ?? (() => ({})),\n getCustomAttributes: config.context?.attributes?.custom ?? (() => ({})),\n getRequestUrlTemplate: resolveTemplateHook(\n config,\n typeof config.tracking?.request === 'object' ? config.tracking.request.getUrlTemplate : undefined,\n ),\n getViewUrlTemplate: resolveTemplateHook(\n config,\n typeof config.tracking?.view === 'object' ? config.tracking.view.getUrlTemplate : undefined,\n url => normalizeUrlPathTemplate(getViewLocation(url, config.tracking?.view?.routeMode ?? 'auto').routePath),\n ),\n redactAttributes: config.privacy?.redactAttributes ?? identityRedactAttributes,\n redactUrl: config.privacy?.redactUrl ?? defaultRedactUrl,\n});\n\nexport const resolveConfig = (config: BkOTOptions): ResolvedBkOTConfig => {\n if (!config.application?.name?.trim()) {\n throw new Error('[bk-ot] application.name is required.');\n }\n validateTransportConfig(config.transport);\n const application = resolveApplicationConfig(config.application);\n const viewConfig = typeof config.tracking?.view === 'object' ? config.tracking.view : undefined;\n const hooks = resolveHooks(config);\n const sampleRate = clampSampleRate(config.session?.sampleRate);\n\n return {\n application,\n autoStart: config.autoStart ?? true,\n debug: config.debug ?? false,\n enabled: config.enabled ?? true,\n extensions: {\n instrumentations: [...(config.extensions?.instrumentations ?? [])],\n plugins: [...(config.extensions?.plugins ?? [])],\n },\n hooks,\n resourceAttributes: hooks.redactAttributes(\n resolveResourceAttributes(application, config.tracking?.device, sampleRate),\n ),\n session: {\n ...config.session,\n sampleRate,\n },\n spanBatch: config.transport.batch,\n spanProcessor: config.transport.processor ?? 'batch',\n tracking: config.tracking ?? {},\n trackingConsent: config.privacy?.trackingConsent ?? 'granted',\n transport: resolveTransportConfig(config.transport),\n user: config.context?.user,\n view: {\n excludedActivityUrls: viewConfig?.excludedActivityUrls,\n loadingTime: viewConfig?.loadingTime !== false,\n tracking: viewConfig?.tracking === 'manual' ? 'manual' : 'auto',\n routeMode: viewConfig?.routeMode ?? 'auto',\n },\n };\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport type { RumSpanType } from '../schema/span';\nimport type { BkOTActivityEvent } from './action-activity';\nimport type { ResolvedBkOTConfig } from './config';\nimport type { BkOTSessionLifecycleEvent, BkOTUserContext, BkOTViewCommand, BkOTViewContext } from './runtime-context';\nimport type { Attributes, Link, Span, SpanKind, TimeInput, Tracer } from '@opentelemetry/api';\nimport type { Instrumentation } from '@opentelemetry/instrumentation';\n\nexport interface BkOTPlugin {\n enabled?: ((config: ResolvedBkOTConfig) => boolean) | boolean;\n name: string;\n /** 同步读取浏览器待交付队列;所有插件 drain 后才允许 checkpoint 或停止请求。 */\n drain?: () => void;\n flush?: () => Promise<void> | void;\n init: (context: BkOTRuntimeContext) => Promise<void> | void;\n shutdown?: () => Promise<void> | void;\n}\n\nexport interface BkOTRuntimeContext {\n config: ResolvedBkOTConfig;\n tracer: Tracer;\n /** afterAssociation 加入身份关联队列,按注册顺序执行;默认阶段仍用于先初始化 View。 */\n afterSessionTransition: (callback: () => void, afterAssociation?: boolean) => void;\n /** 对外提供的属性脱敏入口,所有插件在 emit 前都应过一次 */\n applyRedact: (attributes: Attributes) => Attributes;\n beginSessionTransition: (at: number) => () => void;\n /** 关闭该动作的半开关联区间;不会影响其他重叠 Action。 */\n endActionContext: (id: string, endTime: number, relativeEndTime?: number) => void;\n flush: () => Promise<void>;\n getRuntimeAttributes: () => Attributes;\n getRuntimeAttributesAt: (timestamp: number) => Attributes;\n getRuntimeContextAtRelativeTime?: (relativeTime: number) => undefined | { attributes: Attributes; time: number };\n getViewHistory?: () => Array<{ runtimeAttributes: Attributes; view: BkOTViewContext }>;\n isSampled: () => boolean;\n isSessionActive: () => boolean;\n isSessionTransitionPending: () => boolean;\n isViewActive: () => boolean;\n notifyActivity: (event: BkOTActivityEvent) => void;\n notifySessionLifecycle: (event: BkOTSessionLifecycleEvent) => void;\n onActivity: (listener: (event: BkOTActivityEvent) => void) => () => void;\n onSessionLifecycle: (listener: (event: BkOTSessionLifecycleEvent) => void) => () => void;\n onViewChange: (listener: (view: BkOTViewContext) => void) => () => void;\n onViewCommand: (listener: (command: BkOTViewCommand) => void) => () => void;\n /** attributes 保留捕获引用,以支持待定 Session 提交后回填。 */\n registerActionContext: (id: string, startTime: number, attributes: Attributes) => void;\n registerInstrumentations: (instrumentations: Instrumentation[]) => void;\n registerSessionCheck: (check: () => void) => () => void;\n setRuntimeAttributes: (attributes: Attributes, changedAt?: number) => void;\n /** 更新用户上下文;user.id 由接入方传入,SDK 原样透传 */\n setUser: (user: BkOTUserContext) => void;\n /** 更新当前 View 上下文,后续 span 会自动带上 view.* 关联字段 */\n setView: (view: BkOTViewContext, changedAt?: number) => void;\n startSpan: (name: string, attributes?: Attributes, options?: BkOTStartSpanOptions) => Span;\n /** 本次授权采集区间;再次授权不能重新生成物理文档加载指标。 */\n collectionStart?: {\n /** 仅最初即允许采集的实例可读取安装前资源,不补采未授权区间。 */\n allowInitialResourceHistory?: boolean;\n isInitialDocument: boolean;\n relativeStartedAt: number;\n startedAt: number;\n };\n}\n\n/**\n * startSpan 的扩展选项。\n *\n * 用于\"事件实际发生在过去某个时刻,但 span 现在才创建\"的场景:\n * 例如 PerformanceObserver 在条目结束后才回调,但 span 的时间窗仍需反映\n * 条目真实发生的区间,方便 trace 视图与并发请求对齐。\n *\n * startTime 接受 OT TimeInput;常用 epoch 毫秒(performance.timeOrigin + performance.now())。\n * 配合 span.end(endTime?) 可控制结束时间。\n */\nexport interface BkOTStartSpanOptions {\n /** 完整运行时快照;缺失字段表示明确不存在,不再从当前或历史上下文补齐。 */\n contextAttributes?: Attributes;\n /** 用于从历史中解析 Session/View/Action 归属;默认复用数字类型 startTime。 */\n contextTime?: number;\n kind?: SpanKind;\n /** 关联其他 trace 的 Span Link;OTel 要求在创建时传入。 */\n links?: Link[];\n /** 内置 Span 根据脱敏后的属性生成名称;自定义 startSpan 默认保留传入名称。 */\n rumSpanType?: RumSpanType;\n startTime?: TimeInput;\n}\n\nexport const isPluginEnabled = (plugin: BkOTPlugin, config: ResolvedBkOTConfig) => {\n if (typeof plugin.enabled === 'function') {\n return plugin.enabled(config);\n }\n return plugin.enabled !== false;\n};\n\nexport const createPlugin = (plugin: BkOTPlugin) => plugin;\n\nexport class PluginManager {\n private debug = false;\n private readonly plugins: BkOTPlugin[];\n private startedPlugins: BkOTPlugin[] = [];\n private stopped = false;\n private stopping?: Promise<void>;\n\n private drain(plugins: BkOTPlugin[]) {\n for (const plugin of plugins) {\n try {\n plugin.drain?.();\n } catch (error) {\n this.warn(plugin, 'drain', error);\n }\n }\n }\n\n private async invoke(plugin: BkOTPlugin, phase: 'flush' | 'shutdown') {\n try {\n await plugin[phase]?.();\n } catch (error) {\n this.warn(plugin, phase, error);\n }\n }\n\n private warn(plugin: BkOTPlugin, phase: string, error: unknown) {\n if (this.debug) globalThis.console?.warn(`[bk-ot] plugin \"${plugin.name}\" ${phase} failed:`, error);\n }\n\n public constructor(plugins: BkOTPlugin[]) {\n this.plugins = plugins;\n }\n\n public async flush() {\n const plugins = [...this.startedPlugins];\n this.drain(plugins);\n for (const plugin of plugins) await this.invoke(plugin, 'flush');\n }\n\n public async shutdown() {\n if (this.stopping) return this.stopping;\n this.stopped = true;\n const plugins = this.startedPlugins.splice(0);\n this.stopping = (async () => {\n this.drain(plugins);\n for (const plugin of plugins) await this.invoke(plugin, 'flush');\n for (const plugin of plugins.reverse()) await this.invoke(plugin, 'shutdown');\n })();\n return this.stopping;\n }\n\n public async start(context: BkOTRuntimeContext) {\n this.debug = context.config.debug;\n // 每个插件独立 try/catch,单个插件 init 失败不应拖累其他插件:\n // - init 前登记,才能在等待异步初始化时取消;失败时清理已安装的资源\n // - debug 模式打 warn,方便排查;非 debug 静默失败避免污染业务日志\n for (const plugin of this.plugins) {\n if (this.stopped) return;\n if (!isPluginEnabled(plugin, context.config)) {\n continue;\n }\n this.startedPlugins.push(plugin);\n try {\n await plugin.init(context);\n if (this.stopped) {\n // 异步 init 可能在第一次 shutdown 后才返回,再清理它后续安装的资源。\n await plugin.shutdown?.();\n return;\n }\n } catch (error) {\n const index = this.startedPlugins.indexOf(plugin);\n if (index >= 0) {\n this.startedPlugins.splice(index, 1);\n try {\n await plugin.shutdown?.();\n } catch {\n /* 保留原始初始化错误。 */\n }\n }\n if (context.config.debug) {\n globalThis.console?.warn(`[bk-ot] plugin \"${plugin.name}\" init failed:`, error);\n }\n }\n }\n }\n}\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport type { ResolvedBkOTConfig } from './config';\n\nconst hashToUnitInterval = (input: string) => {\n let hash = 0x811c9dc5;\n for (let index = 0; index < input.length; index += 1) {\n hash = Math.imul(hash ^ input.charCodeAt(index), 0x01000193);\n }\n hash += hash << 13;\n hash ^= hash >>> 7;\n hash += hash << 3;\n hash ^= hash >>> 17;\n hash += hash << 5;\n return (hash >>> 0) / 0x100000000;\n};\n\n/**\n * 按应用和 RUM Session ID 做确定性采样。采样决定随 Session 更新,不再依赖 Tab 级 sessionStorage。\n */\nexport const isBkOTSampled = (\n { application, session }: Pick<ResolvedBkOTConfig, 'application' | 'session'>,\n sessionId: string,\n) => {\n if (session.sampleRate <= 0) {\n return false;\n }\n if (session.sampleRate >= 1) {\n return true;\n }\n return hashToUnitInterval(`${application.name}\\0${sessionId}`) < session.sampleRate;\n};\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n/**\n * 串行提交 Session 时先采集事件,再关联会话。View 变更先落地,随后解析待定快照,\n * 防止第一击在 Web Lock 返回前继承旧 ID。停止采集会使所有旧回调失效。\n */\nexport class SessionTransition {\n private readonly associations: Array<() => void> = [];\n private readonly callbacks: Array<() => void> = [];\n private check?: () => void;\n private checking = false;\n private readonly pending = new Set<{ at: number }>();\n\n public begin = (at: number) => {\n const transition = { at };\n this.pending.add(transition);\n return () => {\n if (!this.pending.delete(transition) || this.pending.size) return;\n while (!this.pending.size && this.callbacks.length) this.callbacks.shift()!();\n while (!this.pending.size && this.associations.length) this.associations.shift()!();\n };\n };\n\n public checkSession = () => {\n if (this.checking || this.pending.size) return;\n this.checking = true;\n try {\n this.check?.();\n } finally {\n this.checking = false;\n }\n };\n\n public isPending = (at?: number) => [...this.pending].some(transition => at === undefined || at >= transition.at);\n\n public registerCheck = (check: () => void) => {\n this.check = check;\n return () => {\n if (this.check === check) this.check = undefined;\n };\n };\n\n public reset = () => {\n this.pending.clear();\n this.callbacks.length = 0;\n this.associations.length = 0;\n };\n\n public whenReady = (callback: () => void, association = false) => {\n if (!this.pending.size) {\n callback();\n return;\n }\n const queue = association ? this.associations : this.callbacks;\n if (queue.length >= this.capacity) queue.shift();\n queue.push(callback);\n };\n\n public constructor(private readonly capacity: number) {}\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2017-2025 Tencent. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport {\n type Attributes,\n type Span,\n context,\n INVALID_SPAN_CONTEXT,\n propagation,\n SpanKind,\n SpanStatusCode,\n trace,\n} from '@opentelemetry/api';\nimport { ZoneContextManager } from '@opentelemetry/context-zone';\nimport { W3CTraceContextPropagator } from '@opentelemetry/core';\nimport { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';\nimport { resourceFromAttributes } from '@opentelemetry/resources';\nimport { BatchSpanProcessor, SamplingDecision, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base';\nimport { WebTracerProvider } from '@opentelemetry/sdk-trace-web';\n\nimport { createActionPlugin } from '../plugins/action';\nimport { createActivityPlugin } from '../plugins/activity';\nimport { createBlankScreenPlugin } from '../plugins/blank-screen';\nimport { createCommonInstrumentationsPlugin } from '../plugins/common';\nimport { createCspViolationPlugin } from '../plugins/csp-violation';\nimport { createDevicePlugin } from '../plugins/device';\nimport { createErrorPlugin } from '../plugins/error';\nimport { createLongTaskPlugin } from '../plugins/long-task';\nimport { createPageViewPlugin } from '../plugins/page-view';\nimport { createResourcePlugin } from '../plugins/resource';\nimport { createSessionPlugin } from '../plugins/session';\nimport { createWebVitalsPlugin } from '../plugins/web-vitals';\nimport { createWebSocketPlugin } from '../plugins/websocket';\nimport { RUM_ATTRIBUTES } from '../schema/attributes';\nimport { buildRumSpanAttributes, buildRumSpanName, RUM_SPAN_OUTCOME, RUM_SPAN_TYPE } from '../schema/span';\nimport { RumActivityObserver } from './action-activity';\nimport {\n type BkOTActionEventPayload,\n type BkOTCustomEventPayload,\n type BkOTOptions,\n type BkOTTrackingConfig,\n type BkOTTrackingConsent,\n type ResolvedBkOTConfig,\n type ResolvedTransportConfig,\n resolveConfig,\n} from './config';\nimport { createRandomId } from './id';\nimport { type BkOTPlugin, type BkOTRuntimeContext, type BkOTStartSpanOptions, PluginManager } from './plugin';\nimport { filterActionAttributes, FilteringSpanProcessor, RUM_CONTEXT_SNAPSHOT, RUM_CONTEXT_TIME } from './processor';\nimport {\n type BkOTSessionLifecycleEvent,\n type BkOTStartViewOptions,\n type BkOTUserContext,\n copyAttributes,\n RumRuntimeContext,\n} from './runtime-context';\nimport { isBkOTSampled } from './sampling';\nimport { SessionTransition } from './session-transition';\n\nimport type { Instrumentation } from '@opentelemetry/instrumentation';\nimport type { Sampler } from '@opentelemetry/sdk-trace-base';\n\nexport interface BkOTInstance extends Omit<\n BkOTRuntimeContext,\n | 'endActionContext'\n | 'notifyActivity'\n | 'onActivity'\n | 'onViewChange'\n | 'onViewCommand'\n | 'registerActionContext'\n | 'registerInstrumentations'\n | 'setView'\n> {\n addTiming: (name: string, elapsed?: number) => void;\n flush: () => Promise<void>;\n getViewContext: () => Attributes;\n reportAction: (payload: BkOTActionEventPayload) => void;\n reportCustomEvent: (payload: BkOTCustomEventPayload) => void;\n setTrackingConsent: (consent: BkOTTrackingConsent) => Promise<void>;\n setUser: (user: BkOTUserContext) => void;\n setViewContext: (attributes: Attributes) => void;\n setViewContextProperty: (key: string, value: Attributes[string]) => void;\n setViewLoadingTime: () => void;\n setViewName: (name: string) => void;\n shutdown: () => Promise<void>;\n start: () => Promise<void>;\n startView: (options?: BkOTStartViewOptions) => void;\n use: (plugin: BkOTPlugin) => BkOTInstance;\n useInstrumentation: (instrumentation: Instrumentation) => BkOTInstance;\n}\n\nconst createExporterOptions = (config: ResolvedTransportConfig) => ({\n url: config.endpoint,\n headers: config.headers,\n concurrencyLimit: config.concurrencyLimit,\n timeoutMillis: config.timeoutMillis,\n});\n\nconst BK_OT_INSTRUMENTATION_NAME = 'bk-rum';\n\nclass RumSessionSampler implements Sampler {\n public constructor(private readonly isSampled: (attributes: Attributes) => boolean) {}\n\n public shouldSample(_context: unknown, _traceId: string, _name: string, _kind: SpanKind, attributes: Attributes) {\n return {\n decision: this.isSampled(attributes) ? SamplingDecision.RECORD_AND_SAMPLED : SamplingDecision.NOT_RECORD,\n };\n }\n\n public toString() {\n return 'RumSessionSampler';\n }\n}\n\n// OTel context manager 和 propagator 是页面级全局对象,多 SDK 实例通过引用计数共享,最后一个实例退出时释放。\nlet globalRegistration:\n | undefined\n | {\n contextManager?: ZoneContextManager;\n ownsContext: boolean;\n ownsPropagator: boolean;\n users: number;\n };\n\nconst acquireOtelGlobals = () => {\n if (globalRegistration) {\n globalRegistration.users += 1;\n } else {\n const contextManager = new ZoneContextManager().enable();\n const ownsContext = context.setGlobalContextManager(contextManager);\n if (!ownsContext) contextManager.disable();\n globalRegistration = {\n contextManager: ownsContext ? contextManager : undefined,\n ownsContext,\n ownsPropagator: propagation.setGlobalPropagator(new W3CTraceContextPropagator()),\n users: 1,\n };\n }\n let released = false;\n return () => {\n if (released || !globalRegistration) return;\n released = true;\n globalRegistration.users -= 1;\n if (globalRegistration.users > 0) return;\n if (globalRegistration.ownsContext) context.disable();\n if (globalRegistration.ownsPropagator) propagation.disable();\n globalRegistration = undefined;\n };\n};\n\n/**\n * 用 Proxy 包装一层 debug 旁路,避免直接 mutate 第三方 exporter 实例(其内部可能含 #private fields)。\n */\nconst wrapWithDebug = <TExporter extends { export: (...args: any[]) => any }>(\n exporter: TExporter,\n enabled: boolean,\n): TExporter => {\n if (!enabled) {\n return exporter;\n }\n return new Proxy(exporter, {\n get(target, prop, receiver) {\n if (prop === 'export') {\n return (records: unknown, callback: unknown) => {\n globalThis.console?.log('[bk-ot][rum]', records);\n return (target as { export: (...args: unknown[]) => unknown }).export(records, callback);\n };\n }\n const value = Reflect.get(target, prop, receiver);\n return typeof value === 'function' ? value.bind(target) : value;\n },\n });\n};\n\n// 请求插件统一负责 Fetch/XHR span、Trace Header 与活动计数。\nconst getCorePlugins = (config: ResolvedBkOTConfig): BkOTPlugin[] => [\n createCommonInstrumentationsPlugin(config.tracking.request),\n];\n\nconst getRumContextPlugins = (config: ResolvedBkOTConfig): BkOTPlugin[] => [\n createSessionPlugin(config.session),\n ...createBuiltInPlugin(config.tracking.device, true, createDevicePlugin),\n createActivityPlugin(),\n createPageViewPlugin(),\n createResourcePlugin(isBuiltInPluginEnabled(config.tracking.resource, true)),\n];\n\nconst isBuiltInPluginEnabled = <TOptions extends object>(\n option: boolean | TOptions | undefined,\n defaultEnabled: boolean,\n) => (option === undefined ? defaultEnabled : option !== false);\n\nconst getBuiltInPluginOptions = <TOptions extends object>(option: boolean | TOptions | undefined) =>\n typeof option === 'object' && option !== null ? option : undefined;\n\nconst createBuiltInPlugin = <TOptions extends object>(\n option: boolean | TOptions | undefined,\n defaultEnabled: boolean,\n factory: (options?: TOptions) => BkOTPlugin,\n) => (isBuiltInPluginEnabled(option, defaultEnabled) ? [factory(getBuiltInPluginOptions(option))] : []);\n\n// 上下文插件先启动,确保后续 span 能带上关联字段;Session sampler 与 processor 负责统一采样。\nconst getRumPlugins = (tracking: BkOTTrackingConfig): BkOTPlugin[] => [\n ...createBuiltInPlugin(tracking.error, true, createErrorPlugin),\n ...createBuiltInPlugin(tracking.webVitals, true, createWebVitalsPlugin),\n ...createBuiltInPlugin(tracking.blankScreen, true, createBlankScreenPlugin),\n ...createBuiltInPlugin(tracking.action, true, createActionPlugin),\n ...createBuiltInPlugin(tracking.websocket, false, createWebSocketPlugin),\n ...createBuiltInPlugin(tracking.longTask, false, createLongTaskPlugin),\n ...createBuiltInPlugin(tracking.cspViolation, false, createCspViolationPlugin),\n];\n\ntype SdkLifecyclePhase = 'idle' | 'started' | 'starting' | 'stopped';\n\n/**\n * 浏览器 RUM SDK 的生命周期入口。Provider 在构造时创建,插件和全局 patch 则随 start、授权变更和\n * shutdown 安装或卸载;Session 决定统一作用于所有 RUM span。\n */\nexport class BkOpenTelemetry implements BkOTInstance {\n private readonly activityObserver = new RumActivityObserver();\n private allowInitialResourceHistory: boolean;\n private readonly collectAttributesAt = (timestamp: number, historical: boolean): Attributes => {\n this.sessionTransition.checkSession();\n const attributes = historical\n ? this.runtimeContext.getAttributesAt(timestamp)\n : this.runtimeContext.getAttributes();\n if (!this.sessionTransition.isPending(timestamp)) return attributes;\n // 该对象可被 Action 等延迟上报的采集器持有。先移除旧关联,提交后再填充事件时刻的归属。\n for (const key of Object.keys(attributes)) {\n if (\n key.startsWith('session.') ||\n key.startsWith('view.') ||\n key === RUM_ATTRIBUTES.actionId ||\n key === RUM_ATTRIBUTES.actionIds\n )\n delete attributes[key];\n }\n this.sessionTransition.whenReady(() => {\n const resolved = this.runtimeContext.getAttributesAt(timestamp);\n for (const [key, value] of Object.entries(resolved)) {\n if (\n key.startsWith('session.') ||\n key.startsWith('view.') ||\n key === RUM_ATTRIBUTES.actionId ||\n key === RUM_ATTRIBUTES.actionIds\n )\n attributes[key] = value;\n }\n }, true);\n return attributes;\n };\n private collectionStopping?: Promise<void>;\n private readonly flushProviders = async () => {\n await this.tracerProvider.forceFlush();\n };\n private hasStartedCollection = false;\n private readonly isStopped = () => this.phase === 'stopped';\n private latestManualViewOptions?: BkOTStartViewOptions;\n private phase: SdkLifecyclePhase = 'idle';\n private pluginManager?: PluginManager;\n private readonly registeredInstrumentations: Instrumentation[];\n private releaseOtelGlobals?: () => void;\n private readonly runtimeContext: RumRuntimeContext;\n private sampled = false;\n\n private readonly sessionTransition: SessionTransition;\n private shutdownTask?: Promise<void>;\n private readonly startCollection = async () => {\n // Provider 始终存在以保持公开 API 稳定;采集插件仅在启用且获得授权后安装。\n // 快速撤回再授权时先完成旧插件清理,避免新启动被旧 pluginManager 挡住或被其 teardown 清空。\n await this.collectionStopping;\n if (this.isStopped() || this.pluginManager || !this.config.enabled || this.config.trackingConsent !== 'granted')\n return;\n if (typeof window !== 'undefined') {\n if (!this.tabId) {\n this.tabId = createRandomId('tab');\n try {\n const stored = window.sessionStorage.getItem('bk_ot_tab_id');\n if (stored) this.tabId = stored;\n else window.sessionStorage.setItem('bk_ot_tab_id', this.tabId);\n } catch {\n /* 禁止持久化时,仅在当前 SDK 实例中保留标签页标识。 */\n }\n }\n this.runtimeContext.setAttributes({ [RUM_ATTRIBUTES.tabId]: this.tabId });\n }\n this.releaseOtelGlobals = acquireOtelGlobals();\n const pluginManager = this.createPluginManager();\n this.pluginManager = pluginManager;\n if (this.config.view.tracking === 'manual' && this.latestManualViewOptions) {\n this.runtimeContext.dispatchViewCommand({\n type: 'start',\n options: this.latestManualViewOptions,\n // 撤权后的重新授权建立新的体验区间,不回填到此前不允许采集的文档起点。\n startedAt: this.hasStartedCollection ? Date.now() : undefined,\n relativeStartedAt:\n this.hasStartedCollection && typeof performance !== 'undefined' ? performance.now() : undefined,\n });\n }\n const collectionStart = {\n allowInitialResourceHistory: this.allowInitialResourceHistory && !this.hasStartedCollection,\n isInitialDocument: !this.hasStartedCollection,\n startedAt: Date.now(),\n relativeStartedAt: typeof performance !== 'undefined' ? performance.now() : 0,\n };\n this.hasStartedCollection = true;\n try {\n await pluginManager.start({ ...this.createPluginContext(), collectionStart });\n if (this.isStopped() || this.pluginManager !== pluginManager || this.config.trackingConsent !== 'granted') return;\n this.registerInstrumentations(this.config.extensions.instrumentations ?? []);\n } catch (error) {\n if (this.pluginManager === pluginManager) await this.stopCollection(false);\n else await pluginManager.shutdown();\n throw error;\n }\n };\n private readonly stopCollection = async (flush: boolean) => {\n if (this.collectionStopping) return this.collectionStopping;\n const pluginManager = this.pluginManager;\n this.pluginManager = undefined;\n this.sessionTransition.reset();\n const instrumentations = this.registeredInstrumentations.splice(0);\n const releaseGlobals = this.releaseOtelGlobals;\n this.releaseOtelGlobals = undefined;\n // 撤销授权后立即清空 Session,防止后续手工 API 继续复用旧采样决定。\n this.setRuntimeAttributes({\n [RUM_ATTRIBUTES.sessionHasReplay]: undefined,\n [RUM_ATTRIBUTES.sessionId]: undefined,\n });\n const stopping = (async () => {\n try {\n await pluginManager?.shutdown();\n if (flush) await this.flushProviders();\n } finally {\n while (instrumentations.length) instrumentations.pop()?.disable?.();\n releaseGlobals?.();\n }\n })();\n this.collectionStopping = stopping;\n try {\n await stopping;\n } finally {\n if (this.collectionStopping === stopping) this.collectionStopping = undefined;\n }\n };\n private tabId?: string;\n private readonly teardownCallbacks: Array<() => void> = [];\n private readonly tracerProvider: WebTracerProvider;\n private assertBeforeStart(method: string) {\n if (this.phase !== 'idle') {\n throw new Error(`[bk-ot] ${method}() must be called before start(); set autoStart: false before registration.`);\n }\n }\n private createPluginContext(): BkOTRuntimeContext {\n return {\n applyRedact: this.applyRedact,\n beginSessionTransition: this.beginSessionTransition,\n registerSessionCheck: this.registerSessionCheck,\n isSessionTransitionPending: this.isSessionTransitionPending,\n afterSessionTransition: this.afterSessionTransition,\n config: this.config,\n registerActionContext: this.runtimeContext.registerActionContext,\n endActionContext: this.runtimeContext.endActionContext,\n flush: this.flush,\n getRuntimeAttributes: this.getRuntimeAttributes,\n getRuntimeAttributesAt: this.getRuntimeAttributesAt,\n getRuntimeContextAtRelativeTime: relativeTime => {\n // 先关闭已过期身份,再查历史;不能让显式快照绕过后台资源的过期边界。\n this.sessionTransition.checkSession();\n return this.runtimeContext.getRuntimeContextAtRelativeTime(relativeTime);\n },\n getViewHistory: this.runtimeContext.getViewHistory,\n isSampled: this.isSampled,\n isSessionActive: this.isSessionActive,\n isViewActive: this.isViewActive,\n notifySessionLifecycle: this.notifySessionLifecycle,\n notifyActivity: this.activityObserver.notify,\n onActivity: this.activityObserver.subscribe,\n onSessionLifecycle: this.onSessionLifecycle,\n onViewCommand: this.runtimeContext.onViewCommand,\n onViewChange: this.runtimeContext.onViewChange,\n registerInstrumentations: this.registerInstrumentations,\n setRuntimeAttributes: this.setRuntimeAttributes,\n setUser: this.setUser,\n setView: this.runtimeContext.setView,\n startSpan: this.startSpan,\n tracer: this.tracer,\n };\n }\n private createPluginManager() {\n return new PluginManager([\n ...getRumContextPlugins(this.config),\n ...getCorePlugins(this.config),\n ...getRumPlugins(this.config.tracking),\n ...(this.config.extensions.plugins ?? []),\n ]);\n }\n\n /** elapsed 为相对当前 View 起点的毫秒;省略时使用调用时刻,避免混用 epoch 时间。 */\n public readonly addTiming = (name: string, elapsed?: number) => {\n if (this.isSampled())\n this.runtimeContext.dispatchViewCommand({ name, elapsed, time: Date.now(), type: 'add_timing' });\n };\n\n public readonly afterSessionTransition = (callback: () => void, afterAssociation = false) =>\n this.sessionTransition.whenReady(callback, afterAssociation);\n\n public readonly applyRedact = (attributes: Attributes) => this.config.hooks.redactAttributes(attributes);\n public readonly beginSessionTransition = (at: number) => this.sessionTransition.begin(at);\n public readonly config: ResolvedBkOTConfig;\n public readonly flush = async () => {\n await this.pluginManager?.flush();\n await this.flushProviders();\n };\n\n public readonly getRuntimeAttributes = () => this.collectAttributesAt(Date.now(), false);\n public readonly getRuntimeAttributesAt = (timestamp: number) => this.collectAttributesAt(timestamp, true);\n public readonly getViewContext = (): Attributes => ({ ...this.runtimeContext.getView().attributes });\n public readonly isSampled = () => {\n this.sessionTransition.checkSession();\n return (\n this.config.trackingConsent === 'granted' &&\n this.config.enabled &&\n (this.sampled || this.sessionTransition.isPending())\n );\n };\n public readonly isSessionActive = () => {\n this.sessionTransition.checkSession();\n return this.runtimeContext.isSessionActive();\n };\n public readonly isSessionTransitionPending = () => this.sessionTransition.isPending();\n public readonly isViewActive = () => this.runtimeContext.isViewActive();\n\n public readonly notifySessionLifecycle = (event: BkOTSessionLifecycleEvent) => {\n this.runtimeContext.notifySessionLifecycle(event);\n };\n\n public readonly onSessionLifecycle = (listener: (event: BkOTSessionLifecycleEvent) => void) =>\n this.runtimeContext.onSessionLifecycle(listener);\n\n public readonly registerInstrumentations = (instrumentations: Instrumentation[]) => {\n if (!instrumentations.length) return;\n instrumentations.forEach(instrumentation => {\n instrumentation.setTracerProvider(this.tracerProvider);\n if (!instrumentation.getConfig().enabled) instrumentation.enable();\n });\n this.registeredInstrumentations.push(...instrumentations);\n };\n\n public readonly registerSessionCheck = (check: () => void) => this.sessionTransition.registerCheck(check);\n\n public readonly reportAction = ({ attributes = {}, name }: BkOTActionEventPayload) => {\n if (!this.isSampled()) {\n return;\n }\n const actionId = createRandomId('action');\n const occurredAt = Date.now();\n const spanAttributes = {\n ...this.config.hooks.getPageAttributes(),\n ...attributes,\n ...buildRumSpanAttributes({\n spanType: RUM_SPAN_TYPE.action,\n }),\n [RUM_ATTRIBUTES.actionId]: actionId,\n [RUM_ATTRIBUTES.actionName]: name,\n [RUM_ATTRIBUTES.actionType]: 'custom',\n };\n const span = this.startSpan(\n buildRumSpanName({ attributes: spanAttributes, spanType: RUM_SPAN_TYPE.action }),\n spanAttributes,\n { rumSpanType: RUM_SPAN_TYPE.action, startTime: occurredAt },\n );\n span.end(occurredAt);\n };\n\n public readonly reportCustomEvent = ({ attributes = {}, error, name }: BkOTCustomEventPayload) => {\n if (!this.isSampled()) {\n // 未采样时静默丢弃;如需调试请把 debug 选项打开\n if (this.config.debug) {\n globalThis.console?.warn('[bk-ot] custom event dropped (not sampled):', name);\n }\n return;\n }\n\n const occurredAt = Date.now();\n const spanAttributes = {\n ...this.config.hooks.getPageAttributes(),\n ...this.config.hooks.getCustomAttributes(),\n ...attributes,\n ...buildRumSpanAttributes({\n outcome: error ? RUM_SPAN_OUTCOME.error : RUM_SPAN_OUTCOME.success,\n spanType: RUM_SPAN_TYPE.custom,\n }),\n };\n const span = this.startSpan(\n buildRumSpanName({ attributes: spanAttributes, nameHint: name, spanType: RUM_SPAN_TYPE.custom }),\n spanAttributes,\n { startTime: occurredAt },\n );\n\n if (error) {\n span.recordException(error);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: error.message,\n });\n }\n\n span.end(occurredAt);\n };\n\n public readonly setRuntimeAttributes = (attributes: Attributes, changedAt?: number) => {\n const nextAttributes = { ...attributes };\n const effectiveChangedAt = changedAt ?? Date.now();\n if (RUM_ATTRIBUTES.sessionId in attributes) {\n // 采样以 Session 为边界重新计算,并保存在运行时私有历史中。\n const sessionId = attributes[RUM_ATTRIBUTES.sessionId];\n this.sampled =\n this.config.enabled && typeof sessionId === 'string' && sessionId.length > 0\n ? isBkOTSampled(this.config, sessionId)\n : false;\n this.runtimeContext.setSessionSampled(this.sampled, effectiveChangedAt);\n }\n this.runtimeContext.setAttributes(nextAttributes, effectiveChangedAt);\n };\n\n public readonly setTrackingConsent = async (consent: BkOTTrackingConsent) => {\n // 包括 start 前的撤权:之后的首次授权也不能读取曾明确拒绝采集的历史。\n if (consent === 'not-granted') this.allowInitialResourceHistory = false;\n if (this.config.trackingConsent === consent) return;\n this.config.trackingConsent = consent;\n if (this.phase !== 'started' && this.phase !== 'starting') return;\n if (consent === 'granted') await this.startCollection();\n else await this.stopCollection(true);\n };\n\n public readonly setUser = (user: BkOTUserContext) => {\n this.runtimeContext.setUser(user);\n };\n\n public readonly setViewContext = (attributes: Attributes) => {\n if (this.isSampled())\n this.runtimeContext.dispatchViewCommand({ attributes: { ...attributes }, type: 'set_context' });\n };\n\n public readonly setViewContextProperty = (key: string, value: Attributes[string]) => {\n if (this.isSampled()) this.runtimeContext.dispatchViewCommand({ key, value, type: 'set_context_property' });\n };\n\n public readonly setViewLoadingTime = () => {\n if (this.isSampled()) this.runtimeContext.dispatchViewCommand({ time: Date.now(), type: 'set_loading_time' });\n };\n\n public readonly setViewName = (name: string) => {\n if (this.isSampled()) this.runtimeContext.dispatchViewCommand({ name, type: 'set_name' });\n };\n\n public readonly shutdown = async () => {\n if (this.shutdownTask) return this.shutdownTask;\n // 在任何 await 之前封住启动路径,迟到的 start 不得重新安装监听器或恢复 started。\n this.phase = 'stopped';\n this.shutdownTask = (async () => {\n await this.stopCollection(false);\n await this.flushProviders();\n while (this.teardownCallbacks.length) this.teardownCallbacks.pop()?.();\n await this.tracerProvider.shutdown();\n })();\n return this.shutdownTask;\n };\n\n public readonly start = async () => {\n if (this.phase === 'started' || this.phase === 'starting') {\n return;\n }\n if (this.phase === 'stopped') {\n // shutdown 已经销毁了 provider/processor,此处禁止再次启动\n throw new Error('[bk-ot] instance has been shut down and cannot be restarted; create a new instance instead.');\n }\n if (!this.config.enabled) {\n this.phase = 'started';\n return;\n }\n this.phase = 'starting';\n try {\n await this.startCollection();\n if (this.phase !== 'starting') return;\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n // 页面进入后台或被丢弃前尽力导出批量数据;两个事件并存以覆盖不同浏览器生命周期。\n const flushOnPageHide = () => {\n void this.flush();\n };\n const flushOnHidden = () => {\n if (document.visibilityState === 'hidden') {\n void this.flush();\n }\n };\n window.addEventListener('pagehide', flushOnPageHide);\n document.addEventListener('visibilitychange', flushOnHidden);\n document.addEventListener('freeze', flushOnPageHide);\n this.teardownCallbacks.push(\n () => window.removeEventListener('pagehide', flushOnPageHide),\n () => document.removeEventListener('visibilitychange', flushOnHidden),\n () => document.removeEventListener('freeze', flushOnPageHide),\n );\n }\n } catch (error) {\n while (this.teardownCallbacks.length) {\n this.teardownCallbacks.pop()?.();\n }\n await this.stopCollection(false);\n if (this.phase === 'starting') this.phase = 'idle';\n throw error;\n }\n if (this.phase === 'starting') this.phase = 'started';\n };\n\n public readonly startSpan = (name: string, attributes: Attributes = {}, options?: BkOTStartSpanOptions): Span => {\n const contextTime =\n options?.contextTime ?? (typeof options?.startTime === 'number' ? options.startTime : undefined);\n const runtimeAttributes =\n options?.contextAttributes ??\n (contextTime === undefined ? this.getRuntimeAttributes() : this.getRuntimeAttributesAt(contextTime));\n const redactedAttributes = filterActionAttributes(this.applyRedact({ ...runtimeAttributes, ...attributes }));\n if (redactedAttributes[RUM_ATTRIBUTES.spanType] === RUM_SPAN_TYPE.session) {\n for (const key of Object.keys(redactedAttributes)) {\n if (key.startsWith('view.') || key === RUM_ATTRIBUTES.actionId || key === RUM_ATTRIBUTES.actionIds)\n delete redactedAttributes[key];\n }\n }\n if (\n typeof redactedAttributes[RUM_ATTRIBUTES.sessionId] !== 'string' &&\n !this.sessionTransition.isPending(contextTime ?? Date.now())\n ) {\n // 历史空白区间不能通过 Tracer 的当前上下文补成一个新的 Session。\n return trace.wrapSpanContext(INVALID_SPAN_CONTEXT);\n }\n const spanName = options?.rumSpanType\n ? buildRumSpanName({ attributes: redactedAttributes, spanType: options.rumSpanType })\n : name;\n let parentContext = context.active();\n if (options?.contextTime !== undefined)\n parentContext = parentContext.setValue(RUM_CONTEXT_TIME, options.contextTime);\n if (options?.contextAttributes !== undefined) parentContext = parentContext.setValue(RUM_CONTEXT_SNAPSHOT, true);\n return this.tracer.startSpan(\n spanName,\n {\n kind: options?.kind ?? SpanKind.INTERNAL,\n links: options?.links?.map(link => ({\n ...link,\n context: { ...link.context },\n attributes: this.applyRedact(copyAttributes(link.attributes)),\n })),\n startTime: options?.startTime,\n attributes: redactedAttributes,\n },\n parentContext,\n );\n };\n\n public readonly startView = (options: BkOTStartViewOptions = {}) => {\n // 保存路由意图与允许采集是两件事。首次 hidden/未授权时不能导出,\n // 但也不能让 Router 去重后永久失去该页面;Page View 在 Session 生效后消费。\n if (this.phase === 'stopped') return;\n const captured = { ...options, attributes: copyAttributes(options.attributes) };\n if (this.config.view.tracking === 'manual') this.latestManualViewOptions = captured;\n this.runtimeContext.dispatchViewCommand({ options: captured, type: 'start' });\n };\n\n public readonly tracer: BkOTRuntimeContext['tracer'];\n\n public readonly use = (plugin: BkOTPlugin): this => {\n this.assertBeforeStart('use');\n this.config.extensions.plugins?.push(plugin);\n return this;\n };\n\n public readonly useInstrumentation = (instrumentation: Instrumentation): this => {\n this.assertBeforeStart('useInstrumentation');\n if (this.config.enabled) this.config.extensions.instrumentations?.push(instrumentation);\n return this;\n };\n\n constructor(inputConfig: BkOTOptions) {\n this.config = resolveConfig(inputConfig);\n this.allowInitialResourceHistory = this.config.trackingConsent === 'granted';\n this.sessionTransition = new SessionTransition(this.config.spanBatch?.maxQueueSize ?? 2048);\n this.runtimeContext = new RumRuntimeContext({}, this.config.user);\n\n const resource = resourceFromAttributes(this.config.resourceAttributes);\n const spanProcessors = (() => {\n const exporter = wrapWithDebug(\n new OTLPTraceExporter(createExporterOptions(this.config.transport)),\n this.config.debug,\n );\n const processor =\n this.config.spanProcessor === 'simple'\n ? new SimpleSpanProcessor(exporter)\n : new BatchSpanProcessor(exporter, this.config.spanBatch);\n return [\n new FilteringSpanProcessor(\n processor,\n this.config,\n () =>\n this.applyRedact({\n ...this.runtimeContext.getAttributes(),\n ...this.config.hooks.getPageAttributes(),\n }),\n {\n checkSession: this.sessionTransition.checkSession,\n isPending: this.sessionTransition.isPending,\n whenReady: callback => this.sessionTransition.whenReady(callback, true),\n getAttributesAt: timestamp => this.applyRedact(this.runtimeContext.getAttributesAt(timestamp)),\n isSampled: attributes =>\n this.config.trackingConsent === 'granted' &&\n this.config.enabled &&\n typeof attributes[RUM_ATTRIBUTES.sessionId] === 'string' &&\n isBkOTSampled(this.config, attributes[RUM_ATTRIBUTES.sessionId] as string),\n },\n this.activityObserver.notify,\n ),\n ];\n })();\n this.tracerProvider = new WebTracerProvider({\n resource,\n sampler: new RumSessionSampler(attributes => {\n this.sessionTransition.checkSession();\n if (!this.config.enabled || this.config.trackingConsent !== 'granted') return false;\n const sessionId = attributes[RUM_ATTRIBUTES.sessionId];\n return typeof sessionId === 'string' ? isBkOTSampled(this.config, sessionId) : this.isSampled();\n }),\n spanProcessors,\n });\n this.tracer = this.tracerProvider.getTracer(BK_OT_INSTRUMENTATION_NAME);\n this.registeredInstrumentations = [];\n if (this.config.autoStart) {\n void this.start().catch(error => {\n globalThis.console?.warn('[bk-ot] auto start failed:', error);\n });\n }\n }\n}\n","/*\n * Tencent is pleased to support the open source community by making\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.\n *\n * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):\n *\n * ---------------------------------------------------\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n * documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n * to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of\n * the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { BkOpenTelemetry } from './core/sdk';\n\nif (typeof window !== 'undefined') {\n Object.assign(window, {\n BkOpenTelemetry,\n });\n}\n\nexport default BkOpenTelemetry;\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107],"mappings":"gCAKA,IAAaA,EAAU,QCAjB,EAAK,gCAiBX,SAAgB,EAAwB,EAAY,CAChD,IAAM,EAAmB,IAAI,IAAI,CAAC,EAAW,CAAC,CACxC,EAAmB,IAAI,IACvB,EAAiB,EAAW,MAAM,EAAG,CAC3C,GAAI,CAAC,EAED,UAAa,GAEjB,IAAM,EAAmB,CACrB,MAAO,CAAC,E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