dd-trace 6.24.0 → 6.25.0
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/ci/init.js +2 -22
- package/ext/exporters.js +0 -1
- package/index.d.ts +105 -5
- package/initialize.mjs +5 -2
- package/lambda.d.ts +39 -0
- package/lambda.js +3 -0
- package/package.json +11 -9
- package/packages/datadog-esbuild/index.js +8 -55
- package/packages/datadog-instrumentations/src/aws-lambda.js +88 -0
- package/packages/datadog-instrumentations/src/cucumber.js +5 -2
- package/packages/datadog-instrumentations/src/elevenlabs/activity.js +114 -0
- package/packages/datadog-instrumentations/src/elevenlabs/audio.js +104 -0
- package/packages/datadog-instrumentations/src/elevenlabs/index.js +288 -0
- package/packages/datadog-instrumentations/src/elevenlabs/session.js +444 -0
- package/packages/datadog-instrumentations/src/graphql.js +20 -17
- package/packages/{datadog-esbuild/src/utils.js → datadog-instrumentations/src/helpers/bundler-esm-exports.js} +282 -40
- package/packages/datadog-instrumentations/src/helpers/bundler-transform.js +573 -0
- package/packages/datadog-instrumentations/src/helpers/bundler-utils.js +104 -0
- package/packages/datadog-instrumentations/src/helpers/hook.js +29 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +3 -7
- package/packages/datadog-instrumentations/src/helpers/lambda-handler.js +189 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +2 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +18 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/async-mutex.js +41 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/elevenlabs.js +25 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql.js +0 -36
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/next.js +40 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/openai-agents-realtime.js +23 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/trpc.js +148 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/target-patterns.json +50 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +17 -3
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +59 -2
- package/packages/datadog-instrumentations/src/ioredis.js +101 -3
- package/packages/datadog-instrumentations/src/next.js +19 -6
- package/packages/datadog-instrumentations/src/openai-agents-realtime.js +149 -0
- package/packages/datadog-instrumentations/src/openai-realtime/audio-accumulator.js +27 -0
- package/packages/datadog-instrumentations/src/openai-realtime/index.js +17 -6
- package/packages/datadog-instrumentations/src/openai-realtime/server-playback.js +887 -0
- package/packages/datadog-instrumentations/src/openai-realtime/session.js +150 -25
- package/packages/datadog-instrumentations/src/openai-realtime/turns.js +29 -2
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +11 -9
- package/packages/datadog-instrumentations/src/webdriverio.js +12 -12
- package/packages/datadog-plugin-async-mutex/src/index.js +50 -0
- package/packages/datadog-plugin-aws-lambda/src/index.js +106 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +22 -11
- package/packages/datadog-plugin-elevenlabs/src/index.js +69 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +10 -7
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +19 -52
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +4 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-request-context.js +25 -4
- package/packages/datadog-plugin-http/src/client.js +32 -9
- package/packages/datadog-plugin-http2/src/client.js +38 -13
- package/packages/datadog-plugin-next/src/index.js +112 -14
- package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +5 -3
- package/packages/datadog-plugin-trpc/src/index.js +15 -0
- package/packages/datadog-plugin-trpc/src/procedure.js +48 -0
- package/packages/datadog-plugin-trpc/src/request.js +81 -0
- package/packages/datadog-plugin-undici/src/index.js +22 -7
- package/packages/datadog-turbopack/index.js +4 -28
- package/packages/datadog-turbopack/src/loader.js +14 -452
- package/packages/datadog-webpack/index.js +3 -55
- package/packages/dd-trace/src/aiguard/evaluation.js +62 -1
- package/packages/dd-trace/src/aiguard/sdk.js +8 -2
- package/packages/dd-trace/src/aiguard/tags.js +2 -0
- package/packages/dd-trace/src/appsec/blocking/index.js +4 -0
- package/packages/dd-trace/src/appsec/graphql.js +91 -6
- package/packages/dd-trace/src/appsec/recommended.json +1287 -90
- package/packages/dd-trace/src/before-exit.js +32 -0
- package/packages/dd-trace/src/bootstrap.js +5 -3
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +15 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +12 -34
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +41 -13
- package/packages/dd-trace/src/ci-visibility/exporters/request.js +2 -3
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +1 -2
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +1 -1
- package/packages/dd-trace/src/ci-visibility/telemetry.js +6 -0
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +1 -1
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache-schema.js +9 -134
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache.js +11 -156
- package/packages/dd-trace/src/config/config-types.d.ts +3 -0
- package/packages/dd-trace/src/config/defaults.js +5 -0
- package/packages/dd-trace/src/config/generated-config-types.d.ts +42 -2
- package/packages/dd-trace/src/config/index.js +17 -5
- package/packages/dd-trace/src/config/parsers.js +9 -0
- package/packages/dd-trace/src/config/supported-configurations.json +158 -4
- package/packages/dd-trace/src/constants.js +1 -0
- package/packages/dd-trace/src/debugger/pause-duration-histogram.js +2 -1
- package/packages/dd-trace/src/exporter.js +0 -11
- package/packages/dd-trace/src/exporters/common/request.js +81 -48
- package/packages/dd-trace/src/exporters/common/retry.js +12 -7
- package/packages/dd-trace/src/exporters/common/url.js +1 -1
- package/packages/dd-trace/src/id.js +1 -1
- package/packages/dd-trace/src/lambda/facade.js +74 -0
- package/packages/dd-trace/src/lambda/handler.js +3 -41
- package/packages/dd-trace/src/lambda/index.js +38 -15
- package/packages/dd-trace/src/lambda/runtime/patch.js +19 -3
- package/packages/dd-trace/src/lambda/wrap.js +44 -0
- package/packages/dd-trace/src/llmobs/constants/tags.js +2 -0
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +10 -5
- package/packages/dd-trace/src/llmobs/plugins/elevenlabs.js +96 -0
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +19 -6
- package/packages/dd-trace/src/llmobs/plugins/openai/realtime.js +38 -11
- package/packages/dd-trace/src/llmobs/plugins/vertexai.js +10 -2
- package/packages/dd-trace/src/llmobs/sdk.js +19 -0
- package/packages/dd-trace/src/llmobs/span_processor.js +9 -0
- package/packages/dd-trace/src/llmobs/tagger.js +22 -0
- package/packages/dd-trace/src/log/channels.js +4 -0
- package/packages/dd-trace/src/log/writer.js +6 -1
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +4 -0
- package/packages/dd-trace/src/openfeature/configuration_source.js +35 -27
- package/packages/dd-trace/src/openfeature/flag-selection.js +152 -0
- package/packages/dd-trace/src/openfeature/flagging_provider.js +19 -1
- package/packages/dd-trace/src/openfeature/writers/base.js +1 -3
- package/packages/dd-trace/src/opentelemetry/logs/index.js +11 -0
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +7 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_exporter.js +4 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +19 -1
- package/packages/dd-trace/src/opentelemetry/span-ending-hook.js +5 -1
- package/packages/dd-trace/src/opentelemetry/span-helpers.js +6 -1
- package/packages/dd-trace/src/opentelemetry/span.js +2 -2
- package/packages/dd-trace/src/opentelemetry/startup-config.js +174 -0
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +7 -1
- package/packages/dd-trace/src/opentracing/propagation/tracestate.js +77 -23
- package/packages/dd-trace/src/opentracing/tracer.js +24 -0
- package/packages/dd-trace/src/otel-thread-ctx.js +28 -31
- package/packages/dd-trace/src/plugin_manager.js +34 -7
- package/packages/dd-trace/src/plugins/ci_plugin.js +41 -10
- package/packages/dd-trace/src/plugins/index.js +6 -0
- package/packages/dd-trace/src/plugins/plugin.js +4 -2
- package/packages/dd-trace/src/plugins/tracing.js +1 -1
- package/packages/dd-trace/src/plugins/util/ci.js +18 -1
- package/packages/dd-trace/src/plugins/util/git-cache.js +4 -4
- package/packages/dd-trace/src/plugins/util/git.js +263 -82
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +75 -46
- package/packages/dd-trace/src/plugins/util/inferred_proxy.js +12 -4
- package/packages/dd-trace/src/plugins/util/status-validator.js +23 -10
- package/packages/dd-trace/src/plugins/util/tags.js +6 -0
- package/packages/dd-trace/src/plugins/util/test.js +64 -39
- package/packages/dd-trace/src/plugins/util/url.js +10 -2
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +2 -2
- package/packages/dd-trace/src/plugins/util/web.js +65 -10
- package/packages/dd-trace/src/profiling/webspan-utils.js +6 -5
- package/packages/dd-trace/src/proxy.js +33 -53
- package/packages/dd-trace/src/span_processor.js +20 -0
- package/packages/dd-trace/src/startup-log.js +8 -6
- package/packages/dd-trace/src/telemetry/metrics.js +2 -1
- package/packages/dd-trace/src/tracer.js +0 -2
- package/packages/dd-trace/src/web-tags-cache.js +8 -9
- package/register.js +2 -1
- package/vendor/dist/@apm-js-collab/code-transformer/LICENSE +489 -0
- package/vendor/dist/@datadog/flagging-core/LICENSE +221 -0
- package/vendor/dist/@datadog/flagging-core/index.js +1 -0
- package/vendor/dist/@datadog/openfeature-node-server/LICENSE +21 -1
- package/vendor/dist/@datadog/openfeature-node-server/rules-based/LICENSE +3 -1
- package/vendor/dist/@datadog/sketches-js/LICENSE +263 -0
- package/vendor/dist/@datadog/source-map/LICENSE +1 -0
- package/vendor/dist/@isaacs/ttlcache/LICENSE +13 -0
- package/vendor/dist/@opentelemetry/core/LICENSE +209 -1
- package/vendor/dist/crypto-randomuuid/LICENSE +3 -0
- package/vendor/dist/escape-string-regexp/LICENSE +13 -0
- package/vendor/dist/esquery/LICENSE +2 -0
- package/vendor/dist/https-proxy-agent/LICENSE +80 -1
- package/vendor/dist/istanbul-lib-coverage/LICENSE +2 -0
- package/vendor/dist/jest-docblock/LICENSE +16 -0
- package/vendor/dist/jsonpath-plus/LICENSE +13 -0
- package/vendor/dist/limiter/LICENSE +2 -0
- package/vendor/dist/lodash.sortby/LICENSE +2 -0
- package/vendor/dist/lru-cache/LICENSE +13 -0
- package/vendor/dist/meriyah/LICENSE +13 -0
- package/vendor/dist/module-details-from-path/LICENSE +2 -0
- package/vendor/dist/mutexify/promise/LICENSE +28 -0
- package/vendor/dist/pprof-format/LICENSE +13 -0
- package/vendor/dist/pprof-format/index.js +1 -1
- package/vendor/dist/protobufjs/LICENSE +219 -0
- package/vendor/dist/protobufjs/minimal/LICENSE +219 -0
- package/vendor/dist/proxy-from-env/LICENSE +13 -0
- package/vendor/dist/retry/LICENSE +2 -0
- package/vendor/dist/rfdc/LICENSE +2 -0
- package/vendor/dist/semifies/LICENSE +3 -1
- package/vendor/dist/shell-quote/LICENSE +3 -1
- package/vendor/dist/source-map/LICENSE +1 -0
- package/vendor/dist/source-map/lib/util/LICENSE +1 -0
- package/vendor/dist/tlhunter-sorted-set/LICENSE +2 -0
- package/vendor/dist/ttl-set/LICENSE +28 -0
- package/ci/diagnose.js +0 -2215
- package/ci/runbook.md +0 -299
- package/ci/test-optimization-validation/approval-artifacts.js +0 -175
- package/ci/test-optimization-validation/approval.js +0 -386
- package/ci/test-optimization-validation/artifact-id.js +0 -18
- package/ci/test-optimization-validation/blocker-category.js +0 -24
- package/ci/test-optimization-validation/bounded-json.js +0 -120
- package/ci/test-optimization-validation/ci-command-candidate.js +0 -77
- package/ci/test-optimization-validation/ci-discovery.js +0 -192
- package/ci/test-optimization-validation/ci-package-scripts.js +0 -169
- package/ci/test-optimization-validation/ci-remediation.js +0 -283
- package/ci/test-optimization-validation/cli.js +0 -954
- package/ci/test-optimization-validation/command-blocker.js +0 -377
- package/ci/test-optimization-validation/command-output-policy.js +0 -188
- package/ci/test-optimization-validation/command-runner.js +0 -649
- package/ci/test-optimization-validation/environment.js +0 -88
- package/ci/test-optimization-validation/executable-approval.js +0 -47
- package/ci/test-optimization-validation/executable.js +0 -244
- package/ci/test-optimization-validation/execution-lock.js +0 -70
- package/ci/test-optimization-validation/framework-adapters/cucumber-validation.json +0 -3
- package/ci/test-optimization-validation/framework-adapters/cucumber.js +0 -767
- package/ci/test-optimization-validation/framework-adapters/cypress.js +0 -99
- package/ci/test-optimization-validation/framework-adapters/playwright.js +0 -175
- package/ci/test-optimization-validation/framework-adapters/vitest.js +0 -513
- package/ci/test-optimization-validation/generated-file-policy.js +0 -63
- package/ci/test-optimization-validation/generated-files.js +0 -425
- package/ci/test-optimization-validation/generated-test-contract.js +0 -284
- package/ci/test-optimization-validation/generated-verifier.js +0 -235
- package/ci/test-optimization-validation/literal-environment.js +0 -56
- package/ci/test-optimization-validation/literal-glob.js +0 -52
- package/ci/test-optimization-validation/manifest-loader.js +0 -116
- package/ci/test-optimization-validation/manifest-scaffold.js +0 -1276
- package/ci/test-optimization-validation/manifest-schema.js +0 -695
- package/ci/test-optimization-validation/offline-fixtures.js +0 -335
- package/ci/test-optimization-validation/offline-output.js +0 -406
- package/ci/test-optimization-validation/package-check.js +0 -97
- package/ci/test-optimization-validation/payload-normalizer.js +0 -72
- package/ci/test-optimization-validation/plan-writer.js +0 -541
- package/ci/test-optimization-validation/preflight-runner.js +0 -186
- package/ci/test-optimization-validation/project-build-artifact.js +0 -31
- package/ci/test-optimization-validation/redaction.js +0 -319
- package/ci/test-optimization-validation/report-writer.js +0 -666
- package/ci/test-optimization-validation/result-semantics.js +0 -103
- package/ci/test-optimization-validation/runner-command.js +0 -264
- package/ci/test-optimization-validation/runner-contract.js +0 -695
- package/ci/test-optimization-validation/safe-files.js +0 -202
- package/ci/test-optimization-validation/scenarios/auto-test-retries.js +0 -171
- package/ci/test-optimization-validation/scenarios/basic-reporting.js +0 -407
- package/ci/test-optimization-validation/scenarios/ci-wiring.js +0 -666
- package/ci/test-optimization-validation/scenarios/early-flake-detection.js +0 -142
- package/ci/test-optimization-validation/scenarios/helpers.js +0 -621
- package/ci/test-optimization-validation/scenarios/test-management.js +0 -219
- package/ci/test-optimization-validation/source-text.js +0 -84
- package/ci/test-optimization-validation/static-diagnosis.js +0 -166
- package/ci/test-optimization-validation/test-output.js +0 -120
- package/ci/test-optimization-validation/validation-blocker.js +0 -21
- package/ci/validate-test-optimization.js +0 -3
- package/packages/datadog-esbuild/src/resolver.js +0 -284
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/index.js +0 -156
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/msgpack-to-json.js +0 -287
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/payload-projection.js +0 -84
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/sink.js +0 -368
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/writer.js +0 -59
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
@datadog/flagging-core
|
|
2
|
+
|
|
3
|
+
Apache License
|
|
4
|
+
Version 2.0, January 2004
|
|
5
|
+
http://www.apache.org/licenses/
|
|
6
|
+
|
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
+
|
|
9
|
+
1. Definitions.
|
|
10
|
+
|
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
12
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
13
|
+
|
|
14
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
15
|
+
the copyright owner that is granting the License.
|
|
16
|
+
|
|
17
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
18
|
+
other entities that control, are controlled by, or are under common
|
|
19
|
+
control with that entity. For the purposes of this definition,
|
|
20
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
21
|
+
direction or management of such entity, whether by contract or
|
|
22
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
23
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
24
|
+
|
|
25
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
26
|
+
exercising permissions granted by this License.
|
|
27
|
+
|
|
28
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
29
|
+
including but not limited to software source code, documentation
|
|
30
|
+
source, and configuration files.
|
|
31
|
+
|
|
32
|
+
"Object" form shall mean any form resulting from mechanical
|
|
33
|
+
transformation or translation of a Source form, including but
|
|
34
|
+
not limited to compiled object code, generated documentation,
|
|
35
|
+
and conversions to other media types.
|
|
36
|
+
|
|
37
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
38
|
+
Object form, made available under the License, as indicated by a
|
|
39
|
+
copyright notice that is included in or attached to the work
|
|
40
|
+
(an example is provided in the Appendix below).
|
|
41
|
+
|
|
42
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
43
|
+
form, that is based on (or derived from) the Work and for which the
|
|
44
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
45
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
46
|
+
of this License, Derivative Works shall not include works that remain
|
|
47
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
48
|
+
the Work and Derivative Works thereof.
|
|
49
|
+
|
|
50
|
+
"Contribution" shall mean any work of authorship, including
|
|
51
|
+
the original version of the Work and any modifications or additions
|
|
52
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
53
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
54
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
55
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
56
|
+
means any form of electronic, verbal, or written communication sent
|
|
57
|
+
to the Licensor or its representatives, including but not limited to
|
|
58
|
+
communication on electronic mailing lists, source code control systems,
|
|
59
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
60
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
61
|
+
excluding communication that is conspicuously marked or otherwise
|
|
62
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
63
|
+
|
|
64
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
65
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
66
|
+
subsequently incorporated within the Work.
|
|
67
|
+
|
|
68
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
69
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
70
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
71
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
72
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
73
|
+
Work and such Derivative Works in Source or Object form.
|
|
74
|
+
|
|
75
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
76
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
77
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
78
|
+
(except as stated in this section) patent license to make, have made,
|
|
79
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
80
|
+
where such license applies only to those patent claims licensable
|
|
81
|
+
by such Contributor that are necessarily infringed by their
|
|
82
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
83
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
84
|
+
institute patent litigation against any entity (including a
|
|
85
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
86
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
87
|
+
or contributory patent infringement, then any patent licenses
|
|
88
|
+
granted to You under this License for that Work shall terminate
|
|
89
|
+
as of the date such litigation is filed.
|
|
90
|
+
|
|
91
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
92
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
93
|
+
modifications, and in Source or Object form, provided that You
|
|
94
|
+
meet the following conditions:
|
|
95
|
+
|
|
96
|
+
(a) You must give any other recipients of the Work or
|
|
97
|
+
Derivative Works a copy of this License; and
|
|
98
|
+
|
|
99
|
+
(b) You must cause any modified files to carry prominent notices
|
|
100
|
+
stating that You changed the files; and
|
|
101
|
+
|
|
102
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
103
|
+
that You distribute, all copyright, patent, trademark, and
|
|
104
|
+
attribution notices from the Source form of the Work,
|
|
105
|
+
excluding those notices that do not pertain to any part of
|
|
106
|
+
the Derivative Works; and
|
|
107
|
+
|
|
108
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
109
|
+
distribution, then any Derivative Works that You distribute must
|
|
110
|
+
include a readable copy of the attribution notices contained
|
|
111
|
+
within such NOTICE file, excluding those notices that do not
|
|
112
|
+
pertain to any part of the Derivative Works, in at least one
|
|
113
|
+
of the following places: within a NOTICE text file distributed
|
|
114
|
+
as part of the Derivative Works; within the Source form or
|
|
115
|
+
documentation, if provided along with the Derivative Works; or,
|
|
116
|
+
within a display generated by the Derivative Works, if and
|
|
117
|
+
wherever such third-party notices normally appear. The contents
|
|
118
|
+
of the NOTICE file are for informational purposes only and
|
|
119
|
+
do not modify the License. You may add Your own attribution
|
|
120
|
+
notices within Derivative Works that You distribute, alongside
|
|
121
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
122
|
+
that such additional attribution notices cannot be construed
|
|
123
|
+
as modifying the License.
|
|
124
|
+
|
|
125
|
+
You may add Your own copyright statement to Your modifications and
|
|
126
|
+
may provide additional or different license terms and conditions
|
|
127
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
128
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
129
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
130
|
+
the conditions stated in this License.
|
|
131
|
+
|
|
132
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
133
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
134
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
135
|
+
this License, without any additional terms or conditions.
|
|
136
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
137
|
+
the terms of any separate license agreement you may have executed
|
|
138
|
+
with Licensor regarding such Contributions.
|
|
139
|
+
|
|
140
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
141
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
142
|
+
except as required for reasonable and customary use in describing the
|
|
143
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
144
|
+
|
|
145
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
146
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
147
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
148
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
149
|
+
implied, including, without limitation, any warranties or conditions
|
|
150
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
151
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
152
|
+
appropriateness of using or redistributing the Work and assume any
|
|
153
|
+
risks associated with Your exercise of permissions under this License.
|
|
154
|
+
|
|
155
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
156
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
157
|
+
unless required by applicable law (such as deliberate and grossly
|
|
158
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
159
|
+
liable to You for damages, including any direct, indirect, special,
|
|
160
|
+
incidental, or consequential damages of any character arising as a
|
|
161
|
+
result of this License or out of the use or inability to use the
|
|
162
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
163
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
164
|
+
other commercial damages or losses), even if such Contributor
|
|
165
|
+
has been advised of the possibility of such damages.
|
|
166
|
+
|
|
167
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
168
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
169
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
170
|
+
or other liability obligations and/or rights consistent with this
|
|
171
|
+
License. However, in accepting such obligations, You may act only
|
|
172
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
173
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
174
|
+
defend, and hold each Contributor harmless for any liability
|
|
175
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
176
|
+
of your accepting any such warranty or additional liability.
|
|
177
|
+
|
|
178
|
+
END OF TERMS AND CONDITIONS
|
|
179
|
+
|
|
180
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
181
|
+
|
|
182
|
+
To apply the Apache License to your work, attach the following
|
|
183
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
184
|
+
replaced with your own identifying information. (Don't include
|
|
185
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
186
|
+
comment syntax for the file format. We also recommend that a
|
|
187
|
+
file or class name and description of purpose be included on the
|
|
188
|
+
same "printed page" as the copyright notice for easier
|
|
189
|
+
identification within third-party archives.
|
|
190
|
+
|
|
191
|
+
Copyright 2025-present Datadog, Inc.
|
|
192
|
+
|
|
193
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
194
|
+
you may not use this file except in compliance with the License.
|
|
195
|
+
You may obtain a copy of the License at
|
|
196
|
+
|
|
197
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
198
|
+
|
|
199
|
+
Unless required by applicable law or agreed to in writing, software
|
|
200
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
201
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
|
+
See the License for the specific language governing permissions and
|
|
203
|
+
limitations under the License.
|
|
204
|
+
|
|
205
|
+
------------------------------------------------------------------------------
|
|
206
|
+
|
|
207
|
+
spark-md5
|
|
208
|
+
|
|
209
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
210
|
+
Version 2, December 2004
|
|
211
|
+
|
|
212
|
+
Copyright (C) 2015 André Cruz <amdfcruz@gmail.com>
|
|
213
|
+
|
|
214
|
+
Everyone is permitted to copy and distribute verbatim or modified
|
|
215
|
+
copies of this license document, and changing it is allowed as long
|
|
216
|
+
as the name is changed.
|
|
217
|
+
|
|
218
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
219
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
220
|
+
|
|
221
|
+
0. You just DO WHAT THE FUCK YOU WANT TO.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{var e={"./spark-md5/spark-md5.js"(e){e.exports=function(){"use strict";var e=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function md5cycle(e,t){var r=e[0],a=e[1],n=e[2],i=e[3];r+=(a&n|~a&i)+t[0]-0x28955b88|0,i+=((r=(r<<7|r>>>25)+a|0)&a|~r&n)+t[1]-0x173848aa|0,n+=((i=(i<<12|i>>>20)+r|0)&r|~i&a)+t[2]+0x242070db|0,a+=((n=(n<<17|n>>>15)+i|0)&i|~n&r)+t[3]-0x3e423112|0,r+=((a=(a<<22|a>>>10)+n|0)&n|~a&i)+t[4]-0xa83f051|0,i+=((r=(r<<7|r>>>25)+a|0)&a|~r&n)+t[5]+0x4787c62a|0,n+=((i=(i<<12|i>>>20)+r|0)&r|~i&a)+t[6]-0x57cfb9ed|0,a+=((n=(n<<17|n>>>15)+i|0)&i|~n&r)+t[7]-0x2b96aff|0,r+=((a=(a<<22|a>>>10)+n|0)&n|~a&i)+t[8]+0x698098d8|0,i+=((r=(r<<7|r>>>25)+a|0)&a|~r&n)+t[9]-0x74bb0851|0,n+=((i=(i<<12|i>>>20)+r|0)&r|~i&a)+t[10]-42063|0,a+=((n=(n<<17|n>>>15)+i|0)&i|~n&r)+t[11]-0x76a32842|0,r+=((a=(a<<22|a>>>10)+n|0)&n|~a&i)+t[12]+0x6b901122|0,i+=((r=(r<<7|r>>>25)+a|0)&a|~r&n)+t[13]-0x2678e6d|0,n+=((i=(i<<12|i>>>20)+r|0)&r|~i&a)+t[14]-0x5986bc72|0,a+=((n=(n<<17|n>>>15)+i|0)&i|~n&r)+t[15]+0x49b40821|0,r+=((a=(a<<22|a>>>10)+n|0)&i|n&~i)+t[1]-0x9e1da9e|0,i+=((r=(r<<5|r>>>27)+a|0)&n|a&~n)+t[6]-0x3fbf4cc0|0,n+=((i=(i<<9|i>>>23)+r|0)&a|r&~a)+t[11]+0x265e5a51|0,a+=((n=(n<<14|n>>>18)+i|0)&r|i&~r)+t[0]-0x16493856|0,r+=((a=(a<<20|a>>>12)+n|0)&i|n&~i)+t[5]-0x29d0efa3|0,i+=((r=(r<<5|r>>>27)+a|0)&n|a&~n)+t[10]+0x2441453|0,n+=((i=(i<<9|i>>>23)+r|0)&a|r&~a)+t[15]-0x275e197f|0,a+=((n=(n<<14|n>>>18)+i|0)&r|i&~r)+t[4]-0x182c0438|0,r+=((a=(a<<20|a>>>12)+n|0)&i|n&~i)+t[9]+0x21e1cde6|0,i+=((r=(r<<5|r>>>27)+a|0)&n|a&~n)+t[14]-0x3cc8f82a|0,n+=((i=(i<<9|i>>>23)+r|0)&a|r&~a)+t[3]-0xb2af279|0,a+=((n=(n<<14|n>>>18)+i|0)&r|i&~r)+t[8]+0x455a14ed|0,r+=((a=(a<<20|a>>>12)+n|0)&i|n&~i)+t[13]-0x561c16fb|0,i+=((r=(r<<5|r>>>27)+a|0)&n|a&~n)+t[2]-0x3105c08|0,n+=((i=(i<<9|i>>>23)+r|0)&a|r&~a)+t[7]+0x676f02d9|0,a+=((n=(n<<14|n>>>18)+i|0)&r|i&~r)+t[12]-0x72d5b376|0,r+=((a=(a<<20|a>>>12)+n|0)^n^i)+t[5]-378558|0,i+=((r=(r<<4|r>>>28)+a|0)^a^n)+t[8]-0x788e097f|0,n+=((i=(i<<11|i>>>21)+r|0)^r^a)+t[11]+0x6d9d6122|0,a+=((n=(n<<16|n>>>16)+i|0)^i^r)+t[14]-0x21ac7f4|0,r+=((a=(a<<23|a>>>9)+n|0)^n^i)+t[1]-0x5b4115bc|0,i+=((r=(r<<4|r>>>28)+a|0)^a^n)+t[4]+0x4bdecfa9|0,n+=((i=(i<<11|i>>>21)+r|0)^r^a)+t[7]-0x944b4a0|0,a+=((n=(n<<16|n>>>16)+i|0)^i^r)+t[10]-0x41404390|0,r+=((a=(a<<23|a>>>9)+n|0)^n^i)+t[13]+0x289b7ec6|0,i+=((r=(r<<4|r>>>28)+a|0)^a^n)+t[0]-0x155ed806|0,n+=((i=(i<<11|i>>>21)+r|0)^r^a)+t[3]-0x2b10cf7b|0,a+=((n=(n<<16|n>>>16)+i|0)^i^r)+t[6]+0x4881d05|0,r+=((a=(a<<23|a>>>9)+n|0)^n^i)+t[9]-0x262b2fc7|0,i+=((r=(r<<4|r>>>28)+a|0)^a^n)+t[12]-0x1924661b|0,n+=((i=(i<<11|i>>>21)+r|0)^r^a)+t[15]+0x1fa27cf8|0,a+=((n=(n<<16|n>>>16)+i|0)^i^r)+t[2]-0x3b53a99b|0,a=(a<<23|a>>>9)+n|0,r+=(n^(a|~i))+t[0]-0xbd6ddbc|0,r=(r<<6|r>>>26)+a|0,i+=(a^(r|~n))+t[7]+0x432aff97|0,i=(i<<10|i>>>22)+r|0,n+=(r^(i|~a))+t[14]-0x546bdc59|0,n=(n<<15|n>>>17)+i|0,a+=(i^(n|~r))+t[5]-0x36c5fc7|0,a=(a<<21|a>>>11)+n|0,r+=(n^(a|~i))+t[12]+0x655b59c3|0,r=(r<<6|r>>>26)+a|0,i+=(a^(r|~n))+t[3]-0x70f3336e|0,i=(i<<10|i>>>22)+r|0,n+=(r^(i|~a))+t[10]-1051523|0,n=(n<<15|n>>>17)+i|0,a+=(i^(n|~r))+t[1]-0x7a7ba22f|0,a=(a<<21|a>>>11)+n|0,r+=(n^(a|~i))+t[8]+0x6fa87e4f|0,r=(r<<6|r>>>26)+a|0,i+=(a^(r|~n))+t[15]-0x1d31920|0,i=(i<<10|i>>>22)+r|0,n+=(r^(i|~a))+t[6]-0x5cfebcec|0,n=(n<<15|n>>>17)+i|0,a+=(i^(n|~r))+t[13]+0x4e0811a1|0,a=(a<<21|a>>>11)+n|0,r+=(n^(a|~i))+t[4]-0x8ac817e|0,r=(r<<6|r>>>26)+a|0,i+=(a^(r|~n))+t[11]-0x42c50dcb|0,i=(i<<10|i>>>22)+r|0,n+=(r^(i|~a))+t[2]+0x2ad7d2bb|0,n=(n<<15|n>>>17)+i|0,a+=(i^(n|~r))+t[9]-0x14792c6f|0,a=(a<<21|a>>>11)+n|0,e[0]=r+e[0]|0,e[1]=a+e[1]|0,e[2]=n+e[2]|0,e[3]=i+e[3]|0}function md5blk(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return r}function md5blk_array(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return r}function md51(e){var t,r,a,n,i,o,u=e.length,l=[0x67452301,-0x10325477,-0x67452302,0x10325476];for(t=64;t<=u;t+=64)md5cycle(l,md5blk(e.substring(t-64,t)));for(r=(e=e.substring(t-64)).length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<r;t+=1)a[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(md5cycle(l,a),t=0;t<16;t+=1)a[t]=0;return i=parseInt((n=(n=8*u).toString(16).match(/(.*?)(.{0,8})$/))[2],16),o=parseInt(n[1],16)||0,a[14]=i,a[15]=o,md5cycle(l,a),l}function md51_array(e){var t,r,a,n,i,o,u=e.length,l=[0x67452301,-0x10325477,-0x67452302,0x10325476];for(t=64;t<=u;t+=64)md5cycle(l,md5blk_array(e.subarray(t-64,t)));for(r=(e=t-64<u?e.subarray(t-64):new Uint8Array(0)).length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<r;t+=1)a[t>>2]|=e[t]<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(md5cycle(l,a),t=0;t<16;t+=1)a[t]=0;return i=parseInt((n=(n=8*u).toString(16).match(/(.*?)(.{0,8})$/))[2],16),o=parseInt(n[1],16)||0,a[14]=i,a[15]=o,md5cycle(l,a),l}function rhex(t){var r,a="";for(r=0;r<4;r+=1)a+=e[t>>8*r+4&15]+e[t>>8*r&15];return a}function hex(e){var t;for(t=0;t<e.length;t+=1)e[t]=rhex(e[t]);return e.join("")}function toUtf8(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function utf8Str2ArrayBuffer(e,t){var r,a=e.length,n=new ArrayBuffer(a),i=new Uint8Array(n);for(r=0;r<a;r+=1)i[r]=e.charCodeAt(r);return t?i:n}function arrayBuffer2Utf8Str(e){return String.fromCharCode.apply(null,new Uint8Array(e))}function concatenateArrayBuffers(e,t,r){var a=new Uint8Array(e.byteLength+t.byteLength);return a.set(new Uint8Array(e)),a.set(new Uint8Array(t),e.byteLength),r?a:a.buffer}function hexToBinaryString(e){var t,r=[],a=e.length;for(t=0;t<a-1;t+=2)r.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,r)}function SparkMD5(){this.reset()}return hex(md51("hello")),"u">typeof ArrayBuffer&&!ArrayBuffer.prototype.slice&&function(){function clamp(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(e,t){var r,a,n,i,o=this.byteLength,u=clamp(e,o),l=o;return(void 0!==t&&(l=clamp(t,o)),u>l)?new ArrayBuffer(0):(n=new Uint8Array(a=new ArrayBuffer(r=l-u)),i=new Uint8Array(this,u,r),n.set(i),a)}}(),SparkMD5.prototype.append=function(e){return this.appendBinary(toUtf8(e)),this},SparkMD5.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,r=this._buff.length;for(t=64;t<=r;t+=64)md5cycle(this._hash,md5blk(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},SparkMD5.prototype.end=function(e){var t,r,a=this._buff,n=a.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<n;t+=1)i[t>>2]|=a.charCodeAt(t)<<(t%4<<3);return this._finish(i,n),r=hex(this._hash),e&&(r=hexToBinaryString(r)),this.reset(),r},SparkMD5.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[0x67452301,-0x10325477,-0x67452302,0x10325476],this},SparkMD5.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},SparkMD5.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},SparkMD5.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},SparkMD5.prototype._finish=function(e,t){var r,a,n,i=t;if(e[i>>2]|=128<<(i%4<<3),i>55)for(md5cycle(this._hash,e),i=0;i<16;i+=1)e[i]=0;a=parseInt((r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/))[2],16),n=parseInt(r[1],16)||0,e[14]=a,e[15]=n,md5cycle(this._hash,e)},SparkMD5.hash=function(e,t){return SparkMD5.hashBinary(toUtf8(e),t)},SparkMD5.hashBinary=function(e,t){var r=hex(md51(e));return t?hexToBinaryString(r):r},SparkMD5.ArrayBuffer=function(){this.reset()},SparkMD5.ArrayBuffer.prototype.append=function(e){var t,r=concatenateArrayBuffers(this._buff.buffer,e,!0),a=r.length;for(this._length+=e.byteLength,t=64;t<=a;t+=64)md5cycle(this._hash,md5blk_array(r.subarray(t-64,t)));return this._buff=new Uint8Array(t-64<a?r.buffer.slice(t-64):0),this},SparkMD5.ArrayBuffer.prototype.end=function(e){var t,r,a=this._buff,n=a.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<n;t+=1)i[t>>2]|=a[t]<<(t%4<<3);return this._finish(i,n),r=hex(this._hash),e&&(r=hexToBinaryString(r)),this.reset(),r},SparkMD5.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[0x67452301,-0x10325477,-0x67452302,0x10325476],this},SparkMD5.ArrayBuffer.prototype.getState=function(){var e=SparkMD5.prototype.getState.call(this);return e.buff=arrayBuffer2Utf8Str(e.buff),e},SparkMD5.ArrayBuffer.prototype.setState=function(e){return e.buff=utf8Str2ArrayBuffer(e.buff,!0),SparkMD5.prototype.setState.call(this,e)},SparkMD5.ArrayBuffer.prototype.destroy=SparkMD5.prototype.destroy,SparkMD5.ArrayBuffer.prototype._finish=SparkMD5.prototype._finish,SparkMD5.ArrayBuffer.hash=function(e,t){var r=hex(md51_array(new Uint8Array(e)));return t?hexToBinaryString(r):r},SparkMD5}()}},t={};function __webpack_require__(r){var a=t[r];if(void 0!==a)return a.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,__webpack_require__),n.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";__webpack_require__.r(r),__webpack_require__.d(r,{createExposureEvent:()=>createExposureEvent,MAX_FLAG_SELECTION_VALUES:()=>d,OperatorType:()=>t,configurationToString:()=>configurationToPrecomputedString,evaluatePrecomputedConfiguration:()=>evaluatePrecomputedConfiguration,MAX_FLAG_SELECTION_KEY_PATTERN_BYTES:()=>p,METADATA_FEATURE_PREFIX:()=>_,LRUInMemoryAssignmentCache:()=>LRUInMemoryAssignmentCache,buildEndpointHost:()=>buildEndpointHost,NonExpiringInMemoryAssignmentCache:()=>NonExpiringInMemoryAssignmentCache,matchesRule:()=>matchesRule,buildStorageKeySuffix:()=>buildStorageKeySuffix,FEATURE_DESTINATION_EVALUATION:()=>E,experimentationOptOutCacheKey:()=>experimentationOptOutCacheKey,assignmentCacheKeyToString:()=>assignmentCacheKeyToString,hasExperimentationOptOut:()=>hasExperimentationOptOut,INVALID_EXPERIMENTATION_OPT_OUT:()=>A,createSplitFeatureMetadata:()=>createSplitFeatureMetadata,METADATA_EVALUATION_FEATURE_PREFIX:()=>x,variantTypeToFlagValueType:()=>variantTypeToFlagValueType,FEATURE_DESTINATION_EXPOSURE:()=>y,FlagConfigurationError:()=>FlagConfigurationError,InvalidContextError:()=>InvalidContextError,MD5Sharder:()=>MD5Sharder,featuresWithPrefix:()=>featuresWithPrefix,containsMatchingRule:()=>containsMatchingRule,HAS_EVALUATION_FEATURES_METADATA_KEY:()=>S,assignmentCacheValueToString:()=>assignmentCacheValueToString,matchesShard:()=>matchesShard,configurationFromString:()=>configurationFromPrecomputedString,configMatchesContext:()=>configMatchesContext,TargetingKeyMissingError:()=>TargetingKeyMissingError,getMD5Hash:()=>getMD5Hash,FEATURE_DESTINATION_HOOK:()=>"HOOK",parsePrecomputedConfigurationResponse:()=>parsePrecomputedConfigurationResponse,createFlagEvaluationEvent:()=>createFlagEvaluationEvent,DeterministicSharder:()=>DeterministicSharder,experimentationOptOutPolicy:()=>experimentationOptOutPolicy,prepareUniversalFlagConfiguration:()=>prepareUniversalFlagConfiguration,Sharder:()=>Sharder,SUPPORTED_FLAGS_CAPABILITIES:()=>f,createEvaluationTimestampMetadata:()=>createEvaluationTimestampMetadata,completeExposureDecision:()=>completeExposureDecision,METADATA_EXPOSURE_FEATURE_PREFIX:()=>b,needsActivation:()=>needsActivation,MAX_FLAG_SELECTION_TAG_BYTES:()=>g,evaluateForSubject:()=>evaluateForSubject,isValidRule:()=>isValidRule,prepareExposureDecision:()=>prepareExposureDecision,timeStampNow:()=>timeStampNow,excludesExperimentAt:()=>excludesExperimentAt,acknowledgesExperimentationOptOut:()=>acknowledgesExperimentationOptOut,AbstractAssignmentCache:()=>AbstractAssignmentCache,evaluateRulesBasedConfiguration:()=>evaluateRulesBasedConfiguration,parseOptOutInstant:()=>parseOptOutInstant,evaluate:()=>evaluate,canonicalizeFlagSelection:()=>canonicalizeFlagSelection,compareOptOutInstants:()=>compareOptOutInstants,createEvaluationMetadata:()=>createEvaluationMetadata,getFlagsConfigurationError:()=>getFlagsConfigurationError,getPrecomputedContext:()=>getPrecomputedContext,FlagEvaluationAggregator:()=>FlagEvaluationAggregator});var e,t,a=__webpack_require__("./spark-md5/spark-md5.js"),n=__webpack_require__.n(a);function getMD5Hash(e,t=""){return new(n())().append(t).append(e).end()}function buildStorageKeySuffix(e){return getMD5Hash(e).slice(0,16)}function assignmentCacheKeyToString(e){return getMD5Hash(JSON.stringify({flag:{key:e.flag.key},subject:{id:e.subject.id,attributes:e.subject.attributes}}))}function assignmentCacheValueToString(e){return getMD5Hash(JSON.stringify(e))}let AbstractAssignmentCache=class AbstractAssignmentCache{constructor(e){this.delegate=e}init(){return Promise.resolve()}has(e){return this.get(e)===assignmentCacheValueToString(e)}get(e){return this.delegate.get(assignmentCacheKeyToString(e))}set(e){this.delegate.set(assignmentCacheKeyToString(e),assignmentCacheValueToString(e))}entries(){return this.delegate.entries()}clear(){this.delegate.clear()}};let LRUCache=class LRUCache{constructor(e){this.capacity=e,this.cache=new Map}entries(){return this.cache.entries()}clear(){this.cache.clear()}delete(e){return this.cache.delete(e)}keys(){return this.cache.keys()}values(){return this.cache.values()}has(e){return this.cache.has(e)}get(e){if(!this.has(e))return;let t=this.cache.get(e);return void 0!==t&&(this.delete(e),this.cache.set(e,t)),t}set(e,t){if(0===this.capacity)return this;if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.capacity){let e=this.cache.keys().next().value;e&&this.delete(e)}return this.cache.set(e,t),this}};let LRUInMemoryAssignmentCache=class LRUInMemoryAssignmentCache extends AbstractAssignmentCache{constructor(e){super(new LRUCache(e))}};let NonExpiringInMemoryAssignmentCache=class NonExpiringInMemoryAssignmentCache extends AbstractAssignmentCache{constructor(e=new Map){super(e)}};function configMatchesContext(e,t){if(!(null==e?void 0:e.precomputed))return!1;let r=e.precomputed.context;return!r||contextsEqual(r,t)}function contextsEqual(e,t){return objectsEqual(e,t)}function objectsEqual(e,t){let r=Object.keys(e).sort(),a=Object.keys(t).sort();if(r.length!==a.length)return!1;for(let n=0;n<r.length;n++)if(r[n]!==a[n]||!valuesEqual(e[r[n]],t[a[n]]))return!1;return!0}function isRecord(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function valuesEqual(e,t){return e===t||null!=e&&null!=t&&typeof e==typeof t&&(e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,r)=>valuesEqual(e,t[r])):!!(isRecord(e)&&isRecord(t))&&objectsEqual(e,t))}let i=new WeakMap;function prepareExposureDecision(e,t,r){let a=t.has(r),n=!1;Object.defineProperty(e,"__dd_exposure_cache_hit",{enumerable:!0,get:()=>a}),i.set(e,()=>{n||((a=t.has(r))||t.set(r),n=!0)})}function completeExposureDecision(e){if(e.errorCode||"ERROR"===e.reason)return!1;let t=e.flagMetadata&&i.get(e.flagMetadata);return!!t&&(t(),!0)}function createExposureEvent(e,t){var r,a,n;if(!(null==(r=t.flagMetadata)?void 0:r.doLog))return;let i=null==(a=t.flagMetadata)?void 0:a.allocationKey,o=t.variant;if(!i||!o)return;let{targetingKey:u="",...l}=e,s=null==(n=t.flagMetadata)?void 0:n.__dd_split_serial_id;return{allocation:{key:i},flag:{key:t.flagKey},variant:{key:o},..."number"==typeof s?{serial_id:s}:{},subject:{id:u,attributes:l}}}let o=[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19],u=[0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2];function sha256(e){let t=64*Math.ceil((e.length+9)/64),r=new Uint8Array(t);r.set(e),r[e.length]=128;let a=8*e.length,n=new DataView(r.buffer);n.setUint32(t-8,Math.floor(a/0x100000000),!1),n.setUint32(t-4,a>>>0,!1);let i=[...o],l=new Uint32Array(64);for(let e=0;e<t;e+=64){for(let t=0;t<16;t++)l[t]=n.getUint32(e+4*t,!1);for(let e=16;e<64;e++){let t=l[e-15],r=l[e-2],a=rotateRight(t,7)^rotateRight(t,18)^t>>>3,n=rotateRight(r,17)^rotateRight(r,19)^r>>>10;l[e]=l[e-16]+a+l[e-7]+n>>>0}let[t,r,a,o,s,c,f,d]=i;for(let e=0;e<64;e++){let n=d+(rotateRight(s,6)^rotateRight(s,11)^rotateRight(s,25))+(s&c^~s&f)+u[e]+l[e]>>>0,i=(rotateRight(t,2)^rotateRight(t,13)^rotateRight(t,22))+(t&r^t&a^r&a)>>>0;d=f,f=c,c=s,s=o+n>>>0,o=a,a=r,r=t,t=n+i>>>0}i[0]=i[0]+t>>>0,i[1]=i[1]+r>>>0,i[2]=i[2]+a>>>0,i[3]=i[3]+o>>>0,i[4]=i[4]+s>>>0,i[5]=i[5]+c>>>0,i[6]=i[6]+f>>>0,i[7]=i[7]+d>>>0}let s=new Uint8Array(32),c=new DataView(s.buffer);return i.forEach((e,t)=>{c.setUint32(4*t,e,!1)}),s}function sha256Hex(e){return[...sha256(e)].map(e=>e.toString(16).padStart(2,"0")).join("")}function rotateRight(e,t){return e>>>t|e<<32-t}let l=getUsableTextEncoder();function encodeUtf8(e){return l?l.encode(e):encodeUtf8Fallback(e)}function compareBytes(e,t){for(let r=0;r<Math.min(e.length,t.length);r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return e.length===t.length?0:e.length<t.length?-1:1}function getUsableTextEncoder(){try{let e=new globalThis.TextEncoder;return 0===e.encode("").length?e:void 0}catch(e){return}}function encodeUtf8Fallback(e){let t=[];for(let r=0;r<e.length;r++){let a=e.charCodeAt(r);if(a>=55296&&a<=56319){let t=e.charCodeAt(r+1);t>=56320&&t<=57343?(a=65536+(a-55296<<10)+(t-56320),r++):a=65533}else a>=56320&&a<=57343&&(a=65533);a<=127?t.push(a):a<=2047?t.push(192|a>>6,128|63&a):a<=65535?t.push(224|a>>12,128|a>>6&63,128|63&a):t.push(240|a>>18,128|a>>12&63,128|a>>6&63,128|63&a)}return new Uint8Array(t)}let s=encodeUtf8("datadog.feature-flags.flag-key.v1\0"),c=new WeakMap,f=["assignment-encoding-flag-key-256-v1"];function readFlagKeyObfuscation(e,t){return(void 0===e||!1===e)&&void 0===t?{}:!0!==e||"object"!=typeof t||null===t||Array.isArray(t)?{error:"Invalid precomputed flag-key obfuscation metadata"}:"flag-key-sha256-v1"!==t.scheme?{error:"Unsupported precomputed flag-key obfuscation scheme"}:isLowercaseHex(t.salt,16)?{encoding:t}:{error:"Precomputed flag-key salt must contain 32 lowercase hexadecimal characters"}}function encodePrecomputedFlagKey(e,t){let r=c.get(t);r&&r.salt===t.salt||(r={salt:t.salt,keys:new Map},c.set(t,r));let a=r.keys.get(e);if(void 0!==a)return{key:a};if(!isWellFormedUnicode(e))return{error:"Flag key must contain valid Unicode"};let n=encodeUtf8(e),i=new Uint8Array(s.length+16+n.length);i.set(s);for(let e=0;e<16;e++)i[s.length+e]=Number.parseInt(t.salt.slice(2*e,2*e+2),16);i.set(n,s.length+16);let o=sha256Hex(i);return r.keys.size>=1024&&r.keys.clear(),r.keys.set(e,o),{key:o}}function isLowercaseHex(e,t){return"string"==typeof e&&e.length===2*t&&/^[0-9a-f]+$/.test(e)}function isWellFormedUnicode(e){for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let r=e.charCodeAt(++t);if(!(r>=56320&&r<=57343))return!1}else if(r>=56320&&r<=57343)return!1}return!0}let d=31,g=200,p=200,h="[\\t\\n\\v\\f\\r \\u0085\\u00A0\\u1680\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]",v=RegExp(`^${h}+|${h}+$`,"g"),m=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]/;function canonicalizeFlagSelection(e){if(null==e)return{};if("object"!=typeof e||Array.isArray(e))return{error:"malformed_selection"};let{tags:t,keyPatterns:r}=e;if(!isOptionalStringList(t)||!isOptionalStringList(r))return{error:"malformed_selection"};let a=canonicalizeList(null!=t?t:[]),n=canonicalizeList(null!=r?r:[]);return a.length>d||n.length>d?{error:"too_many_values"}:n.some(e=>encodeUtf8(e).length>p)?{error:"invalid_key_pattern"}:a.some(e=>encodeUtf8(e).length>g)?{error:"invalid_tag"}:0===a.length&&0===n.length?{}:{selection:{tags:a,keyPatterns:n}}}function isOptionalStringList(e){if(null==e)return!0;if(!Array.isArray(e))return!1;for(let t=0;t<e.length;t++){let r=e[t];if("string"!=typeof r||m.test(r))return!1}return!0}function canonicalizeList(e){let t=new Set;for(let r of e){let e=r.replace(v,"");e&&t.add(e)}return[...t].sort((e,t)=>compareBytes(encodeUtf8(e),encodeUtf8(t)))}let y="EXPOSURE",E="EVALUATION",_="__dd_feature.",b="__dd_exposure_feature.",x="__dd_evaluation_feature.",S="__dd_has_evaluation_features",T=new Set;function metadataPrefix(e){switch(e){case"HOOK":return _;case y:return b;case E:return x;default:return}}function warnUnknownDestination(e,t){T.has(e)||T.size>=64||(T.add(e),t.warn(`Ignoring unknown feature destination ${e}`))}function readDestinations(e){if(!Array.isArray(e))return;let t=e.filter(e=>"string"==typeof e&&""!==e);return t.length>0?t:void 0}function isFeatureValue(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}function split_features_isRecord(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function createSplitFeatureMetadata(e,t){let r={entries:{},hasEvaluationFeatures:!1};if(!Array.isArray(e))return r;let a=new Set;for(let n of e){if(!split_features_isRecord(n))continue;let{key:e,value:i,destinations:o}=n;if("string"!=typeof e||""===e||!isFeatureValue(i))continue;let u=readDestinations(o);if(void 0!==u&&!a.has(e))for(let n of(a.add(e),u)){let a=metadataPrefix(n);if(void 0===a){warnUnknownDestination(n,t);continue}r.entries[`${a}${e}`]=i,a===x&&(r.hasEvaluationFeatures=!0)}}return r}function featuresWithPrefix(e,t){let r;if(null!=e){for(let[a,n]of Object.entries(e))a.startsWith(t)&&isFeatureValue(n)&&(null!=r||(r=Object.create(null)),r[a.slice(t.length)]=n);return r}}function timeStampNow(){return new Date().getTime()}function createFlagEvaluationEvent(e,t){let r={flag:{key:e.flagKey},first_evaluation:e.firstEvaluation,last_evaluation:e.lastEvaluation,evaluation_count:e.count,runtime_default_used:e.runtimeDefaultUsed,timestamp:t};return null!=e.targetingKey&&(r.targeting_key=e.targetingKey),e.error&&(r.error={message:e.error}),e.variantKey&&(r.variant={key:e.variantKey}),e.allocationKey&&(r.allocation={key:e.allocationKey}),e.targetingRuleKey&&(r.targeting_rule={key:e.targetingRuleKey}),e.features&&(r.features=e.features),e.targetingContext&&Object.keys(e.targetingContext).length>0&&(r.context={evaluation:e.targetingContext}),r}let FlagEvaluationAggregator=class FlagEvaluationAggregator{constructor(e,t){this.aggregatedData=new Map,this.flushInterval=e,this.onFlush=t}start(){this.intervalId=setInterval(()=>{this.flush()},this.flushInterval)}stop(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this.flush()}addEvaluation(e,t,r){var a,n;let i=this.createAggregationKeyString(e,t,r),o=getEvaluationTimestamp(t),u=this.aggregatedData.get(i);if(u)u.count++,u.lastEvaluation=o,r&&(u.error=r);else{let u=isRuntimeDefaultUsed(t),l=null==(a=t.flagMetadata)?void 0:a.allocationKey,s=null==(n=t.flagMetadata)?void 0:n.targetingRuleKey,{targetingKey:c,...f}=e;this.aggregatedData.set(i,{flagKey:t.flagKey,variantKey:t.variant,allocationKey:l,targetingRuleKey:s,targetingKey:c,targetingContext:f,features:readEvaluationFeatures(t.flagMetadata),count:1,firstEvaluation:o,lastEvaluation:o,runtimeDefaultUsed:u,error:r})}}flush(){if(0===this.aggregatedData.size)return;let e=timeStampNow(),t=Array.from(this.aggregatedData.values()).map(t=>createFlagEvaluationEvent(t,e));this.aggregatedData.clear(),this.onFlush(t)}createAggregationKeyString(e,t,r){var a,n;let i=null==(a=t.flagMetadata)?void 0:a.allocationKey,o=null==(n=t.flagMetadata)?void 0:n.targetingRuleKey,{targetingKey:u,...l}=e;return getMD5Hash(JSON.stringify({flagKey:t.flagKey,variant:t.variant||"",allocationKey:i||"",targetingRuleKey:o||"",targetingKey:u||"",targetingContext:l,features:canonicalEvaluationFeatures(t.flagMetadata),error:r||""}))}};function readEvaluationFeatures(e){if((null==e?void 0:e[S])===!0)return featuresWithPrefix(e,x)}function canonicalEvaluationFeatures(e){let t=readEvaluationFeatures(e);if(void 0===t)return;let r=Object.create(null);for(let e of Object.keys(t).sort())r[e]=t[e];return r}function getEvaluationTimestamp(e){var t;let r=null==(t=e.flagMetadata)?void 0:t.__dd_eval_timestamp_ms;return Number.isFinite(r)?r:timeStampNow()}function isRuntimeDefaultUsed(e){return null==e.variant}function isDate(e){if(null===e||"object"!=typeof e)return!1;try{return Date.prototype.getTime.call(e),!0}catch(e){return!1}}function cloneContextValue(e){return isDate(e)?new Date(Date.prototype.getTime.call(e)):Array.isArray(e)?e.map(cloneContextValue):null!==e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,cloneContextValue(t)])):e}function cloneEvaluationContext(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,cloneContextValue(t)]))}function getPrecomputedContext(e){var t;let r=null==(t=e.precomputed)?void 0:t.context;return void 0===r?void 0:cloneEvaluationContext(r)}function parseConfigurationWire(e){let t;try{t=JSON.parse(e)}catch(e){return}if("object"==typeof t&&null!==t&&"version"in t&&(1===t.version||2===t.version))return t}function decodeSafely(e){try{return e()}catch(e){return}}function isWireEntry(e){return wire_validation_isRecord(e)&&"string"==typeof e.response&&(void 0===e.fetchedAt||"number"==typeof e.fetchedAt&&Number.isFinite(e.fetchedAt))&&(void 0===e.etag||"string"==typeof e.etag)}function isPrecomputedWireEntry(e){return isWireEntry(e)&&(!("context"in e)||isEvaluationContext(e.context))}function parsePrecomputedConfigurationResponse(e){if(!wire_validation_isRecord(e))return{error:"Precomputed configuration response must be an object"};if(!wire_validation_isRecord(e.data))return{error:"Precomputed configuration response is missing data"};if(!wire_validation_isRecord(e.data.attributes))return{error:"Precomputed configuration response is missing attributes"};let{createdAt:t,flags:r,obfuscated:a,obfuscation:n}=e.data.attributes,i=readFlagKeyObfuscation(a,n);if("error"in i)return i;if("string"!=typeof t&&("number"!=typeof t||!Number.isFinite(t)))return{error:"Precomputed configuration createdAt is invalid"};if(!wire_validation_isRecord(r))return{error:"Precomputed configuration flags must be an object"};let o=[];for(let[e,t]of Object.entries(r)){if(i.encoding&&!isLowercaseHex(e,32))return{error:"Obfuscated flag keys must contain 64 lowercase hexadecimal characters"};isPrecomputedFlag(t)||o.push([e,"Invalid precomputed flag configuration"])}return{response:e,...o.length>0?{flagErrors:Object.fromEntries(o)}:{}}}function isEvaluationContext(e){return wire_validation_isRecord(e)&&(void 0===e.targetingKey||"string"==typeof e.targetingKey)&&Object.values(e).every(isJsonValue)}function isPrecomputedFlag(e){if(!wire_validation_isRecord(e)||"string"!=typeof e.allocationKey||"string"!=typeof e.variationKey||"string"!=typeof e.variationType||"string"!=typeof e.reason||"boolean"!=typeof e.doLog)return!1;let t=e.variationType;return"STRING"===t||"string"===t?"string"==typeof e.variationValue:"BOOLEAN"===t||"boolean"===t?"boolean"==typeof e.variationValue:["NUMBER","NUMERIC","INTEGER","number","integer","float"].includes(t)?"number"==typeof e.variationValue&&Number.isFinite(e.variationValue):("OBJECT"===t||"JSON"===t||"object"===t)&&"object"==typeof e.variationValue&&null!==e.variationValue&&isJsonValue(e.variationValue)}function isJsonValue(e){return null===e||"string"==typeof e||"boolean"==typeof e||("number"==typeof e?Number.isFinite(e):Array.isArray(e)?e.every(isJsonValue):wire_validation_isRecord(e)&&Object.values(e).every(isJsonValue))}function wire_validation_isRecord(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function configurationFromPrecomputedString(e){let t=parseConfigurationWire(e);return t?precomputedConfigurationFromWire(t):{configurationError:"Invalid flags configuration wire format"}}function configurationToPrecomputedString(e){return JSON.stringify(precomputedConfigurationToWire(e))}function precomputedConfigurationFromWire(e){if(void 0===e.precomputed)return{};if(!isPrecomputedWireEntry(e.precomputed))return{precomputedError:"Invalid precomputed configuration wire entry"};let{precomputed:t}=e,r=decodeSafely(()=>parsePrecomputedConfigurationResponse(JSON.parse(t.response)));return r?"error"in r?{precomputedError:r.error}:{precomputed:{...t,...r}}:{precomputedError:"Precomputed configuration response is not valid JSON"}}function precomputedConfigurationToWire(e){let t={version:1};if(!e.precomputed)return t;let{context:r,response:a,fetchedAt:n,etag:i}=e.precomputed;return!0===a.data.attributes.obfuscated&&(t.version=2),t.precomputed={context:r,response:JSON.stringify(a),fetchedAt:n,etag:i},t}let TargetingKeyMissingError=class TargetingKeyMissingError extends Error{constructor(){super("Targeting key is required for split evaluation"),this.name="TargetingKeyMissingError"}};let FlagConfigurationError=class FlagConfigurationError extends Error{constructor(e){super(e),this.name="FlagConfigurationError"}};let InvalidContextError=class InvalidContextError extends Error{constructor(){super("Evaluation context is missing a required partition attribute"),this.name="InvalidContextError"}};function parseOptOutInstant(e){if("string"!=typeof e)return;let t=/^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?([Zz]|([+-])(\d{2}):(\d{2}))$/.exec(e);if(!t)return;let[,r,a,n,i,o,u,l="",s,c,f="0",d="0"]=t,g=new Date(0);if(g.setUTCFullYear(+r,a-1,+n),g.setUTCHours(+i,+o,+u,0),g.getUTCFullYear()!==+r||g.getUTCMonth()!==a-1||g.getUTCDate()!==+n||+i>23||+o>59||+u>59||+f>23||+d>59)return;let p="Z"===s.toUpperCase()?0:(3600*f+60*d)*("-"===c?-1:1);if(g.setTime(g.getTime()-1e3*p),!(0>g.getUTCFullYear()||g.getUTCFullYear()>9999))return{seconds:g.getTime()/1e3,fraction:l.slice(0,9).replace(/0+$/,"")}}function compareOptOutInstants(e,t){if(e.seconds!==t.seconds)return e.seconds<t.seconds?-1:1;let r=Math.max(e.fraction.length,t.fraction.length),a=e.fraction.padEnd(r,"0"),n=t.fraction.padEnd(r,"0");return a===n?0:a<n?-1:1}function experimentationOptOutPolicy(e,t=!1){if(!1===t||"disabled"===t||!Object.prototype.hasOwnProperty.call(e,"dd_experimentation_opt_out_at"))return!1;let r=parseOptOutInstant(e.dd_experimentation_opt_out_at);return r?{mode:!0===t?"immediate":t,cutoff:r}:void 0}function needsActivation(e){return"object"==typeof e&&"future_experiments_only"===e.mode}function excludesExperimentAt(e,t,r){if(!e||!t)return!1;if(!0===e||"immediate"===e.mode)return!0;if("invalid"===r.kind)throw new FlagConfigurationError("Invalid randomization activation timestamp");return"missing"===r.kind||compareOptOutInstants(r.instant,e.cutoff)>=0}function experimentationOptOutCacheKey(e){return e?`${e.mode}:${e.cutoff.seconds}:${e.cutoff.fraction}`:"disabled"}let A="Set dd_experimentation_opt_out_at to YYYY-MM-DDTHH:mm:ss[.fraction] with Z or +/-HH:mm, or omit the attribute";function hasExperimentationOptOut(e){return!!Object.prototype.hasOwnProperty.call(e,"dd_experimentation_opt_out_at")&&(!!parseOptOutInstant(e.dd_experimentation_opt_out_at)||void 0)}function acknowledgesExperimentationOptOut(e,t){var r;let a=null==(r=null==e?void 0:e.precomputed)?void 0:r.response.data.attributes.evaluation_options;if(!t)return(null==a?void 0:a.experimentation_opt_out)!==!0&&(null==a?void 0:a.experimentation_opt_out_mode)!=="immediate"&&(null==a?void 0:a.experimentation_opt_out_mode)!=="future_experiments_only";if("immediate"===t.mode)return(null==a?void 0:a.experimentation_opt_out)===!0&&(void 0===a.experimentation_opt_out_mode||"immediate"===a.experimentation_opt_out_mode);let n=parseOptOutInstant(null==a?void 0:a.dd_experimentation_opt_out_at);return(null==a?void 0:a.experimentation_opt_out_mode)===t.mode&&!!n&&0===compareOptOutInstants(n,t.cutoff)}function prepareAllocations(e,t){let r=!0,a=[];for(let n of e){let e=t(n);"invalid"===e.kind&&(r=!1),a.push({allocation:n,activation:e})}return{valid:r,allocations:a}}let R=new WeakMap;function prepareUniversalFlagConfiguration(e){for(let t of Object.values(e.flags))t&&Array.isArray(t.allocations)&&prepareJsonFlagActivations(t);return e}function prepareJsonFlagActivations(e){let t=R.get(e);if(t)return t;let r=prepareAllocations(e.allocations,e=>{let t=null==e?void 0:e.randomizationActivatedAt;if(null==t)return{kind:"missing"};let r=parseOptOutInstant(t);return r?{kind:"valid",instant:r}:{kind:"invalid"}});return R.set(e,r),r}function createEvaluationMetadata(e,t){return{__dd_eval_timestamp_ms:e,__dd_observe_full_evaluation_data:!0===t}}function createEvaluationTimestampMetadata(e){return{__dd_eval_timestamp_ms:e}}let Sharder=class Sharder{};let MD5Sharder=class MD5Sharder extends Sharder{getShard(e,t){return parseInt(getMD5Hash(e).slice(0,8),16)%t}};let DeterministicSharder=class DeterministicSharder extends Sharder{constructor(e){super(),this.lookup=e}getShard(e,t){var r;return null!=(r=this.lookup[e])?r:0}};function matchesShard(e,t,r){let a=(null!=r?r:new MD5Sharder).getShard(hashKey(e.salt,t),e.totalShards);return e.ranges.some(e=>isInShardRange(a,e))}function isInShardRange(e,t){return t.start<=e&&e<t.end}function hashKey(e,t){return`${e}-${t}`}function compileRegex(e){let t=e.match(/^\(\?([imsu]+)\)/),r=t?[...new Set(t[1])].join(""):"";return new RegExp((t?e.slice(t[0].length):e).replace(/\[:alnum:\]/g,"A-Za-z0-9"),r)}function coerceToString(e){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e||"bigint"==typeof e)return String(e);if("object"==typeof e&&null!==e&&!Array.isArray(e))try{if(e.toString!==Object.prototype.toString)return String(e)}catch(e){}}function coerceToNumber(e){return"number"==typeof e?e:"string"==typeof e&&/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(e)?Number(e):void 0}let C="18446744073709551615",O=/^((?:0|[1-9]\d*)(?:\.(?:0|[1-9]\d*))*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;function parseVersion(e){if("string"!=typeof e)return null;let t=O.exec(e);return t?{components:t[1].split("."),prerelease:t[2]?t[2].split("."):[]}:null}function isParsedVersion(e){return e.components.length>0&&e.components.every(e=>/^(?:0|[1-9]\d*)$/.test(e))&&e.prerelease.every(e=>/^[0-9A-Za-z-]+$/.test(e)&&(!/^\d+$/.test(e)||"0"===e||!e.startsWith("0")))}function compareVersions(e,t){var r,a;let n=Math.max(e.components.length,t.components.length);for(let i=0;i<n;i++){let n=compareNumericStrings(null!=(r=e.components[i])?r:"0",null!=(a=t.components[i])?a:"0");if(0!==n)return n}return compareVersionPrerelease(e.prerelease,t.prerelease)}function parseSemver(e){if("string"!=typeof e||0===e.length)return null;let t=e.length;for(let r=0;r<e.length;r++){let a=e.charCodeAt(r);if(45===a||43===a){t=r;break}}let r=parseCoreParts(e.slice(0,t));if(null===r)return null;let a={parts:r,prerelease:""},n=e.slice(t);if(""===n)return a;if("-"===n[0]){let e=(n=n.slice(1)).indexOf("+");if(-1===e)return isValidSemverIdentifiers(n,!1)?{...a,prerelease:n}:null;let t=n.slice(0,e);if(!isValidSemverIdentifiers(t,!1))return null;a.prerelease=t,n=n.slice(e+1)}else{if("+"!==n[0])return null;n=n.slice(1)}return isValidSemverIdentifiers(n,!0)?a:null}function compareSemver(e,t){let r=Math.max(e.parts.length,t.parts.length);for(let a=0;a<r;a++){let r=compareNumericStrings(a<e.parts.length?e.parts[a]:"0",a<t.parts.length?t.parts[a]:"0");if(0!==r)return r}return compareSemverPrerelease(e.prerelease,t.prerelease)}function parseCoreParts(e){if(0===e.length)return null;let t=e.split(".");if(t.length<1)return null;let r=[];for(let e of t){let t=parseCoreIdentifier(e);if(null===t)return null;r.push(t)}return r}function parseCoreIdentifier(e){if(0===e.length||!isAsciiDigit(e.charCodeAt(0)))return null;if("0"===e[0])return 1===e.length?"0":null;for(let t=1;t<e.length;t++)if(!isAsciiDigit(e.charCodeAt(t)))return null;return e.length>C.length||e.length===C.length&&e>C?null:e}function isValidSemverIdentifiers(e,t){let r=0,a=!0;for(let n=0;n<=e.length;n++){if(n===e.length||"."===e[n]){if(n===r||!t&&a&&n-r>1&&"0"===e[r])return!1;r=n+1,a=!0;continue}let i=e.charCodeAt(n);if(!isAsciiAlphanumeric(i)&&"-"!==e[n])return!1;isAsciiDigit(i)||(a=!1)}return!0}function compareSemverPrerelease(e,t){if(e===t)return 0;if(""===e)return 1;if(""===t)return -1;let r=e,a=t;for(;;){let[e,t]=nextSemverIdentifier(r),[n,i]=nextSemverIdentifier(a),o=compareSemverIdentifier(e,n);if(0!==o)return o;if(""===t||""===i){if(""===t&&""===i)return 0;return""===t?-1:1}r=t.slice(1),a=i.slice(1)}}function compareVersionPrerelease(e,t){if(0===e.length||0===t.length)return e.length===t.length?0:0===e.length?1:-1;let r=Math.min(e.length,t.length);for(let a=0;a<r;a++){let r=compareSemverIdentifier(e[a],t[a]);if(0!==r)return r}return e.length===t.length?0:e.length<t.length?-1:1}function nextSemverIdentifier(e){let t=e.indexOf(".");return -1===t?[e,""]:[e.slice(0,t),e.slice(t)]}function compareSemverIdentifier(e,t){let r=isSemverNumericIdentifier(e),a=isSemverNumericIdentifier(t);return r&&a?compareNumericStrings(e,t):r?-1:a?1:compareAsciiStrings(e,t)}function isSemverNumericIdentifier(e){for(let t=0;t<e.length;t++)if(!isAsciiDigit(e.charCodeAt(t)))return!1;return!0}function compareNumericStrings(e,t){return e.length!==t.length?e.length<t.length?-1:1:compareAsciiStrings(e,t)}function compareAsciiStrings(e,t){let r=Math.min(e.length,t.length);for(let a=0;a<r;a++){let r=e.charCodeAt(a),n=t.charCodeAt(a);if(r!==n)return r<n?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function isAsciiDigit(e){return e>=48&&e<=57}function isAsciiAlphanumeric(e){return isAsciiDigit(e)||e>=65&&e<=90||e>=97&&e<=122}(e=t||(t={})).MATCHES="MATCHES",e.NOT_MATCHES="NOT_MATCHES",e.GTE="GTE",e.GT="GT",e.LTE="LTE",e.LT="LT",e.ONE_OF="ONE_OF",e.NOT_ONE_OF="NOT_ONE_OF",e.IS_NULL="IS_NULL",e.SEMVER_EQ="SEMVER_EQ",e.SEMVER_NEQ="SEMVER_NEQ",e.SEMVER_LT="SEMVER_LT",e.SEMVER_LTE="SEMVER_LTE",e.SEMVER_GT="SEMVER_GT",e.SEMVER_GTE="SEMVER_GTE";let M=new Set(Object.values(t));function isValidRule(e){return!!rules_isRecord(e)&&!!Array.isArray(e.conditions)&&e.conditions.every(e=>{if(!rules_isRecord(e)||"string"!=typeof e.attribute||"string"!=typeof e.operator||!M.has(e.operator))return!1;if(isNumericOperator(e.operator))return"number"==typeof e.value&&Number.isFinite(e.value);if(e.operator===t.ONE_OF||e.operator===t.NOT_ONE_OF)return Array.isArray(e.value)&&e.value.every(e=>"string"==typeof e);if(e.operator===t.IS_NULL)return"boolean"==typeof e.value;if(isSemVerOperator(e.operator))return null!==parseSemver(e.value);if("string"!=typeof e.value)return!1;try{return compileRegex(e.value),!0}catch(e){return!1}})}function matchesRule(e,t){return!evaluateRuleConditions(t,e.conditions).includes(!1)}function evaluateRuleConditions(e,t){return t.map(t=>evaluateCondition(e,t))}function evaluateCondition(e,r){let a=e[r.attribute];if(r.operator===t.IS_NULL)return r.value?null==a:null!=a;if(null!=a)switch(r.operator){case t.GTE:case t.GT:case t.LTE:case t.LT:return compareNumber(a,r.value,(e,a)=>r.operator===t.GTE?e>=a:r.operator===t.GT?e>a:r.operator===t.LTE?e<=a:e<a);case t.MATCHES:{let e=coerceToString(a);if(void 0===e)return!1;return compileRegex(r.value).test(e)}case t.NOT_MATCHES:{let e=coerceToString(a);if(void 0===e)return!1;return!compileRegex(r.value).test(e)}case t.ONE_OF:{var n;let e=coerceToString(a);return void 0!==e&&(n=e,r.value.includes(n))}case t.NOT_ONE_OF:{let e=coerceToString(a);return void 0!==e&&isNotOneOf(e,r.value)}case t.SEMVER_EQ:case t.SEMVER_NEQ:case t.SEMVER_LT:case t.SEMVER_LTE:case t.SEMVER_GT:case t.SEMVER_GTE:return evaluateSemverCondition(a,r.value,r.operator)}return!1}function rules_isRecord(e){return"object"==typeof e&&null!==e}function isNumericOperator(e){return e===t.GTE||e===t.GT||e===t.LTE||e===t.LT}function isSemVerOperator(e){return e===t.SEMVER_EQ||e===t.SEMVER_NEQ||e===t.SEMVER_GTE||e===t.SEMVER_GT||e===t.SEMVER_LTE||e===t.SEMVER_LT}function evaluateSemverCondition(e,r,a){if("string"!=typeof e)return!1;let n=parseSemver(e),i=parseSemver(r);if(!n||!i)return!1;let o=compareSemver(n,i);switch(a){case t.SEMVER_EQ:return 0===o;case t.SEMVER_NEQ:return 0!==o;case t.SEMVER_LT:return o<0;case t.SEMVER_LTE:return o<=0;case t.SEMVER_GT:return o>0;case t.SEMVER_GTE:return o>=0}}function isNotOneOf(e,t){return!t.includes(e)}function compareNumber(e,t,r){let a=coerceToNumber(e),n=coerceToNumber(t);return void 0!==a&&void 0!==n&&r(a,n)}function variantTypeToFlagValueType(e){if("BOOLEAN"===e)return"boolean";if("STRING"===e)return"string";if("INTEGER"===e||"NUMERIC"===e)return"number";if("JSON"===e)return"object";throw Error(`Cannot convert variant type to flag value type: ${e}`)}function evaluateForSubject(e,t,r,a,n,i,o=timeStampNow(),u=!1){var l;if(!isValidFlag(e))return i.debug("returning default assignment because flag configuration is invalid",{flagKey:evaluateForSubject_isRecord(e)&&"string"==typeof e.key?e.key:void 0,subjectKey:r}),{value:n,reason:"ERROR",errorCode:"PARSE_ERROR",flagMetadata:createEvaluationTimestampMetadata(o)};if(!e.enabled)return i.debug("returning default assignment because flag is disabled",{flagKey:e.key,subjectKey:r}),{value:n,reason:"DISABLED",flagMetadata:createEvaluationTimestampMetadata(o)};if(!validateTypeMatch(t,e.variationType))return i.debug("variant value type mismatch, returning default value",{flagKey:e.key,subjectKey:r,expectedType:t,variantType:e.variationType}),{value:n,reason:"ERROR",errorCode:"TYPE_MISMATCH",flagMetadata:createEvaluationTimestampMetadata(o)};let s=new Date(o),c=prepareJsonFlagActivations(e);if(!c.valid&&needsActivation(u))return{value:n,reason:"ERROR",errorCode:"PARSE_ERROR"};for(let{allocation:t,activation:n}of c.allocations){if(excludesExperimentAt(u,!1!==t.doLog,n))continue;if(t.startAt&&s<new Date(t.startAt)){i.debug("allocation before start date",{flagKey:e.key,subjectKey:r,allocationKey:t.key,startAt:t.startAt});continue}if(t.endAt&&s>=new Date(t.endAt)){i.debug("allocation after end date",{flagKey:e.key,subjectKey:r,allocationKey:t.key,endAt:t.endAt});continue}if(!containsMatchingRule(t.rules,a,i))continue;let c=selectSplitUsingSharding(t.splits,r,e.key,i);if(c){let a=e.variations[c.variationKey];if(a){i.debug("evaluated a flag",{flagKey:e.key,subjectKey:r,assignment:a.value});let n=(null==(l=t.rules)?void 0:l.length)?"TARGETING_MATCH":c.shards.length?"SPLIT":t.startAt||t.endAt?"DEFAULT":"STATIC",{entries:u,hasEvaluationFeatures:s}=createSplitFeatureMetadata(c.features,i);return{value:a.value,reason:n,variant:a.key,flagMetadata:{...createEvaluationTimestampMetadata(o),__dd_allocation_key:t.key,__dd_do_log:!!t.doLog,__dd_split_serial_id:c.serialId,...u,...s?{[S]:!0}:{},allocationKey:t.key,variationType:variantTypeToFlagValueType(e.variationType),doLog:!!t.doLog}}}}else i.debug("no matching split found for subject",{flagKey:e.key,subjectKey:r,allocationKey:t.key})}return i.debug("returning default assignment because no allocation matched",{flagKey:e.key,subjectKey:r}),{value:n,reason:"DEFAULT",flagMetadata:createEvaluationTimestampMetadata(o)}}function validateTypeMatch(e,t){if("boolean"===e)return"BOOLEAN"===t;if("string"===e)return"STRING"===t;if("number"===e)return"INTEGER"===t||"NUMERIC"===t;if("object"===e)return"JSON"===t;throw Error(`Invalid expected type: ${e}`)}function isValidFlag(e){if(!evaluateForSubject_isRecord(e)||"string"!=typeof e.key||"boolean"!=typeof e.enabled||!isVariantType(e.variationType)||!evaluateForSubject_isRecord(e.variations)||!Array.isArray(e.allocations))return!1;let t=e.variationType,r=e.variations;return!!Object.entries(r).every(([e,r])=>evaluateForSubject_isRecord(r)&&r.key===e&&isValidVariationValue(t,r.value))&&e.allocations.every(e=>evaluateForSubject_isRecord(e)&&Array.isArray(e.splits)&&e.splits.every(e=>evaluateForSubject_isRecord(e)&&"string"==typeof e.variationKey&&Object.prototype.hasOwnProperty.call(r,e.variationKey)&&Array.isArray(e.shards)&&e.shards.every(isValidShard))&&(void 0===e.rules||Array.isArray(e.rules)&&e.rules.every(e=>isValidRule(e))))}function evaluateForSubject_isRecord(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function isVariantType(e){return"BOOLEAN"===e||"INTEGER"===e||"NUMERIC"===e||"STRING"===e||"JSON"===e}function isValidVariationValue(e,t){switch(e){case"BOOLEAN":return"boolean"==typeof t;case"INTEGER":return"number"==typeof t&&Number.isSafeInteger(t);case"NUMERIC":return"number"==typeof t&&Number.isFinite(t);case"STRING":return"string"==typeof t;case"JSON":return"object"==typeof t&&null!==t}}function isValidShard(e){return!!evaluateForSubject_isRecord(e)&&"string"==typeof e.salt&&!!Number.isInteger(e.totalShards)&&!(e.totalShards<=0)&&!(e.totalShards>0xffffffff)&&!!Array.isArray(e.ranges)&&e.ranges.every(t=>evaluateForSubject_isRecord(t)&&Number.isInteger(t.start)&&Number.isInteger(t.end)&&t.start>=0&&t.end>=t.start&&t.end<=e.totalShards)}function containsMatchingRule(e,t,r){return null==e||!e.length||(r.debug("evaluating rules",{rules:JSON.stringify(e),subjectAttributes:t}),e.some(e=>matchesRule(e,t)))}function selectSplitUsingSharding(e,t,r,a){if(!e||0===e.length)return null;for(let n of e)if(a.debug("evaluating split sharding",{flagKey:r,subjectKey:t,variationKey:n.variationKey,shards:n.shards}),n.shards.every(e=>{if(null==t)throw new TargetingKeyMissingError;let i=matchesShard(e,t);return a.debug("shard match result",{flagKey:r,subjectKey:t,variationKey:n.variationKey,shard:e,matches:i}),i}))return a.debug("subject matches split",{flagKey:r,subjectKey:t,variationKey:n.variationKey}),n;return a.debug("subject matches no splits",{flagKey:r,subjectKey:t}),null}function prepareRulesResponse(e){if(e.evaluationRegexCache&&e.evaluationJsonCache&&e.randomizationActivations)return e;let t=new Map;for(let r of Object.values(e.flags))t.set(r,prepareAllocations(r.allocations,e=>{let t=e.randomizationActivatedAt;if(!t)return{kind:"missing"};let r=Number(t.seconds),a=t.nanos;return!Number.isSafeInteger(r)||r<-0xe7791f700||r>0x3afff4417f||!Number.isInteger(a)||a<0||a>=1e9?{kind:"invalid"}:{kind:"valid",instant:{seconds:r,fraction:String(a).padStart(9,"0").replace(/0+$/,"")}}}));return Object.defineProperties(e,{evaluationRegexCache:{value:new Map},evaluationJsonCache:{value:new Map},randomizationActivations:{value:t}}),e}function getOwnProperty(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function evaluateProtobufConfiguration(e,t,r,a,n,i,o=timeStampNow(),u=!1){let{targetingKey:l}=n,s=getOwnProperty(e.flags,r);if(!s)return i.debug("returning default value because flag is not found",{flagKey:r,targetingKey:l}),{value:a,reason:"ERROR",errorCode:"FLAG_NOT_FOUND",flagMetadata:createEvaluationTimestampMetadata(o)};try{if(s.minimumFeatureLevel>0)throw new FlagConfigurationError("Flag requires an unsupported feature level");let c=variationTypeToFlagValueType(s.variationType);if(t!==c)return i.debug("variant value type mismatch, returning default value",{flagKey:r,targetingKey:l,expectedType:t,variantType:s.variationType}),{value:a,reason:"ERROR",errorCode:"TYPE_MISMATCH",flagMetadata:createEvaluationTimestampMetadata(o)};let f=e.randomizationActivations.get(s);if(!f||!f.valid&&needsActivation(u))throw new FlagConfigurationError("Invalid randomization activation timestamp");let d=new Map;for(let{allocation:t,activation:a}of f.allocations){if(excludesExperimentAt(u,t.logExposureEvent,a)||!matchesCondition(t.targetingConditionIndex,e,n,d))continue;let c=computePartitionKey(t,e,n,o),f=t.splits.find(e=>matchesSplit(e,c));if(!f)continue;let g=atIndex(s.variations,f.variationIndex,"split variation"),p=atIndex(e.strings,g.keyStringIndex,"variation key"),h=variationValue(s,g.value,e);i.debug("evaluated a flag",{flagKey:r,targetingKey:l,assignment:h});let{entries:v,hasEvaluationFeatures:m}=createSplitFeatureMetadata(splitFeaturesMetadataInput(f.features),i);return{value:h,reason:resolutionReason(f),variant:p,flagMetadata:{...createEvaluationTimestampMetadata(o),__dd_allocation_key:t.key,__dd_do_log:t.logExposureEvent,__dd_split_serial_id:f.serialId,...v,...m?{[S]:!0}:{},allocationKey:t.key,variationType:variationTypeToFlagValueType(s.variationType),doLog:t.logExposureEvent}}}}catch(e){if(e instanceof FlagConfigurationError)return i.error("returning default value because flag configuration is invalid",{flagKey:r,targetingKey:l,error:e.message}),{value:a,reason:"ERROR",errorCode:"PARSE_ERROR",errorMessage:e.message,flagMetadata:createEvaluationTimestampMetadata(o)};if(e instanceof TargetingKeyMissingError)return{value:a,reason:"ERROR",errorCode:"TARGETING_KEY_MISSING",flagMetadata:createEvaluationTimestampMetadata(o)};if(e instanceof InvalidContextError)return{value:a,reason:"ERROR",errorCode:"INVALID_CONTEXT",flagMetadata:createEvaluationTimestampMetadata(o)};return i.error("Error evaluating flag",{error:e}),{value:a,reason:"ERROR",errorCode:"GENERAL",flagMetadata:createEvaluationTimestampMetadata(o)}}return i.debug("returning default assignment because no allocation matched",{flagKey:r,targetingKey:l}),{value:a,reason:"DEFAULT",flagMetadata:createEvaluationTimestampMetadata(o)}}function matchesCondition(e,t,r,a){let n;if(void 0===e)return!0;let i=a.get(e);if(void 0!==i)return i;let o=atIndex(t.conditions,e,"condition");return n="all"===o.kind.case?o.kind.value.conditionIndexes.every(n=>{if(n>=e)throw new FlagConfigurationError("Condition must only reference preceding conditions");return matchesCondition(n,t,r,a)}):"any"===o.kind.case?o.kind.value.conditionIndexes.some(n=>{if(n>=e)throw new FlagConfigurationError("Condition must only reference preceding conditions");return matchesCondition(n,t,r,a)}):matchesLeafCondition(o,t,r),a.set(e,n),n}function matchesLeafCondition(e,t,r){let a=e.kind;if(void 0===a.case||"all"===a.case||"any"===a.case)throw new FlagConfigurationError("Unsupported condition");let n=attributeValueAt(t,a.value.attributeIndex,r);if("attributePresence"===a.case)return a.value.expectNull?null==n:null!=n;if(null==n)return!1;if("numeric"===a.case){let e=a.value.comparand;if(Number.isNaN(e))throw new FlagConfigurationError("Invalid numeric comparator");let t=coerceToNumber(n);if(void 0===t)return!1;let r=a.value.comparator;if(1===r)return t<e;if(2===r)return t<=e;if(3===r)return t>e;if(4===r)return t>=e;throw new FlagConfigurationError("Unsupported numeric comparator")}if("regex"===a.case){let e=coerceToString(n);if(void 0===e)return!1;let r=compiledRegexAt(t,a.value.regexIndex).test(e);return a.value.negate?!r:r}if("stringMembership"===a.case){let e=coerceToString(n);if(void 0===e)return!1;let r=containsInternedString(a.value.stringIndexes,e,t.strings);return a.value.negate?!r:r}if("sha256Membership"===a.case){let e=coerceToString(n);if(void 0===e)return!1;let t=containsBytes(a.value.sha256,saltedSha256(a.value.salt,encodeUtf8(e)));return a.value.negate?!t:t}if("version"===a.case){let e=versionAt(t.versions,a.value.versionIndex);if("string"!=typeof n)return!1;let r=parseVersion(n);if(!r)return!1;let i=compareVersions(r,e),o=a.value.comparator;if(1===o)return 0===i;if(2===o)return 0!==i;if(3===o)return i<0;if(4===o)return i<=0;if(5===o)return i>0;if(6===o)return i>=0;throw new FlagConfigurationError("Unsupported version comparator")}if("stringComparison"===a.case){let e,r=coerceToString(n);if(void 0===r)return!1;let i=atIndex(t.strings,a.value.stringIndex,"condition string"),o=a.value.comparator;if(1===o)e=r.startsWith(i);else if(2===o)e=r.endsWith(i);else if(3===o)e=r.includes(i);else throw new FlagConfigurationError("Unsupported string comparator");return a.value.negate?!e:e}if("sha256StringComparison"===a.case){let e=coerceToString(n);if(void 0===e)return!1;let t=extractUtf8Bytes(encodeUtf8(e),a.value.length,a.value.comparator),r=void 0!==t&&0===compareBytes(saltedSha256(a.value.salt,t),a.value.sha256);return a.value.negate?!r:r}throw new FlagConfigurationError("Unsupported condition")}function versionAt(e,t){let r=atIndex(e,t,"version");if(!isParsedVersion(r))throw new FlagConfigurationError("Invalid version comparator");return r}function saltedSha256(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),sha256(r)}function extractUtf8Bytes(e,t,r){let a;if(1===r)a=0;else if(2===r)a=e.length-t;else throw new FlagConfigurationError("Unsupported SHA-256 string comparator");if(t>e.length)return;let n=a+t;if(isUtf8Boundary(e,a)&&isUtf8Boundary(e,n))return e.subarray(a,n)}function isUtf8Boundary(e,t){return 0===t||t===e.length||(192&e[t])!=128}function compiledRegexAt(e,t){let r=e.evaluationRegexCache,a=r.get(t);if(null===a)throw new FlagConfigurationError("Invalid regular expression");if(a)return a;let n=atIndex(e.regexes,t,"regex");try{let e=compileRegex(n);return r.set(t,e),e}catch(e){throw r.set(t,null),new FlagConfigurationError("Invalid regular expression")}}function computePartitionKey(e,t,r,a){let n=[];for(let i of e.partitionKey)if("time"===i.kind.case)n.push(a);else if("shardMd5"===i.kind.case){let e=atIndex(t.attributes,i.kind.value.attributeIndex,"partition attribute"),a=evaluateProtobufConfiguration_attributeValue(e,t,r);if(null==a){if("targetingKey"===e.kind.case)throw new TargetingKeyMissingError;throw new InvalidContextError}let o=safeInteger(i.kind.value.totalShards,"Total shards");if(o<=0)throw new FlagConfigurationError("Total shards must be positive");let u=coerceToString(a);if(void 0===u)throw new InvalidContextError;n.push(new MD5Sharder().getShard(`${i.kind.value.salt}${u}`,o))}else throw new FlagConfigurationError("Unsupported partition key");return n}function attributeValueAt(e,t,r){return evaluateProtobufConfiguration_attributeValue(atIndex(e.attributes,t,"condition attribute"),e,r)}function evaluateProtobufConfiguration_attributeValue(e,t,r){if("targetingKey"===e.kind.case)return r.targetingKey;if("attributePath"!==e.kind.case)throw new FlagConfigurationError("Unsupported attribute reference");let{segments:a}=e.kind.value;if(0===a.length||"objectKeyStringIndex"!==a[0].kind.case)throw new FlagConfigurationError("Invalid attribute path");let n=r;for(let e of a)if("objectKeyStringIndex"===e.kind.case){if(!isContextObject(n))return;n=getOwnProperty(n,atIndex(t.strings,e.kind.value,"attribute path"))}else if("arrayIndex"===e.kind.case){if(!Array.isArray(n))return;n=Object.prototype.hasOwnProperty.call(n,e.kind.value)?n[e.kind.value]:void 0}else throw new FlagConfigurationError("Invalid attribute path");return n}function isContextObject(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&!(e instanceof Date)}function matchesSplit(e,t){if(e.ranges.length!==t.length)throw new FlagConfigurationError("Invalid split");return t.every((t,r)=>{let a=atIndex(e.ranges,r,"partition range");return(void 0===a.from||t>=a.from)&&(void 0===a.to||t<a.to)})}function variationValue(e,t,r){let a=variationValueCase(e.variationType);if(t.case!==a)throw new FlagConfigurationError("Variation value does not match flag variation type");if("stringValueIndex"===t.case)return atIndex(r.strings,t.value,"string variation value");if("integerValue"===t.case)return safeInteger(t.value,"Integer variation value");if("numericValue"===t.case){if(!Number.isFinite(t.value))throw new FlagConfigurationError("Numeric variation value is not finite");return t.value}if("booleanValue"===t.case)return t.value;if("jsonStringIndex"===t.case)return jsonValueAt(r,t.value);throw new FlagConfigurationError("Variation value is missing")}function splitFeaturesMetadataInput(e){let t=[];for(let r of e)void 0!==r.value.case&&t.push({key:r.key,value:r.value.value,destinations:r.destinations});return t}function resolutionReason(e){let t=e.reason;return 1===t?"TARGETING_MATCH":2===t?"SPLIT":3===t?"STATIC":4===t?"DEFAULT":"UNKNOWN"}function variationTypeToFlagValueType(e){if(4===e)return"boolean";if(1===e)return"string";if(2===e||3===e)return"number";if(5===e)return"object";throw new FlagConfigurationError("Unsupported variation type")}function variationValueCase(e){if(1===e)return"stringValueIndex";if(2===e)return"integerValue";if(3===e)return"numericValue";if(4===e)return"booleanValue";if(5===e)return"jsonStringIndex";throw new FlagConfigurationError("Unsupported variation type")}function containsInternedString(e,t,r){return e.some(e=>atIndex(r,e,"condition string")===t)}function safeInteger(e,t){let r=Number(e);if(!Number.isSafeInteger(r)||String(r)!==String(e))throw new FlagConfigurationError(`${t} cannot be represented safely as a JavaScript number`);return r}function atIndex(e,t,r){let a=e[t];if(void 0===a)throw new FlagConfigurationError(`Invalid ${r} index`);return a}function jsonValueAt(e,t){let r=e.evaluationJsonCache,a=r.get(t);if(a&&!a.valid)throw new FlagConfigurationError("JSON variation value is invalid");if(a)return a.value;let n=atIndex(e.jsonStrings,t,"JSON variation value");try{let e=JSON.parse(n);if("number"==typeof e&&!Number.isFinite(e))throw Error();return r.set(t,{valid:!0,value:e}),e}catch(e){throw r.set(t,{valid:!1}),new FlagConfigurationError("JSON variation value is invalid")}}function containsBytes(e,t){return e.some(e=>0===compareBytes(e,t))}let I={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}};function evaluatePrecomputedConfiguration(e,t,r,a,n,i=!1,o=I){var u;let l=experimentationOptOutPolicy(n,i);if(void 0===l)return{value:a,reason:"ERROR",errorCode:"INVALID_CONTEXT",errorMessage:A};if(l&&!(null==(u=null==e?void 0:e.precomputed)?void 0:u.context)||!acknowledgesExperimentationOptOut(e,l))return{value:a,reason:"ERROR",errorCode:"INVALID_CONTEXT",errorMessage:"Precomputed configuration must match the subject and acknowledge the requested experimentation opt-out policy"};let s=selectPrecomputedFlagsConfiguration(e,n);if("precomputed"===s.kind)return evaluatePrecomputedFlag(s.configuration,t,r,a,o);let{error:c}=s;return{value:a,reason:"ERROR",errorCode:c.errorCode,...void 0===c.errorMessage?{}:{errorMessage:c.errorMessage}}}function selectPrecomputedFlagsConfiguration(e,t){var r,a;if(void 0===e)return{kind:"error",error:{errorCode:"PROVIDER_NOT_READY",errorMessage:"No flags configuration has been set"}};if(e.precomputed&&configMatchesContext(e,t))return{kind:"precomputed",configuration:e.precomputed};let n=null!=(a=null!=(r=e.configurationError)?r:e.precomputedError)?a:e.rulesError;return void 0!==n?{kind:"error",error:{errorCode:"PARSE_ERROR",errorMessage:n}}:e.precomputed?{kind:"error",error:{errorCode:"INVALID_CONTEXT",errorMessage:"Precomputed flags configuration does not match the current context"}}:{kind:"error",error:{errorCode:"PARSE_ERROR",errorMessage:"Flags configuration contains no usable capability"}}}function evaluatePrecomputedFlag(e,t,r,a,n){let i=e.response.data.attributes,o=readFlagKeyObfuscation(i.obfuscated,i.obfuscation);if("error"in o)return{value:a,reason:"ERROR",errorCode:"PARSE_ERROR",errorMessage:o.error};let u=o.encoding?encodePrecomputedFlagKey(r,o.encoding):{key:r};if("error"in u)return{value:a,reason:"ERROR",errorCode:"FLAG_NOT_FOUND"};let l=e.flagErrors?getOwnProperty(e.flagErrors,u.key):void 0;if(l)return{value:a,reason:"ERROR",errorCode:"PARSE_ERROR",errorMessage:l};let s=getOwnProperty(i.flags,u.key);if(!s)return{value:a,reason:"ERROR",errorCode:"FLAG_NOT_FOUND"};if(s.variationType&&variationTypeToOpenFeature(s.variationType)!==t)return{value:a,reason:"ERROR",errorCode:"TYPE_MISMATCH"};let{entries:c,hasEvaluationFeatures:f}=createSplitFeatureMetadata(s.features,n);return{value:s.variationValue,variant:s.variationKey,flagMetadata:{__dd_allocation_key:s.allocationKey,__dd_do_log:s.doLog,..."number"==typeof s.serialId?{__dd_split_serial_id:s.serialId}:{},allocationKey:s.allocationKey,variationType:s.variationType,doLog:s.doLog,...c,...f?{[S]:!0}:{}},reason:s.reason}}function variationTypeToOpenFeature(e){return({string:"string",boolean:"boolean",number:"number",integer:"number",float:"number",object:"object",BOOLEAN:"boolean",STRING:"string",NUMERIC:"number",INTEGER:"number",JSON:"object"})[e]||e.toLowerCase()}let w={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}};function evaluate(e,t,r,a,n,i=w,o=!1){let u=selectFlagsConfiguration(e,n,o);if("precomputed"===u.kind)return evaluatePrecomputedConfiguration(e,t,r,a,n,o,i);if("rules"===u.kind)return evaluateRulesBasedConfiguration(u.configuration.response,t,r,a,n,i,o);let{error:l}=u;return{value:a,reason:"ERROR",errorCode:l.errorCode,...void 0===l.errorMessage?{}:{errorMessage:l.errorMessage}}}function getFlagsConfigurationError(e,t,r=!1){let a=selectFlagsConfiguration(e,t,r);return"error"===a.kind?a.error:void 0}function selectFlagsConfiguration(e,t,r=!1){var a,n;let i=experimentationOptOutPolicy(t,r);if(void 0===i)return{kind:"error",error:{errorCode:"INVALID_CONTEXT",errorMessage:A}};if(void 0===e)return{kind:"error",error:{errorCode:"PROVIDER_NOT_READY",errorMessage:"No flags configuration has been set"}};if(e.precomputed&&configMatchesContext(e,t)&&(!i||void 0!==e.precomputed.context)&&acknowledgesExperimentationOptOut(e,i))return{kind:"precomputed",configuration:e.precomputed};if(e.rules)return{kind:"rules",configuration:e.rules};if(i&&e.precomputed)return{kind:"error",error:{errorCode:"INVALID_CONTEXT",errorMessage:"Precomputed configuration must match the opted-out subject and acknowledge experimentation opt-out"}};let o=null!=(n=null!=(a=e.configurationError)?a:e.rulesError)?n:e.precomputedError;return void 0!==o?{kind:"error",error:{errorCode:"PARSE_ERROR",errorMessage:o}}:e.precomputed?{kind:"error",error:{errorCode:"INVALID_CONTEXT",errorMessage:"Precomputed flags configuration does not match the current context"}}:{kind:"error",error:{errorCode:"PARSE_ERROR",errorMessage:"Flags configuration contains no usable capability"}}}function evaluateRulesBasedConfiguration(e,t,r,a,n,i,o=!1){let u,l=timeStampNow(),s=createEvaluationMetadata(l,(null==e?void 0:e.observeFullEvaluationData)===!0),c=experimentationOptOutPolicy(n,o);if(void 0===c)return{value:a,reason:"ERROR",errorCode:"INVALID_CONTEXT",errorMessage:A,flagMetadata:s};try{u=evaluateRules(e,t,r,a,n,i,l,c)}catch(e){i.error("Error evaluating flag",{error:e}),u={value:a,reason:"ERROR",errorCode:"GENERAL"}}return{...u,flagMetadata:{...u.flagMetadata,...s}}}function evaluateRules(e,t,r,a,n,i,o,u){if(!e)return{value:a,reason:"ERROR",errorCode:"PROVIDER_NOT_READY",flagMetadata:createEvaluationTimestampMetadata(o)};if(isProtobufConfiguration(e))return evaluateProtobufConfiguration(prepareRulesResponse(e),t,r,a,n,i,o,u);let{targetingKey:l,...s}=n,c={...null!=l?{id:l}:{},...s};if(!Object.prototype.hasOwnProperty.call(e.flags,r))return i.debug("returning default value because flag is not found",{flagKey:r,subjectKey:l}),{value:a,reason:"ERROR",errorCode:"FLAG_NOT_FOUND",flagMetadata:createEvaluationTimestampMetadata(o)};let f=e.flags[r];try{return evaluateForSubject(f,t,l,c,a,i,o,u)}catch(e){if(e instanceof TargetingKeyMissingError)return{value:a,reason:"ERROR",errorCode:"TARGETING_KEY_MISSING",flagMetadata:createEvaluationTimestampMetadata(o)};return i.error("Error evaluating flag",{error:e}),{value:a,reason:"ERROR",errorCode:"GENERAL",flagMetadata:createEvaluationTimestampMetadata(o)}}}function isProtobufConfiguration(e){return"$typeName"in e&&"datadog.ffe.flagging.ufc.v1.FlagsConfiguration"===e.$typeName}let F=new Set(["datadoghq.com","us3.datadoghq.com","us5.datadoghq.com","ap1.datadoghq.com","ap2.datadoghq.com","uk1.datadoghq.com","datadoghq.eu"]);function buildEndpointHost(e,t="preview"){if("ddog-gov.com"===e)throw Error("ddog-gov.com is not supported for flagging endpoints");if("datad0g.com"===e)return`${t}.ff-cdn.datad0g.com`;if(!F.has(e))throw Error(`Unsupported site: ${e}. Supported sites: ${[...F].join(", ")}`);return`${t}.ff-cdn.${e}`}})(),module.exports=r})();
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
@datadog/openfeature-node-server
|
|
2
|
+
|
|
3
|
+
Apache License
|
|
2
4
|
Version 2.0, January 2004
|
|
3
5
|
http://www.apache.org/licenses/
|
|
4
6
|
|
|
@@ -199,3 +201,21 @@
|
|
|
199
201
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
202
|
See the License for the specific language governing permissions and
|
|
201
203
|
limitations under the License.
|
|
204
|
+
|
|
205
|
+
------------------------------------------------------------------------------
|
|
206
|
+
|
|
207
|
+
spark-md5
|
|
208
|
+
|
|
209
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
210
|
+
Version 2, December 2004
|
|
211
|
+
|
|
212
|
+
Copyright (C) 2015 André Cruz <amdfcruz@gmail.com>
|
|
213
|
+
|
|
214
|
+
Everyone is permitted to copy and distribute verbatim or modified
|
|
215
|
+
copies of this license document, and changing it is allowed as long
|
|
216
|
+
as the name is changed.
|
|
217
|
+
|
|
218
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
219
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
220
|
+
|
|
221
|
+
0. You just DO WHAT THE FUCK YOU WANT TO.
|