diff --git a/go.mod b/go.mod
index 35fb0b5de44..7687267b036 100644
--- a/go.mod
+++ b/go.mod
@@ -31,6 +31,7 @@ require (
github.com/crowdsecurity/grokky v0.2.2
github.com/crowdsecurity/machineid v1.0.3
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
+ github.com/evanw/esbuild v0.27.2
github.com/expr-lang/expr v1.17.8
github.com/fatih/color v1.19.0
github.com/fsnotify/fsnotify v1.9.0
@@ -79,6 +80,7 @@ require (
github.com/slack-go/slack v0.21.0
github.com/spf13/cobra v1.10.2
github.com/stretchr/testify v1.11.1
+ github.com/tetratelabs/wazero v1.11.0
github.com/umahmood/haversine v0.0.0-20151105152445-808ab04add26
github.com/wasilibs/go-re2 v1.10.0
github.com/xhit/go-simple-mail/v2 v2.16.0
@@ -190,6 +192,7 @@ require (
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/klauspost/compress v1.18.5 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
+ github.com/kylelemons/godebug v1.1.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e // indirect
github.com/magefile/mage v1.17.1 // indirect
@@ -219,7 +222,6 @@ require (
github.com/shopspring/decimal v1.4.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
- github.com/tetratelabs/wazero v1.11.0 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.2.0 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
diff --git a/go.sum b/go.sum
index 9fe19854a6a..67a39ff5559 100644
--- a/go.sum
+++ b/go.sum
@@ -159,6 +159,8 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU=
github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
+github.com/evanw/esbuild v0.27.2 h1:3xBEws9y/JosfewXMM2qIyHAi+xRo8hVx475hVkJfNg=
+github.com/evanw/esbuild v0.27.2/go.mod h1:D2vIQZqV/vIf/VRHtViaUtViZmG7o+kKmlBfVQuRi48=
github.com/expr-lang/expr v1.17.8 h1:W1loDTT+0PQf5YteHSTpju2qfUfNoBt4yw9+wOEU9VM=
github.com/expr-lang/expr v1.17.8/go.mod h1:8/vRC7+7HBzESEqt5kKpYXxrxkr31SaO8r40VO/1IT4=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
@@ -712,6 +714,7 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
diff --git a/pkg/acquisition/modules/appsec/appsec_hooks_test.go b/pkg/acquisition/modules/appsec/appsec_hooks_test.go
index b2af7da019a..11d39d47ce4 100644
--- a/pkg/acquisition/modules/appsec/appsec_hooks_test.go
+++ b/pkg/acquisition/modules/appsec/appsec_hooks_test.go
@@ -11,6 +11,7 @@ import (
"github.com/crowdsecurity/crowdsec/pkg/appsec"
"github.com/crowdsecurity/crowdsec/pkg/appsec/appsec_rule"
+ "github.com/crowdsecurity/crowdsec/pkg/appsec/challenge"
"github.com/crowdsecurity/crowdsec/pkg/pipeline"
)
@@ -1339,3 +1340,192 @@ func TestAppsecPhaseScopedHooks(t *testing.T) {
runTests(t, tests)
}
+
+func TestAppsecOnChallengeHooks(t *testing.T) {
+ powWorkerURL, err := url.Parse(challenge.ChallengePowWorkerPath)
+ require.NoError(t, err)
+
+ tests := []appsecRuleTest{
+ {
+ name: "pre_eval issues a challenge when no cookie is present",
+ expected_load_ok: true,
+ pre_eval: []appsec.Hook{
+ {Apply: []string{"SendChallenge()"}},
+ },
+ input_request: appsec.ParsedRequest{
+ RemoteAddr: "1.2.3.4",
+ Method: "GET",
+ URI: "/protected",
+ HTTPRequest: &http.Request{Host: "example.com"},
+ },
+ output_asserts: func(events []pipeline.Event, responses []appsec.AppsecTempResponse, appsecResponse appsec.BodyResponse, statusCode int) {
+ require.Len(t, responses, 1)
+ require.Equal(t, appsec.ChallengeRemediation, responses[0].Action)
+ require.NotEmpty(t, responses[0].UserHTTPBodyContent)
+ require.Contains(t, responses[0].UserHeaders["Content-Type"], "text/html")
+ },
+ },
+ {
+ name: "on_challenge: no cookie → user hooks skipped (filter would nil-deref)",
+ expected_load_ok: true,
+ // This filter would nil-deref if it ran without a fingerprint. The
+ // dispatcher must skip it when no cookie is present.
+ on_challenge: []appsec.Hook{
+ {Filter: "fingerprint.Bot.MismatchWebGLInWorker", Apply: []string{"DropRequest('bot')"}},
+ },
+ // Must reference SendChallenge() somewhere to force ChallengeRuntime init.
+ pre_eval: []appsec.Hook{
+ {Filter: "false", Apply: []string{"SendChallenge()"}},
+ },
+ input_request: appsec.ParsedRequest{
+ RemoteAddr: "1.2.3.4",
+ Method: "GET",
+ URI: "/protected",
+ HTTPRequest: &http.Request{Host: "example.com"},
+ },
+ output_asserts: func(events []pipeline.Event, responses []appsec.AppsecTempResponse, appsecResponse appsec.BodyResponse, statusCode int) {
+ require.Len(t, responses, 1)
+ require.False(t, responses[0].InBandInterrupt, "on_challenge must not fire without a fingerprint")
+ },
+ },
+ {
+ name: "on_challenge: PoW worker path served, WAF evaluation skipped",
+ expected_load_ok: true,
+ inband_rules: []appsec_rule.CustomRule{
+ {
+ Name: "rule1",
+ Zones: []string{"ARGS"},
+ Variables: []string{"foo"},
+ Match: appsec_rule.Match{Type: "regex", Value: "^toto"},
+ Transform: []string{"lowercase"},
+ },
+ },
+ // Force the challenge runtime to be initialized by referencing SendChallenge()
+ // in a hook that won't match this request.
+ on_challenge: []appsec.Hook{
+ {Filter: "false", Apply: []string{"SendChallenge()"}},
+ },
+ input_request: appsec.ParsedRequest{
+ RemoteAddr: "1.2.3.4",
+ Method: "GET",
+ URI: challenge.ChallengePowWorkerPath,
+ Args: url.Values{"foo": []string{"toto"}}, // would normally trigger rule1
+ HTTPRequest: &http.Request{Host: "example.com", URL: powWorkerURL},
+ },
+ output_asserts: func(events []pipeline.Event, responses []appsec.AppsecTempResponse, appsecResponse appsec.BodyResponse, statusCode int) {
+ require.Empty(t, events, "WAF should not have evaluated the infrastructure path")
+ require.Len(t, responses, 1)
+ require.Equal(t, appsec.ChallengeRemediation, responses[0].Action)
+ require.Equal(t, challenge.PowWorkerJS, responses[0].UserHTTPBodyContent)
+ require.Contains(t, responses[0].UserHeaders["Content-Type"], "application/javascript")
+ },
+ },
+ {
+ name: "on_challenge: invalid submission returns failed body, no hooks run",
+ expected_load_ok: true,
+ // Unconditional DropRequest in on_challenge must NOT fire on an
+ // invalid submission — the dispatcher returns the failed JSON
+ // body and skips user hooks.
+ on_challenge: []appsec.Hook{
+ {Apply: []string{"DropRequest('should not fire')"}},
+ },
+ // Force ChallengeRuntime init.
+ pre_eval: []appsec.Hook{
+ {Filter: "false", Apply: []string{"SendChallenge()"}},
+ },
+ input_request: appsec.ParsedRequest{
+ RemoteAddr: "1.2.3.4",
+ Method: "POST",
+ URI: challenge.ChallengeSubmitPath,
+ HTTPRequest: func() *http.Request {
+ u, _ := url.Parse(challenge.ChallengeSubmitPath)
+ return &http.Request{Host: "example.com", URL: u, Method: "POST"}
+ }(),
+ },
+ output_asserts: func(events []pipeline.Event, responses []appsec.AppsecTempResponse, appsecResponse appsec.BodyResponse, statusCode int) {
+ require.Len(t, responses, 1)
+ require.Equal(t, appsec.ChallengeRemediation, responses[0].Action)
+ require.JSONEq(t, `{"status":"failed"}`, responses[0].UserHTTPBodyContent)
+ require.False(t, responses[0].InBandInterrupt, "on_challenge hooks must not run on invalid submission")
+ },
+ },
+ {
+ // Mock LAPI (see testAppSecEngine in appsec_test.go) exposes 5.4.3.2
+ // as an allowlisted IP. SendChallenge() must be a no-op for it: no
+ // challenge HTML, no Set-Cookie, response stays at the default pass
+ // action so the request goes through cleanly.
+ name: "allowlisted IP: pre_eval SendChallenge() is suppressed",
+ expected_load_ok: true,
+ pre_eval: []appsec.Hook{
+ {Apply: []string{"SendChallenge()"}},
+ },
+ input_request: appsec.ParsedRequest{
+ ClientIP: "5.4.3.2",
+ RemoteAddr: "5.4.3.2",
+ Method: "GET",
+ URI: "/protected",
+ HTTPRequest: &http.Request{Host: "example.com"},
+ },
+ output_asserts: func(events []pipeline.Event, responses []appsec.AppsecTempResponse, appsecResponse appsec.BodyResponse, statusCode int) {
+ require.Len(t, responses, 1)
+ require.NotEqual(t, appsec.ChallengeRemediation, responses[0].Action,
+ "allowlisted IP must not be challenged")
+ require.Equal(t, appsec.AllowRemediation, appsecResponse.Action)
+ require.Empty(t, responses[0].UserHTTPBodyContent, "no challenge HTML must be served")
+ require.Empty(t, responses[0].UserHTTPCookies, "no challenge cookie must be issued")
+ require.False(t, responses[0].InBandInterrupt)
+ },
+ },
+ {
+ // Same allowlisted IP, but inside a /24 CIDR entry (5.4.4.0/24) —
+ // confirms range matches are honoured the same way as exact IPs.
+ name: "allowlisted CIDR: pre_eval SendChallenge() is suppressed",
+ expected_load_ok: true,
+ pre_eval: []appsec.Hook{
+ {Apply: []string{"SendChallenge()"}},
+ },
+ input_request: appsec.ParsedRequest{
+ ClientIP: "5.4.4.42",
+ RemoteAddr: "5.4.4.42",
+ Method: "GET",
+ URI: "/protected",
+ HTTPRequest: &http.Request{Host: "example.com"},
+ },
+ output_asserts: func(events []pipeline.Event, responses []appsec.AppsecTempResponse, appsecResponse appsec.BodyResponse, statusCode int) {
+ require.Len(t, responses, 1)
+ require.NotEqual(t, appsec.ChallengeRemediation, responses[0].Action)
+ require.Equal(t, appsec.AllowRemediation, appsecResponse.Action)
+ require.Empty(t, responses[0].UserHTTPBodyContent)
+ require.Empty(t, responses[0].UserHTTPCookies)
+ },
+ },
+ {
+ // Allowlisted IPs hitting infrastructure paths must not get the PoW
+ // worker JS served either — ProcessOnChallengeRules short-circuits
+ // before the path-based branch, so the request flows through normal
+ // WAF processing.
+ name: "allowlisted IP: PoW worker path is not served",
+ expected_load_ok: true,
+ // Reference SendChallenge() so ChallengeRuntime initialises.
+ on_challenge: []appsec.Hook{
+ {Filter: "false", Apply: []string{"SendChallenge()"}},
+ },
+ input_request: appsec.ParsedRequest{
+ ClientIP: "5.4.3.2",
+ RemoteAddr: "5.4.3.2",
+ Method: "GET",
+ URI: challenge.ChallengePowWorkerPath,
+ HTTPRequest: &http.Request{Host: "example.com", URL: powWorkerURL},
+ },
+ output_asserts: func(events []pipeline.Event, responses []appsec.AppsecTempResponse, appsecResponse appsec.BodyResponse, statusCode int) {
+ require.Len(t, responses, 1)
+ require.NotEqual(t, appsec.ChallengeRemediation, responses[0].Action,
+ "allowlisted IP must not receive the PoW worker JS")
+ require.NotEqual(t, challenge.PowWorkerJS, responses[0].UserHTTPBodyContent)
+ require.Equal(t, appsec.AllowRemediation, appsecResponse.Action)
+ },
+ },
+ }
+
+ runTests(t, tests)
+}
diff --git a/pkg/acquisition/modules/appsec/appsec_runner.go b/pkg/acquisition/modules/appsec/appsec_runner.go
index 8cf7bda4126..d427c905884 100644
--- a/pkg/acquisition/modules/appsec/appsec_runner.go
+++ b/pkg/acquisition/modules/appsec/appsec_runner.go
@@ -140,9 +140,7 @@ func (r *AppsecRunner) processRequest(state *appsec.AppsecRequestState, request
}
defer func() {
- state.Tx.ProcessLogging()
//We don't close the transaction here, as it will reset coraza internal state and break variable tracking
-
err := r.AppsecRuntime.ProcessPostEvalRules(state, request)
if err != nil {
r.logger.Errorf("unable to process PostEval rules: %s", err)
@@ -156,11 +154,23 @@ func (r *AppsecRunner) processRequest(state *appsec.AppsecRequestState, request
//FIXME: should we abort here ?
}
+ // User has requested valid challenge, but we did not find a valid cookie
+ // Immediately return, everything has been set already
+ if state.RequireChallenge {
+ r.logger.Infof("valid challenge required, skipping WAF evaluation")
+ return nil
+ }
+
if state.DropInfo(request) != nil {
r.logger.Debug("drop helper triggered during pre_eval, skipping WAF evaluation")
return nil
}
+ defer func() {
+ state.Tx.ProcessLogging()
+ //We don't close the transaction here, as it will reset coraza internal state and break variable tracking
+ }()
+
state.Tx.ProcessConnection(request.ClientIP, 0, "", 0)
for k, v := range request.Args {
@@ -220,14 +230,35 @@ func (r *AppsecRunner) processRequest(state *appsec.AppsecRequestState, request
func (r *AppsecRunner) ProcessInBandRules(state *appsec.AppsecRequestState, request *appsec.ParsedRequest) error {
tx := appsec.NewExtendedTransaction(r.AppsecInbandEngine, request.UUID)
state.Tx = tx
- // Even if we have no inband rules, we might have pre-eval or post-eval rules to process
+ // Even if we have no inband rules, we might have pre-eval, post-eval or on_challenge hooks to process
if len(r.AppsecRuntime.InBandRules) == 0 &&
len(r.AppsecRuntime.CommonHooks.PreEval) == 0 &&
len(r.AppsecRuntime.InBandHooks.PreEval) == 0 &&
len(r.AppsecRuntime.CommonHooks.PostEval) == 0 &&
- len(r.AppsecRuntime.InBandHooks.PostEval) == 0 {
+ len(r.AppsecRuntime.InBandHooks.PostEval) == 0 &&
+ len(r.AppsecRuntime.CompiledOnChallenge) == 0 &&
+ r.AppsecRuntime.ChallengeRuntime == nil {
+ return nil
+ }
+
+ // on_challenge runs before any WAF work: it serves PoW infrastructure paths,
+ // validates submissions, and populates state.Fingerprint from the cookie.
+ if err := r.AppsecRuntime.ProcessOnChallengeRules(state, request); err != nil {
+ r.logger.Errorf("unable to process OnChallenge rules: %s", err)
+ }
+
+ // Infrastructure paths (PoW worker, challenge submit) already set up the
+ // full response — skip pre_eval, WAF evaluation and post_eval entirely.
+ if state.RequireChallenge {
+ r.logger.Debugf("challenge response set by on_challenge, skipping WAF evaluation")
return nil
}
+
+ if state.DropInfo(request) != nil {
+ r.logger.Debug("drop helper triggered during on_challenge, skipping WAF evaluation")
+ return nil
+ }
+
err := r.processRequest(state, request)
return err
}
@@ -247,12 +278,6 @@ func (r *AppsecRunner) ProcessOutOfBandRules(state *appsec.AppsecRequestState, r
}
func (r *AppsecRunner) handleInBandInterrupt(state *appsec.AppsecRequestState, request *appsec.ParsedRequest) {
-
- if allowed, reason := r.appsecAllowlistsClient.IsAllowlisted(request.ClientIP); allowed {
- r.logger.Infof("%s is allowlisted by %s, skipping", request.ClientIP, reason)
- return
- }
-
//create the associated event for crowdsec itself
evt, err := EventFromRequest(request, r.Labels, state.Tx.ID())
if err != nil {
@@ -319,12 +344,6 @@ func (r *AppsecRunner) handleInBandInterrupt(state *appsec.AppsecRequestState, r
}
func (r *AppsecRunner) handleOutBandInterrupt(state *appsec.AppsecRequestState, request *appsec.ParsedRequest) {
-
- if allowed, reason := r.appsecAllowlistsClient.IsAllowlisted(request.ClientIP); allowed {
- r.logger.Infof("%s is allowlisted by %s, skipping", request.ClientIP, reason)
- return
- }
-
evt, err := EventFromRequest(request, r.Labels, state.Tx.ID())
if err != nil {
//let's not interrupt the pipeline for this
@@ -391,6 +410,17 @@ func (r *AppsecRunner) handleRequest(request *appsec.ParsedRequest) {
logger.Debug("Request received in runner")
r.AppsecRuntime.ClearResponse(&state)
+ // Allowlisted IPs bypass every form of appsec processing (in-band rules,
+ // hooks, challenge issuance, on_challenge cookie validation, out-of-band
+ // rules). We send the default pass response straight back to the bouncer.
+ if r.appsecAllowlistsClient != nil {
+ if allowed, reason := r.appsecAllowlistsClient.IsAllowlisted(request.ClientIP); allowed {
+ logger.Infof("%s is allowlisted by %s, skipping WAF processing", request.ClientIP, reason)
+ request.ResponseChannel <- state.Response
+ return
+ }
+ }
+
request.IsInBand = true
request.IsOutBand = false
@@ -427,6 +457,9 @@ func (r *AppsecRunner) handleRequest(request *appsec.ParsedRequest) {
// send back the result to the HTTP handler for the InBand part
request.ResponseChannel <- state.Response
+ // TODO: what should we do with challenge remediation for OOB matches ?
+ // (captcha has no special treatment, but is also useless for OOB)
+
//Now let's process the out of band rules
request.IsInBand = false
diff --git a/pkg/acquisition/modules/appsec/appsec_test.go b/pkg/acquisition/modules/appsec/appsec_test.go
index 6cf824e8649..b7103e0fd80 100644
--- a/pkg/acquisition/modules/appsec/appsec_test.go
+++ b/pkg/acquisition/modules/appsec/appsec_test.go
@@ -32,10 +32,12 @@ type appsecRuleTest struct {
pre_eval []appsec.Hook
post_eval []appsec.Hook
on_match []appsec.Hook
+ on_challenge []appsec.Hook
// Phase-scoped hooks (dispatched only during the matching phase)
inband_on_match []appsec.Hook
inband_pre_eval []appsec.Hook
inband_post_eval []appsec.Hook
+ inband_on_challenge []appsec.Hook
outofband_on_match []appsec.Hook
outofband_pre_eval []appsec.Hook
outofband_post_eval []appsec.Hook
@@ -115,6 +117,7 @@ func testAppSecEngine(t *testing.T, test appsecRuleTest) {
PreEval: test.pre_eval,
PostEval: test.post_eval,
OnMatch: test.on_match,
+ OnChallenge: test.on_challenge,
BouncerBlockedHTTPCode: test.BouncerBlockedHTTPCode,
UserBlockedHTTPCode: test.UserBlockedHTTPCode,
UserPassedHTTPCode: test.UserPassedHTTPCode,
@@ -123,11 +126,12 @@ func testAppSecEngine(t *testing.T, test appsecRuleTest) {
}
// Set phase-scoped hooks if any are provided
- if len(test.inband_on_match) > 0 || len(test.inband_pre_eval) > 0 || len(test.inband_post_eval) > 0 {
+ if len(test.inband_on_match) > 0 || len(test.inband_pre_eval) > 0 || len(test.inband_post_eval) > 0 || len(test.inband_on_challenge) > 0 {
appsecCfg.InBand = &appsec.AppsecPhaseConfig{
- OnMatch: test.inband_on_match,
- PreEval: test.inband_pre_eval,
- PostEval: test.inband_post_eval,
+ OnMatch: test.inband_on_match,
+ PreEval: test.inband_pre_eval,
+ PostEval: test.inband_post_eval,
+ OnChallenge: test.inband_on_challenge,
}
}
@@ -146,6 +150,15 @@ func testAppSecEngine(t *testing.T, test appsecRuleTest) {
}
AppsecRuntime.InBandRules = []appsec.AppsecCollection{{Rules: inbandRules, NativeRules: nativeInbandRules}}
AppsecRuntime.OutOfBandRules = []appsec.AppsecCollection{{Rules: outofbandRules, NativeRules: nativeOutofbandRules}}
+
+ // Hooks using SendChallenge() or on_challenge hooks require the WASM
+ // challenge runtime; mirror what pkg/acquisition/modules/appsec/config.go
+ // does in production. We share a single runtime across tests — building
+ // one is expensive (~15-20s for WASM obfuscator warm-up), and none of the
+ // tests mutate runtime-level state like default difficulty.
+ if AppsecRuntime.NeedWASMVM {
+ AppsecRuntime.ChallengeRuntime = getSharedChallengeRuntime(t)
+ }
appsecRunnerUUID := uuid.New().String()
//we copy AppsecRutime for each runner
wrt := *AppsecRuntime
diff --git a/pkg/acquisition/modules/appsec/config.go b/pkg/acquisition/modules/appsec/config.go
index 4b9554faa64..ac3b20a327e 100644
--- a/pkg/acquisition/modules/appsec/config.go
+++ b/pkg/acquisition/modules/appsec/config.go
@@ -20,6 +20,7 @@ import (
"github.com/crowdsecurity/crowdsec/pkg/apiclient/useragent"
"github.com/crowdsecurity/crowdsec/pkg/appsec"
"github.com/crowdsecurity/crowdsec/pkg/appsec/allowlists"
+ "github.com/crowdsecurity/crowdsec/pkg/appsec/challenge"
"github.com/crowdsecurity/crowdsec/pkg/metrics"
)
@@ -115,7 +116,7 @@ func loadCertPool(caCertPath string, logger log.FieldLogger) (*x509.CertPool, er
return caCertPool, nil
}
-func (w *Source) Configure(_ context.Context, yamlConfig []byte, logger *log.Entry, _ metrics.AcquisitionMetricsLevel) error {
+func (w *Source) Configure(ctx context.Context, yamlConfig []byte, logger *log.Entry, _ metrics.AcquisitionMetricsLevel) error {
if w.hub == nil {
return errors.New("appsec datasource requires a hub. this is a bug, please report")
}
@@ -188,6 +189,15 @@ func (w *Source) Configure(_ context.Context, yamlConfig []byte, logger *log.Ent
return fmt.Errorf("unable to build appsec_config: %w", err)
}
+ if appsecRuntime.NeedWASMVM {
+ logger.Info("Initializing WASM runtime for challenge obfuscation")
+ challengeRuntime, err := challenge.NewChallengeRuntime(ctx)
+ if err != nil {
+ return fmt.Errorf("unable to create challenge runtime: %w", err)
+ }
+ appsecRuntime.ChallengeRuntime = challengeRuntime
+ }
+
w.AppsecRuntime = appsecRuntime
err = w.AppsecRuntime.ProcessOnLoadRules()
@@ -201,14 +211,11 @@ func (w *Source) Configure(_ context.Context, yamlConfig []byte, logger *log.Ent
for nbRoutine := range w.config.Routines {
appsecRunnerUUID := uuid.New().String()
- // we copy AppsecRuntime for each runner
- wrt := *w.AppsecRuntime
- wrt.Logger = w.logger.Dup().WithField("runner_uuid", appsecRunnerUUID)
runner := AppsecRunner{
inChan: w.InChan,
UUID: appsecRunnerUUID,
logger: w.logger.WithField("runner_uuid", appsecRunnerUUID),
- AppsecRuntime: &wrt,
+ AppsecRuntime: w.AppsecRuntime,
Labels: w.config.Labels,
appsecAllowlistsClient: w.appsecAllowlistClient,
}
diff --git a/pkg/acquisition/modules/appsec/metrics.go b/pkg/acquisition/modules/appsec/metrics.go
index 167d5828390..734cbe72766 100644
--- a/pkg/acquisition/modules/appsec/metrics.go
+++ b/pkg/acquisition/modules/appsec/metrics.go
@@ -11,6 +11,7 @@ func (*Source) GetMetrics() []prometheus.Collector {
metrics.AppsecReqCounter,
metrics.AppsecBlockCounter,
metrics.AppsecRuleHits,
+ metrics.AppsecFingerprintMismatch,
metrics.AppsecOutbandParsingHistogram,
metrics.AppsecInbandParsingHistogram,
metrics.AppsecGlobalParsingHistogram,
@@ -22,6 +23,7 @@ func (*Source) GetAggregMetrics() []prometheus.Collector {
metrics.AppsecReqCounter,
metrics.AppsecBlockCounter,
metrics.AppsecRuleHits,
+ metrics.AppsecFingerprintMismatch,
metrics.AppsecOutbandParsingHistogram,
metrics.AppsecInbandParsingHistogram,
metrics.AppsecGlobalParsingHistogram,
diff --git a/pkg/acquisition/modules/appsec/testhelpers_test.go b/pkg/acquisition/modules/appsec/testhelpers_test.go
new file mode 100644
index 00000000000..5548154937b
--- /dev/null
+++ b/pkg/acquisition/modules/appsec/testhelpers_test.go
@@ -0,0 +1,31 @@
+package appsecacquisition
+
+import (
+ "context"
+ "sync"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/crowdsecurity/crowdsec/pkg/appsec/challenge"
+)
+
+// sharedChallengeRuntime lazily creates a single ChallengeRuntime for the
+// whole package test run. NewChallengeRuntime runs the obfuscator WASM to
+// generate a challenge JS bundle (~15-20s), so spinning one up per test is
+// prohibitively slow and unnecessary for integration tests that don't mutate
+// runtime-level state.
+var (
+ sharedChallengeRuntimeOnce sync.Once
+ sharedChallengeRuntimeInst *challenge.ChallengeRuntime
+ sharedChallengeRuntimeErr error
+)
+
+func getSharedChallengeRuntime(t *testing.T) *challenge.ChallengeRuntime {
+ t.Helper()
+ sharedChallengeRuntimeOnce.Do(func() {
+ sharedChallengeRuntimeInst, sharedChallengeRuntimeErr = challenge.NewChallengeRuntime(context.Background())
+ })
+ require.NoError(t, sharedChallengeRuntimeErr)
+ return sharedChallengeRuntimeInst
+}
diff --git a/pkg/appsec/appsec.go b/pkg/appsec/appsec.go
index b873b6dbffa..e696dfbd57e 100644
--- a/pkg/appsec/appsec.go
+++ b/pkg/appsec/appsec.go
@@ -11,11 +11,15 @@ import (
corazatypes "github.com/corazawaf/coraza/v3/types"
"github.com/expr-lang/expr"
"github.com/expr-lang/expr/vm"
+ "github.com/prometheus/client_golang/prometheus"
log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v2"
+ "github.com/crowdsecurity/crowdsec/pkg/appsec/challenge"
+ "github.com/crowdsecurity/crowdsec/pkg/appsec/cookie"
"github.com/crowdsecurity/crowdsec/pkg/cwhub"
"github.com/crowdsecurity/crowdsec/pkg/exprhelpers"
+ "github.com/crowdsecurity/crowdsec/pkg/metrics"
"github.com/crowdsecurity/crowdsec/pkg/pipeline"
)
@@ -35,6 +39,7 @@ const (
hookPreEval
hookPostEval
hookOnMatch
+ hookOnChallenge
)
func (s hookStage) String() string {
@@ -47,6 +52,8 @@ func (s hookStage) String() string {
return "post_eval"
case hookOnMatch:
return "on_match"
+ case hookOnChallenge:
+ return "on_challenge"
default:
return "unknown"
}
@@ -77,11 +84,15 @@ func (p *PhaseHooks) get(stage hookStage) []Hook {
}
const (
- BanRemediation = "ban"
- CaptchaRemediation = "captcha"
- AllowRemediation = "allow"
+ BanRemediation = "ban"
+ CaptchaRemediation = "captcha"
+ AllowRemediation = "allow"
+ ChallengeRemediation = "challenge"
)
+const bodyChallengeOK = `{"status":"ok"}`
+const bodyChallengeFailed = `{"status":"failed"}`
+
type phase int
const (
@@ -89,21 +100,26 @@ const (
PhaseOutOfBand
)
-func (h *Hook) Build(stage hookStage) error {
+func (h *Hook) Build(stage hookStage, patcher *appsecExprPatcher) error {
ctx := map[string]any{}
switch stage {
case hookOnLoad:
ctx = GetOnLoadEnv(&AppsecRuntimeConfig{})
case hookPreEval:
- ctx = GetPreEvalEnv(&AppsecRuntimeConfig{}, nil, &ParsedRequest{})
+ ctx = GetPreEvalEnv(&AppsecRuntimeConfig{}, &AppsecRequestState{}, &ParsedRequest{})
case hookPostEval:
- ctx = GetPostEvalEnv(&AppsecRuntimeConfig{}, nil, &ParsedRequest{})
+ ctx = GetPostEvalEnv(&AppsecRuntimeConfig{}, &AppsecRequestState{}, &ParsedRequest{})
case hookOnMatch:
- ctx = GetOnMatchEnv(&AppsecRuntimeConfig{}, nil, &ParsedRequest{}, pipeline.Event{})
+ ctx = GetOnMatchEnv(&AppsecRuntimeConfig{}, &AppsecRequestState{}, &ParsedRequest{}, pipeline.Event{})
+ case hookOnChallenge:
+ ctx = GetOnChallengeEnv(&AppsecRuntimeConfig{}, &AppsecRequestState{}, &ParsedRequest{})
}
opts := exprhelpers.GetExprOptions(ctx)
+ if patcher != nil {
+ opts = append(opts, expr.Patch(patcher))
+ }
if h.Filter != "" {
program, err := expr.Compile(h.Filter, opts...) // FIXME: opts
if err != nil {
@@ -128,11 +144,14 @@ func (h *Hook) Build(stage hookStage) error {
type AppsecTempResponse struct {
InBandInterrupt bool
OutOfBandInterrupt bool
- Action string // allow, deny, captcha, log
- UserHTTPResponseCode int // The response code to send to the user
- BouncerHTTPResponseCode int // The response code to send to the remediation component
- SendEvent bool // do we send an internal event on rule match
- SendAlert bool // do we send an alert on rule match
+ Action string // allow, deny, captcha, challenge, log
+ UserHTTPResponseCode int // The response code to send to the user
+ UserHTTPBodyContent string // The body content to send to the user, only for challenge response
+ UserHTTPCookies []cookie.AppsecCookie // Raw Set-Cookie headers to send to the user.
+ UserHeaders map[string][]string // Headers to send to the user
+ BouncerHTTPResponseCode int // The response code to send to the remediation component
+ SendEvent bool // do we send an internal event on rule match
+ SendAlert bool // do we send an alert on rule match
}
type AppsecDropInfo struct {
@@ -150,6 +169,17 @@ type AppsecRequestState struct {
PendingAction *string
PendingHTTPCode *int
+
+ RequireChallenge bool
+ Fingerprint *challenge.FingerprintData
+ CookiePowDifficulty int // PoW difficulty proven by the client for the current cookie (0 if no/invalid cookie)
+ ChallengeDifficulty *int // per-request PoW difficulty override (nil = use runtime default)
+
+ // LastMismatchReport caches the result of the EvaluateMismatches expr
+ // closure for the current request, so repeated calls from a single
+ // rule expression don't redo the work (or re-emit observability).
+ // nil until the first call.
+ LastMismatchReport *challenge.MismatchReport
}
func (s *AppsecRequestState) ResetResponse(cfg *AppsecConfig) {
@@ -164,8 +194,11 @@ func (s *AppsecRequestState) ResetResponse(cfg *AppsecConfig) {
s.Response.UserHTTPResponseCode = cfg.UserPassedHTTPCode
s.Response.SendEvent = true
s.Response.SendAlert = true
+ s.Response.UserHTTPBodyContent = ""
+ s.Response.UserHTTPCookies = nil
s.PendingAction = nil
s.PendingHTTPCode = nil
+ s.RequireChallenge = false
}
func (s *AppsecRequestState) DropInfo(request *ParsedRequest) *AppsecDropInfo {
@@ -198,11 +231,13 @@ type AppsecSubEngineOpts struct {
// AppsecPhaseConfig holds configuration scoped to a specific phase (inband or outofband).
// Hooks defined here are automatically dispatched only during the corresponding phase.
+// on_challenge is in-band only; setting it under `outofband:` is rejected at Build() time.
type AppsecPhaseConfig struct {
Rules []string `yaml:"rules"`
OnMatch []Hook `yaml:"on_match"`
PreEval []Hook `yaml:"pre_eval"`
PostEval []Hook `yaml:"post_eval"`
+ OnChallenge []Hook `yaml:"on_challenge"`
Options AppsecSubEngineOpts `yaml:"options"`
VariablesTracking []string `yaml:"variables_tracking"`
}
@@ -218,10 +253,11 @@ type AppsecRuntimeConfig struct {
RemediationByTag map[string]string // Also used for ByName, as the name (for modsec rules) is a tag crowdsec-NAME
RemediationById map[int]string
- CompiledOnLoad []Hook // runs once at startup, not phase-scoped
- CommonHooks PhaseHooks // apply to both phases
- InBandHooks PhaseHooks // only run during in-band
- OutOfBandHooks PhaseHooks // only run during out-of-band
+ CompiledOnLoad []Hook // runs once at startup, not phase-scoped
+ CompiledOnChallenge []Hook // in-band only; runs before pre_eval
+ CommonHooks PhaseHooks // apply to both phases
+ InBandHooks PhaseHooks // only run during in-band
+ OutOfBandHooks PhaseHooks // only run during out-of-band
CompiledVariablesTracking []*regexp.Regexp
Config *AppsecConfig
@@ -235,6 +271,10 @@ type AppsecRuntimeConfig struct {
DisabledOutOfBandRuleIds []int
DisabledOutOfBandRulesTags []string // Also used for ByName, as the name (for modsec rules) is a tag crowdsec-NAME
+
+ // True if at least one of the hooks use `RequireValidChallenge`
+ NeedWASMVM bool
+ ChallengeRuntime *challenge.ChallengeRuntime
}
type AppsecConfig struct {
@@ -252,6 +292,7 @@ type AppsecConfig struct {
PreEval []Hook `yaml:"pre_eval"`
PostEval []Hook `yaml:"post_eval"`
OnMatch []Hook `yaml:"on_match"`
+ OnChallenge []Hook `yaml:"on_challenge"`
VariablesTracking []string `yaml:"variables_tracking"`
InbandOptions AppsecSubEngineOpts `yaml:"inband_options"`
OutOfBandOptions AppsecSubEngineOpts `yaml:"outofband_options"`
@@ -376,6 +417,10 @@ func (wc *AppsecConfig) LoadByPath(file string) error {
wc.OnMatch = append(wc.OnMatch, tmp.OnMatch...)
}
+ if tmp.OnChallenge != nil {
+ wc.OnChallenge = append(wc.OnChallenge, tmp.OnChallenge...)
+ }
+
if tmp.VariablesTracking != nil {
wc.VariablesTracking = append(wc.VariablesTracking, tmp.VariablesTracking...)
}
@@ -389,6 +434,7 @@ func (wc *AppsecConfig) LoadByPath(file string) error {
wc.InBand.OnMatch = append(wc.InBand.OnMatch, tmp.InBand.OnMatch...)
wc.InBand.PreEval = append(wc.InBand.PreEval, tmp.InBand.PreEval...)
wc.InBand.PostEval = append(wc.InBand.PostEval, tmp.InBand.PostEval...)
+ wc.InBand.OnChallenge = append(wc.InBand.OnChallenge, tmp.InBand.OnChallenge...)
}
if tmp.OutOfBand != nil {
@@ -399,6 +445,7 @@ func (wc *AppsecConfig) LoadByPath(file string) error {
wc.OutOfBand.OnMatch = append(wc.OutOfBand.OnMatch, tmp.OutOfBand.OnMatch...)
wc.OutOfBand.PreEval = append(wc.OutOfBand.PreEval, tmp.OutOfBand.PreEval...)
wc.OutOfBand.PostEval = append(wc.OutOfBand.PostEval, tmp.OutOfBand.PostEval...)
+ wc.OutOfBand.OnChallenge = append(wc.OutOfBand.OnChallenge, tmp.OutOfBand.OnChallenge...)
}
// override other options
@@ -468,7 +515,7 @@ func (wc *AppsecConfig) normalizePhaseScoped() {
}
// buildHookList validates and compiles a list of hooks of the given stage.
-func buildHookList(hooks []Hook, stage hookStage) ([]Hook, error) {
+func buildHookList(hooks []Hook, stage hookStage, patcher *appsecExprPatcher) ([]Hook, error) {
var compiled []Hook
for _, hook := range hooks {
@@ -476,7 +523,7 @@ func buildHookList(hooks []Hook, stage hookStage) ([]Hook, error) {
return nil, fmt.Errorf("invalid 'on_success' for %s hook : %s", stage, hook.OnSuccess)
}
- if err := hook.Build(stage); err != nil {
+ if err := hook.Build(stage, patcher); err != nil {
return nil, fmt.Errorf("unable to build %s hook : %w", stage, err)
}
@@ -488,7 +535,7 @@ func buildHookList(hooks []Hook, stage hookStage) ([]Hook, error) {
// buildPhaseHooks compiles pre_eval / post_eval / on_match hook lists into a
// PhaseHooks. phaseName is only used to wrap errors ("" for the shared section).
-func buildPhaseHooks(phaseName string, pre, post, onMatch []Hook) (PhaseHooks, error) {
+func buildPhaseHooks(phaseName string, pre, post, onMatch []Hook, patcher *appsecExprPatcher) (PhaseHooks, error) {
var (
out PhaseHooks
err error
@@ -501,15 +548,15 @@ func buildPhaseHooks(phaseName string, pre, post, onMatch []Hook) (PhaseHooks, e
return fmt.Errorf("%s: %w", phaseName, e)
}
- if out.PreEval, err = buildHookList(pre, hookPreEval); err != nil {
+ if out.PreEval, err = buildHookList(pre, hookPreEval, patcher); err != nil {
return PhaseHooks{}, wrap(err)
}
- if out.PostEval, err = buildHookList(post, hookPostEval); err != nil {
+ if out.PostEval, err = buildHookList(post, hookPostEval, patcher); err != nil {
return PhaseHooks{}, wrap(err)
}
- if out.OnMatch, err = buildHookList(onMatch, hookOnMatch); err != nil {
+ if out.OnMatch, err = buildHookList(onMatch, hookOnMatch, patcher); err != nil {
return PhaseHooks{}, wrap(err)
}
@@ -562,10 +609,10 @@ func (wc *AppsecConfig) Build(hub *cwhub.Hub) (*AppsecRuntimeConfig, error) {
// set the defaults
switch wc.DefaultRemediation {
- case BanRemediation, CaptchaRemediation, AllowRemediation:
+ case BanRemediation, CaptchaRemediation, AllowRemediation, ChallengeRemediation:
// those are the officially supported remediation(s)
default:
- wc.Logger.Warningf("default '%s' remediation of %s is none of [%s,%s,%s] ensure bouncer compatbility!", wc.DefaultRemediation, wc.Name, BanRemediation, CaptchaRemediation, AllowRemediation)
+ wc.Logger.Warningf("default '%s' remediation of %s is none of [%s,%s,%s,%s] ensure bouncer compatbility!", wc.DefaultRemediation, wc.Name, BanRemediation, CaptchaRemediation, AllowRemediation, ChallengeRemediation)
}
ret.Name = wc.Name
@@ -600,29 +647,52 @@ func (wc *AppsecConfig) Build(hub *cwhub.Hub) (*AppsecRuntimeConfig, error) {
wc.Logger.Infof("Loaded %d inband rules", len(ret.InBandRules))
+ patcher := &appsecExprPatcher{}
+
// load hooks
var err error
- if ret.CompiledOnLoad, err = buildHookList(wc.OnLoad, hookOnLoad); err != nil {
+ if ret.CompiledOnLoad, err = buildHookList(wc.OnLoad, hookOnLoad, nil); err != nil {
return nil, err
}
- if ret.CommonHooks, err = buildPhaseHooks("", wc.PreEval, wc.PostEval, wc.OnMatch); err != nil {
+ if ret.CommonHooks, err = buildPhaseHooks("", wc.PreEval, wc.PostEval, wc.OnMatch, patcher); err != nil {
return nil, err
}
if wc.InBand != nil {
if ret.InBandHooks, err = buildPhaseHooks("inband",
- wc.InBand.PreEval, wc.InBand.PostEval, wc.InBand.OnMatch); err != nil {
+ wc.InBand.PreEval, wc.InBand.PostEval, wc.InBand.OnMatch, patcher); err != nil {
return nil, err
}
}
if wc.OutOfBand != nil {
if ret.OutOfBandHooks, err = buildPhaseHooks("outofband",
- wc.OutOfBand.PreEval, wc.OutOfBand.PostEval, wc.OutOfBand.OnMatch); err != nil {
+ wc.OutOfBand.PreEval, wc.OutOfBand.PostEval, wc.OutOfBand.OnMatch, patcher); err != nil {
return nil, err
}
+
+ if len(wc.OutOfBand.OnChallenge) > 0 {
+ return nil, errors.New("on_challenge hooks are only valid in-band, not under outofband")
+ }
+ }
+
+ // on_challenge hooks: merge top-level and inband-scoped (both are in-band only).
+ onChallengeHooks := wc.OnChallenge
+ if wc.InBand != nil {
+ onChallengeHooks = append(onChallengeHooks, wc.InBand.OnChallenge...)
+ }
+
+ if ret.CompiledOnChallenge, err = buildHookList(onChallengeHooks, hookOnChallenge, patcher); err != nil {
+ return nil, err
+ }
+
+ // Defining any on_challenge hook implies we need the challenge runtime to
+ // validate cookies and submissions, even if the hook bodies never call
+ // SendChallenge() themselves.
+ if len(ret.CompiledOnChallenge) > 0 {
+ patcher.NeedWASMVM = true
}
// variable tracking
@@ -635,6 +705,8 @@ func (wc *AppsecConfig) Build(hub *cwhub.Hub) (*AppsecRuntimeConfig, error) {
ret.CompiledVariablesTracking = append(ret.CompiledVariablesTracking, compiledVariableRule)
}
+ ret.NeedWASMVM = patcher.NeedWASMVM
+
return ret, nil
}
@@ -713,6 +785,66 @@ func (w *AppsecRuntimeConfig) ProcessOnMatchRules(state *AppsecRequestState, req
return w.runPhaseHooks(hookOnMatch, GetOnMatchEnv(w, state, request, evt), request)
}
+// ProcessOnChallengeRules is the in-band-only challenge entry point. It
+// handles the PoW worker JS path and the challenge submission path internally,
+// validates any existing challenge cookie to populate state.Fingerprint, and
+// runs the user-defined on_challenge hook expressions ONLY when there is a
+// fingerprint to inspect — i.e. on a valid submission or when a valid cookie
+// was presented. Requests with no cookie / invalid cookie / invalid submission
+// skip user hooks entirely (there's nothing to evaluate).
+func (w *AppsecRuntimeConfig) ProcessOnChallengeRules(state *AppsecRequestState, request *ParsedRequest) error {
+ if w.ChallengeRuntime == nil {
+ return nil
+ }
+
+ var path string
+ if request.HTTPRequest.URL != nil {
+ path = request.HTTPRequest.URL.Path
+ }
+
+ // Serve the PoW worker JS (static asset). Skip user expressions.
+ if path == challenge.ChallengePowWorkerPath {
+ return w.setChallengeResponse(state, http.StatusOK, challenge.PowWorkerJS,
+ map[string]string{"Content-Type": "application/javascript", "Cache-Control": "public, max-age=3600"}, nil)
+ }
+
+ // Challenge submission: validate and issue (or deny) the cookie. User hooks
+ // do NOT run here — they would overwrite the JSON submission response and
+ // confuse the client. Policy inspection of the fingerprint happens on the
+ // very next request, which will carry the cookie we just issued.
+ if path == challenge.ChallengeSubmitPath && request.HTTPRequest.Method == http.MethodPost {
+ w.Logger.Debugf("validating challenge response")
+ ck, _, err := w.ChallengeRuntime.ValidateChallengeResponse(request.HTTPRequest, request.Body)
+ if err != nil {
+ // TODO: find a way to propagate an event to the LP for use in scenarios
+ w.Logger.Errorf("challenge validation failed: %s", err)
+ return w.setChallengeResponse(state, http.StatusOK, bodyChallengeFailed,
+ map[string]string{"Content-Type": "application/json", "Cache-Control": "no-cache, no-store"}, nil)
+ }
+ return w.setChallengeResponse(state, http.StatusOK, bodyChallengeOK,
+ map[string]string{"Content-Type": "application/json", "Cache-Control": "no-cache, no-store"}, ck)
+ }
+
+ // Regular request: validate the existing cookie (if any) to populate
+ // fingerprint and remember the difficulty the client proved.
+ if httpCookie, err := request.HTTPRequest.Cookie(challenge.ChallengeCookieName); err == nil {
+ if cookieData, validErr := w.ChallengeRuntime.ValidCookie(httpCookie, request.HTTPRequest.UserAgent()); validErr == nil {
+ w.Logger.Debugf("valid challenge cookie found, setting fingerprint data")
+ fp := cookieData.Fingerprint
+ state.Fingerprint = &fp
+ state.CookiePowDifficulty = cookieData.PowDifficulty
+ }
+ }
+
+ // No fingerprint to inspect — skip user hooks. This avoids nil-deref inside
+ // expr filters like `fingerprint.Bot.X` when no cookie was presented.
+ if state.Fingerprint == nil {
+ return nil
+ }
+
+ return w.processHooks(w.CompiledOnChallenge, GetOnChallengeEnv(w, state, request), "on_challenge")
+}
+
func (w *AppsecRuntimeConfig) ProcessPreEvalRules(state *AppsecRequestState, request *ParsedRequest) error {
return w.runPhaseHooks(hookPreEval, GetPreEvalEnv(w, state, request), request)
}
@@ -884,19 +1016,198 @@ func (w *AppsecRuntimeConfig) SetHTTPCode(state *AppsecRequestState, code int) e
return nil
}
+func (w *AppsecRuntimeConfig) SetChallengeBody(state *AppsecRequestState, content string) error {
+ w.Logger.Debugf("setting challenge body content")
+ state.Response.UserHTTPBodyContent = content
+ return nil
+}
+
+func (w *AppsecRuntimeConfig) SetChallengeCookie(state *AppsecRequestState, cookie cookie.AppsecCookie) error {
+ w.Logger.Debugf("adding challenge cookie")
+ state.Response.UserHTTPCookies = append(state.Response.UserHTTPCookies, cookie)
+ return nil
+}
+
+func (w *AppsecRuntimeConfig) SetChallengeHeader(state *AppsecRequestState, name string, value string) error {
+ w.Logger.Debugf("adding challenge headers")
+ if state.Response.UserHeaders == nil {
+ state.Response.UserHeaders = make(map[string][]string)
+ }
+ state.Response.UserHeaders[name] = append(state.Response.UserHeaders[name], value)
+ return nil
+}
+
+func (w *AppsecRuntimeConfig) setChallengeResponse(state *AppsecRequestState, code int, body string, headers map[string]string, cookie *cookie.AppsecCookie) error {
+ w.SetAction(state, ChallengeRemediation)
+ w.SetHTTPCode(state, code)
+ // FIXME: don't do this here, should be handled the same way as a block
+ state.Response.BouncerHTTPResponseCode = w.Config.BouncerBlockedHTTPCode
+ w.SetChallengeBody(state, body)
+ for name, value := range headers {
+ w.SetChallengeHeader(state, name, value)
+ }
+ if cookie != nil {
+ w.SetChallengeCookie(state, *cookie)
+ }
+ state.RequireChallenge = true
+ return nil
+}
+
+// SetChallengeDifficulty sets the default PoW difficulty on the runtime (used from on_load).
+func (w *AppsecRuntimeConfig) SetChallengeDifficulty(level string) error {
+ if w.ChallengeRuntime == nil {
+ return fmt.Errorf("challenge runtime not initialized")
+ }
+
+ return w.ChallengeRuntime.SetDifficulty(level)
+}
+
+// SetChallengeDifficultyPerRequest sets a per-request PoW difficulty override (used from pre_eval/post_eval).
+func (w *AppsecRuntimeConfig) SetChallengeDifficultyPerRequest(state *AppsecRequestState, level string) error {
+ bits, err := challenge.DifficultyFromLevel(level)
+ if err != nil {
+ return err
+ }
+
+ state.ChallengeDifficulty = &bits
+
+ return nil
+}
+
+// SendChallenge issues a challenge HTML page for the current request. Cookie
+// and submission handling live in ProcessOnChallengeRules; by the time this
+// runs, state.Fingerprint has already been populated if a valid cookie was
+// presented. If the client already proved a PoW at least as hard as the
+// target difficulty for this request, SendChallenge is a no-op. When the
+// target difficulty is raised (e.g. on_challenge calls SetChallengeDifficulty
+// to punish a suspect fingerprint), the stored difficulty is lower than the
+// target and a fresh challenge is issued.
+// EvaluateMismatches runs all library-native + custom fingerprint mismatch
+// checks, caches the result on state, and emits one structured Debug log
+// line + one metric bump per fired signal on the first call of a given
+// request. Subsequent calls return the cached pointer so rules can reference
+// the report multiple times without redoing the work.
+func (w *AppsecRuntimeConfig) EvaluateMismatches(state *AppsecRequestState, request *ParsedRequest) *challenge.MismatchReport {
+ if state.LastMismatchReport != nil {
+ return state.LastMismatchReport
+ }
+
+ country := exprhelpers.IPToCountryString(request.ClientIP)
+ report := state.Fingerprint.ComputeMismatchReport(request.HTTPRequest, country)
+
+ state.LastMismatchReport = report
+
+ if !report.Empty() {
+ w.emitMismatchObservability(state, request, report)
+ }
+
+ return report
+}
+
+// emitMismatchObservability logs the report at Debug level and bumps the
+// per-reason/severity Prometheus counter. Called exactly once per request
+// from EvaluateMismatches (guarded by state.LastMismatchReport being nil
+// on entry).
+func (w *AppsecRuntimeConfig) emitMismatchObservability(
+ state *AppsecRequestState,
+ request *ParsedRequest,
+ report *challenge.MismatchReport,
+) {
+ fsid := ""
+ if state.Fingerprint != nil {
+ fsid = state.Fingerprint.FSID
+ }
+
+ if w.Logger != nil {
+ w.Logger.WithFields(log.Fields{
+ "fsid": fsid,
+ "source": request.RemoteAddrNormalized,
+ "reasons": report.Reasons(),
+ "high": report.High(),
+ "medium": report.Medium(),
+ "low": report.Low(),
+ "count": report.Count(),
+ }).Debug("fingerprint mismatch")
+ }
+
+ for _, sig := range report.Signals {
+ metrics.AppsecFingerprintMismatch.With(prometheus.Labels{
+ "reason": sig.Reason,
+ "severity": sig.Severity,
+ "appsec_engine": request.AppsecEngine,
+ }).Inc()
+ }
+}
+
+func (w *AppsecRuntimeConfig) SendChallenge(state *AppsecRequestState, request *ParsedRequest) error {
+ if w.ChallengeRuntime == nil {
+ return fmt.Errorf("challenge runtime not initialized")
+ }
+
+ target := w.ChallengeRuntime.Difficulty()
+ if state.ChallengeDifficulty != nil {
+ target = *state.ChallengeDifficulty
+ }
+
+ if state.Fingerprint != nil && state.CookiePowDifficulty >= target {
+ w.Logger.Debugf("client already proved difficulty %d >= target %d, skipping challenge issue",
+ state.CookiePowDifficulty, target)
+ return nil
+ }
+
+ w.Logger.Debugf("sending challenge at difficulty %d (client proved %d)", target, state.CookiePowDifficulty)
+
+ challengePage, err := w.ChallengeRuntime.GetChallengePage(request.HTTPRequest.UserAgent(), target)
+ if err != nil {
+ return fmt.Errorf("unable to get challenge page: %w", err)
+ }
+ return w.setChallengeResponse(state, http.StatusOK, challengePage, map[string]string{"Content-Type": "text/html", "Cache-Control": "no-cache, no-store"}, nil)
+}
+
type BodyResponse struct {
- Action string `json:"action"`
- HTTPStatus int `json:"http_status"`
+ Action string `json:"action"`
+ HTTPStatus int `json:"http_status"`
+ UserBodyContent string `json:"user_body_content,omitempty"`
+ UserCookies []string `json:"user_cookies,omitempty"`
+ UserHeaders map[string][]string `json:"user_headers,omitempty"`
}
func (w *AppsecRuntimeConfig) GenerateResponse(response AppsecTempResponse, logger *log.Entry) (int, BodyResponse) {
var bouncerStatusCode int
resp := BodyResponse{Action: response.Action}
- if response.Action == AllowRemediation {
+
+ //spew.Dump("Generating response", response)
+
+ switch response.Action {
+ case AllowRemediation:
resp.HTTPStatus = w.Config.UserPassedHTTPCode
bouncerStatusCode = w.Config.BouncerPassedHTTPCode
- } else { // ban, captcha and anything else
+ case ChallengeRemediation:
+ resp.UserBodyContent = response.UserHTTPBodyContent
+ resp.UserCookies = make([]string, 0, len(response.UserHTTPCookies))
+ for _, cookie := range response.UserHTTPCookies {
+ resp.UserCookies = append(resp.UserCookies, cookie.String())
+ }
+ resp.UserHeaders = response.UserHeaders
+ // If there's no Content-Security-Policy header, add a default one to make sure that the JS code can be evaluated
+ if _, ok := resp.UserHeaders["Content-Security-Policy"]; !ok {
+ resp.UserHeaders["Content-Security-Policy"] = []string{challenge.DefaultChallengeCSP}
+ }
+ // Return code are handled the same way for challenge/ban/captcha
+ // There's probably a less brittle way to do this, but falltrhough is easier
+ fallthrough
+ case BanRemediation, CaptchaRemediation:
+ resp.HTTPStatus = response.UserHTTPResponseCode
+ if resp.HTTPStatus == 0 {
+ resp.HTTPStatus = w.Config.UserBlockedHTTPCode
+ }
+ bouncerStatusCode = response.BouncerHTTPResponseCode
+ if bouncerStatusCode == 0 {
+ bouncerStatusCode = w.Config.BouncerBlockedHTTPCode
+ }
+ default:
+ // Custom remediations use the same status code logic as ban/captcha
resp.HTTPStatus = response.UserHTTPResponseCode
if resp.HTTPStatus == 0 {
resp.HTTPStatus = w.Config.UserBlockedHTTPCode
diff --git a/pkg/appsec/appsec_challenge_test.go b/pkg/appsec/appsec_challenge_test.go
new file mode 100644
index 00000000000..5df92bbde1f
--- /dev/null
+++ b/pkg/appsec/appsec_challenge_test.go
@@ -0,0 +1,239 @@
+package appsec
+
+import (
+ "context"
+ "net/http"
+ "net/url"
+ "sync"
+ "testing"
+
+ log "github.com/sirupsen/logrus"
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+
+ "github.com/crowdsecurity/crowdsec/pkg/appsec/challenge"
+)
+
+// sharedChallengeRuntime lazily creates a single ChallengeRuntime for the
+// whole package test run. NewChallengeRuntime runs the obfuscator WASM to
+// generate a challenge JS bundle (~15-20s), so spinning one up per test is
+// prohibitively slow and unnecessary for logic-only dispatcher tests.
+var (
+ sharedChallengeRuntimeOnce sync.Once
+ sharedChallengeRuntimeInst *challenge.ChallengeRuntime
+ sharedChallengeRuntimeErr error
+)
+
+func getSharedChallengeRuntime(t *testing.T) *challenge.ChallengeRuntime {
+ t.Helper()
+ sharedChallengeRuntimeOnce.Do(func() {
+ // Use context.Background so the runtime survives across tests.
+ // Goroutines it spawns leak for the duration of the test binary; that's
+ // acceptable here since the binary exits after tests complete.
+ sharedChallengeRuntimeInst, sharedChallengeRuntimeErr = challenge.NewChallengeRuntime(context.Background())
+ })
+ require.NoError(t, sharedChallengeRuntimeErr)
+ return sharedChallengeRuntimeInst
+}
+
+// newChallengeTestRuntime builds an AppsecRuntimeConfig wired with a real
+// ChallengeRuntime for dispatcher tests. Provided on_challenge hooks are
+// compiled via buildHookList, so tests can assert that user expressions run.
+func newChallengeTestRuntime(t *testing.T, hooks []Hook) *AppsecRuntimeConfig {
+ t.Helper()
+
+ cr := getSharedChallengeRuntime(t)
+
+ compiled, err := buildHookList(hooks, hookOnChallenge, &appsecExprPatcher{})
+ require.NoError(t, err)
+
+ logger := log.NewEntry(log.StandardLogger())
+
+ cfg := &AppsecConfig{
+ Name: "test-challenge",
+ BouncerBlockedHTTPCode: http.StatusForbidden,
+ BouncerPassedHTTPCode: http.StatusOK,
+ UserBlockedHTTPCode: http.StatusForbidden,
+ UserPassedHTTPCode: http.StatusOK,
+ DefaultPassAction: AllowRemediation,
+ DefaultRemediation: BanRemediation,
+ }
+
+ return &AppsecRuntimeConfig{
+ Name: "test-challenge",
+ Config: cfg,
+ Logger: logger,
+ ChallengeRuntime: cr,
+ CompiledOnChallenge: compiled,
+ }
+}
+
+func newInBandRequest(method, path string, body []byte) *ParsedRequest {
+ u, _ := url.Parse(path)
+ return &ParsedRequest{
+ HTTPRequest: &http.Request{
+ Method: method,
+ URL: u,
+ Header: http.Header{"User-Agent": []string{"go-test"}},
+ },
+ Body: body,
+ IsInBand: true,
+ }
+}
+
+func TestProcessOnChallengeRulesNilRuntime(t *testing.T) {
+ rt := &AppsecRuntimeConfig{
+ Logger: log.NewEntry(log.StandardLogger()),
+ Config: &AppsecConfig{},
+ }
+ state := &AppsecRequestState{}
+ req := newInBandRequest(http.MethodGet, "/", nil)
+
+ require.NoError(t, rt.ProcessOnChallengeRules(state, req))
+ assert.False(t, state.RequireChallenge)
+ assert.Nil(t, state.Fingerprint)
+}
+
+func TestProcessOnChallengeRulesServesPowWorker(t *testing.T) {
+ rt := newChallengeTestRuntime(t, nil)
+ state := &AppsecRequestState{}
+ state.ResetResponse(rt.Config)
+
+ req := newInBandRequest(http.MethodGet, challenge.ChallengePowWorkerPath, nil)
+
+ require.NoError(t, rt.ProcessOnChallengeRules(state, req))
+ assert.True(t, state.RequireChallenge)
+ assert.Equal(t, ChallengeRemediation, state.Response.Action)
+ assert.Equal(t, http.StatusOK, state.Response.UserHTTPResponseCode)
+ assert.Equal(t, challenge.PowWorkerJS, state.Response.UserHTTPBodyContent)
+ assert.Contains(t, state.Response.UserHeaders["Content-Type"], "application/javascript")
+}
+
+func TestProcessOnChallengeRulesSubmitInvalidBody(t *testing.T) {
+ rt := newChallengeTestRuntime(t, nil)
+ state := &AppsecRequestState{}
+ state.ResetResponse(rt.Config)
+
+ // Empty body → ValidateChallengeResponse fails; dispatcher returns failed JSON body.
+ req := newInBandRequest(http.MethodPost, challenge.ChallengeSubmitPath, nil)
+
+ require.NoError(t, rt.ProcessOnChallengeRules(state, req))
+ assert.True(t, state.RequireChallenge)
+ assert.JSONEq(t, bodyChallengeFailed, state.Response.UserHTTPBodyContent)
+ assert.Contains(t, state.Response.UserHeaders["Content-Type"], "application/json")
+ // No cookie is issued on failure.
+ assert.Empty(t, state.Response.UserHTTPCookies)
+}
+
+func TestProcessOnChallengeRulesNoCookieSkipsUserHooks(t *testing.T) {
+ // A hook that would unconditionally flip PendingAction must NOT run when
+ // there is no fingerprint to inspect — this prevents nil-deref panics on
+ // filters like `fingerprint.Bot.X`.
+ rt := newChallengeTestRuntime(t, []Hook{
+ {Apply: []string{"SetRemediation('allow')"}},
+ })
+
+ state := &AppsecRequestState{}
+ state.ResetResponse(rt.Config)
+
+ req := newInBandRequest(http.MethodGet, "/", nil)
+
+ require.NoError(t, rt.ProcessOnChallengeRules(state, req))
+ assert.Nil(t, state.Fingerprint)
+ assert.Nil(t, state.PendingAction, "user hooks must not run when fingerprint is nil")
+}
+
+func TestProcessOnChallengeRulesInvalidCookieSkipsUserHooks(t *testing.T) {
+ rt := newChallengeTestRuntime(t, []Hook{
+ {Apply: []string{"SetReturnCode(418)"}},
+ })
+
+ state := &AppsecRequestState{}
+ state.ResetResponse(rt.Config)
+
+ // Attach an invalid cookie; ValidCookie fails silently and fingerprint stays nil.
+ u, _ := url.Parse("/")
+ httpReq := &http.Request{
+ Method: http.MethodGet,
+ URL: u,
+ Header: http.Header{
+ "User-Agent": []string{"go-test"},
+ "Cookie": []string{challenge.ChallengeCookieName + "=garbage"},
+ },
+ }
+ req := &ParsedRequest{HTTPRequest: httpReq, IsInBand: true}
+
+ require.NoError(t, rt.ProcessOnChallengeRules(state, req))
+ assert.Nil(t, state.Fingerprint)
+ assert.Nil(t, state.PendingHTTPCode, "user hooks must not run when fingerprint is nil")
+}
+
+func TestSendChallengeNoOpWhenStoredDifficultyMeetsTarget(t *testing.T) {
+ rt := newChallengeTestRuntime(t, nil)
+ state := &AppsecRequestState{}
+ state.ResetResponse(rt.Config)
+ // Simulate a client that already proved the runtime-default difficulty.
+ state.Fingerprint = &challenge.FingerprintData{}
+ state.CookiePowDifficulty = rt.ChallengeRuntime.Difficulty()
+
+ req := newInBandRequest(http.MethodGet, "/protected", nil)
+
+ require.NoError(t, rt.SendChallenge(state, req))
+ assert.False(t, state.RequireChallenge)
+ assert.Empty(t, state.Response.UserHTTPBodyContent)
+ assert.NotEqual(t, ChallengeRemediation, state.Response.Action)
+}
+
+func TestSendChallengeReIssuesWhenTargetExceedsStored(t *testing.T) {
+ rt := newChallengeTestRuntime(t, nil)
+ state := &AppsecRequestState{}
+ state.ResetResponse(rt.Config)
+ // Client proved medium; this request demands impossible.
+ state.Fingerprint = &challenge.FingerprintData{}
+ state.CookiePowDifficulty = challenge.PowDifficultyMedium
+ impossible := challenge.PowDifficultyImpossible
+ state.ChallengeDifficulty = &impossible
+
+ req := newInBandRequest(http.MethodGet, "/protected", nil)
+
+ require.NoError(t, rt.SendChallenge(state, req))
+ assert.True(t, state.RequireChallenge)
+ assert.Equal(t, ChallengeRemediation, state.Response.Action)
+ assert.Contains(t, state.Response.UserHeaders["Content-Type"], "text/html")
+ assert.NotEmpty(t, state.Response.UserHTTPBodyContent)
+}
+
+func TestSendChallengeNoOpWhenTargetLoweredBelowStored(t *testing.T) {
+ rt := newChallengeTestRuntime(t, nil)
+ state := &AppsecRequestState{}
+ state.ResetResponse(rt.Config)
+ // Client proved high; admin lowered the global target.
+ state.Fingerprint = &challenge.FingerprintData{}
+ state.CookiePowDifficulty = challenge.PowDifficultyHigh
+ low := challenge.PowDifficultyLow
+ state.ChallengeDifficulty = &low
+
+ req := newInBandRequest(http.MethodGet, "/protected", nil)
+
+ require.NoError(t, rt.SendChallenge(state, req))
+ assert.False(t, state.RequireChallenge)
+}
+
+func TestProcessOnChallengeRulesInvalidSubmissionSkipsUserHooks(t *testing.T) {
+ // A hook that would unconditionally flip PendingAction must NOT run when
+ // the submission is invalid — the failed JSON body is the only response.
+ rt := newChallengeTestRuntime(t, []Hook{
+ {Apply: []string{"SetRemediation('allow')"}},
+ })
+
+ state := &AppsecRequestState{}
+ state.ResetResponse(rt.Config)
+
+ // Empty body → ValidateChallengeResponse fails.
+ req := newInBandRequest(http.MethodPost, challenge.ChallengeSubmitPath, nil)
+
+ require.NoError(t, rt.ProcessOnChallengeRules(state, req))
+ assert.True(t, state.RequireChallenge)
+ assert.JSONEq(t, bodyChallengeFailed, state.Response.UserHTTPBodyContent)
+ assert.Nil(t, state.PendingAction, "user hooks must not run on invalid submission")
+}
diff --git a/pkg/appsec/appsec_config_test.go b/pkg/appsec/appsec_config_test.go
index da4fb35f038..0a0c936740a 100644
--- a/pkg/appsec/appsec_config_test.go
+++ b/pkg/appsec/appsec_config_test.go
@@ -326,6 +326,68 @@ func TestBuildNilPhaseConfig(t *testing.T) {
assert.Empty(t, rt.OutOfBandHooks.OnMatch)
}
+func TestBuildOnChallengeTopLevelAndInband(t *testing.T) {
+ cfg := AppsecConfig{
+ Logger: log.NewEntry(log.StandardLogger()),
+ DefaultRemediation: "ban",
+ OnChallenge: []Hook{
+ {Apply: []string{"SetRemediation('allow')"}},
+ },
+ InBand: &AppsecPhaseConfig{
+ OnChallenge: []Hook{
+ {Filter: "IsInBand == true", Apply: []string{"SetReturnCode(418)"}},
+ },
+ },
+ }
+
+ hub := &cwhub.Hub{}
+ rt, err := cfg.Build(hub)
+ require.NoError(t, err)
+
+ // Both top-level and inband on_challenge hooks end up in CompiledOnChallenge.
+ require.Len(t, rt.CompiledOnChallenge, 2)
+ assert.NotNil(t, rt.CompiledOnChallenge[0].ApplyExpr)
+ assert.NotNil(t, rt.CompiledOnChallenge[1].FilterExpr)
+
+ // Defining on_challenge must force the challenge runtime on.
+ assert.True(t, rt.NeedWASMVM)
+}
+
+func TestBuildOnChallengeUnderOutofbandRejected(t *testing.T) {
+ cfg := AppsecConfig{
+ Logger: log.NewEntry(log.StandardLogger()),
+ DefaultRemediation: "ban",
+ OutOfBand: &AppsecPhaseConfig{
+ OnChallenge: []Hook{{Apply: []string{"SetRemediation('allow')"}}},
+ },
+ }
+
+ hub := &cwhub.Hub{}
+ _, err := cfg.Build(hub)
+ require.Error(t, err)
+ assert.Contains(t, err.Error(), "on_challenge hooks are only valid in-band")
+}
+
+func TestLoadByPathOnChallengeYAML(t *testing.T) {
+ cfg := newTestConfig()
+ f := writeTempYAML(t, `
+name: test-on-challenge
+on_challenge:
+ - filter: "fingerprint != nil"
+ apply:
+ - SetRemediation('allow')
+inband:
+ on_challenge:
+ - apply:
+ - SendChallenge()
+`)
+
+ require.NoError(t, cfg.LoadByPath(f))
+ assert.Len(t, cfg.OnChallenge, 1)
+ require.NotNil(t, cfg.InBand)
+ assert.Len(t, cfg.InBand.OnChallenge, 1)
+}
+
func TestBuildOnLoadStaysOutOfPhaseHooks(t *testing.T) {
cfg := AppsecConfig{
Logger: log.NewEntry(log.StandardLogger()),
diff --git a/pkg/appsec/challenge/challenge.go b/pkg/appsec/challenge/challenge.go
new file mode 100644
index 00000000000..e6853c20081
--- /dev/null
+++ b/pkg/appsec/challenge/challenge.go
@@ -0,0 +1,557 @@
+package challenge
+
+import (
+ "bytes"
+ "compress/gzip"
+ "context"
+ "crypto/hmac"
+ crand "crypto/rand"
+ "crypto/sha256"
+ "encoding/base64"
+ "encoding/hex"
+ "encoding/json"
+ "fmt"
+ "io"
+ "math/rand/v2"
+ "net/http"
+ "net/url"
+ "strconv"
+ "strings"
+ "sync"
+ "time"
+
+ _ "embed"
+
+ "text/template"
+
+ challengejs "github.com/crowdsecurity/crowdsec/pkg/appsec/challenge/js"
+ "github.com/crowdsecurity/crowdsec/pkg/appsec/challenge/pb"
+ "github.com/crowdsecurity/crowdsec/pkg/appsec/cookie"
+ "github.com/google/uuid"
+ log "github.com/sirupsen/logrus"
+ "github.com/tetratelabs/wazero"
+ "github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1"
+)
+
+const ChallengeJSPath = "/crowdsec-internal/challenge/challenge.js"
+const ChallengeSubmitPath = "/crowdsec-internal/challenge/submit"
+const ChallengePowWorkerPath = "/crowdsec-internal/challenge/pow-worker.js"
+const ChallengeCookieName = "__crowdsec_challenge"
+const challengeJSCacheSize = 10
+const challengeJSRefreshInterval = 10 * time.Minute
+
+// PoW difficulty levels in leading zero bits. Pure JS SHA-256 through the
+// obfuscator runs ~500-5000 ops/sec, so keep these conservative.
+const (
+ PowDifficultyDisabled = 0 // no PoW required, nonce "0" always valid
+ PowDifficultyLow = 10 // ~1024 avg iterations ≈ 0.2-2s
+ PowDifficultyMedium = 12 // ~4096 avg iterations ≈ 1-8s
+ PowDifficultyHigh = 15 // ~32768 avg iterations ≈ 7-60s
+ PowDifficultyImpossible = 256 // full SHA-256 width: clients cannot solve, server always rejects
+
+ defaultPowDifficulty = PowDifficultyMedium
+)
+
+const DefaultChallengeCSP = "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; worker-src 'self' blob:;"
+
+// FIXME
+const masterSecret = "SUPER_SECRET_KEY"
+
+//go:embed challenge.html.tmpl
+var htmlTemplate string
+
+//go:embed pow-worker.js
+var PowWorkerJS string
+
+//go:embed js/obfuscate/index.wasm.gz
+var obfuscatorWasmGz []byte
+
+var (
+ obfuscatorWasm []byte
+ obfuscatorWasmOnce sync.Once
+)
+
+type ChallengeRuntime struct {
+ r wazero.Runtime
+
+ obfuscatedJSCache []obfuscatedScript
+ cacheMutex sync.RWMutex
+
+ powDifficulty int
+}
+
+// DifficultyFromLevel resolves a named level ("low", "medium", "high") to
+// a PoW difficulty in leading zero bits. Case-insensitive.
+func DifficultyFromLevel(level string) (int, error) {
+ switch strings.ToLower(level) {
+ case "disabled":
+ return PowDifficultyDisabled, nil
+ case "low":
+ return PowDifficultyLow, nil
+ case "medium":
+ return PowDifficultyMedium, nil
+ case "high":
+ return PowDifficultyHigh, nil
+ case "impossible":
+ return PowDifficultyImpossible, nil
+ default:
+ return 0, fmt.Errorf("unknown challenge difficulty %q (expected disabled, low, medium, high, or impossible)", level)
+ }
+}
+
+// Difficulty returns the current default PoW difficulty (in leading zero bits).
+func (c *ChallengeRuntime) Difficulty() int {
+ return c.powDifficulty
+}
+
+// SetDifficulty sets the default PoW difficulty from a named level.
+func (c *ChallengeRuntime) SetDifficulty(level string) error {
+ bits, err := DifficultyFromLevel(level)
+ if err != nil {
+ return err
+ }
+
+ c.powDifficulty = bits
+
+ return nil
+}
+
+type obfuscatedScript struct {
+ Code string // the obfuscated JS code
+ uuid uuid.UUID // unique ID to track the script
+}
+
+func NewChallengeRuntime(ctx context.Context) (*ChallengeRuntime, error) {
+ r := wazero.NewRuntime(ctx)
+
+ // No need to keep the closer around, we can just close the runtime itself when stopping
+ _, err := wasi_snapshot_preview1.Instantiate(ctx, r)
+ if err != nil {
+ return nil, fmt.Errorf("failed to instantiate WASI: %w", err)
+ }
+
+ var obfuscatorWasmErr error
+
+ obfuscatorWasmOnce.Do(func() {
+ r, err := gzip.NewReader(bytes.NewReader(obfuscatorWasmGz))
+ if err != nil {
+ obfuscatorWasmErr = fmt.Errorf("failed to create gzip reader for obfuscator wasm: %w", err)
+ return
+ }
+ defer r.Close()
+
+ obfuscatorWasm, err = io.ReadAll(r)
+ if err != nil {
+ obfuscatorWasmErr = fmt.Errorf("failed to decompress obfuscator wasm: %w", err)
+ return
+ }
+ })
+
+ if obfuscatorWasmErr != nil {
+ return nil, obfuscatorWasmErr
+ }
+
+ challengeRuntime := &ChallengeRuntime{
+ r: r,
+ obfuscatedJSCache: make([]obfuscatedScript, 0, challengeJSCacheSize),
+ powDifficulty: defaultPowDifficulty,
+ }
+
+ if err := challengeRuntime.generateAndCacheChallengeJS(ctx); err != nil {
+ return nil, fmt.Errorf("failed to generate initial challenge bundle: %w", err)
+ }
+
+ go challengeRuntime.challengeGenerator(ctx)
+
+ return challengeRuntime, nil
+}
+
+func (c *ChallengeRuntime) challengeGenerator(ctx context.Context) {
+ // Startup warm-up: grow the cache in background until full.
+ if err := c.fillCacheToCapacity(ctx); err != nil {
+ log.Errorf("failed to prefill challenge JS cache: %v", err)
+ }
+
+ ticker := time.NewTicker(challengeJSRefreshInterval)
+ defer ticker.Stop()
+
+ for {
+ select {
+ case <-ticker.C:
+ variants, err := c.generateChallengeVariants(ctx, challengeJSCacheSize)
+ if err != nil {
+ log.Errorf("failed to regenerate full challenge JS cache: %v", err)
+ continue
+ }
+
+ c.replaceCachedChallengeJS(variants)
+ case <-ctx.Done():
+ return
+ }
+ }
+}
+
+func (c *ChallengeRuntime) buildChallengeBundle() string {
+ return strings.NewReplacer(
+ "__CROWDSEC_SUBMIT_PATH__", ChallengeSubmitPath,
+ "__CROWDSEC_POW_WORKER_PATH__", ChallengePowWorkerPath,
+ ).Replace(challengejs.FPScannerBundle)
+}
+
+func (c *ChallengeRuntime) generateAndCacheChallengeJS(ctx context.Context) error {
+ variants, err := c.generateChallengeVariants(ctx, 1)
+ if err != nil {
+ return err
+ }
+
+ c.appendCachedChallengeJS(variants)
+
+ return nil
+}
+
+func (c *ChallengeRuntime) generateChallengeVariants(ctx context.Context, count int) ([]obfuscatedScript, error) {
+ if count <= 0 {
+ return []obfuscatedScript{}, nil
+ }
+
+ variants := make([]obfuscatedScript, 0, count)
+
+ bundle := c.buildChallengeBundle()
+
+ for range count {
+ o := obfuscatedScript{}
+ o.uuid = uuid.New()
+ obfuscatedJS, err := c.ObfuscateJS(ctx, bundle)
+ if err != nil {
+ return nil, err
+ }
+ o.Code = obfuscatedJS
+ variants = append(variants, o)
+ }
+
+ return variants, nil
+}
+
+func (c *ChallengeRuntime) fillCacheToCapacity(ctx context.Context) error {
+ c.cacheMutex.RLock()
+ missing := challengeJSCacheSize - len(c.obfuscatedJSCache)
+ c.cacheMutex.RUnlock()
+
+ if missing <= 0 {
+ return nil
+ }
+
+ variants, err := c.generateChallengeVariants(ctx, missing)
+ if err != nil {
+ return err
+ }
+
+ c.appendCachedChallengeJS(variants)
+ return nil
+}
+
+func (c *ChallengeRuntime) appendCachedChallengeJS(variants []obfuscatedScript) {
+ if len(variants) == 0 {
+ return
+ }
+
+ c.cacheMutex.Lock()
+ c.obfuscatedJSCache = append(c.obfuscatedJSCache, variants...)
+ if len(c.obfuscatedJSCache) > challengeJSCacheSize {
+ c.obfuscatedJSCache = c.obfuscatedJSCache[len(c.obfuscatedJSCache)-challengeJSCacheSize:]
+ }
+ c.cacheMutex.Unlock()
+}
+
+func (c *ChallengeRuntime) replaceCachedChallengeJS(variants []obfuscatedScript) {
+ if len(variants) == 0 {
+ return
+ }
+
+ c.cacheMutex.Lock()
+ c.obfuscatedJSCache = append([]obfuscatedScript(nil), variants...)
+ c.cacheMutex.Unlock()
+}
+
+func (c *ChallengeRuntime) getCachedChallengeJS() obfuscatedScript {
+ c.cacheMutex.RLock()
+ defer c.cacheMutex.RUnlock()
+
+ cacheSize := len(c.obfuscatedJSCache)
+ if cacheSize == 0 {
+ return obfuscatedScript{}
+ }
+
+ idx := rand.IntN(cacheSize)
+ return c.obfuscatedJSCache[idx]
+}
+
+func (c *ChallengeRuntime) ObfuscateJS(ctx context.Context, inputJS string) (string, error) {
+ stdin := bytes.NewReader([]byte(inputJS))
+ var stdout bytes.Buffer
+ var stderr bytes.Buffer
+
+ config := wazero.NewModuleConfig().
+ WithStdin(stdin).
+ WithStdout(&stdout).
+ WithStderr(&stderr)
+
+ mod, err := c.r.InstantiateWithConfig(ctx, obfuscatorWasm, config)
+ if err != nil {
+ if stderr.Len() > 0 {
+ return "", fmt.Errorf("wasm runtime error: %v | stderr: %s", err, stderr.String())
+ }
+ return "", fmt.Errorf("wasm instantiation error: %v", err)
+ }
+
+ mod.Close(ctx)
+
+ return stdout.String(), nil
+}
+
+func computeTicket(ts string) string {
+ h := hmac.New(sha256.New, []byte(masterSecret))
+ h.Write([]byte(ts))
+
+ return fmt.Sprintf("%x", h.Sum(nil))
+}
+
+// GetChallengePage renders the challenge HTML page with the given PoW difficulty.
+// If difficulty is 0, the default difficulty is used.
+func (c *ChallengeRuntime) GetChallengePage(userAgent string, difficulty int) (string, error) {
+ _ = userAgent
+
+ if difficulty <= 0 {
+ difficulty = c.powDifficulty
+ }
+
+ // We are using text/template instead of html/template because the data we send is pretty much hardcoded and trusted.
+ // Using html/template would escape the JS code we are adding, making it unusable.
+ templateObj, err := template.New("challenge").Parse(htmlTemplate)
+ if err != nil {
+ return "", fmt.Errorf("failed to parse challenge template: %w", err)
+ }
+
+ obfuscatedJS := c.getCachedChallengeJS()
+ if obfuscatedJS.Code == "" {
+ if err := c.generateAndCacheChallengeJS(context.Background()); err != nil {
+ return "", fmt.Errorf("failed to generate challenge JS: %w", err)
+ }
+ obfuscatedJS = c.getCachedChallengeJS()
+ if obfuscatedJS.Code == "" {
+ return "", fmt.Errorf("challenge JS cache is empty")
+ }
+ }
+
+ // All per-request values: ticket, timestamp, PoW salt, PoW MAC.
+ // Fully stateless — no server-side storage, works across HA instances.
+ ts := fmt.Sprintf("%d", time.Now().UnixNano())
+ ticket := computeTicket(ts)
+ powSalt := generatePowPrefix()
+ powMAC := computePowMAC(powSalt, ticket, ts)
+
+ var renderedPage strings.Builder
+
+ templateObj.Execute(&renderedPage, map[string]interface{}{
+ "JSChallenge": obfuscatedJS.Code,
+ "PowDifficulty": difficulty,
+ "PowPrefix": powSalt,
+ "PowMAC": powMAC,
+ "Ticket": ticket,
+ "Timestamp": ts,
+ })
+ return renderedPage.String(), nil
+}
+
+func generatePowPrefix() string {
+ buf := make([]byte, 16)
+ if _, err := crand.Read(buf); err != nil {
+ panic(fmt.Sprintf("failed to generate PoW prefix: %v", err))
+ }
+
+ return hex.EncodeToString(buf)
+}
+
+// computePowMAC produces an HMAC that authenticates a PoW salt as server-generated
+// and bound to a specific ticket window. Stateless: any instance sharing the
+// masterSecret can verify it.
+func computePowMAC(salt, ticket, ts string) string {
+ h := hmac.New(sha256.New, []byte(masterSecret))
+ h.Write([]byte(salt))
+ h.Write([]byte(ticket))
+ h.Write([]byte(ts))
+
+ return fmt.Sprintf("%x", h.Sum(nil))
+}
+
+func hasLeadingZeroBits(hash []byte, bits int) bool {
+ fullBytes := bits / 8
+ remainBits := bits % 8
+
+ for i := range fullBytes {
+ if hash[i] != 0 {
+ return false
+ }
+ }
+
+ if remainBits > 0 {
+ mask := byte(0xFF << (8 - remainBits))
+ if hash[fullBytes]&mask != 0 {
+ return false
+ }
+ }
+
+ return true
+}
+
+func (c *ChallengeRuntime) getSessionKey(ticket string, nonce string) string {
+ hash := sha256.Sum256([]byte(ticket + nonce))
+ return fmt.Sprintf("%x", hash)
+}
+
+func (c *ChallengeRuntime) decryptFingerprint(sessionKey string, encrypted string) (string, error) {
+ encryptedBytes, err := base64.StdEncoding.DecodeString(encrypted)
+ if err != nil {
+ return "", fmt.Errorf("failed to decode encrypted fingerprint: %w", err)
+ }
+
+ decryptedBytes := make([]byte, len(encryptedBytes))
+
+ for i := range encryptedBytes {
+ decryptedBytes[i] = encryptedBytes[i] ^ sessionKey[i%len(sessionKey)]
+ }
+
+ return string(decryptedBytes), nil
+}
+
+// matchesChallenge verifies that the ticket/timestamp/PoW salt are authentically
+// server-generated and the timestamp is recent. Fully stateless — any instance
+// sharing masterSecret can verify.
+func matchesChallenge(clientTicket, clientTS, clientPowSalt, clientPowMAC string) bool {
+ // Verify the ticket is an authentic HMAC of the timestamp.
+ expectedTicket := computeTicket(clientTS)
+ if !hmac.Equal([]byte(clientTicket), []byte(expectedTicket)) {
+ return false
+ }
+
+ // Verify the timestamp is recent (within 2 refresh intervals for safety).
+ tsVal, err := strconv.ParseInt(clientTS, 10, 64)
+ if err != nil {
+ return false
+ }
+
+ age := time.Since(time.Unix(0, tsVal))
+ if age < 0 || age > 2*challengeJSRefreshInterval {
+ return false
+ }
+
+ // Verify the PoW salt MAC is authentic and bound to this ticket+timestamp.
+ expectedMAC := computePowMAC(clientPowSalt, clientTicket, clientTS)
+
+ return hmac.Equal([]byte(clientPowMAC), []byte(expectedMAC))
+}
+
+func (c *ChallengeRuntime) ValidateChallengeResponse(request *http.Request, body []byte) (*cookie.AppsecCookie, FingerprintData, error) {
+ vars, err := url.ParseQuery(string(body))
+ if err != nil {
+ return nil, FingerprintData{}, fmt.Errorf("failed to parse challenge response: %w", err)
+ }
+
+ encryptedFingerprint := vars.Get("f")
+ clientTicket := vars.Get("t")
+ clientTS := vars.Get("ts")
+ clientHMAC := vars.Get("h")
+ clientNonce := vars.Get("n")
+ clientPowSalt := vars.Get("p")
+ clientPowMAC := vars.Get("m")
+
+ if encryptedFingerprint == "" || clientTicket == "" || clientTS == "" || clientHMAC == "" || clientNonce == "" || clientPowSalt == "" || clientPowMAC == "" {
+ return nil, FingerprintData{}, fmt.Errorf("missing required fields in challenge response")
+ }
+
+ // Verify ticket/timestamp match and PoW salt is authentically server-generated (stateless).
+ if !matchesChallenge(clientTicket, clientTS, clientPowSalt, clientPowMAC) {
+ return nil, FingerprintData{}, fmt.Errorf("invalid ticket in challenge response")
+ }
+
+ // An impossible difficulty is a deliberate hard-block: clients cannot solve
+ // it, and the server must not accept any submission.
+ if c.powDifficulty >= PowDifficultyImpossible {
+ return nil, FingerprintData{}, fmt.Errorf("challenge difficulty is impossible; submission rejected")
+ }
+
+ // Verify proof-of-work: SHA256(powSalt + nonce) must have required leading zero bits
+ powHash := sha256.Sum256([]byte(clientPowSalt + clientNonce))
+ if !hasLeadingZeroBits(powHash[:], c.powDifficulty) {
+ return nil, FingerprintData{}, fmt.Errorf("invalid proof-of-work in challenge response")
+ }
+
+ // Derive session key from ticket + nonce (same as client-side)
+ sessionKey := c.getSessionKey(clientTicket, clientNonce)
+
+ // Verify HMAC over encrypted fingerprint + timestamp + ticket + nonce
+ expectedHMAC := hmac.New(sha256.New, []byte(sessionKey))
+ expectedHMAC.Write([]byte(encryptedFingerprint))
+ expectedHMAC.Write([]byte(clientTS))
+ expectedHMAC.Write([]byte(clientTicket))
+ expectedHMAC.Write([]byte(clientNonce))
+
+ expectedHMACHex := fmt.Sprintf("%x", expectedHMAC.Sum(nil))
+
+ if !hmac.Equal([]byte(clientHMAC), []byte(expectedHMACHex)) {
+ return nil, FingerprintData{}, fmt.Errorf("invalid HMAC in challenge response")
+ }
+
+ fingerprint, err := c.decryptFingerprint(sessionKey, encryptedFingerprint)
+ if err != nil {
+ return nil, FingerprintData{}, fmt.Errorf("failed to decrypt fingerprint: %w", err)
+ }
+
+ var fpData FingerprintData
+
+ if err := json.Unmarshal([]byte(fingerprint), &fpData); err != nil {
+ log.Errorf("fp: %s", fingerprint)
+ return nil, FingerprintData{}, fmt.Errorf("failed to unmarshal fingerprint data: %w", err)
+ }
+
+ envelope := &pb.ChallengeCookie{
+ Fingerprint: fpData.ToProto(),
+ PowDifficulty: int32(c.powDifficulty),
+ }
+
+ cookieValue, err := sealCookie(envelope, masterSecret, []byte(request.UserAgent()))
+ if err != nil {
+ return nil, FingerprintData{}, fmt.Errorf("failed to seal challenge cookie: %w", err)
+ }
+
+ ck := cookie.NewAppsecCookie(ChallengeCookieName).HttpOnly().Path("/").SameSite(cookie.SameSiteLax).ExpiresIn(2 * time.Hour).Value(cookieValue)
+ if request.URL.Scheme == "https" {
+ ck = ck.Secure()
+ }
+
+ return ck, fpData, nil
+}
+
+// CookieData bundles the decrypted fingerprint with cookie-envelope metadata
+// (currently just the proven PoW difficulty) so callers can make re-challenge
+// decisions without touching the fingerprint struct.
+type CookieData struct {
+ Fingerprint FingerprintData
+ PowDifficulty int
+}
+
+func (c *ChallengeRuntime) ValidCookie(ck *http.Cookie, userAgent string) (*CookieData, error) {
+ if ck == nil {
+ return nil, fmt.Errorf("nil cookie")
+ }
+
+ envelope, err := openCookie(ck.Value, masterSecret, []byte(userAgent))
+ if err != nil {
+ return nil, fmt.Errorf("invalid challenge cookie: %w", err)
+ }
+
+ return &CookieData{
+ Fingerprint: fingerprintDataFromProto(envelope.GetFingerprint()),
+ PowDifficulty: int(envelope.GetPowDifficulty()),
+ }, nil
+}
diff --git a/pkg/appsec/challenge/challenge.html.tmpl b/pkg/appsec/challenge/challenge.html.tmpl
new file mode 100644
index 00000000000..0d774387e69
--- /dev/null
+++ b/pkg/appsec/challenge/challenge.html.tmpl
@@ -0,0 +1,469 @@
+
+
+
+ CrowdSec Challenge
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
+
+
Consulting the crowd...
+
+
+
+
+
+
+
+
+
+
+
+
This page runs a brief security check to confirm you are not a bot.
+
The verification is automatic and typically completes within a few seconds. No action is required on your part.
+
This check is powered by CrowdSec, a collaborative cybersecurity platform.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pkg/appsec/challenge/challenge.js b/pkg/appsec/challenge/challenge.js
new file mode 100644
index 00000000000..4b196344912
--- /dev/null
+++ b/pkg/appsec/challenge/challenge.js
@@ -0,0 +1,237 @@
+import FingerprintScanner from "./js/fpscanner/src/index.ts";
+
+// --- Pure JS SHA-256 (RFC 6234) ---
+
+const K = [
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
+ 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
+ 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
+ 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
+ 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 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(data) {
+ let h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a,
+ h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;
+
+ const len = data.length;
+ const bitLen = len * 8;
+
+ const padLen = 64 - ((len + 9) % 64);
+ const totalLen = len + 1 + (padLen === 64 ? 0 : padLen) + 8;
+ const msg = new Uint8Array(totalLen);
+ msg.set(data);
+ msg[len] = 0x80;
+ const dv = new DataView(msg.buffer);
+ dv.setUint32(totalLen - 4, bitLen, false);
+
+ const w = new Int32Array(64);
+ for (let offset = 0; offset < totalLen; offset += 64) {
+ for (let i = 0; i < 16; i++) {
+ w[i] = dv.getInt32(offset + i * 4, false);
+ }
+ for (let i = 16; i < 64; i++) {
+ const s0 = (((w[i-15] >>> 7) | (w[i-15] << 25)) ^ ((w[i-15] >>> 18) | (w[i-15] << 14)) ^ (w[i-15] >>> 3)) | 0;
+ const s1 = (((w[i-2] >>> 17) | (w[i-2] << 15)) ^ ((w[i-2] >>> 19) | (w[i-2] << 13)) ^ (w[i-2] >>> 10)) | 0;
+ w[i] = (w[i-16] + s0 + w[i-7] + s1) | 0;
+ }
+
+ let a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7;
+
+ for (let i = 0; i < 64; i++) {
+ const S1 = (((e >>> 6) | (e << 26)) ^ ((e >>> 11) | (e << 21)) ^ ((e >>> 25) | (e << 7))) | 0;
+ const ch = ((e & f) ^ (~e & g)) | 0;
+ const temp1 = (h + S1 + ch + K[i] + w[i]) | 0;
+ const S0 = (((a >>> 2) | (a << 30)) ^ ((a >>> 13) | (a << 19)) ^ ((a >>> 22) | (a << 10))) | 0;
+ const maj = ((a & b) ^ (a & c) ^ (b & c)) | 0;
+ const temp2 = (S0 + maj) | 0;
+
+ h = g; g = f; f = e; e = (d + temp1) | 0;
+ d = c; c = b; b = a; a = (temp1 + temp2) | 0;
+ }
+
+ h0 = (h0 + a) | 0; h1 = (h1 + b) | 0; h2 = (h2 + c) | 0; h3 = (h3 + d) | 0;
+ h4 = (h4 + e) | 0; h5 = (h5 + f) | 0; h6 = (h6 + g) | 0; h7 = (h7 + h) | 0;
+ }
+
+ const out = new Uint8Array(32);
+ const ov = new DataView(out.buffer);
+ ov.setUint32(0, h0, false); ov.setUint32(4, h1, false);
+ ov.setUint32(8, h2, false); ov.setUint32(12, h3, false);
+ ov.setUint32(16, h4, false); ov.setUint32(20, h5, false);
+ ov.setUint32(24, h6, false); ov.setUint32(28, h7, false);
+ return out;
+}
+
+// --- Helpers ---
+
+function toHex(bytes) {
+ let hex = "";
+ for (let i = 0; i < bytes.length; i++) {
+ hex += (bytes[i] >> 4).toString(16) + (bytes[i] & 0xf).toString(16);
+ }
+ return hex;
+}
+
+function encode(str) {
+ return new TextEncoder().encode(str);
+}
+
+function sha256Hex(str) {
+ return toHex(sha256(encode(str)));
+}
+
+// --- HMAC-SHA256 ---
+
+function hmacSHA256(key, message) {
+ if (key.length > 64) {
+ key = sha256(key);
+ }
+ const paddedKey = new Uint8Array(64);
+ paddedKey.set(key);
+
+ const ipad = new Uint8Array(64);
+ const opad = new Uint8Array(64);
+ for (let i = 0; i < 64; i++) {
+ ipad[i] = paddedKey[i] ^ 0x36;
+ opad[i] = paddedKey[i] ^ 0x5c;
+ }
+
+ const inner = new Uint8Array(64 + message.length);
+ inner.set(ipad);
+ inner.set(message, 64);
+ const innerHash = sha256(inner);
+
+ const outer = new Uint8Array(64 + 32);
+ outer.set(opad);
+ outer.set(innerHash, 64);
+ return sha256(outer);
+}
+
+function hmacSHA256Hex(keyStr, msgStr) {
+ return toHex(hmacSHA256(encode(keyStr), encode(msgStr)));
+}
+
+// --- Proof-of-Work (offloaded to Web Worker) ---
+
+const powWorkerPath = "__CROWDSEC_POW_WORKER_PATH__";
+
+function solvePoWAsync(prefix, difficulty) {
+ if (difficulty <= 0) {
+ return Promise.resolve("0");
+ }
+
+ try {
+ const worker = new Worker(powWorkerPath);
+
+ return new Promise((resolve) => {
+ worker.onmessage = (e) => {
+ worker.terminate();
+ resolve(e.data);
+ };
+ worker.onerror = () => {
+ worker.terminate();
+ resolve(solvePoWMainThread(prefix, difficulty));
+ };
+ worker.postMessage({ p: prefix, d: difficulty });
+ });
+ } catch (_) {
+ return Promise.resolve(solvePoWMainThread(prefix, difficulty));
+ }
+}
+
+function solvePoWMainThread(prefix, difficulty) {
+ let nonce = 0;
+ while (true) {
+ const candidate = prefix + nonce.toString(36);
+ const hash = sha256(encode(candidate));
+ const fullBytes = difficulty >> 3;
+ const remainBits = difficulty & 7;
+ let ok = true;
+ for (let i = 0; i < fullBytes; i++) {
+ if (hash[i] !== 0) { ok = false; break; }
+ }
+ if (ok && remainBits > 0) {
+ const mask = (0xff << (8 - remainBits)) & 0xff;
+ if ((hash[fullBytes] & mask) !== 0) ok = false;
+ }
+ if (ok) return nonce.toString(36);
+ nonce++;
+ }
+}
+
+// --- Fingerprint encryption (XOR) ---
+
+function encryptFingerprint(key, fingerprint) {
+ const keyBytes = encode(key);
+ const textBytes = encode(fingerprint);
+ const encrypted = new Uint8Array(textBytes.length);
+
+ for (let i = 0; i < textBytes.length; i++) {
+ encrypted[i] = textBytes[i] ^ keyBytes[i % keyBytes.length];
+ }
+
+ const binaryString = String.fromCharCode(...encrypted);
+ return btoa(binaryString);
+}
+
+// --- Template-injected values (replaced server-side before obfuscation) ---
+
+const ts = typeof _ts !== "undefined" ? _ts : "";
+const ticket = typeof _t !== "undefined" ? _t : "";
+const powPrefix = typeof _powP !== "undefined" ? _powP : "";
+const powMAC = typeof _powM !== "undefined" ? _powM : "";
+const powDifficulty = typeof _powD !== "undefined" ? _powD : 12;
+const submitPath = "__CROWDSEC_SUBMIT_PATH__";
+
+// --- Challenge status reporting ---
+
+function reportChallengeStatus(status) {
+ if (typeof window.crowdsecSetChallengeStatus === "function") {
+ window.crowdsecSetChallengeStatus(status);
+ return;
+ }
+
+ window.dispatchEvent(
+ new CustomEvent("crowdsec-challenge-status", {
+ detail: { status },
+ }),
+ );
+}
+
+// --- Main flow ---
+// PoW runs in a Web Worker while fingerprint collection runs on the main thread.
+// Both run in parallel; the main thread stays responsive for event collection.
+
+const [nonce, fpResult] = await Promise.all([
+ solvePoWAsync(powPrefix, powDifficulty),
+ new FingerprintScanner().collectFingerprint({ encrypt: false }),
+]);
+
+const sessionKey = sha256Hex(ticket + nonce);
+const f = encryptFingerprint(sessionKey, JSON.stringify(fpResult));
+const h = hmacSHA256Hex(sessionKey, f + ts + ticket + nonce);
+fetch(submitPath, {
+ method: "POST",
+ credentials: "same-origin",
+ body: new URLSearchParams({ f: f, t: ticket, ts: ts, h: h, n: nonce, p: powPrefix, m: powMAC }),
+})
+ .then((response) => response.json())
+ .then((data) => {
+ const status = typeof data?.status === "string" ? data.status : "fail";
+ reportChallengeStatus(status);
+ })
+ .catch(() => {
+ reportChallengeStatus("fail");
+ });
diff --git a/pkg/appsec/challenge/challenge_test.go b/pkg/appsec/challenge/challenge_test.go
new file mode 100644
index 00000000000..ded6354963f
--- /dev/null
+++ b/pkg/appsec/challenge/challenge_test.go
@@ -0,0 +1,428 @@
+package challenge
+
+import (
+ "crypto/hmac"
+ "crypto/sha256"
+ "encoding/base64"
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "net/url"
+ "strings"
+ "testing"
+ "time"
+
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+)
+
+func TestHasLeadingZeroBits(t *testing.T) {
+ tests := []struct {
+ name string
+ hash []byte
+ bits int
+ expect bool
+ }{
+ {
+ name: "0 bits required",
+ hash: []byte{0xff, 0xff},
+ bits: 0,
+ expect: true,
+ },
+ {
+ name: "8 bits - first byte zero",
+ hash: []byte{0x00, 0xff},
+ bits: 8,
+ expect: true,
+ },
+ {
+ name: "8 bits - first byte not zero",
+ hash: []byte{0x01, 0xff},
+ bits: 8,
+ expect: false,
+ },
+ {
+ name: "16 bits - two zero bytes",
+ hash: []byte{0x00, 0x00, 0xff},
+ bits: 16,
+ expect: true,
+ },
+ {
+ name: "10 bits - partial byte check passes",
+ hash: []byte{0x00, 0x20}, // 0b00000000 0b00100000 → 10 leading zeros
+ bits: 10,
+ expect: true,
+ },
+ {
+ name: "10 bits - partial byte check fails",
+ hash: []byte{0x00, 0x40}, // 0b00000000 0b01000000 → 9 leading zeros
+ bits: 10,
+ expect: false,
+ },
+ {
+ name: "1 bit - first bit zero",
+ hash: []byte{0x7f},
+ bits: 1,
+ expect: true,
+ },
+ {
+ name: "1 bit - first bit set",
+ hash: []byte{0x80},
+ bits: 1,
+ expect: false,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ assert.Equal(t, tt.expect, hasLeadingZeroBits(tt.hash, tt.bits))
+ })
+ }
+}
+
+func TestGeneratePowPrefix(t *testing.T) {
+ p1 := generatePowPrefix()
+ p2 := generatePowPrefix()
+
+ assert.Len(t, p1, 32) // 16 bytes = 32 hex chars
+ assert.Len(t, p2, 32)
+ assert.NotEqual(t, p1, p2) // random, should differ
+}
+
+func TestDifficultyFromLevel(t *testing.T) {
+ bits, err := DifficultyFromLevel("low")
+ assert.NoError(t, err)
+ assert.Equal(t, PowDifficultyLow, bits)
+
+ bits, err = DifficultyFromLevel("MEDIUM")
+ assert.NoError(t, err)
+ assert.Equal(t, PowDifficultyMedium, bits)
+
+ bits, err = DifficultyFromLevel("High")
+ assert.NoError(t, err)
+ assert.Equal(t, PowDifficultyHigh, bits)
+
+ bits, err = DifficultyFromLevel("disabled")
+ assert.NoError(t, err)
+ assert.Equal(t, PowDifficultyDisabled, bits)
+
+ bits, err = DifficultyFromLevel("IMPOSSIBLE")
+ assert.NoError(t, err)
+ assert.Equal(t, PowDifficultyImpossible, bits)
+
+ _, err = DifficultyFromLevel("extreme")
+ assert.Error(t, err)
+}
+
+func TestSetDifficulty(t *testing.T) {
+ c := &ChallengeRuntime{powDifficulty: defaultPowDifficulty}
+
+ assert.NoError(t, c.SetDifficulty("low"))
+ assert.Equal(t, PowDifficultyLow, c.powDifficulty)
+
+ assert.NoError(t, c.SetDifficulty("MEDIUM"))
+ assert.Equal(t, PowDifficultyMedium, c.powDifficulty)
+
+ assert.NoError(t, c.SetDifficulty("High"))
+ assert.Equal(t, PowDifficultyHigh, c.powDifficulty)
+
+ assert.NoError(t, c.SetDifficulty("impossible"))
+ assert.Equal(t, PowDifficultyImpossible, c.powDifficulty)
+
+ assert.Error(t, c.SetDifficulty("extreme"))
+ assert.Equal(t, PowDifficultyImpossible, c.powDifficulty) // unchanged on error
+}
+
+func TestGetSessionKey(t *testing.T) {
+ c := &ChallengeRuntime{}
+
+ key1 := c.getSessionKey("ticket1", "nonce1")
+ key2 := c.getSessionKey("ticket1", "nonce2")
+ key3 := c.getSessionKey("ticket1", "nonce1")
+
+ assert.Len(t, key1, 64) // SHA-256 = 64 hex chars
+ assert.NotEqual(t, key1, key2)
+ assert.Equal(t, key1, key3) // deterministic
+
+ expected := sha256.Sum256([]byte("ticket1nonce1"))
+ assert.Equal(t, fmt.Sprintf("%x", expected), key1)
+}
+
+func TestComputeTicket(t *testing.T) {
+ // Deterministic for same timestamp
+ t1 := computeTicket("12345")
+ t2 := computeTicket("12345")
+ assert.Equal(t, t1, t2)
+
+ // Different for different timestamps
+ t3 := computeTicket("67890")
+ assert.NotEqual(t, t1, t3)
+
+ // Matches expected HMAC-SHA256
+ h := hmac.New(sha256.New, []byte(masterSecret))
+ h.Write([]byte("12345"))
+ assert.Equal(t, fmt.Sprintf("%x", h.Sum(nil)), t1)
+}
+
+func TestMatchesChallenge(t *testing.T) {
+ ts := fmt.Sprintf("%d", time.Now().UnixNano())
+ ticket := computeTicket(ts)
+ salt := generatePowPrefix()
+ mac := computePowMAC(salt, ticket, ts)
+
+ // Valid challenge
+ assert.True(t, matchesChallenge(ticket, ts, salt, mac))
+
+ // Wrong ticket
+ assert.False(t, matchesChallenge("wrong-ticket", ts, salt, mac))
+
+ // Wrong timestamp (ticket doesn't match)
+ assert.False(t, matchesChallenge(ticket, "9999999999999999999", salt, mac))
+
+ // Forged MAC
+ assert.False(t, matchesChallenge(ticket, ts, salt, "forged-mac"))
+
+ // MAC from different salt
+ otherSalt := generatePowPrefix()
+ assert.False(t, matchesChallenge(ticket, ts, otherSalt, mac))
+
+ // Expired timestamp (too old)
+ oldTS := fmt.Sprintf("%d", time.Now().Add(-3*challengeJSRefreshInterval).UnixNano())
+ oldTicket := computeTicket(oldTS)
+ oldMAC := computePowMAC(salt, oldTicket, oldTS)
+ assert.False(t, matchesChallenge(oldTicket, oldTS, salt, oldMAC))
+}
+
+// solvePoWGo is a Go implementation of the PoW solver matching the JS client.
+func solvePoWGo(prefix string, difficulty int) string {
+ for nonce := 0; ; nonce++ {
+ candidate := prefix + formatBase36(nonce)
+ hash := sha256.Sum256([]byte(candidate))
+ if hasLeadingZeroBits(hash[:], difficulty) {
+ return formatBase36(nonce)
+ }
+ }
+}
+
+func formatBase36(n int) string {
+ if n == 0 {
+ return "0"
+ }
+
+ const digits = "0123456789abcdefghijklmnopqrstuvwxyz"
+ var buf [64]byte
+ i := len(buf)
+
+ for n > 0 {
+ i--
+ buf[i] = digits[n%36]
+ n /= 36
+ }
+
+ return string(buf[i:])
+}
+
+func TestPoWVerification(t *testing.T) {
+ prefix := generatePowPrefix()
+ difficulty := 8
+
+ nonce := solvePoWGo(prefix, difficulty)
+
+ powHash := sha256.Sum256([]byte(prefix + nonce))
+ assert.True(t, hasLeadingZeroBits(powHash[:], difficulty))
+}
+
+// freshTicket generates a per-request ticket+timestamp pair (matching GetChallengePage).
+func freshTicket() (ticket, ts string) {
+ ts = fmt.Sprintf("%d", time.Now().UnixNano())
+ ticket = computeTicket(ts)
+ return
+}
+
+// buildValidBody constructs a valid challenge POST body.
+func buildValidBody(difficulty int, ticket, ts string) string {
+ c := &ChallengeRuntime{}
+ salt := generatePowPrefix()
+ powMAC := computePowMAC(salt, ticket, ts)
+ nonce := solvePoWGo(salt, difficulty)
+ sessionKey := c.getSessionKey(ticket, nonce)
+
+ fp := FingerprintData{}
+ fpJSON, _ := json.Marshal(fp)
+
+ keyBytes := []byte(sessionKey)
+ encrypted := make([]byte, len(fpJSON))
+ for i := range fpJSON {
+ encrypted[i] = fpJSON[i] ^ keyBytes[i%len(keyBytes)]
+ }
+ encryptedB64 := base64.StdEncoding.EncodeToString(encrypted)
+
+ mac := hmac.New(sha256.New, []byte(sessionKey))
+ mac.Write([]byte(encryptedB64))
+ mac.Write([]byte(ts))
+ mac.Write([]byte(ticket))
+ mac.Write([]byte(nonce))
+ hmacHex := fmt.Sprintf("%x", mac.Sum(nil))
+
+ return url.Values{
+ "f": {encryptedB64},
+ "t": {ticket},
+ "ts": {ts},
+ "h": {hmacHex},
+ "n": {nonce},
+ "p": {salt},
+ "m": {powMAC},
+ }.Encode()
+}
+
+func TestValidateChallengeResponse(t *testing.T) {
+ c := &ChallengeRuntime{powDifficulty: 8}
+ ticket, ts := freshTicket()
+ body := buildValidBody(c.powDifficulty, ticket, ts)
+
+ req, _ := http.NewRequest("POST", "http://example.com/submit", strings.NewReader(body))
+ req.Header.Set("User-Agent", "test-agent")
+
+ ck, fpResult, err := c.ValidateChallengeResponse(req, []byte(body))
+ require.NoError(t, err)
+ assert.NotNil(t, ck)
+ assert.NotNil(t, fpResult)
+}
+
+func TestValidateChallengeResponse_MultipleConcurrentClients(t *testing.T) {
+ c := &ChallengeRuntime{powDifficulty: 8}
+
+ for range 20 {
+ ticket, ts := freshTicket()
+ body := buildValidBody(c.powDifficulty, ticket, ts)
+ req, _ := http.NewRequest("POST", "http://example.com/submit", strings.NewReader(body))
+ req.Header.Set("User-Agent", "test-agent")
+
+ _, _, err := c.ValidateChallengeResponse(req, []byte(body))
+ require.NoError(t, err)
+ }
+}
+
+func TestValidateChallengeResponse_InvalidPoW(t *testing.T) {
+ c := &ChallengeRuntime{powDifficulty: 8}
+ ticket, ts := freshTicket()
+ salt := generatePowPrefix()
+ powMAC := computePowMAC(salt, ticket, ts)
+
+ body := url.Values{
+ "f": {"dGVzdA=="},
+ "t": {ticket},
+ "ts": {ts},
+ "h": {"deadbeef"},
+ "n": {"invalid-nonce"},
+ "p": {salt},
+ "m": {powMAC},
+ }.Encode()
+
+ req, _ := http.NewRequest("POST", "http://example.com/submit", strings.NewReader(body))
+ _, _, err := c.ValidateChallengeResponse(req, []byte(body))
+ assert.ErrorContains(t, err, "invalid proof-of-work")
+}
+
+func TestValidateChallengeResponse_ImpossibleDifficulty(t *testing.T) {
+ // A submission that would otherwise pass at low difficulty is rejected
+ // outright when the runtime is set to impossible.
+ c := &ChallengeRuntime{powDifficulty: PowDifficultyImpossible}
+ ticket, ts := freshTicket()
+ body := buildValidBody(8, ticket, ts) // satisfies 8-bit PoW but not impossible
+
+ req, _ := http.NewRequest("POST", "http://example.com/submit", strings.NewReader(body))
+ req.Header.Set("User-Agent", "test-agent")
+
+ _, _, err := c.ValidateChallengeResponse(req, []byte(body))
+ assert.ErrorContains(t, err, "impossible")
+}
+
+func TestValidateChallengeResponse_ExpiredTimestamp(t *testing.T) {
+ c := &ChallengeRuntime{powDifficulty: 8}
+ oldTS := fmt.Sprintf("%d", time.Now().Add(-3*challengeJSRefreshInterval).UnixNano())
+ oldTicket := computeTicket(oldTS)
+ body := buildValidBody(c.powDifficulty, oldTicket, oldTS)
+
+ req, _ := http.NewRequest("POST", "http://example.com/submit", strings.NewReader(body))
+ req.Header.Set("User-Agent", "test-agent")
+
+ _, _, err := c.ValidateChallengeResponse(req, []byte(body))
+ assert.ErrorContains(t, err, "invalid ticket")
+}
+
+func TestValidateChallengeResponse_InvalidTicket(t *testing.T) {
+ c := &ChallengeRuntime{powDifficulty: 8}
+ ticket, ts := freshTicket()
+ salt := generatePowPrefix()
+ powMAC := computePowMAC(salt, ticket, ts)
+
+ body := url.Values{
+ "f": {"dGVzdA=="},
+ "t": {"wrong-ticket"},
+ "ts": {ts},
+ "h": {"deadbeef"},
+ "n": {"0"},
+ "p": {salt},
+ "m": {powMAC},
+ }.Encode()
+
+ req, _ := http.NewRequest("POST", "http://example.com/submit", strings.NewReader(body))
+ _, _, err := c.ValidateChallengeResponse(req, []byte(body))
+ assert.ErrorContains(t, err, "invalid ticket")
+}
+
+func TestValidateChallengeResponse_ForgedMAC(t *testing.T) {
+ c := &ChallengeRuntime{powDifficulty: 8}
+ ticket, ts := freshTicket()
+ salt := generatePowPrefix()
+
+ body := url.Values{
+ "f": {"dGVzdA=="},
+ "t": {ticket},
+ "ts": {ts},
+ "h": {"deadbeef"},
+ "n": {"0"},
+ "p": {salt},
+ "m": {"forged-mac-value"},
+ }.Encode()
+
+ req, _ := http.NewRequest("POST", "http://example.com/submit", strings.NewReader(body))
+ _, _, err := c.ValidateChallengeResponse(req, []byte(body))
+ assert.ErrorContains(t, err, "invalid ticket")
+}
+
+func TestValidateChallengeResponse_InvalidHMAC(t *testing.T) {
+ c := &ChallengeRuntime{powDifficulty: 8}
+ ticket, ts := freshTicket()
+ salt := generatePowPrefix()
+ powMAC := computePowMAC(salt, ticket, ts)
+ nonce := solvePoWGo(salt, c.powDifficulty)
+
+ body := url.Values{
+ "f": {"dGVzdA=="},
+ "t": {ticket},
+ "ts": {ts},
+ "h": {"0000000000000000000000000000000000000000000000000000000000000000"},
+ "n": {nonce},
+ "p": {salt},
+ "m": {powMAC},
+ }.Encode()
+
+ req, _ := http.NewRequest("POST", "http://example.com/submit", strings.NewReader(body))
+ _, _, err := c.ValidateChallengeResponse(req, []byte(body))
+ assert.ErrorContains(t, err, "invalid HMAC")
+}
+
+func TestValidateChallengeResponse_MissingFields(t *testing.T) {
+ c := &ChallengeRuntime{}
+
+ body := url.Values{
+ "f": {"dGVzdA=="},
+ "t": {"ticket"},
+ }.Encode()
+
+ req, _ := http.NewRequest("POST", "http://example.com/submit", strings.NewReader(body))
+ _, _, err := c.ValidateChallengeResponse(req, []byte(body))
+ assert.ErrorContains(t, err, "missing required fields")
+}
diff --git a/pkg/appsec/challenge/crypto.go b/pkg/appsec/challenge/crypto.go
new file mode 100644
index 00000000000..b70d8867f4d
--- /dev/null
+++ b/pkg/appsec/challenge/crypto.go
@@ -0,0 +1,107 @@
+package challenge
+
+import (
+ "crypto/aes"
+ "crypto/cipher"
+ "crypto/rand"
+ "crypto/sha256"
+ "encoding/base64"
+ "errors"
+ "fmt"
+
+ "golang.org/x/crypto/hkdf"
+
+ "github.com/crowdsecurity/crowdsec/pkg/appsec/challenge/pb"
+ "google.golang.org/protobuf/proto"
+)
+
+var (
+ ErrCookieMalformed = errors.New("malformed cookie")
+ ErrCookieSignature = errors.New("invalid cookie signature")
+ ErrCookiePayload = errors.New("invalid cookie payload")
+)
+
+const hkdfInfo = "crowdsec-challenge-cookie"
+
+func deriveKey(secret string) ([]byte, error) {
+ h := hkdf.New(sha256.New, []byte(secret), nil, []byte(hkdfInfo))
+ key := make([]byte, 32) // AES-256
+
+ if _, err := h.Read(key); err != nil {
+ return nil, fmt.Errorf("failed to derive key: %w", err)
+ }
+
+ return key, nil
+}
+
+func sealCookie(envelope *pb.ChallengeCookie, secret string, aad []byte) (string, error) {
+ plaintext, err := proto.Marshal(envelope)
+ if err != nil {
+ return "", fmt.Errorf("failed to marshal challenge cookie proto: %w", err)
+ }
+
+ key, err := deriveKey(secret)
+ if err != nil {
+ return "", err
+ }
+
+ block, err := aes.NewCipher(key)
+ if err != nil {
+ return "", fmt.Errorf("failed to create cipher: %w", err)
+ }
+
+ gcm, err := cipher.NewGCM(block)
+ if err != nil {
+ return "", fmt.Errorf("failed to create GCM: %w", err)
+ }
+
+ nonce := make([]byte, gcm.NonceSize())
+ if _, err := rand.Read(nonce); err != nil {
+ return "", fmt.Errorf("failed to generate nonce: %w", err)
+ }
+
+ ciphertext := gcm.Seal(nonce, nonce, plaintext, aad)
+
+ return base64.RawURLEncoding.EncodeToString(ciphertext), nil
+}
+
+func openCookie(encoded string, secret string, aad []byte) (*pb.ChallengeCookie, error) {
+ ciphertext, err := base64.RawURLEncoding.DecodeString(encoded)
+ if err != nil {
+ return nil, fmt.Errorf("%w: failed to decode: %w", ErrCookieMalformed, err)
+ }
+
+ key, err := deriveKey(secret)
+ if err != nil {
+ return nil, err
+ }
+
+ block, err := aes.NewCipher(key)
+ if err != nil {
+ return nil, fmt.Errorf("failed to create cipher: %w", err)
+ }
+
+ gcm, err := cipher.NewGCM(block)
+ if err != nil {
+ return nil, fmt.Errorf("failed to create GCM: %w", err)
+ }
+
+ nonceSize := gcm.NonceSize()
+ if len(ciphertext) < nonceSize {
+ return nil, fmt.Errorf("%w: ciphertext too short", ErrCookieMalformed)
+ }
+
+ nonce, ciphertext := ciphertext[:nonceSize], ciphertext[nonceSize:]
+
+ plaintext, err := gcm.Open(nil, nonce, ciphertext, aad)
+ if err != nil {
+ return nil, fmt.Errorf("%w: %w", ErrCookieSignature, err)
+ }
+
+ envelope := &pb.ChallengeCookie{}
+ if err := proto.Unmarshal(plaintext, envelope); err != nil {
+ return nil, fmt.Errorf("%w: %w", ErrCookiePayload, err)
+ }
+
+ return envelope, nil
+}
diff --git a/pkg/appsec/challenge/fingerprint.go b/pkg/appsec/challenge/fingerprint.go
new file mode 100644
index 00000000000..13a910cb135
--- /dev/null
+++ b/pkg/appsec/challenge/fingerprint.go
@@ -0,0 +1,694 @@
+package challenge
+
+import (
+ "encoding/json"
+ "strconv"
+)
+
+// FlexInt handles JSON values that may be either a number or a string.
+// The fingerprint JS library returns a string (error message) instead of
+// a number when it fails to collect a value.
+type FlexInt int
+
+// FlexBool handles JSON values that may be either a boolean or a string.
+type FlexBool bool
+
+func (fb *FlexBool) UnmarshalJSON(data []byte) error {
+ var b bool
+ if err := json.Unmarshal(data, &b); err == nil {
+ *fb = FlexBool(b)
+ return nil
+ }
+
+ var s string
+ if err := json.Unmarshal(data, &s); err != nil {
+ return err
+ }
+
+ *fb = FlexBool(s == "true" || s == "1")
+
+ return nil
+}
+
+func (fb FlexBool) Bool() bool {
+ return bool(fb)
+}
+
+func (fi *FlexInt) UnmarshalJSON(data []byte) error {
+ // Try number first (most common case).
+ var n int
+ if err := json.Unmarshal(data, &n); err == nil {
+ *fi = FlexInt(n)
+ return nil
+ }
+
+ // Fall back to string → parse as int, or default to 0.
+ var s string
+ if err := json.Unmarshal(data, &s); err != nil {
+ return err
+ }
+
+ parsed, err := strconv.Atoi(s)
+ if err != nil {
+ *fi = 0
+ return nil
+ }
+
+ *fi = FlexInt(parsed)
+
+ return nil
+}
+
+func (fi FlexInt) Int() int {
+ return int(fi)
+}
+
+/*
+{
+ "signals": {
+ "automation": {
+ "webdriver": false,
+ "webdriverWritable": false,
+ "selenium": false,
+ "cdp": true,
+ "playwright": false,
+ "navigatorPropertyDescriptors": "00000"
+ },
+ "device": {
+ "cpuCount": 14,
+ "memory": 8,
+ "platform": "MacIntel",
+ "screenResolution": {
+ "width": 2304,
+ "height": 1296,
+ "pixelDepth": 30,
+ "colorDepth": 30,
+ "availableWidth": 2304,
+ "availableHeight": 1265,
+ "innerWidth": 1444,
+ "innerHeight": 1144,
+ "hasMultipleDisplays": true
+ },
+ "multimediaDevices": {
+ "speakers": 1,
+ "microphones": 1,
+ "webcams": 1
+ },
+ "mediaQueries": {
+ "prefersColorScheme": "dark",
+ "prefersReducedMotion": false,
+ "prefersReducedTransparency": false,
+ "colorGamut": "p3",
+ "pointer": "fine",
+ "anyPointer": "fine",
+ "hover": true,
+ "anyHover": true,
+ "colorDepth": 10
+ }
+ },
+ "browser": {
+ "userAgent": "Mozilla/5.0+(Macintosh;+Intel+Mac+OS+X+10_15_7)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/144.0.0.0+Safari/537.36",
+ "features": {
+ "bitmask": "1000111100",
+ "chrome": true,
+ "brave": false,
+ "applePaySupport": false,
+ "opera": false,
+ "serial": true,
+ "attachShadow": true,
+ "caches": true,
+ "webAssembly": true,
+ "buffer": false,
+ "showModalDialog": false
+ },
+ "plugins": {
+ "isValidPluginArray": true,
+ "pluginCount": 5,
+ "pluginNamesHash": "-2cdc5c8b",
+ "pluginConsistency1": true,
+ "pluginOverflow": false
+ },
+ "extensions": {
+ "bitmask": "00000000",
+ "extensions": []
+ },
+ "highEntropyValues": {
+ "architecture": "arm",
+ "bitness": "64",
+ "brands": [
+ {
+ "brand": "Not(A:Brand",
+ "version": "8"
+ },
+ {
+ "brand": "Chromium",
+ "version": "144"
+ },
+ {
+ "brand": "Google+Chrome",
+ "version": "144"
+ }
+ ],
+ "mobile": false,
+ "model": "",
+ "platform": "macOS",
+ "platformVersion": "26.2.0",
+ "uaFullVersion": "144.0.7559.133"
+ },
+ "etsl": 33,
+ "maths": "67d0b556",
+ "toSourceError": {
+ "toSourceError": "TypeError:+Cannot+read+properties+of+null+(reading+usdfsh)",
+ "hasToSource": false
+ }
+ },
+ "graphics": {
+ "webGL": {
+ "vendor": "Google+Inc.+(Apple)",
+ "renderer": "ANGLE+(Apple,+ANGLE+Metal+Renderer:+Apple+M4+Max,+Unspecified+Version)"
+ },
+ "webgpu": {
+ "vendor": "apple",
+ "architecture": "metal-3",
+ "device": "",
+ "description": ""
+ },
+ "canvas": {
+ "hasModifiedCanvas": false,
+ "canvasFingerprint": "-421c84e0"
+ }
+ },
+ "codecs": {
+ "audioCanPlayTypeHash": "688c7345",
+ "videoCanPlayTypeHash": "-126cde82",
+ "audioMediaSourceHash": "-3cbc04a4",
+ "videoMediaSourceHash": "-48c15d34",
+ "rtcAudioCapabilitiesHash": "26a15cc5",
+ "rtcVideoCapabilitiesHash": "4f24a817",
+ "hasMediaSource": true
+ },
+ "locale": {
+ "internationalization": {
+ "timezone": "Europe/Paris",
+ "localeLanguage": "en-US"
+ },
+ "languages": {
+ "languages": [
+ "en",
+ "en-US",
+ "fr-FR",
+ "fr"
+ ],
+ "language": "en"
+ }
+ },
+ "contexts": {
+ "iframe": {
+ "webdriver": false,
+ "userAgent": "Mozilla/5.0+(Macintosh;+Intel+Mac+OS+X+10_15_7)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/144.0.0.0+Safari/537.36",
+ "platform": "MacIntel",
+ "memory": 8,
+ "cpuCount": 14,
+ "language": "en"
+ },
+ "webWorker": {
+ "vendor": "Google+Inc.+(Apple)",
+ "renderer": "ANGLE+(Apple,+ANGLE+Metal+Renderer:+Apple+M4+Max,+Unspecified+Version)",
+ "userAgent": "Mozilla/5.0+(Macintosh;+Intel+Mac+OS+X+10_15_7)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/144.0.0.0+Safari/537.36",
+ "language": "en",
+ "platform": "MacIntel",
+ "memory": 8,
+ "cpuCount": 14
+ }
+ }
+ },
+ "fsid": "FS1_00001000000000_00010h02ba_2304x1296c14m08b10011h-5db59_f1000111100e00000000p1100h-7ce12_0h06653c_1h-36e6b_en4h720e_0100h-156f8",
+ "nonce": "jb8t2jfm839",
+ "time": 1770669806462,
+ "url": "http://localhost/",
+ "fastBotDetection": true,
+ "fastBotDetectionDetails": {
+ "headlessChromeScreenResolution": {
+ "detected": false,
+ "severity": "high"
+ },
+ "hasWebdriver": {
+ "detected": false,
+ "severity": "high"
+ },
+ "hasWebdriverWritable": {
+ "detected": false,
+ "severity": "high"
+ },
+ "hasSeleniumProperty": {
+ "detected": false,
+ "severity": "high"
+ },
+ "hasCDP": {
+ "detected": true,
+ "severity": "high"
+ },
+ "hasPlaywright": {
+ "detected": false,
+ "severity": "high"
+ },
+ "hasImpossibleDeviceMemory": {
+ "detected": false,
+ "severity": "high"
+ },
+ "hasHighCPUCount": {
+ "detected": false,
+ "severity": "high"
+ },
+ "hasMissingChromeObject": {
+ "detected": false,
+ "severity": "high"
+ },
+ "hasWebdriverIframe": {
+ "detected": false,
+ "severity": "high"
+ },
+ "hasWebdriverWorker": {
+ "detected": false,
+ "severity": "high"
+ },
+ "hasMismatchWebGLInWorker": {
+ "detected": false,
+ "severity": "high"
+ },
+ "hasMismatchPlatformIframe": {
+ "detected": false,
+ "severity": "high"
+ },
+ "hasMismatchPlatformWorker": {
+ "detected": false,
+ "severity": "high"
+ },
+ "hasSwiftshaderRenderer": {
+ "detected": false,
+ "severity": "low"
+ },
+ "hasUTCTimezone": {
+ "detected": false,
+ "severity": "medium"
+ }
+ }
+}
+*/
+
+type FingerprintData struct {
+ Signals fingerprintSignals `json:"signals"`
+ FSID string `json:"fsid"`
+ Nonce string `json:"nonce"`
+ Time int64 `json:"time"`
+ URL string `json:"url"`
+ FastBotDetection FlexBool `json:"fastBotDetection"`
+ FastBotDetectionDetails fingerprintFastBotDetectionDetails `json:"fastBotDetectionDetails"`
+ Bot fingerprintBotAlias `json:"-"`
+}
+
+type fingerprintSignals struct {
+ Automation fingerprintAutomation `json:"automation"`
+ Device fingerprintDevice `json:"device"`
+ Browser fingerprintBrowser `json:"browser"`
+ Graphics fingerprintGraphics `json:"graphics"`
+ Codecs fingerprintCodecs `json:"codecs"`
+ Locale fingerprintLocale `json:"locale"`
+ Contexts fingerprintContexts `json:"contexts"`
+}
+
+type fingerprintAutomation struct {
+ Webdriver FlexBool `json:"webdriver"`
+ WebdriverWritable FlexBool `json:"webdriverWritable"`
+ Selenium FlexBool `json:"selenium"`
+ CDP FlexBool `json:"cdp"`
+ Playwright FlexBool `json:"playwright"`
+ NavigatorPropertyDescriptors string `json:"navigatorPropertyDescriptors"`
+}
+
+type fingerprintDevice struct {
+ CPUCount FlexInt `json:"cpuCount"`
+ Memory FlexInt `json:"memory"`
+ Platform string `json:"platform"`
+ ScreenResolution fingerprintScreenResolution `json:"screenResolution"`
+ MultimediaDevices fingerprintMultimediaDevices `json:"multimediaDevices"`
+ MediaQueries fingerprintDeviceMediaQueries `json:"mediaQueries"`
+}
+
+type fingerprintScreenResolution struct {
+ Width FlexInt `json:"width"`
+ Height FlexInt `json:"height"`
+ PixelDepth FlexInt `json:"pixelDepth"`
+ ColorDepth FlexInt `json:"colorDepth"`
+ AvailableWidth FlexInt `json:"availableWidth"`
+ AvailableHeight FlexInt `json:"availableHeight"`
+ InnerWidth FlexInt `json:"innerWidth"`
+ InnerHeight FlexInt `json:"innerHeight"`
+ HasMultipleDisplays FlexBool `json:"hasMultipleDisplays"`
+}
+
+type fingerprintMultimediaDevices struct {
+ Speakers FlexInt `json:"speakers"`
+ Microphones FlexInt `json:"microphones"`
+ Webcams FlexInt `json:"webcams"`
+}
+
+type fingerprintDeviceMediaQueries struct {
+ PrefersColorScheme string `json:"prefersColorScheme"`
+ PrefersReducedMotion FlexBool `json:"prefersReducedMotion"`
+ PrefersReducedTransparency FlexBool `json:"prefersReducedTransparency"`
+ ColorGamut string `json:"colorGamut"`
+ Pointer string `json:"pointer"`
+ AnyPointer string `json:"anyPointer"`
+ Hover FlexBool `json:"hover"`
+ AnyHover FlexBool `json:"anyHover"`
+ ColorDepth FlexInt `json:"colorDepth"`
+}
+
+type fingerprintBrowser struct {
+ UserAgent string `json:"userAgent"`
+ Features fingerprintBrowserFeatures `json:"features"`
+ Plugins fingerprintBrowserPlugins `json:"plugins"`
+ Extensions fingerprintBrowserExtensions `json:"extensions"`
+ HighEntropyValues fingerprintBrowserHighEntropyValues `json:"highEntropyValues"`
+ ETSL FlexInt `json:"etsl"`
+ Maths string `json:"maths"`
+ ToSourceError fingerprintBrowserToSourceError `json:"toSourceError"`
+}
+
+type fingerprintBrowserFeatures struct {
+ Bitmask string `json:"bitmask"`
+ Chrome FlexBool `json:"chrome"`
+ Brave FlexBool `json:"brave"`
+ ApplePaySupport FlexBool `json:"applePaySupport"`
+ Opera FlexBool `json:"opera"`
+ Serial FlexBool `json:"serial"`
+ AttachShadow FlexBool `json:"attachShadow"`
+ Caches FlexBool `json:"caches"`
+ WebAssembly FlexBool `json:"webAssembly"`
+ Buffer FlexBool `json:"buffer"`
+ ShowModalDialog FlexBool `json:"showModalDialog"`
+ Safari FlexBool `json:"safari"`
+ WebkitPrefixedFunction FlexBool `json:"webkitPrefixedFunction"`
+ MozPrefixedFunction FlexBool `json:"mozPrefixedFunction"`
+ USB FlexBool `json:"usb"`
+ BrowserCapture FlexBool `json:"browserCapture"`
+ PaymentRequestUpdateEvent FlexBool `json:"paymentRequestUpdateEvent"`
+ PressureObserver FlexBool `json:"pressureObserver"`
+ AudioSession FlexBool `json:"audioSession"`
+ SelectAudioOutput FlexBool `json:"selectAudioOutput"`
+ BarcodeDetector FlexBool `json:"barcodeDetector"`
+ Battery FlexBool `json:"battery"`
+ DevicePosture FlexBool `json:"devicePosture"`
+ DocumentPictureInPicture FlexBool `json:"documentPictureInPicture"`
+ EyeDropper FlexBool `json:"eyeDropper"`
+ EditContext FlexBool `json:"editContext"`
+ FencedFrame FlexBool `json:"fencedFrame"`
+ Sanitizer FlexBool `json:"sanitizer"`
+ OTPCredential FlexBool `json:"otpCredential"`
+}
+
+type fingerprintBrowserPlugins struct {
+ IsValidPluginArray FlexBool `json:"isValidPluginArray"`
+ PluginCount FlexInt `json:"pluginCount"`
+ PluginNamesHash string `json:"pluginNamesHash"`
+ PluginConsistency1 FlexBool `json:"pluginConsistency1"`
+ PluginOverflow FlexBool `json:"pluginOverflow"`
+}
+
+type fingerprintBrowserExtensions struct {
+ Bitmask string `json:"bitmask"`
+ Extensions []string `json:"extensions"`
+}
+
+type fingerprintBrowserHighEntropyValues struct {
+ Architecture string `json:"architecture"`
+ Bitness string `json:"bitness"`
+ Brands FlexBrandVersions `json:"brands"`
+ Mobile FlexBool `json:"mobile"`
+ Model string `json:"model"`
+ Platform string `json:"platform"`
+ PlatformVersion string `json:"platformVersion"`
+ UAFullVersion string `json:"uaFullVersion"`
+}
+
+type fingerprintBrandVersion struct {
+ Brand string `json:"brand"`
+ Version string `json:"version"`
+}
+
+// FlexBrandVersions handles a JSON value that should be []fingerprintBrandVersion
+// but may be a string (error) from the fingerprint library.
+type FlexBrandVersions []fingerprintBrandVersion
+
+func (f *FlexBrandVersions) UnmarshalJSON(data []byte) error {
+ var arr []fingerprintBrandVersion
+ if err := json.Unmarshal(data, &arr); err == nil {
+ *f = arr
+ return nil
+ }
+
+ // Probably a string error — ignore it, leave empty.
+ *f = nil
+
+ return nil
+}
+
+type fingerprintBrowserToSourceError struct {
+ ToSourceError string `json:"toSourceError"`
+ HasToSource FlexBool `json:"hasToSource"`
+}
+
+type fingerprintGraphics struct {
+ WebGL fingerprintGraphicsWebGL `json:"webGL"`
+ WebGPU fingerprintGraphicsWebGPU `json:"webgpu"`
+ Canvas fingerprintGraphicsCanvas `json:"canvas"`
+}
+
+type fingerprintGraphicsWebGL struct {
+ Vendor string `json:"vendor"`
+ Renderer string `json:"renderer"`
+}
+
+type fingerprintGraphicsWebGPU struct {
+ Vendor string `json:"vendor"`
+ Architecture string `json:"architecture"`
+ Device string `json:"device"`
+ Description string `json:"description"`
+}
+
+type fingerprintGraphicsCanvas struct {
+ HasModifiedCanvas FlexBool `json:"hasModifiedCanvas"`
+ CanvasFingerprint string `json:"canvasFingerprint"`
+}
+
+type fingerprintCodecs struct {
+ AudioCanPlayTypeHash string `json:"audioCanPlayTypeHash"`
+ VideoCanPlayTypeHash string `json:"videoCanPlayTypeHash"`
+ AudioMediaSourceHash string `json:"audioMediaSourceHash"`
+ VideoMediaSourceHash string `json:"videoMediaSourceHash"`
+ RTCAudioCapabilitiesHash string `json:"rtcAudioCapabilitiesHash"`
+ RTCVideoCapabilitiesHash string `json:"rtcVideoCapabilitiesHash"`
+ HasMediaSource FlexBool `json:"hasMediaSource"`
+}
+
+type fingerprintLocale struct {
+ Internationalization fingerprintLocaleInternationalization `json:"internationalization"`
+ Languages fingerprintLocaleLanguages `json:"languages"`
+}
+
+type fingerprintLocaleInternationalization struct {
+ Timezone string `json:"timezone"`
+ LocaleLanguage string `json:"localeLanguage"`
+}
+
+type fingerprintLocaleLanguages struct {
+ Languages []string `json:"languages"`
+ Language string `json:"language"`
+}
+
+type fingerprintContexts struct {
+ Iframe fingerprintIframeContext `json:"iframe"`
+ WebWorker fingerprintWebWorkerContext `json:"webWorker"`
+}
+
+type fingerprintIframeContext struct {
+ Webdriver FlexBool `json:"webdriver"`
+ UserAgent string `json:"userAgent"`
+ Platform string `json:"platform"`
+ Memory FlexInt `json:"memory"`
+ CPUCount FlexInt `json:"cpuCount"`
+ Language string `json:"language"`
+}
+
+type fingerprintWebWorkerContext struct {
+ Vendor string `json:"vendor"`
+ Renderer string `json:"renderer"`
+ UserAgent string `json:"userAgent"`
+ Language string `json:"language"`
+ Platform string `json:"platform"`
+ Memory FlexInt `json:"memory"`
+ CPUCount FlexInt `json:"cpuCount"`
+}
+
+type fingerprintFastBotDetectionDetails struct {
+ HeadlessChromeScreenResolution fingerprintDetectionResult `json:"headlessChromeScreenResolution"`
+ HasWebdriver fingerprintDetectionResult `json:"hasWebdriver"`
+ HasWebdriverWritable fingerprintDetectionResult `json:"hasWebdriverWritable"`
+ HasSeleniumProperty fingerprintDetectionResult `json:"hasSeleniumProperty"`
+ HasCDP fingerprintDetectionResult `json:"hasCDP"`
+ HasPlaywright fingerprintDetectionResult `json:"hasPlaywright"`
+ HasImpossibleDeviceMemory fingerprintDetectionResult `json:"hasImpossibleDeviceMemory"`
+ HasHighCPUCount fingerprintDetectionResult `json:"hasHighCPUCount"`
+ HasMissingChromeObject fingerprintDetectionResult `json:"hasMissingChromeObject"`
+ HasWebdriverIframe fingerprintDetectionResult `json:"hasWebdriverIframe"`
+ HasWebdriverWorker fingerprintDetectionResult `json:"hasWebdriverWorker"`
+ HasMismatchWebGLInWorker fingerprintDetectionResult `json:"hasMismatchWebGLInWorker"`
+ HasMismatchPlatformIframe fingerprintDetectionResult `json:"hasMismatchPlatformIframe"`
+ HasMismatchPlatformWorker fingerprintDetectionResult `json:"hasMismatchPlatformWorker"`
+ HasSwiftshaderRenderer fingerprintDetectionResult `json:"hasSwiftshaderRenderer"`
+ HasUTCTimezone fingerprintDetectionResult `json:"hasUTCTimezone"`
+ HasMismatchLanguages fingerprintDetectionResult `json:"hasMismatchLanguages"`
+ HasInconsistentEtsl fingerprintDetectionResult `json:"hasInconsistentEtsl"`
+ HasBotUserAgent fingerprintDetectionResult `json:"hasBotUserAgent"`
+ HasGPUMismatch fingerprintDetectionResult `json:"hasGPUMismatch"`
+ HasPlatformMismatch fingerprintDetectionResult `json:"hasPlatformMismatch"`
+}
+
+type fingerprintDetectionResult struct {
+ Detected FlexBool `json:"detected"`
+}
+
+type fingerprintBotAlias struct {
+ HeadlessChromeScreenResolution bool `json:"headlessChromeScreenResolution"`
+ Webdriver bool `json:"webdriver"`
+ WebdriverWritable bool `json:"webdriverWritable"`
+ Selenium bool `json:"selenium"`
+ CDP bool `json:"cdp"`
+ Playwright bool `json:"playwright"`
+ ImpossibleDeviceMemory bool `json:"impossibleDeviceMemory"`
+ HighCPUCount bool `json:"highCPUCount"`
+ MissingChromeObject bool `json:"missingChromeObject"`
+ WebdriverIframe bool `json:"webdriverIframe"`
+ WebdriverWorker bool `json:"webdriverWorker"`
+ MismatchWebGLInWorker bool `json:"mismatchWebGLInWorker"`
+ MismatchPlatformIframe bool `json:"mismatchPlatformIframe"`
+ MismatchPlatformWorker bool `json:"mismatchPlatformWorker"`
+ SwiftshaderRenderer bool `json:"swiftshaderRenderer"`
+ UTCTimezone bool `json:"utcTimezone"`
+ MismatchLanguages bool `json:"mismatchLanguages"`
+ InconsistentEtsl bool `json:"inconsistentEtsl"`
+ BotUserAgent bool `json:"botUserAgent"`
+ GPUMismatch bool `json:"gpuMismatch"`
+ PlatformMismatch bool `json:"platformMismatch"`
+ AnyDetected bool `json:"anyDetected"`
+ DetectedCount FlexInt `json:"detectedCount"`
+}
+
+func (f *FingerprintData) UnmarshalJSON(data []byte) error {
+ type rawFingerprintData FingerprintData
+
+ var raw rawFingerprintData
+ if err := json.Unmarshal(data, &raw); err != nil {
+ return err
+ }
+
+ *f = FingerprintData(raw)
+ f.Bot = newFingerprintBotAlias(f.FastBotDetectionDetails)
+
+ return nil
+}
+
+func newFingerprintBotAlias(details fingerprintFastBotDetectionDetails) fingerprintBotAlias {
+ alias := fingerprintBotAlias{
+ HeadlessChromeScreenResolution: bool(details.HeadlessChromeScreenResolution.Detected),
+ Webdriver: bool(details.HasWebdriver.Detected),
+ WebdriverWritable: bool(details.HasWebdriverWritable.Detected),
+ Selenium: bool(details.HasSeleniumProperty.Detected),
+ CDP: bool(details.HasCDP.Detected),
+ Playwright: bool(details.HasPlaywright.Detected),
+ ImpossibleDeviceMemory: bool(details.HasImpossibleDeviceMemory.Detected),
+ HighCPUCount: bool(details.HasHighCPUCount.Detected),
+ MissingChromeObject: bool(details.HasMissingChromeObject.Detected),
+ WebdriverIframe: bool(details.HasWebdriverIframe.Detected),
+ WebdriverWorker: bool(details.HasWebdriverWorker.Detected),
+ MismatchWebGLInWorker: bool(details.HasMismatchWebGLInWorker.Detected),
+ MismatchPlatformIframe: bool(details.HasMismatchPlatformIframe.Detected),
+ MismatchPlatformWorker: bool(details.HasMismatchPlatformWorker.Detected),
+ SwiftshaderRenderer: bool(details.HasSwiftshaderRenderer.Detected),
+ UTCTimezone: bool(details.HasUTCTimezone.Detected),
+ MismatchLanguages: bool(details.HasMismatchLanguages.Detected),
+ InconsistentEtsl: bool(details.HasInconsistentEtsl.Detected),
+ BotUserAgent: bool(details.HasBotUserAgent.Detected),
+ GPUMismatch: bool(details.HasGPUMismatch.Detected),
+ PlatformMismatch: bool(details.HasPlatformMismatch.Detected),
+ }
+
+ if alias.HeadlessChromeScreenResolution {
+ alias.DetectedCount++
+ }
+ if alias.Webdriver {
+ alias.DetectedCount++
+ }
+ if alias.WebdriverWritable {
+ alias.DetectedCount++
+ }
+ if alias.Selenium {
+ alias.DetectedCount++
+ }
+ if alias.CDP {
+ alias.DetectedCount++
+ }
+ if alias.Playwright {
+ alias.DetectedCount++
+ }
+ if alias.ImpossibleDeviceMemory {
+ alias.DetectedCount++
+ }
+ if alias.HighCPUCount {
+ alias.DetectedCount++
+ }
+ if alias.MissingChromeObject {
+ alias.DetectedCount++
+ }
+ if alias.WebdriverIframe {
+ alias.DetectedCount++
+ }
+ if alias.WebdriverWorker {
+ alias.DetectedCount++
+ }
+ if alias.MismatchWebGLInWorker {
+ alias.DetectedCount++
+ }
+ if alias.MismatchPlatformIframe {
+ alias.DetectedCount++
+ }
+ if alias.MismatchPlatformWorker {
+ alias.DetectedCount++
+ }
+ if alias.SwiftshaderRenderer {
+ alias.DetectedCount++
+ }
+ if alias.UTCTimezone {
+ alias.DetectedCount++
+ }
+ if alias.MismatchLanguages {
+ alias.DetectedCount++
+ }
+ if alias.InconsistentEtsl {
+ alias.DetectedCount++
+ }
+ if alias.BotUserAgent {
+ alias.DetectedCount++
+ }
+ if alias.GPUMismatch {
+ alias.DetectedCount++
+ }
+ if alias.PlatformMismatch {
+ alias.DetectedCount++
+ }
+
+ alias.AnyDetected = alias.DetectedCount > 0
+
+ return alias
+}
diff --git a/pkg/appsec/challenge/fingerprint_helpers.go b/pkg/appsec/challenge/fingerprint_helpers.go
new file mode 100644
index 00000000000..dfb5f51f158
--- /dev/null
+++ b/pkg/appsec/challenge/fingerprint_helpers.go
@@ -0,0 +1,168 @@
+package challenge
+
+// Handwritten helpers on *FingerprintData. Kept in a dedicated file (not
+// fingerprint.go) so a future fpscanner library bump — which rewrites the
+// data-shape structs — doesn't clobber these methods.
+
+// IsBot returns the library's fast-bot verdict as a native bool, so rules can write
+// `fingerprint.IsBot()` instead of `fingerprint.FastBotDetection.Bool() == true`.
+func (f *FingerprintData) IsBot() bool {
+ if f == nil {
+ return false
+ }
+
+ return bool(f.FastBotDetection)
+}
+
+// BotSignalCount returns the number of fast-bot-detection signals that fired.
+func (f *FingerprintData) BotSignalCount() int {
+ if f == nil {
+ return 0
+ }
+
+ return f.Bot.DetectedCount.Int()
+}
+
+// HasBotSignal returns true if any fast-bot-detection signal fired.
+func (f *FingerprintData) HasBotSignal() bool {
+ if f == nil {
+ return false
+ }
+
+ return f.Bot.AnyDetected
+}
+
+// HasAutomationSignal returns true if any automation-framework signal fired
+// (webdriver, selenium, CDP, playwright, bot user-agent regex).
+func (f *FingerprintData) HasAutomationSignal() bool {
+ if f == nil {
+ return false
+ }
+
+ b := f.Bot
+
+ return b.Webdriver ||
+ b.WebdriverWritable ||
+ b.Selenium ||
+ b.CDP ||
+ b.Playwright ||
+ b.BotUserAgent
+}
+
+// HasHeadlessSignal returns true if any headless-browser signal fired. Also
+// folds in inconsistent-etsl, which fires when the TLS-level `etsl` integer
+// disagrees with the claimed browser family — characteristic of patched /
+// forged headless environments.
+func (f *FingerprintData) HasHeadlessSignal() bool {
+ if f == nil {
+ return false
+ }
+
+ b := f.Bot
+
+ return b.HeadlessChromeScreenResolution ||
+ b.MissingChromeObject ||
+ b.SwiftshaderRenderer ||
+ b.InconsistentEtsl
+}
+
+// HasMismatchSignal returns true if any cross-context or cross-API mismatch
+// signal fired (iframe/worker webdriver, platform, WebGL in worker, UA-vs-
+// navigator platform, GPU, languages).
+func (f *FingerprintData) HasMismatchSignal() bool {
+ if f == nil {
+ return false
+ }
+
+ b := f.Bot
+
+ return b.MismatchWebGLInWorker ||
+ b.MismatchPlatformIframe ||
+ b.MismatchPlatformWorker ||
+ b.WebdriverIframe ||
+ b.WebdriverWorker ||
+ b.PlatformMismatch ||
+ b.GPUMismatch ||
+ b.MismatchLanguages
+}
+
+// HasImpossibleDeviceSignal returns true if the reported device specs are outside
+// plausible bounds (memory / CPU count).
+func (f *FingerprintData) HasImpossibleDeviceSignal() bool {
+ if f == nil {
+ return false
+ }
+
+ b := f.Bot
+
+ return b.ImpossibleDeviceMemory || b.HighCPUCount
+}
+
+// UserAgent returns the user-agent reported by the browser.
+func (f *FingerprintData) UserAgent() string {
+ if f == nil {
+ return ""
+ }
+
+ return f.Signals.Browser.UserAgent
+}
+
+// Platform returns the browser-reported platform, preferring the high-entropy
+// client-hint value and falling back to navigator.platform.
+func (f *FingerprintData) Platform() string {
+ if f == nil {
+ return ""
+ }
+
+ if p := f.Signals.Browser.HighEntropyValues.Platform; p != "" {
+ return p
+ }
+
+ return f.Signals.Device.Platform
+}
+
+// Timezone returns the browser-reported IANA timezone.
+func (f *FingerprintData) Timezone() string {
+ if f == nil {
+ return ""
+ }
+
+ return f.Signals.Locale.Internationalization.Timezone
+}
+
+// Language returns the browser's primary language.
+func (f *FingerprintData) Language() string {
+ if f == nil {
+ return ""
+ }
+
+ return f.Signals.Locale.Languages.Language
+}
+
+// IsMobile returns true if the browser advertises a mobile form factor
+// (via UA client hints).
+func (f *FingerprintData) IsMobile() bool {
+ if f == nil {
+ return false
+ }
+
+ return bool(f.Signals.Browser.HighEntropyValues.Mobile)
+}
+
+// CPUCount returns navigator.hardwareConcurrency as a native int.
+func (f *FingerprintData) CPUCount() int {
+ if f == nil {
+ return 0
+ }
+
+ return f.Signals.Device.CPUCount.Int()
+}
+
+// Memory returns navigator.deviceMemory as a native int.
+func (f *FingerprintData) Memory() int {
+ if f == nil {
+ return 0
+ }
+
+ return f.Signals.Device.Memory.Int()
+}
diff --git a/pkg/appsec/challenge/fingerprint_helpers_test.go b/pkg/appsec/challenge/fingerprint_helpers_test.go
new file mode 100644
index 00000000000..34958c23cc6
--- /dev/null
+++ b/pkg/appsec/challenge/fingerprint_helpers_test.go
@@ -0,0 +1,158 @@
+package challenge
+
+import (
+ "encoding/json"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+)
+
+const sampleFingerprintJSON = `{
+ "signals": {
+ "device": {
+ "cpuCount": 14,
+ "memory": 8,
+ "platform": "MacIntel"
+ },
+ "browser": {
+ "userAgent": "Mozilla/5.0 Chrome",
+ "highEntropyValues": {
+ "platform": "macOS",
+ "mobile": false
+ }
+ },
+ "locale": {
+ "internationalization": {"timezone": "Europe/Paris"},
+ "languages": {"language": "en", "languages": ["en","fr"]}
+ }
+ },
+ "fsid": "FS1_abc",
+ "nonce": "n1",
+ "time": 1770669806462,
+ "url": "http://localhost/",
+ "fastBotDetection": true,
+ "fastBotDetectionDetails": {
+ "hasCDP": {"detected": true, "severity": "high"},
+ "headlessChromeScreenResolution": {"detected": false, "severity": "high"},
+ "hasWebdriver": {"detected": false, "severity": "high"},
+ "hasWebdriverWritable": {"detected": false, "severity": "high"},
+ "hasSeleniumProperty": {"detected": false, "severity": "high"},
+ "hasPlaywright": {"detected": false, "severity": "high"},
+ "hasImpossibleDeviceMemory":{"detected": false, "severity": "high"},
+ "hasHighCPUCount": {"detected": false, "severity": "high"},
+ "hasMissingChromeObject": {"detected": false, "severity": "high"},
+ "hasWebdriverIframe": {"detected": false, "severity": "high"},
+ "hasWebdriverWorker": {"detected": false, "severity": "high"},
+ "hasMismatchWebGLInWorker": {"detected": false, "severity": "high"},
+ "hasMismatchPlatformIframe":{"detected": false, "severity": "high"},
+ "hasMismatchPlatformWorker":{"detected": false, "severity": "high"},
+ "hasSwiftshaderRenderer": {"detected": false, "severity": "low"},
+ "hasUTCTimezone": {"detected": false, "severity": "medium"}
+ }
+}`
+
+func TestFingerprintHelpers_Getters(t *testing.T) {
+ var fp FingerprintData
+ require.NoError(t, json.Unmarshal([]byte(sampleFingerprintJSON), &fp))
+
+ assert.True(t, fp.IsBot())
+ assert.True(t, fp.HasBotSignal())
+ assert.Equal(t, 1, fp.BotSignalCount())
+
+ // only CDP is set in the sample, so only HasAutomationSignal should flip
+ assert.True(t, fp.HasAutomationSignal())
+ assert.False(t, fp.HasHeadlessSignal())
+ assert.False(t, fp.HasMismatchSignal())
+ assert.False(t, fp.HasImpossibleDeviceSignal())
+
+ assert.Equal(t, "Mozilla/5.0 Chrome", fp.UserAgent())
+ assert.Equal(t, "macOS", fp.Platform()) // prefers high-entropy value
+ assert.Equal(t, "Europe/Paris", fp.Timezone())
+ assert.Equal(t, "en", fp.Language())
+ assert.False(t, fp.IsMobile())
+ assert.Equal(t, 14, fp.CPUCount())
+ assert.Equal(t, 8, fp.Memory())
+}
+
+func TestFingerprintHelpers_PlatformFallback(t *testing.T) {
+ // no high-entropy platform -> falls back to navigator.platform
+ fp := FingerprintData{}
+ fp.Signals.Device.Platform = "Linux x86_64"
+ assert.Equal(t, "Linux x86_64", fp.Platform())
+}
+
+func TestFingerprintHelpers_NilReceiver(t *testing.T) {
+ var fp *FingerprintData
+
+ assert.False(t, fp.IsBot())
+ assert.False(t, fp.HasBotSignal())
+ assert.Equal(t, 0, fp.BotSignalCount())
+ assert.False(t, fp.HasAutomationSignal())
+ assert.False(t, fp.HasHeadlessSignal())
+ assert.False(t, fp.HasMismatchSignal())
+ assert.False(t, fp.HasImpossibleDeviceSignal())
+ assert.Equal(t, "", fp.UserAgent())
+ assert.Equal(t, "", fp.Platform())
+ assert.Equal(t, "", fp.Timezone())
+ assert.Equal(t, "", fp.Language())
+ assert.False(t, fp.IsMobile())
+ assert.Equal(t, 0, fp.CPUCount())
+ assert.Equal(t, 0, fp.Memory())
+}
+
+func TestFingerprintHelpers_CategoryAggregates(t *testing.T) {
+ const (
+ catAutomation = "automation"
+ catHeadless = "headless"
+ catMismatch = "mismatch"
+ catImpossibleDevice = "impossible_device"
+ )
+
+ cases := []struct {
+ name string
+ set func(*fingerprintBotAlias)
+ want string
+ }{
+ {"webdriver", func(b *fingerprintBotAlias) { b.Webdriver = true }, catAutomation},
+ {"webdriverWritable", func(b *fingerprintBotAlias) { b.WebdriverWritable = true }, catAutomation},
+ {"selenium", func(b *fingerprintBotAlias) { b.Selenium = true }, catAutomation},
+ {"cdp", func(b *fingerprintBotAlias) { b.CDP = true }, catAutomation},
+ {"playwright", func(b *fingerprintBotAlias) { b.Playwright = true }, catAutomation},
+
+ {"headlessChromeScreenResolution", func(b *fingerprintBotAlias) { b.HeadlessChromeScreenResolution = true }, catHeadless},
+ {"missingChromeObject", func(b *fingerprintBotAlias) { b.MissingChromeObject = true }, catHeadless},
+ {"swiftshaderRenderer", func(b *fingerprintBotAlias) { b.SwiftshaderRenderer = true }, catHeadless},
+
+ {"mismatchWebGLInWorker", func(b *fingerprintBotAlias) { b.MismatchWebGLInWorker = true }, catMismatch},
+ {"mismatchPlatformIframe", func(b *fingerprintBotAlias) { b.MismatchPlatformIframe = true }, catMismatch},
+ {"mismatchPlatformWorker", func(b *fingerprintBotAlias) { b.MismatchPlatformWorker = true }, catMismatch},
+ {"webdriverIframe", func(b *fingerprintBotAlias) { b.WebdriverIframe = true }, catMismatch},
+ {"webdriverWorker", func(b *fingerprintBotAlias) { b.WebdriverWorker = true }, catMismatch},
+
+ {"impossibleDeviceMemory", func(b *fingerprintBotAlias) { b.ImpossibleDeviceMemory = true }, catImpossibleDevice},
+ {"highCPUCount", func(b *fingerprintBotAlias) { b.HighCPUCount = true }, catImpossibleDevice},
+ }
+
+ for _, tc := range cases {
+ t.Run(tc.name, func(t *testing.T) {
+ fp := &FingerprintData{}
+ tc.set(&fp.Bot)
+
+ got := map[string]bool{
+ catAutomation: fp.HasAutomationSignal(),
+ catHeadless: fp.HasHeadlessSignal(),
+ catMismatch: fp.HasMismatchSignal(),
+ catImpossibleDevice: fp.HasImpossibleDeviceSignal(),
+ }
+
+ for cat, fired := range got {
+ if cat == tc.want {
+ assert.True(t, fired, "expected category %q to fire", cat)
+ } else {
+ assert.False(t, fired, "expected category %q to stay false", cat)
+ }
+ }
+ })
+ }
+}
diff --git a/pkg/appsec/challenge/fingerprint_mismatch.go b/pkg/appsec/challenge/fingerprint_mismatch.go
new file mode 100644
index 00000000000..f7c2a3613c6
--- /dev/null
+++ b/pkg/appsec/challenge/fingerprint_mismatch.go
@@ -0,0 +1,256 @@
+package challenge
+
+import (
+ "net/http"
+ "strings"
+
+ "golang.org/x/text/language"
+)
+
+// UAMobileMismatch reports whether the fingerprint's user-agent claims a
+// mobile form factor while the reported inner viewport width is implausibly
+// wide for a real device. Catches the "UA switcher set to Android while
+// actually on a desktop" pattern.
+//
+// Returns false (no signal) when either the UA doesn't claim mobile or the
+// inner width is zero/missing.
+func (f *FingerprintData) UAMobileMismatch() bool {
+ if f == nil {
+ return false
+ }
+
+ ua := f.UserAgent()
+ if ua == "" {
+ return false
+ }
+
+ if !mobileUARegex.MatchString(ua) {
+ return false
+ }
+
+ innerWidth := f.Signals.Device.ScreenResolution.InnerWidth.Int()
+ if innerWidth <= 0 {
+ return false
+ }
+
+ return innerWidth >= mobileViewportThreshold
+}
+
+// AcceptLanguageMismatch reports whether the request's Accept-Language
+// header disagrees with the fingerprint's navigator.language. Both are
+// derived from the same browser preference, so on a real browser they
+// should agree at the base-language level.
+//
+// Returns false when either side is empty or unparseable — never a false
+// positive on missing data.
+//
+// Deliberately different from the library's MismatchLanguages detection,
+// which only compares navigator.languages[0] to navigator.language inside
+// the browser; this helper brings the HTTP header into the comparison.
+func (f *FingerprintData) AcceptLanguageMismatch(req *http.Request) bool {
+ if f == nil || req == nil {
+ return false
+ }
+
+ fpLang := f.Language()
+ if fpLang == "" {
+ return false
+ }
+
+ header := req.Header.Get("Accept-Language")
+ if header == "" {
+ return false
+ }
+
+ tags, _, err := language.ParseAcceptLanguage(header)
+ if err != nil || len(tags) == 0 {
+ return false
+ }
+
+ headerBase, _ := tags[0].Base()
+
+ fpTag, err := language.Parse(fpLang)
+ if err != nil {
+ return false
+ }
+
+ fpBase, _ := fpTag.Base()
+
+ return headerBase.String() != fpBase.String()
+}
+
+// TimezoneCountryMismatch reports whether the fingerprint's timezone
+// disagrees with the client's country of origin (typically resolved via
+// IPToCountry from the client IP).
+//
+// SOFT SIGNAL. Travelers whose OS timezone hasn't auto-adjusted and VPN
+// users will legitimately trigger this. Rule authors should combine it
+// with other signals (High()/Medium() counts, or reason-specific checks)
+// before using it alone to ban.
+//
+// Returns false when either the timezone is unknown to our IANA table or
+// the country is empty.
+func (f *FingerprintData) TimezoneCountryMismatch(country string) bool {
+ if f == nil || country == "" {
+ return false
+ }
+
+ tz := f.Timezone()
+ if tz == "" {
+ return false
+ }
+
+ countries := lookupTimezoneCountries(tz)
+ if len(countries) == 0 {
+ return false
+ }
+
+ for _, c := range countries {
+ if c == country {
+ return false
+ }
+ }
+
+ return true
+}
+
+// MismatchSignal is a single fired reason/severity pair on the report.
+type MismatchSignal struct {
+ Reason string
+ Severity string
+}
+
+// MismatchReport aggregates the fired mismatch signals for a single
+// fingerprint evaluation. Returned by ComputeMismatchReport; typically
+// accessed through the cached EvaluateMismatches closure in the
+// on_challenge expr env.
+type MismatchReport struct {
+ Signals []MismatchSignal
+}
+
+// Count returns the total number of fired signals.
+func (r *MismatchReport) Count() int {
+ if r == nil {
+ return 0
+ }
+ return len(r.Signals)
+}
+
+// Empty reports whether no signal fired.
+func (r *MismatchReport) Empty() bool {
+ return r.Count() == 0
+}
+
+// Has reports whether a signal with the given reason key is present.
+func (r *MismatchReport) Has(reason string) bool {
+ if r == nil {
+ return false
+ }
+ for _, s := range r.Signals {
+ if s.Reason == reason {
+ return true
+ }
+ }
+ return false
+}
+
+// Reasons returns the stable-ordered list of fired reason keys.
+func (r *MismatchReport) Reasons() []string {
+ if r == nil {
+ return nil
+ }
+ out := make([]string, len(r.Signals))
+ for i, s := range r.Signals {
+ out[i] = s.Reason
+ }
+ return out
+}
+
+// High returns the count of signals tagged with the "high" severity.
+func (r *MismatchReport) High() int {
+ return r.BySeverity(SeverityHigh)
+}
+
+// Medium returns the count of signals tagged with the "medium" severity.
+func (r *MismatchReport) Medium() int {
+ return r.BySeverity(SeverityMedium)
+}
+
+// Low returns the count of signals tagged with the "low" severity.
+func (r *MismatchReport) Low() int {
+ return r.BySeverity(SeverityLow)
+}
+
+// BySeverity returns the count of signals at the requested severity level.
+func (r *MismatchReport) BySeverity(sev string) int {
+ if r == nil {
+ return 0
+ }
+ n := 0
+ for _, s := range r.Signals {
+ if s.Severity == sev {
+ n++
+ }
+ }
+ return n
+}
+
+// String renders the report as "reason1(sev),reason2(sev)" for log lines.
+func (r *MismatchReport) String() string {
+ if r == nil || len(r.Signals) == 0 {
+ return ""
+ }
+ var b strings.Builder
+ for i, s := range r.Signals {
+ if i > 0 {
+ b.WriteByte(',')
+ }
+ b.WriteString(s.Reason)
+ b.WriteByte('(')
+ b.WriteString(s.Severity)
+ b.WriteByte(')')
+ }
+ return b.String()
+}
+
+// ComputeMismatchReport walks the library-native bot alias plus the
+// CrowdSec custom helpers and returns every fired signal in a stable
+// order. It is the pure computation backing EvaluateMismatches; callers
+// wanting caching + observability should use the env closure registered
+// in GetOnChallengeEnv instead.
+//
+// `country` is the ISO-3166 alpha-2 code of the client's geolocated
+// country, or "" when unknown. Pass `exprhelpers.IPToCountry(...)`'s
+// return value (or equivalent) — resolved once at the call site so this
+// method stays free of side-effects.
+//
+// Iteration order is libDetections first (in the order declared there),
+// then customDetections. Reason / severity / accessor binding for every
+// check lives in one place — fingerprint_mismatch_data.go.
+func (f *FingerprintData) ComputeMismatchReport(req *http.Request, country string) *MismatchReport {
+ report := &MismatchReport{}
+
+ if f == nil {
+ return report
+ }
+
+ for _, d := range libDetections {
+ if d.Read(f.Bot) {
+ report.Signals = append(report.Signals, MismatchSignal{
+ Reason: d.Key,
+ Severity: d.Severity,
+ })
+ }
+ }
+
+ for _, d := range customDetections {
+ if d.Fire(f, req, country) {
+ report.Signals = append(report.Signals, MismatchSignal{
+ Reason: d.Key,
+ Severity: d.Severity,
+ })
+ }
+ }
+
+ return report
+}
diff --git a/pkg/appsec/challenge/fingerprint_mismatch_data.go b/pkg/appsec/challenge/fingerprint_mismatch_data.go
new file mode 100644
index 00000000000..a163f73a880
--- /dev/null
+++ b/pkg/appsec/challenge/fingerprint_mismatch_data.go
@@ -0,0 +1,163 @@
+package challenge
+
+import (
+ "net/http"
+ "regexp"
+)
+
+// Severity labels. Mirror the fpscanner library's fastBotDetectionDetails[*].severity
+// strings so the vocabulary is consistent end-to-end.
+const (
+ SeverityHigh = "high"
+ SeverityMedium = "medium"
+ SeverityLow = "low"
+)
+
+// Stable reason keys. One per entry in libDetections / customDetections
+// below. Kept as exported constants so rule authors can
+// `Has("platform_mismatch")` without typos.
+const (
+ ReasonCDP = "cdp"
+ ReasonWebdriver = "webdriver"
+ ReasonWebdriverWritable = "webdriver_writable"
+ ReasonSelenium = "selenium"
+ ReasonPlaywright = "playwright"
+ ReasonWebdriverIframe = "webdriver_iframe"
+ ReasonWebdriverWorker = "webdriver_worker"
+ ReasonHeadlessScreenResolution = "headless_screen_resolution"
+ ReasonMissingChromeObject = "missing_chrome_object"
+ ReasonImpossibleMemory = "impossible_memory"
+ ReasonHighCPUCount = "high_cpu_count"
+ ReasonMismatchWebGLWorker = "mismatch_webgl_worker"
+ ReasonMismatchPlatformIframe = "mismatch_platform_iframe"
+ ReasonMismatchPlatformWorker = "mismatch_platform_worker"
+ ReasonPlatformMismatch = "platform_mismatch"
+ ReasonGPUMismatch = "gpu_mismatch"
+ ReasonBotUserAgent = "bot_user_agent"
+ ReasonInconsistentEtsl = "inconsistent_etsl"
+ ReasonUAMobile = "ua_mobile"
+ ReasonUTCTimezone = "utc_timezone"
+ ReasonAcceptLanguage = "accept_language"
+ ReasonSwiftshaderRenderer = "swiftshader_renderer"
+ ReasonMismatchLanguages = "mismatch_languages"
+ ReasonTimezoneCountry = "timezone_country"
+)
+
+// libDetection binds an fpscanner-native signal to the bot-alias bool that
+// carries its `detected` flag, together with our severity label for it.
+//
+// TODO: the fpscanner library ships each check with its own severity in the
+// JSON payload. We don't unmarshal `severity` today (the struct only carries
+// `detected`), so the severity values below are a mirror of what the library
+// defaults to. When `fingerprintDetectionResult` grows a Severity field, we
+// can drop the Severity column here and read it from the payload instead.
+type libDetection struct {
+ Key string
+ Severity string
+ Read func(fingerprintBotAlias) bool
+}
+
+// libDetections is the single source of truth for every library-native bot
+// signal we surface: the reason key, its severity, and how to read its
+// `detected` value from the bot alias. Append-only and ordering-stable so
+// `MismatchReport.Reasons()` has a deterministic output.
+var libDetections = []libDetection{
+ {ReasonCDP, SeverityHigh, func(b fingerprintBotAlias) bool { return b.CDP }},
+ {ReasonWebdriver, SeverityHigh, func(b fingerprintBotAlias) bool { return b.Webdriver }},
+ {ReasonWebdriverWritable, SeverityHigh, func(b fingerprintBotAlias) bool { return b.WebdriverWritable }},
+ {ReasonSelenium, SeverityHigh, func(b fingerprintBotAlias) bool { return b.Selenium }},
+ {ReasonPlaywright, SeverityHigh, func(b fingerprintBotAlias) bool { return b.Playwright }},
+ {ReasonWebdriverIframe, SeverityHigh, func(b fingerprintBotAlias) bool { return b.WebdriverIframe }},
+ {ReasonWebdriverWorker, SeverityHigh, func(b fingerprintBotAlias) bool { return b.WebdriverWorker }},
+ {ReasonHeadlessScreenResolution, SeverityHigh, func(b fingerprintBotAlias) bool { return b.HeadlessChromeScreenResolution }},
+ {ReasonMissingChromeObject, SeverityHigh, func(b fingerprintBotAlias) bool { return b.MissingChromeObject }},
+ {ReasonImpossibleMemory, SeverityHigh, func(b fingerprintBotAlias) bool { return b.ImpossibleDeviceMemory }},
+ {ReasonHighCPUCount, SeverityHigh, func(b fingerprintBotAlias) bool { return b.HighCPUCount }},
+ {ReasonMismatchWebGLWorker, SeverityHigh, func(b fingerprintBotAlias) bool { return b.MismatchWebGLInWorker }},
+ {ReasonMismatchPlatformIframe, SeverityHigh, func(b fingerprintBotAlias) bool { return b.MismatchPlatformIframe }},
+ {ReasonMismatchPlatformWorker, SeverityHigh, func(b fingerprintBotAlias) bool { return b.MismatchPlatformWorker }},
+ {ReasonPlatformMismatch, SeverityHigh, func(b fingerprintBotAlias) bool { return b.PlatformMismatch }},
+ {ReasonGPUMismatch, SeverityHigh, func(b fingerprintBotAlias) bool { return b.GPUMismatch }},
+ {ReasonBotUserAgent, SeverityHigh, func(b fingerprintBotAlias) bool { return b.BotUserAgent }},
+ {ReasonInconsistentEtsl, SeverityHigh, func(b fingerprintBotAlias) bool { return b.InconsistentEtsl }},
+ {ReasonUTCTimezone, SeverityMedium, func(b fingerprintBotAlias) bool { return b.UTCTimezone }},
+ {ReasonSwiftshaderRenderer, SeverityLow, func(b fingerprintBotAlias) bool { return b.SwiftshaderRenderer }},
+ {ReasonMismatchLanguages, SeverityLow, func(b fingerprintBotAlias) bool { return b.MismatchLanguages }},
+}
+
+// customDetection binds a CrowdSec-authored mismatch helper (which may need
+// request or geoip data) to its reason key and severity. The Fire function
+// wraps whichever method-on-fp is the actual check — unified signature so
+// customDetections can be iterated like libDetections.
+type customDetection struct {
+ Key string
+ Severity string
+ Fire func(fp *FingerprintData, req *http.Request, country string) bool
+}
+
+// customDetections lists every check we run on top of the library's own.
+// Ordering is stable and comes after libDetections in the final report.
+var customDetections = []customDetection{
+ {
+ Key: ReasonUAMobile,
+ Severity: SeverityMedium,
+ Fire: func(fp *FingerprintData, _ *http.Request, _ string) bool { return fp.UAMobileMismatch() },
+ },
+ {
+ Key: ReasonAcceptLanguage,
+ Severity: SeverityMedium,
+ Fire: func(fp *FingerprintData, req *http.Request, _ string) bool { return fp.AcceptLanguageMismatch(req) },
+ },
+ {
+ Key: ReasonTimezoneCountry,
+ Severity: SeverityLow,
+ Fire: func(fp *FingerprintData, _ *http.Request, country string) bool { return fp.TimezoneCountryMismatch(country) },
+ },
+}
+
+// severityByReason is derived once at init from the two detection tables
+// above. It exists so callers that only need the severity for a reason key
+// (metric labels, tests, SeverityFor) don't have to walk the tables.
+var severityByReason = buildSeverityByReason()
+
+func buildSeverityByReason() map[string]string {
+ m := make(map[string]string, len(libDetections)+len(customDetections))
+ for _, d := range libDetections {
+ m[d.Key] = d.Severity
+ }
+ for _, d := range customDetections {
+ m[d.Key] = d.Severity
+ }
+ return m
+}
+
+// SeverityFor returns the severity tagged to a reason key, or "" for
+// unknown reasons.
+func SeverityFor(reason string) string {
+ return severityByReason[reason]
+}
+
+// KnownReasons returns the full set of reason keys the aggregator may emit.
+// Order is not guaranteed; callers that need deterministic ordering should
+// walk libDetections / customDetections directly.
+func KnownReasons() []string {
+ out := make([]string, 0, len(severityByReason))
+ for k := range severityByReason {
+ out = append(out, k)
+ }
+ return out
+}
+
+// mobileUARegex matches UAs that claim a PHONE form factor. Deliberately
+// does not match bare "Android", because per Google's UA convention the
+// `Mobile` / `Mobi` token is what phones add and tablets omit. Matching
+// Android alone would FP on every Android tablet in landscape and on
+// Samsung DeX / Android desktop mode (UA keeps "Android", viewport is
+// ≥1000px).
+var mobileUARegex = regexp.MustCompile(`(?i)Mobi|iPhone|iPod`)
+
+// mobileViewportThreshold is the innerWidth cutoff above which we treat a
+// mobile-claiming UA as inconsistent. Real phones report CSS pixel widths
+// well below this (typical phones: 360-430). Tablets run wider but don't
+// match the UA regex above, so this threshold only applies to phone-UAs.
+const mobileViewportThreshold = 1000
diff --git a/pkg/appsec/challenge/fingerprint_mismatch_test.go b/pkg/appsec/challenge/fingerprint_mismatch_test.go
new file mode 100644
index 00000000000..b3f61450d09
--- /dev/null
+++ b/pkg/appsec/challenge/fingerprint_mismatch_test.go
@@ -0,0 +1,334 @@
+package challenge
+
+import (
+ "encoding/json"
+ "net/http"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+)
+
+// androidOnLinuxSample is the user-provided fingerprint with a spoofed
+// Android/Firefox UA on a real Chromium-on-Linux environment. It's kept
+// verbatim as a permanent regression fixture.
+const androidOnLinuxSample = `{
+ "signals": {
+ "automation": {"webdriver": false, "cdp": true},
+ "device": {
+ "cpuCount": 16,
+ "memory": 8,
+ "platform": "Linux x86_64",
+ "screenResolution": {
+ "width": 1920, "height": 1080,
+ "innerWidth": 1920, "innerHeight": 993
+ }
+ },
+ "browser": {
+ "userAgent": "Mozilla/5.0 (Android 4.4; Mobile; rv:70.0) Gecko/70.0 Firefox/70.0",
+ "features": {"chrome": true},
+ "highEntropyValues": {"platform": "", "mobile": false}
+ },
+ "locale": {
+ "internationalization": {"timezone": "Europe/Paris"},
+ "languages": {"language": "en-US", "languages": ["en-US"]}
+ }
+ },
+ "fsid": "FS_SAMPLE",
+ "nonce": "n",
+ "time": 1776669341379,
+ "url": "https://example/",
+ "fastBotDetection": true,
+ "fastBotDetectionDetails": {
+ "hasCDP": {"detected": true, "severity": "high"},
+ "hasInconsistentEtsl": {"detected": true, "severity": "high"},
+ "hasPlatformMismatch": {"detected": true, "severity": "high"},
+ "headlessChromeScreenResolution": {"detected": false, "severity": "high"},
+ "hasWebdriver": {"detected": false, "severity": "high"},
+ "hasWebdriverWritable": {"detected": false, "severity": "high"},
+ "hasSeleniumProperty": {"detected": false, "severity": "high"},
+ "hasPlaywright": {"detected": false, "severity": "high"},
+ "hasImpossibleDeviceMemory":{"detected": false, "severity": "high"},
+ "hasHighCPUCount": {"detected": false, "severity": "high"},
+ "hasMissingChromeObject": {"detected": false, "severity": "high"},
+ "hasWebdriverIframe": {"detected": false, "severity": "high"},
+ "hasWebdriverWorker": {"detected": false, "severity": "high"},
+ "hasMismatchWebGLInWorker": {"detected": false, "severity": "high"},
+ "hasMismatchPlatformIframe":{"detected": false, "severity": "high"},
+ "hasMismatchPlatformWorker":{"detected": false, "severity": "high"},
+ "hasSwiftshaderRenderer": {"detected": false, "severity": "low"},
+ "hasUTCTimezone": {"detected": false, "severity": "medium"},
+ "hasMismatchLanguages": {"detected": false, "severity": "low"},
+ "hasBotUserAgent": {"detected": false, "severity": "high"},
+ "hasGPUMismatch": {"detected": false, "severity": "high"}
+ }
+}`
+
+func mustUnmarshal(t *testing.T, raw string) *FingerprintData {
+ t.Helper()
+ fp := &FingerprintData{}
+ require.NoError(t, json.Unmarshal([]byte(raw), fp))
+ return fp
+}
+
+func TestUAMobileMismatch(t *testing.T) {
+ cases := []struct {
+ name string
+ ua string
+ innerWidth int
+ want bool
+ }{
+ {"android phone UA desktop viewport", "Mozilla/5.0 (Android 4.4; Mobile; rv:70.0)", 1920, true},
+ {"iphone UA huge viewport", "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0)", 1440, true},
+ {"real android phone small viewport", "Mozilla/5.0 (Linux; Android 14; Pixel 7) Mobile", 412, false},
+ {"desktop UA desktop viewport", "Mozilla/5.0 (X11; Linux x86_64) Chrome/120", 1920, false},
+ {"mobile UA missing innerWidth", "Mozilla/5.0 (Android 10; Mobile)", 0, false},
+ {"empty UA", "", 1920, false},
+ // Regression: a real Android tablet UA lacks the "Mobile" token by
+ // Google's convention. Its landscape viewport is wider than 1000px.
+ // Must NOT fire — previously a FP when the regex matched bare "Android".
+ {"android tablet landscape", "Mozilla/5.0 (Linux; Android 13; SM-X710) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36", 1280, false},
+ // Regression: Samsung DeX / Android desktop mode keeps "Android" in
+ // the UA but the user is on a desktop-sized screen. Must NOT fire.
+ {"samsung dex desktop viewport", "Mozilla/5.0 (Linux; Android 13; SM-S908U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36", 1920, false},
+ }
+
+ for _, tc := range cases {
+ t.Run(tc.name, func(t *testing.T) {
+ fp := &FingerprintData{}
+ fp.Signals.Browser.UserAgent = tc.ua
+ fp.Signals.Device.ScreenResolution.InnerWidth = FlexInt(tc.innerWidth)
+ assert.Equal(t, tc.want, fp.UAMobileMismatch())
+ })
+ }
+
+ var nilFP *FingerprintData
+ assert.False(t, nilFP.UAMobileMismatch())
+}
+
+func TestAcceptLanguageMismatch(t *testing.T) {
+ cases := []struct {
+ name string
+ header string
+ fpLang string
+ want bool
+ }{
+ {"match en simple", "en-US,fr;q=0.8", "en", false},
+ {"match fr simple", "fr-FR,fr;q=0.9,en;q=0.5", "fr", false},
+ {"mismatch de vs en", "de-DE,de;q=0.9", "en", true},
+ {"mismatch zh vs en", "zh-CN", "en-US", true},
+ {"missing header", "", "en", false},
+ {"missing fp lang", "en-US", "", false},
+ {"garbage header", "@@@", "en", false},
+ {"garbage fp lang", "en-US", "@@@", false},
+ }
+
+ for _, tc := range cases {
+ t.Run(tc.name, func(t *testing.T) {
+ fp := &FingerprintData{}
+ fp.Signals.Locale.Languages.Language = tc.fpLang
+
+ req, err := http.NewRequest("GET", "http://x/", nil)
+ require.NoError(t, err)
+ if tc.header != "" {
+ req.Header.Set("Accept-Language", tc.header)
+ }
+
+ assert.Equal(t, tc.want, fp.AcceptLanguageMismatch(req))
+ })
+ }
+
+ var nilFP *FingerprintData
+ assert.False(t, nilFP.AcceptLanguageMismatch(nil))
+}
+
+func TestTimezoneCountryMismatch(t *testing.T) {
+ cases := []struct {
+ name string
+ tz string
+ country string
+ want bool
+ }{
+ {"paris in france", "Europe/Paris", "FR", false},
+ {"paris for monaco too", "Europe/Paris", "MC", false},
+ {"paris claimed from US", "Europe/Paris", "US", true},
+ {"new york in us", "America/New_York", "US", false},
+ {"new york claimed from fr", "America/New_York", "FR", true},
+ {"alias calcutta", "Asia/Calcutta", "IN", false},
+ {"alias kiev", "Europe/Kiev", "UA", false},
+ {"unknown tz", "Made/Up", "FR", false},
+ {"empty country", "Europe/Paris", "", false},
+ {"empty tz", "", "FR", false},
+ }
+
+ for _, tc := range cases {
+ t.Run(tc.name, func(t *testing.T) {
+ fp := &FingerprintData{}
+ fp.Signals.Locale.Internationalization.Timezone = tc.tz
+ assert.Equal(t, tc.want, fp.TimezoneCountryMismatch(tc.country))
+ })
+ }
+
+ var nilFP *FingerprintData
+ assert.False(t, nilFP.TimezoneCountryMismatch("FR"))
+}
+
+func TestMismatchReport_Helpers(t *testing.T) {
+ r := &MismatchReport{Signals: []MismatchSignal{
+ {Reason: ReasonCDP, Severity: SeverityHigh},
+ {Reason: ReasonPlatformMismatch, Severity: SeverityHigh},
+ {Reason: ReasonAcceptLanguage, Severity: SeverityMedium},
+ {Reason: ReasonTimezoneCountry, Severity: SeverityLow},
+ }}
+
+ assert.Equal(t, 4, r.Count())
+ assert.False(t, r.Empty())
+ assert.Equal(t, 2, r.High())
+ assert.Equal(t, 1, r.Medium())
+ assert.Equal(t, 1, r.Low())
+ assert.Equal(t, 2, r.BySeverity(SeverityHigh))
+ assert.True(t, r.Has(ReasonCDP))
+ assert.False(t, r.Has(ReasonBotUserAgent))
+ assert.Equal(t, []string{ReasonCDP, ReasonPlatformMismatch, ReasonAcceptLanguage, ReasonTimezoneCountry}, r.Reasons())
+ assert.Equal(t,
+ "cdp(high),platform_mismatch(high),accept_language(medium),timezone_country(low)",
+ r.String(),
+ )
+}
+
+func TestMismatchReport_NilReceiver(t *testing.T) {
+ var r *MismatchReport
+ assert.Equal(t, 0, r.Count())
+ assert.True(t, r.Empty())
+ assert.False(t, r.Has(ReasonCDP))
+ assert.Nil(t, r.Reasons())
+ assert.Equal(t, 0, r.High())
+ assert.Equal(t, 0, r.Medium())
+ assert.Equal(t, 0, r.Low())
+ assert.Equal(t, "", r.String())
+}
+
+func TestComputeMismatchReport_AndroidOnLinuxSample(t *testing.T) {
+ fp := mustUnmarshal(t, androidOnLinuxSample)
+
+ req, err := http.NewRequest("GET", "http://x/", nil)
+ require.NoError(t, err)
+
+ // Request originates from France; timezone is also Europe/Paris, so
+ // timezone_country should NOT fire. The Android-UA + 1920 viewport
+ // should fire ua_mobile, and the library-native detections fire cdp,
+ // inconsistent_etsl, platform_mismatch.
+ report := fp.ComputeMismatchReport(req, "FR")
+
+ assert.Equal(t, []string{
+ ReasonCDP,
+ ReasonPlatformMismatch,
+ ReasonInconsistentEtsl,
+ ReasonUAMobile,
+ }, report.Reasons())
+ assert.Equal(t, 3, report.High())
+ assert.Equal(t, 1, report.Medium(), "ua_mobile is medium severity")
+ assert.Equal(t, 0, report.Low())
+}
+
+func TestComputeMismatchReport_BaselineConsistent(t *testing.T) {
+ // Minimal consistent fingerprint — no library detections, consistent
+ // UA/platform, en Accept-Language, FR timezone, from FR.
+ raw := `{
+ "signals": {
+ "device": {"platform": "MacIntel"},
+ "browser": {
+ "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/120",
+ "highEntropyValues": {"platform": "macOS", "mobile": false}
+ },
+ "locale": {
+ "internationalization": {"timezone": "Europe/Paris"},
+ "languages": {"language": "en"}
+ }
+ },
+ "fsid": "FS_OK", "nonce": "n", "time": 1, "url": "http://x/",
+ "fastBotDetection": false,
+ "fastBotDetectionDetails": {}
+ }`
+ fp := mustUnmarshal(t, raw)
+
+ req, err := http.NewRequest("GET", "http://x/", nil)
+ require.NoError(t, err)
+ req.Header.Set("Accept-Language", "en-US,en;q=0.9")
+
+ report := fp.ComputeMismatchReport(req, "FR")
+ assert.True(t, report.Empty())
+}
+
+func TestComputeMismatchReport_AcceptLanguageOnly(t *testing.T) {
+ raw := `{
+ "signals": {
+ "device": {"platform": "MacIntel"},
+ "browser": {
+ "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X) Chrome/120",
+ "highEntropyValues": {"platform": "macOS"}
+ },
+ "locale": {
+ "internationalization": {"timezone": "Europe/Paris"},
+ "languages": {"language": "en"}
+ }
+ },
+ "fsid": "X", "nonce": "n", "time": 1, "url": "http://x/",
+ "fastBotDetection": false,
+ "fastBotDetectionDetails": {}
+ }`
+ fp := mustUnmarshal(t, raw)
+
+ req, err := http.NewRequest("GET", "http://x/", nil)
+ require.NoError(t, err)
+ req.Header.Set("Accept-Language", "zh-CN,zh;q=0.9")
+
+ report := fp.ComputeMismatchReport(req, "FR")
+ assert.Equal(t, []string{ReasonAcceptLanguage}, report.Reasons())
+ assert.Equal(t, 0, report.High())
+ assert.Equal(t, 1, report.Medium())
+ assert.Equal(t, 0, report.Low())
+}
+
+func TestComputeMismatchReport_TimezoneCountryOnly(t *testing.T) {
+ raw := `{
+ "signals": {
+ "device": {"platform": "MacIntel"},
+ "browser": {
+ "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X) Chrome/120",
+ "highEntropyValues": {"platform": "macOS"}
+ },
+ "locale": {
+ "internationalization": {"timezone": "Europe/Paris"},
+ "languages": {"language": "en"}
+ }
+ },
+ "fsid": "X", "nonce": "n", "time": 1, "url": "http://x/",
+ "fastBotDetection": false,
+ "fastBotDetectionDetails": {}
+ }`
+ fp := mustUnmarshal(t, raw)
+
+ req, err := http.NewRequest("GET", "http://x/", nil)
+ require.NoError(t, err)
+ req.Header.Set("Accept-Language", "en-US")
+
+ // Europe/Paris but client IP geolocated in the US.
+ report := fp.ComputeMismatchReport(req, "US")
+ assert.Equal(t, []string{ReasonTimezoneCountry}, report.Reasons())
+ assert.Equal(t, 0, report.High())
+ assert.Equal(t, 0, report.Medium())
+ assert.Equal(t, 1, report.Low())
+}
+
+func TestComputeMismatchReport_NilFingerprint(t *testing.T) {
+ report := ((*FingerprintData)(nil)).ComputeMismatchReport(nil, "")
+ assert.True(t, report.Empty())
+}
+
+func TestSeverityFor(t *testing.T) {
+ assert.Equal(t, SeverityHigh, SeverityFor(ReasonCDP))
+ assert.Equal(t, SeverityMedium, SeverityFor(ReasonAcceptLanguage))
+ assert.Equal(t, SeverityLow, SeverityFor(ReasonTimezoneCountry))
+ assert.Equal(t, "", SeverityFor("not_a_reason"))
+}
diff --git a/pkg/appsec/challenge/fingerprint_proto.go b/pkg/appsec/challenge/fingerprint_proto.go
new file mode 100644
index 00000000000..101bcd58b9d
--- /dev/null
+++ b/pkg/appsec/challenge/fingerprint_proto.go
@@ -0,0 +1,475 @@
+package challenge
+
+import (
+ "github.com/crowdsecurity/crowdsec/pkg/appsec/challenge/pb"
+)
+
+func fingerprintDataFromProto(p *pb.FingerprintData) FingerprintData {
+ f := FingerprintData{
+ FSID: p.GetFsid(),
+ Nonce: p.GetNonce(),
+ Time: p.GetTime(),
+ URL: p.GetUrl(),
+ FastBotDetection: FlexBool(p.GetFastBotDetection()),
+ }
+
+ if s := p.GetSignals(); s != nil {
+ if a := s.GetAutomation(); a != nil {
+ f.Signals.Automation = fingerprintAutomation{
+ Webdriver: FlexBool(a.GetWebdriver()),
+ WebdriverWritable: FlexBool(a.GetWebdriverWritable()),
+ Selenium: FlexBool(a.GetSelenium()),
+ CDP: FlexBool(a.GetCdp()),
+ Playwright: FlexBool(a.GetPlaywright()),
+ NavigatorPropertyDescriptors: a.GetNavigatorPropertyDescriptors(),
+ }
+ }
+
+ if d := s.GetDevice(); d != nil {
+ f.Signals.Device = fingerprintDevice{
+ CPUCount: FlexInt(d.GetCpuCount()),
+ Memory: FlexInt(d.GetMemory()),
+ Platform: d.GetPlatform(),
+ }
+ if sr := d.GetScreenResolution(); sr != nil {
+ f.Signals.Device.ScreenResolution = fingerprintScreenResolution{
+ Width: FlexInt(sr.GetWidth()),
+ Height: FlexInt(sr.GetHeight()),
+ PixelDepth: FlexInt(sr.GetPixelDepth()),
+ ColorDepth: FlexInt(sr.GetColorDepth()),
+ AvailableWidth: FlexInt(sr.GetAvailableWidth()),
+ AvailableHeight: FlexInt(sr.GetAvailableHeight()),
+ InnerWidth: FlexInt(sr.GetInnerWidth()),
+ InnerHeight: FlexInt(sr.GetInnerHeight()),
+ HasMultipleDisplays: FlexBool(sr.GetHasMultipleDisplays()),
+ }
+ }
+ if mm := d.GetMultimediaDevices(); mm != nil {
+ f.Signals.Device.MultimediaDevices = fingerprintMultimediaDevices{
+ Speakers: FlexInt(mm.GetSpeakers()),
+ Microphones: FlexInt(mm.GetMicrophones()),
+ Webcams: FlexInt(mm.GetWebcams()),
+ }
+ }
+ if mq := d.GetMediaQueries(); mq != nil {
+ f.Signals.Device.MediaQueries = fingerprintDeviceMediaQueries{
+ PrefersColorScheme: mq.GetPrefersColorScheme(),
+ PrefersReducedMotion: FlexBool(mq.GetPrefersReducedMotion()),
+ PrefersReducedTransparency: FlexBool(mq.GetPrefersReducedTransparency()),
+ ColorGamut: mq.GetColorGamut(),
+ Pointer: mq.GetPointer(),
+ AnyPointer: mq.GetAnyPointer(),
+ Hover: FlexBool(mq.GetHover()),
+ AnyHover: FlexBool(mq.GetAnyHover()),
+ ColorDepth: FlexInt(mq.GetColorDepth()),
+ }
+ }
+ }
+
+ if b := s.GetBrowser(); b != nil {
+ f.Signals.Browser = fingerprintBrowser{
+ UserAgent: b.GetUserAgent(),
+ ETSL: FlexInt(b.GetEtsl()),
+ Maths: b.GetMaths(),
+ }
+ if ft := b.GetFeatures(); ft != nil {
+ f.Signals.Browser.Features = fingerprintBrowserFeatures{
+ Bitmask: ft.GetBitmask(),
+ Chrome: FlexBool(ft.GetChrome()),
+ Brave: FlexBool(ft.GetBrave()),
+ ApplePaySupport: FlexBool(ft.GetApplePaySupport()),
+ Opera: FlexBool(ft.GetOpera()),
+ Serial: FlexBool(ft.GetSerial()),
+ AttachShadow: FlexBool(ft.GetAttachShadow()),
+ Caches: FlexBool(ft.GetCaches()),
+ WebAssembly: FlexBool(ft.GetWebAssembly()),
+ Buffer: FlexBool(ft.GetBuffer()),
+ ShowModalDialog: FlexBool(ft.GetShowModalDialog()),
+ Safari: FlexBool(ft.GetSafari()),
+ WebkitPrefixedFunction: FlexBool(ft.GetWebkitPrefixedFunction()),
+ MozPrefixedFunction: FlexBool(ft.GetMozPrefixedFunction()),
+ USB: FlexBool(ft.GetUsb()),
+ BrowserCapture: FlexBool(ft.GetBrowserCapture()),
+ PaymentRequestUpdateEvent: FlexBool(ft.GetPaymentRequestUpdateEvent()),
+ PressureObserver: FlexBool(ft.GetPressureObserver()),
+ AudioSession: FlexBool(ft.GetAudioSession()),
+ SelectAudioOutput: FlexBool(ft.GetSelectAudioOutput()),
+ BarcodeDetector: FlexBool(ft.GetBarcodeDetector()),
+ Battery: FlexBool(ft.GetBattery()),
+ DevicePosture: FlexBool(ft.GetDevicePosture()),
+ DocumentPictureInPicture: FlexBool(ft.GetDocumentPictureInPicture()),
+ EyeDropper: FlexBool(ft.GetEyeDropper()),
+ EditContext: FlexBool(ft.GetEditContext()),
+ FencedFrame: FlexBool(ft.GetFencedFrame()),
+ Sanitizer: FlexBool(ft.GetSanitizer()),
+ OTPCredential: FlexBool(ft.GetOtpCredential()),
+ }
+ }
+ if pl := b.GetPlugins(); pl != nil {
+ f.Signals.Browser.Plugins = fingerprintBrowserPlugins{
+ IsValidPluginArray: FlexBool(pl.GetIsValidPluginArray()),
+ PluginCount: FlexInt(pl.GetPluginCount()),
+ PluginNamesHash: pl.GetPluginNamesHash(),
+ PluginConsistency1: FlexBool(pl.GetPluginConsistency1()),
+ PluginOverflow: FlexBool(pl.GetPluginOverflow()),
+ }
+ }
+ if ext := b.GetExtensions(); ext != nil {
+ f.Signals.Browser.Extensions = fingerprintBrowserExtensions{
+ Bitmask: ext.GetBitmask(),
+ Extensions: ext.GetExtensions(),
+ }
+ }
+ if hev := b.GetHighEntropyValues(); hev != nil {
+ f.Signals.Browser.HighEntropyValues = fingerprintBrowserHighEntropyValues{
+ Architecture: hev.GetArchitecture(),
+ Bitness: hev.GetBitness(),
+ Mobile: FlexBool(hev.GetMobile()),
+ Model: hev.GetModel(),
+ Platform: hev.GetPlatform(),
+ PlatformVersion: hev.GetPlatformVersion(),
+ UAFullVersion: hev.GetUaFullVersion(),
+ }
+ for _, bv := range hev.GetBrands() {
+ f.Signals.Browser.HighEntropyValues.Brands = append(f.Signals.Browser.HighEntropyValues.Brands, fingerprintBrandVersion{
+ Brand: bv.GetBrand(),
+ Version: bv.GetVersion(),
+ })
+ }
+ }
+ if tse := b.GetToSourceError(); tse != nil {
+ f.Signals.Browser.ToSourceError = fingerprintBrowserToSourceError{
+ ToSourceError: tse.GetToSourceError(),
+ HasToSource: FlexBool(tse.GetHasToSource()),
+ }
+ }
+ }
+
+ if g := s.GetGraphics(); g != nil {
+ if gl := g.GetWebGL(); gl != nil {
+ f.Signals.Graphics.WebGL = fingerprintGraphicsWebGL{
+ Vendor: gl.GetVendor(),
+ Renderer: gl.GetRenderer(),
+ }
+ }
+ if gpu := g.GetWebgpu(); gpu != nil {
+ f.Signals.Graphics.WebGPU = fingerprintGraphicsWebGPU{
+ Vendor: gpu.GetVendor(),
+ Architecture: gpu.GetArchitecture(),
+ Device: gpu.GetDevice(),
+ Description: gpu.GetDescription(),
+ }
+ }
+ if cv := g.GetCanvas(); cv != nil {
+ f.Signals.Graphics.Canvas = fingerprintGraphicsCanvas{
+ HasModifiedCanvas: FlexBool(cv.GetHasModifiedCanvas()),
+ CanvasFingerprint: cv.GetCanvasFingerprint(),
+ }
+ }
+ }
+
+ if c := s.GetCodecs(); c != nil {
+ f.Signals.Codecs = fingerprintCodecs{
+ AudioCanPlayTypeHash: c.GetAudioCanPlayTypeHash(),
+ VideoCanPlayTypeHash: c.GetVideoCanPlayTypeHash(),
+ AudioMediaSourceHash: c.GetAudioMediaSourceHash(),
+ VideoMediaSourceHash: c.GetVideoMediaSourceHash(),
+ RTCAudioCapabilitiesHash: c.GetRtcAudioCapabilitiesHash(),
+ RTCVideoCapabilitiesHash: c.GetRtcVideoCapabilitiesHash(),
+ HasMediaSource: FlexBool(c.GetHasMediaSource()),
+ }
+ }
+
+ if l := s.GetLocale(); l != nil {
+ if i18n := l.GetInternationalization(); i18n != nil {
+ f.Signals.Locale.Internationalization = fingerprintLocaleInternationalization{
+ Timezone: i18n.GetTimezone(),
+ LocaleLanguage: i18n.GetLocaleLanguage(),
+ }
+ }
+ if lang := l.GetLanguages(); lang != nil {
+ f.Signals.Locale.Languages = fingerprintLocaleLanguages{
+ Languages: lang.GetLanguages(),
+ Language: lang.GetLanguage(),
+ }
+ }
+ }
+
+ if ctx := s.GetContexts(); ctx != nil {
+ if iframe := ctx.GetIframe(); iframe != nil {
+ f.Signals.Contexts.Iframe = fingerprintIframeContext{
+ Webdriver: FlexBool(iframe.GetWebdriver()),
+ UserAgent: iframe.GetUserAgent(),
+ Platform: iframe.GetPlatform(),
+ Memory: FlexInt(iframe.GetMemory()),
+ CPUCount: FlexInt(iframe.GetCpuCount()),
+ Language: iframe.GetLanguage(),
+ }
+ }
+ if ww := ctx.GetWebWorker(); ww != nil {
+ f.Signals.Contexts.WebWorker = fingerprintWebWorkerContext{
+ Vendor: ww.GetVendor(),
+ Renderer: ww.GetRenderer(),
+ UserAgent: ww.GetUserAgent(),
+ Language: ww.GetLanguage(),
+ Platform: ww.GetPlatform(),
+ Memory: FlexInt(ww.GetMemory()),
+ CPUCount: FlexInt(ww.GetCpuCount()),
+ }
+ }
+ }
+ }
+
+ if det := p.GetFastBotDetectionDetails(); det != nil {
+ f.FastBotDetectionDetails = fingerprintFastBotDetectionDetails{
+ HeadlessChromeScreenResolution: fingerprintDetectionResult{Detected: FlexBool(det.GetHeadlessChromeScreenResolution().GetDetected())},
+ HasWebdriver: fingerprintDetectionResult{Detected: FlexBool(det.GetHasWebdriver().GetDetected())},
+ HasWebdriverWritable: fingerprintDetectionResult{Detected: FlexBool(det.GetHasWebdriverWritable().GetDetected())},
+ HasSeleniumProperty: fingerprintDetectionResult{Detected: FlexBool(det.GetHasSeleniumProperty().GetDetected())},
+ HasCDP: fingerprintDetectionResult{Detected: FlexBool(det.GetHasCDP().GetDetected())},
+ HasPlaywright: fingerprintDetectionResult{Detected: FlexBool(det.GetHasPlaywright().GetDetected())},
+ HasImpossibleDeviceMemory: fingerprintDetectionResult{Detected: FlexBool(det.GetHasImpossibleDeviceMemory().GetDetected())},
+ HasHighCPUCount: fingerprintDetectionResult{Detected: FlexBool(det.GetHasHighCPUCount().GetDetected())},
+ HasMissingChromeObject: fingerprintDetectionResult{Detected: FlexBool(det.GetHasMissingChromeObject().GetDetected())},
+ HasWebdriverIframe: fingerprintDetectionResult{Detected: FlexBool(det.GetHasWebdriverIframe().GetDetected())},
+ HasWebdriverWorker: fingerprintDetectionResult{Detected: FlexBool(det.GetHasWebdriverWorker().GetDetected())},
+ HasMismatchWebGLInWorker: fingerprintDetectionResult{Detected: FlexBool(det.GetHasMismatchWebGLInWorker().GetDetected())},
+ HasMismatchPlatformIframe: fingerprintDetectionResult{Detected: FlexBool(det.GetHasMismatchPlatformIframe().GetDetected())},
+ HasMismatchPlatformWorker: fingerprintDetectionResult{Detected: FlexBool(det.GetHasMismatchPlatformWorker().GetDetected())},
+ HasSwiftshaderRenderer: fingerprintDetectionResult{Detected: FlexBool(det.GetHasSwiftshaderRenderer().GetDetected())},
+ HasUTCTimezone: fingerprintDetectionResult{Detected: FlexBool(det.GetHasUTCTimezone().GetDetected())},
+ HasMismatchLanguages: fingerprintDetectionResult{Detected: FlexBool(det.GetHasMismatchLanguages().GetDetected())},
+ HasInconsistentEtsl: fingerprintDetectionResult{Detected: FlexBool(det.GetHasInconsistentEtsl().GetDetected())},
+ HasBotUserAgent: fingerprintDetectionResult{Detected: FlexBool(det.GetHasBotUserAgent().GetDetected())},
+ HasGPUMismatch: fingerprintDetectionResult{Detected: FlexBool(det.GetHasGPUMismatch().GetDetected())},
+ HasPlatformMismatch: fingerprintDetectionResult{Detected: FlexBool(det.GetHasPlatformMismatch().GetDetected())},
+ }
+ }
+
+ f.Bot = newFingerprintBotAlias(f.FastBotDetectionDetails)
+
+ return f
+}
+
+func (f *FingerprintData) ToProto() *pb.FingerprintData {
+ brands := make([]*pb.FingerprintBrandVersion, len(f.Signals.Browser.HighEntropyValues.Brands))
+ for i, b := range f.Signals.Browser.HighEntropyValues.Brands {
+ brands[i] = &pb.FingerprintBrandVersion{
+ Brand: b.Brand,
+ Version: b.Version,
+ }
+ }
+
+ return &pb.FingerprintData{
+ Signals: &pb.FingerprintSignals{
+ Automation: &pb.FingerprintAutomation{
+ Webdriver: bool(f.Signals.Automation.Webdriver),
+ WebdriverWritable: bool(f.Signals.Automation.WebdriverWritable),
+ Selenium: bool(f.Signals.Automation.Selenium),
+ Cdp: bool(f.Signals.Automation.CDP),
+ Playwright: bool(f.Signals.Automation.Playwright),
+ NavigatorPropertyDescriptors: f.Signals.Automation.NavigatorPropertyDescriptors,
+ },
+ Device: &pb.FingerprintDevice{
+ CpuCount: int32(f.Signals.Device.CPUCount),
+ Memory: int32(f.Signals.Device.Memory),
+ Platform: f.Signals.Device.Platform,
+ ScreenResolution: &pb.FingerprintScreenResolution{
+ Width: int32(f.Signals.Device.ScreenResolution.Width),
+ Height: int32(f.Signals.Device.ScreenResolution.Height),
+ PixelDepth: int32(f.Signals.Device.ScreenResolution.PixelDepth),
+ ColorDepth: int32(f.Signals.Device.ScreenResolution.ColorDepth),
+ AvailableWidth: int32(f.Signals.Device.ScreenResolution.AvailableWidth),
+ AvailableHeight: int32(f.Signals.Device.ScreenResolution.AvailableHeight),
+ InnerWidth: int32(f.Signals.Device.ScreenResolution.InnerWidth),
+ InnerHeight: int32(f.Signals.Device.ScreenResolution.InnerHeight),
+ HasMultipleDisplays: bool(f.Signals.Device.ScreenResolution.HasMultipleDisplays),
+ },
+ MultimediaDevices: &pb.FingerprintMultimediaDevices{
+ Speakers: int32(f.Signals.Device.MultimediaDevices.Speakers),
+ Microphones: int32(f.Signals.Device.MultimediaDevices.Microphones),
+ Webcams: int32(f.Signals.Device.MultimediaDevices.Webcams),
+ },
+ MediaQueries: &pb.FingerprintDeviceMediaQueries{
+ PrefersColorScheme: f.Signals.Device.MediaQueries.PrefersColorScheme,
+ PrefersReducedMotion: bool(f.Signals.Device.MediaQueries.PrefersReducedMotion),
+ PrefersReducedTransparency: bool(f.Signals.Device.MediaQueries.PrefersReducedTransparency),
+ ColorGamut: f.Signals.Device.MediaQueries.ColorGamut,
+ Pointer: f.Signals.Device.MediaQueries.Pointer,
+ AnyPointer: f.Signals.Device.MediaQueries.AnyPointer,
+ Hover: bool(f.Signals.Device.MediaQueries.Hover),
+ AnyHover: bool(f.Signals.Device.MediaQueries.AnyHover),
+ ColorDepth: int32(f.Signals.Device.MediaQueries.ColorDepth),
+ },
+ },
+ Browser: &pb.FingerprintBrowser{
+ UserAgent: f.Signals.Browser.UserAgent,
+ Features: &pb.FingerprintBrowserFeatures{
+ Bitmask: f.Signals.Browser.Features.Bitmask,
+ Chrome: bool(f.Signals.Browser.Features.Chrome),
+ Brave: bool(f.Signals.Browser.Features.Brave),
+ ApplePaySupport: bool(f.Signals.Browser.Features.ApplePaySupport),
+ Opera: bool(f.Signals.Browser.Features.Opera),
+ Serial: bool(f.Signals.Browser.Features.Serial),
+ AttachShadow: bool(f.Signals.Browser.Features.AttachShadow),
+ Caches: bool(f.Signals.Browser.Features.Caches),
+ WebAssembly: bool(f.Signals.Browser.Features.WebAssembly),
+ Buffer: bool(f.Signals.Browser.Features.Buffer),
+ ShowModalDialog: bool(f.Signals.Browser.Features.ShowModalDialog),
+ Safari: bool(f.Signals.Browser.Features.Safari),
+ WebkitPrefixedFunction: bool(f.Signals.Browser.Features.WebkitPrefixedFunction),
+ MozPrefixedFunction: bool(f.Signals.Browser.Features.MozPrefixedFunction),
+ Usb: bool(f.Signals.Browser.Features.USB),
+ BrowserCapture: bool(f.Signals.Browser.Features.BrowserCapture),
+ PaymentRequestUpdateEvent: bool(f.Signals.Browser.Features.PaymentRequestUpdateEvent),
+ PressureObserver: bool(f.Signals.Browser.Features.PressureObserver),
+ AudioSession: bool(f.Signals.Browser.Features.AudioSession),
+ SelectAudioOutput: bool(f.Signals.Browser.Features.SelectAudioOutput),
+ BarcodeDetector: bool(f.Signals.Browser.Features.BarcodeDetector),
+ Battery: bool(f.Signals.Browser.Features.Battery),
+ DevicePosture: bool(f.Signals.Browser.Features.DevicePosture),
+ DocumentPictureInPicture: bool(f.Signals.Browser.Features.DocumentPictureInPicture),
+ EyeDropper: bool(f.Signals.Browser.Features.EyeDropper),
+ EditContext: bool(f.Signals.Browser.Features.EditContext),
+ FencedFrame: bool(f.Signals.Browser.Features.FencedFrame),
+ Sanitizer: bool(f.Signals.Browser.Features.Sanitizer),
+ OtpCredential: bool(f.Signals.Browser.Features.OTPCredential),
+ },
+ Plugins: &pb.FingerprintBrowserPlugins{
+ IsValidPluginArray: bool(f.Signals.Browser.Plugins.IsValidPluginArray),
+ PluginCount: int32(f.Signals.Browser.Plugins.PluginCount),
+ PluginNamesHash: f.Signals.Browser.Plugins.PluginNamesHash,
+ PluginConsistency1: bool(f.Signals.Browser.Plugins.PluginConsistency1),
+ PluginOverflow: bool(f.Signals.Browser.Plugins.PluginOverflow),
+ },
+ Extensions: &pb.FingerprintBrowserExtensions{
+ Bitmask: f.Signals.Browser.Extensions.Bitmask,
+ Extensions: f.Signals.Browser.Extensions.Extensions,
+ },
+ HighEntropyValues: &pb.FingerprintBrowserHighEntropyValues{
+ Architecture: f.Signals.Browser.HighEntropyValues.Architecture,
+ Bitness: f.Signals.Browser.HighEntropyValues.Bitness,
+ Brands: brands,
+ Mobile: bool(f.Signals.Browser.HighEntropyValues.Mobile),
+ Model: f.Signals.Browser.HighEntropyValues.Model,
+ Platform: f.Signals.Browser.HighEntropyValues.Platform,
+ PlatformVersion: f.Signals.Browser.HighEntropyValues.PlatformVersion,
+ UaFullVersion: f.Signals.Browser.HighEntropyValues.UAFullVersion,
+ },
+ Etsl: int32(f.Signals.Browser.ETSL),
+ Maths: f.Signals.Browser.Maths,
+ ToSourceError: &pb.FingerprintBrowserToSourceError{
+ ToSourceError: f.Signals.Browser.ToSourceError.ToSourceError,
+ HasToSource: bool(f.Signals.Browser.ToSourceError.HasToSource),
+ },
+ },
+ Graphics: &pb.FingerprintGraphics{
+ WebGL: &pb.FingerprintGraphicsWebGL{
+ Vendor: f.Signals.Graphics.WebGL.Vendor,
+ Renderer: f.Signals.Graphics.WebGL.Renderer,
+ },
+ Webgpu: &pb.FingerprintGraphicsWebGPU{
+ Vendor: f.Signals.Graphics.WebGPU.Vendor,
+ Architecture: f.Signals.Graphics.WebGPU.Architecture,
+ Device: f.Signals.Graphics.WebGPU.Device,
+ Description: f.Signals.Graphics.WebGPU.Description,
+ },
+ Canvas: &pb.FingerprintGraphicsCanvas{
+ HasModifiedCanvas: bool(f.Signals.Graphics.Canvas.HasModifiedCanvas),
+ CanvasFingerprint: f.Signals.Graphics.Canvas.CanvasFingerprint,
+ },
+ },
+ Codecs: &pb.FingerprintCodecs{
+ AudioCanPlayTypeHash: f.Signals.Codecs.AudioCanPlayTypeHash,
+ VideoCanPlayTypeHash: f.Signals.Codecs.VideoCanPlayTypeHash,
+ AudioMediaSourceHash: f.Signals.Codecs.AudioMediaSourceHash,
+ VideoMediaSourceHash: f.Signals.Codecs.VideoMediaSourceHash,
+ RtcAudioCapabilitiesHash: f.Signals.Codecs.RTCAudioCapabilitiesHash,
+ RtcVideoCapabilitiesHash: f.Signals.Codecs.RTCVideoCapabilitiesHash,
+ HasMediaSource: bool(f.Signals.Codecs.HasMediaSource),
+ },
+ Locale: &pb.FingerprintLocale{
+ Internationalization: &pb.FingerprintLocaleInternationalization{
+ Timezone: f.Signals.Locale.Internationalization.Timezone,
+ LocaleLanguage: f.Signals.Locale.Internationalization.LocaleLanguage,
+ },
+ Languages: &pb.FingerprintLocaleLanguages{
+ Languages: f.Signals.Locale.Languages.Languages,
+ Language: f.Signals.Locale.Languages.Language,
+ },
+ },
+ Contexts: &pb.FingerprintContexts{
+ Iframe: &pb.FingerprintIframeContext{
+ Webdriver: bool(f.Signals.Contexts.Iframe.Webdriver),
+ UserAgent: f.Signals.Contexts.Iframe.UserAgent,
+ Platform: f.Signals.Contexts.Iframe.Platform,
+ Memory: int32(f.Signals.Contexts.Iframe.Memory),
+ CpuCount: int32(f.Signals.Contexts.Iframe.CPUCount),
+ Language: f.Signals.Contexts.Iframe.Language,
+ },
+ WebWorker: &pb.FingerprintWebWorkerContext{
+ Vendor: f.Signals.Contexts.WebWorker.Vendor,
+ Renderer: f.Signals.Contexts.WebWorker.Renderer,
+ UserAgent: f.Signals.Contexts.WebWorker.UserAgent,
+ Language: f.Signals.Contexts.WebWorker.Language,
+ Platform: f.Signals.Contexts.WebWorker.Platform,
+ Memory: int32(f.Signals.Contexts.WebWorker.Memory),
+ CpuCount: int32(f.Signals.Contexts.WebWorker.CPUCount),
+ },
+ },
+ },
+ Fsid: f.FSID,
+ Nonce: f.Nonce,
+ Time: f.Time,
+ Url: f.URL,
+ FastBotDetection: bool(f.FastBotDetection),
+ FastBotDetectionDetails: &pb.FingerprintFastBotDetectionDetails{
+ HeadlessChromeScreenResolution: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HeadlessChromeScreenResolution.Detected)},
+ HasWebdriver: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasWebdriver.Detected)},
+ HasWebdriverWritable: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasWebdriverWritable.Detected)},
+ HasSeleniumProperty: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasSeleniumProperty.Detected)},
+ HasCDP: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasCDP.Detected)},
+ HasPlaywright: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasPlaywright.Detected)},
+ HasImpossibleDeviceMemory: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasImpossibleDeviceMemory.Detected)},
+ HasHighCPUCount: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasHighCPUCount.Detected)},
+ HasMissingChromeObject: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasMissingChromeObject.Detected)},
+ HasWebdriverIframe: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasWebdriverIframe.Detected)},
+ HasWebdriverWorker: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasWebdriverWorker.Detected)},
+ HasMismatchWebGLInWorker: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasMismatchWebGLInWorker.Detected)},
+ HasMismatchPlatformIframe: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasMismatchPlatformIframe.Detected)},
+ HasMismatchPlatformWorker: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasMismatchPlatformWorker.Detected)},
+ HasSwiftshaderRenderer: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasSwiftshaderRenderer.Detected)},
+ HasUTCTimezone: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasUTCTimezone.Detected)},
+ HasMismatchLanguages: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasMismatchLanguages.Detected)},
+ HasInconsistentEtsl: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasInconsistentEtsl.Detected)},
+ HasBotUserAgent: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasBotUserAgent.Detected)},
+ HasGPUMismatch: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasGPUMismatch.Detected)},
+ HasPlatformMismatch: &pb.FingerprintDetectionResult{Detected: bool(f.FastBotDetectionDetails.HasPlatformMismatch.Detected)},
+ },
+ Bot: &pb.FingerprintBotAlias{
+ HeadlessChromeScreenResolution: f.Bot.HeadlessChromeScreenResolution,
+ Webdriver: f.Bot.Webdriver,
+ WebdriverWritable: f.Bot.WebdriverWritable,
+ Selenium: f.Bot.Selenium,
+ Cdp: f.Bot.CDP,
+ Playwright: f.Bot.Playwright,
+ ImpossibleDeviceMemory: f.Bot.ImpossibleDeviceMemory,
+ HighCPUCount: f.Bot.HighCPUCount,
+ MissingChromeObject: f.Bot.MissingChromeObject,
+ WebdriverIframe: f.Bot.WebdriverIframe,
+ WebdriverWorker: f.Bot.WebdriverWorker,
+ MismatchWebGLInWorker: f.Bot.MismatchWebGLInWorker,
+ MismatchPlatformIframe: f.Bot.MismatchPlatformIframe,
+ MismatchPlatformWorker: f.Bot.MismatchPlatformWorker,
+ SwiftshaderRenderer: f.Bot.SwiftshaderRenderer,
+ UtcTimezone: f.Bot.UTCTimezone,
+ MismatchLanguages: f.Bot.MismatchLanguages,
+ InconsistentEtsl: f.Bot.InconsistentEtsl,
+ BotUserAgent: f.Bot.BotUserAgent,
+ GpuMismatch: f.Bot.GPUMismatch,
+ PlatformMismatch: f.Bot.PlatformMismatch,
+ AnyDetected: f.Bot.AnyDetected,
+ DetectedCount: int32(f.Bot.DetectedCount),
+ },
+ }
+}
diff --git a/pkg/appsec/challenge/js/cmd/bundle/main.go b/pkg/appsec/challenge/js/cmd/bundle/main.go
new file mode 100644
index 00000000000..0b4b3f60d61
--- /dev/null
+++ b/pkg/appsec/challenge/js/cmd/bundle/main.go
@@ -0,0 +1,46 @@
+package main
+
+import (
+ "fmt"
+ "os"
+
+ esbuildapi "github.com/evanw/esbuild/pkg/api"
+)
+
+const (
+ entryPoint = "../challenge.js"
+ outFile = "fpscanner/bundle.js"
+)
+
+func main() {
+ result := esbuildapi.Build(esbuildapi.BuildOptions{
+ EntryPoints: []string{entryPoint},
+ Bundle: true,
+ Write: false,
+ Format: esbuildapi.FormatESModule,
+ Platform: esbuildapi.PlatformBrowser,
+ Target: esbuildapi.ES2022,
+ MinifyWhitespace: true,
+ MinifyIdentifiers: true,
+ MinifySyntax: true,
+ Sourcemap: esbuildapi.SourceMapNone,
+ })
+
+ if len(result.Errors) > 0 {
+ fmt.Fprintf(os.Stderr, "esbuild failed with %d error(s)\n", len(result.Errors))
+ for _, msg := range result.Errors {
+ fmt.Fprintln(os.Stderr, msg.Text)
+ }
+ os.Exit(1)
+ }
+
+ if len(result.OutputFiles) == 0 {
+ fmt.Fprintln(os.Stderr, "esbuild returned no output files")
+ os.Exit(1)
+ }
+
+ if err := os.WriteFile(outFile, result.OutputFiles[0].Contents, 0o644); err != nil {
+ fmt.Fprintf(os.Stderr, "failed to write %s: %v\n", outFile, err)
+ os.Exit(1)
+ }
+}
diff --git a/pkg/appsec/challenge/js/cmd/obfuscate/main.go b/pkg/appsec/challenge/js/cmd/obfuscate/main.go
new file mode 100644
index 00000000000..2077aaf3ec1
--- /dev/null
+++ b/pkg/appsec/challenge/js/cmd/obfuscate/main.go
@@ -0,0 +1,107 @@
+package main
+
+import (
+ "compress/gzip"
+ "fmt"
+ "os"
+ "os/exec"
+ "time"
+
+ esbuildapi "github.com/evanw/esbuild/pkg/api"
+)
+
+const (
+ entryPoint = "obfuscate/obfuscate.js"
+ bundleFile = "obfuscate/bundle.js"
+ wasmFile = "obfuscate/index.wasm"
+ wasmGzFile = "obfuscate/index.wasm.gz"
+)
+
+func main() {
+ if err := buildObfuscatorBundle(); err != nil {
+ fmt.Fprintf(os.Stderr, "failed to build obfuscator bundle: %v\n", err)
+ os.Exit(1)
+ }
+
+ if err := buildWASM(); err != nil {
+ fmt.Fprintf(os.Stderr, "failed to build obfuscator wasm: %v\n", err)
+ os.Exit(1)
+ }
+
+ if err := gzipWASM(); err != nil {
+ fmt.Fprintf(os.Stderr, "failed to compress obfuscator wasm: %v\n", err)
+ os.Exit(1)
+ }
+}
+
+func buildObfuscatorBundle() error {
+ result := esbuildapi.Build(esbuildapi.BuildOptions{
+ EntryPoints: []string{entryPoint},
+ Bundle: true,
+ Write: false,
+ Format: esbuildapi.FormatIIFE,
+ Platform: esbuildapi.PlatformBrowser,
+ Target: esbuildapi.ES2022,
+ Sourcemap: esbuildapi.SourceMapNone,
+ Banner: map[string]string{"js": "var self=globalThis; var window=globalThis; var global=globalThis;"}, // JS obfuscator expects to have this available, but in WASM we don't have a window or global object, so we alias them to globalThis
+ })
+
+ if len(result.Errors) > 0 {
+ return fmt.Errorf("esbuild failed with %d error(s): %s", len(result.Errors), result.Errors[0].Text)
+ }
+ if len(result.OutputFiles) == 0 {
+ return fmt.Errorf("esbuild returned no output files")
+ }
+
+ return os.WriteFile(bundleFile, result.OutputFiles[0].Contents, 0o644)
+}
+
+func buildWASM() error {
+ if _, err := exec.LookPath("javy"); err != nil {
+ return fmt.Errorf("javy was not found in PATH")
+ }
+
+ cmd := exec.Command("javy", "build", "-o", wasmFile, bundleFile)
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stderr
+
+ if err := cmd.Run(); err != nil {
+ return fmt.Errorf("javy build failed: %w", err)
+ }
+
+ return nil
+}
+
+func gzipWASM() error {
+ wasmData, err := os.ReadFile(wasmFile)
+ if err != nil {
+ return fmt.Errorf("failed to read %s: %w", wasmFile, err)
+ }
+
+ f, err := os.Create(wasmGzFile)
+ if err != nil {
+ return fmt.Errorf("failed to create %s: %w", wasmGzFile, err)
+ }
+ defer f.Close()
+
+ zw, err := gzip.NewWriterLevel(f, gzip.BestCompression)
+ if err != nil {
+ return fmt.Errorf("failed to create gzip writer: %w", err)
+ }
+ zw.Name = "index.wasm"
+ zw.ModTime = time.Unix(0, 0)
+
+ if _, err := zw.Write(wasmData); err != nil {
+ zw.Close()
+ return fmt.Errorf("failed to write gzip data: %w", err)
+ }
+
+ if err := zw.Close(); err != nil {
+ return fmt.Errorf("failed to close gzip writer: %w", err)
+ }
+
+ os.Remove(wasmFile)
+ os.Remove(bundleFile)
+
+ return nil
+}
diff --git a/pkg/appsec/challenge/js/fpscanner/bundle.js b/pkg/appsec/challenge/js/fpscanner/bundle.js
new file mode 100644
index 00000000000..a2ee21b7f03
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/bundle.js
@@ -0,0 +1,32 @@
+function q(){return navigator.webdriver}function J(){return navigator.userAgent}function Y(){return navigator.platform}var c="ERROR",n="INIT";var S="SKIPPED",y="high";var Z="medium";function h(t){let e=0;for(let r=0,i=t.length;r=0?(t.vendor=r.getParameter(r.getExtension("WEBGL_debug_renderer_info").UNMASKED_VENDOR_WEBGL),t.renderer=r.getParameter(r.getExtension("WEBGL_debug_renderer_info").UNMASKED_RENDERER_WEBGL)):m(t,"NA")}catch{m(t,c)}return t}function re(){return"__pwInitScripts"in window||"__playwright__binding__"in window}function ne(){return navigator.hardwareConcurrency||"NA"}function ie(){let t=[],e=.123456789;return["E","LN10","LN2","LOG10E","LOG2E","PI","SQRT1_2","SQRT2"].forEach(function(o){try{t.push(Math[o])}catch{t.push(-1)}}),["tan","sin","exp","atan","acosh","asinh","atanh","expm1","log1p","sinh"].forEach(function(o){try{t.push(Math[o](e))}catch{t.push(-1)}}),h(t.map(String).join(","))}function oe(){return navigator.deviceMemory||"NA"}function ae(){return eval.toString().length}function se(){let t={timezone:n,localeLanguage:n};try{if(typeof Intl<"u"&&typeof Intl.DateTimeFormat<"u"){let e=Intl.DateTimeFormat().resolvedOptions();t.timezone=e.timeZone,t.localeLanguage=e.locale}else t.timezone="NA",t.localeLanguage="NA"}catch{t.timezone=c,t.localeLanguage=c}return t}function ce(){return{width:window.screen.width,height:window.screen.height,pixelDepth:window.screen.pixelDepth,colorDepth:window.screen.colorDepth,availableWidth:window.screen.availWidth,availableHeight:window.screen.availHeight,innerWidth:window.innerWidth,innerHeight:window.innerHeight,hasMultipleDisplays:typeof screen.isExtended<"u"?screen.isExtended:"NA"}}function le(){return{languages:navigator.languages,language:navigator.language}}async function ue(){let t={vendor:n,architecture:n,device:n,description:n};if("gpu"in navigator)try{let e=await navigator.gpu.requestAdapter();e&&(t.vendor=e.info.vendor,t.architecture=e.info.architecture,t.device=e.info.device,t.description=e.info.description)}catch{m(t,c)}else m(t,"NA");return t}function de(){let t=["__driver_evaluate","__webdriver_evaluate","__selenium_evaluate","__fxdriver_evaluate","__driver_unwrapped","__webdriver_unwrapped","__selenium_unwrapped","__fxdriver_unwrapped","_Selenium_IDE_Recorder","_selenium","calledSelenium","$cdc_asdjflasutopfhvcZLmcfl_","$chrome_asyncScriptInfo","__$webdriverAsyncExecutor","webdriver","__webdriverFunc","domAutomation","domAutomationController","__lastWatirAlert","__lastWatirConfirm","__lastWatirPrompt","__webdriver_script_fn","_WEBDRIVER_ELEM_CACHE"],e=!1;for(let r=0;r{let e={vendor:n,renderer:n,userAgent:n,language:n,platform:n,memory:n,cpuCount:n},r=null,i=null,o=null,u=()=>{o&&clearTimeout(o),r&&r.terminate(),i&&URL.revokeObjectURL(i)};try{let l=`try {
+ var fingerprintWorker = {};
+
+ fingerprintWorker.userAgent = navigator.userAgent;
+ fingerprintWorker.language = navigator.language;
+ fingerprintWorker.cpuCount = navigator.hardwareConcurrency;
+ fingerprintWorker.platform = navigator.platform;
+ fingerprintWorker.memory = navigator.deviceMemory;
+
+
+ var canvas = new OffscreenCanvas(1, 1);
+ fingerprintWorker.vendor = 'INIT';
+ fingerprintWorker.renderer = 'INIT';
+ var gl = canvas.getContext('webgl');
+ const isFirefox = navigator.userAgent.includes('Firefox');
+ try {
+ if (gl && !isFirefox) {
+ var glExt = gl.getExtension('WEBGL_debug_renderer_info');
+ fingerprintWorker.vendor = gl.getParameter(glExt.UNMASKED_VENDOR_WEBGL);
+ fingerprintWorker.renderer = gl.getParameter(glExt.UNMASKED_RENDERER_WEBGL);
+ } else {
+ fingerprintWorker.vendor = 'NA';
+ fingerprintWorker.renderer = 'NA';
+ }
+ } catch (_) {
+ fingerprintWorker.vendor = 'ERROR';
+ fingerprintWorker.renderer = 'ERROR';
+ }
+ self.postMessage(fingerprintWorker);
+ } catch (e) {
+ self.postMessage(fingerprintWorker);
+ }`,f=new Blob([l],{type:"application/javascript"});i=URL.createObjectURL(f),r=new Worker(i),o=window.setTimeout(()=>{u(),m(e,c),t(e)},2e3),r.onmessage=function(a){try{e.vendor=a.data.vendor,e.renderer=a.data.renderer,e.userAgent=a.data.userAgent,e.language=a.data.language,e.platform=a.data.platform,e.memory=a.data.memory,e.cpuCount=a.data.cpuCount}catch{m(e,c)}finally{u(),t(e)}},r.onerror=function(){u(),m(e,c),t(e)}}catch{u(),m(e,c),t(e)}})}function ve(){let t={toSourceError:n,hasToSource:!1};try{null.usdfsh}catch(e){t.toSourceError=e.toString()}try{throw"xyz"}catch(e){try{e.toSource(),t.hasToSource=!0}catch{t.hasToSource=!1}}return t}var we=['audio/mp4; codecs="mp4a.40.2"',"audio/mpeg;",'audio/webm; codecs="vorbis"','audio/ogg; codecs="vorbis"','audio/wav; codecs="1"','audio/ogg; codecs="speex"','audio/ogg; codecs="flac"','audio/3gpp; codecs="samr"'],be=['video/mp4; codecs="avc1.42E01E, mp4a.40.2"','video/mp4; codecs="avc1.42E01E"','video/mp4; codecs="avc1.58A01E"','video/mp4; codecs="avc1.4D401E"','video/mp4; codecs="avc1.64001E"','video/mp4; codecs="mp4v.20.8"','video/mp4; codecs="mp4v.20.240"','video/webm; codecs="vp8"','video/ogg; codecs="theora"','video/ogg; codecs="dirac"','video/3gpp; codecs="mp4v.20.8"','video/x-matroska; codecs="theora"'];function xe(t,e){let r={};try{let i=document.createElement(e);for(let o of t)try{r[o]=i.canPlayType(o)||null}catch{r[o]=null}}catch{for(let i of t)r[i]=null}return r}function Se(t){let e={},r=window.MediaSource;if(!r||typeof r.isTypeSupported!="function"){for(let i of t)e[i]=null;return e}for(let i of t)try{e[i]=r.isTypeSupported(i)}catch{e[i]=null}return e}function Re(t){try{let e=window.RTCRtpReceiver;if(e&&typeof e.getCapabilities=="function"){let r=e.getCapabilities(t);return h(JSON.stringify(r))}return"NA"}catch{return c}}function Ce(){let t={audioCanPlayTypeHash:"NA",videoCanPlayTypeHash:"NA",audioMediaSourceHash:"NA",videoMediaSourceHash:"NA",rtcAudioCapabilitiesHash:"NA",rtcVideoCapabilitiesHash:"NA",hasMediaSource:!1};try{t.hasMediaSource=!!window.MediaSource;let e=xe(we,"audio"),r=xe(be,"video");t.audioCanPlayTypeHash=h(JSON.stringify(e)),t.videoCanPlayTypeHash=h(JSON.stringify(r));let i=Se(we),o=Se(be);t.audioMediaSourceHash=h(JSON.stringify(i)),t.videoMediaSourceHash=h(JSON.stringify(o)),t.rtcAudioCapabilitiesHash=Re("audio"),t.rtcVideoCapabilitiesHash=Re("video")}catch{m(t,c)}return t}async function Rt(){return new Promise(t=>{try{let e=new Image,r=document.createElement("canvas").getContext("2d");e.onload=()=>{r.drawImage(e,0,0),t(r.getImageData(0,0,1,1).data.filter(i=>i===0).length!=4)},e.onerror=()=>{t(c)},e.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII="}catch{t(c)}})}function Ct(){var t=document.createElement("canvas");t.width=400,t.height=200,t.style.display="inline";var e=t.getContext("2d");try{return e.rect(0,0,10,10),e.rect(2,2,6,6),e.textBaseline="alphabetic",e.fillStyle="#f60",e.fillRect(125,1,62,20),e.fillStyle="#069",e.font="11pt no-real-font-123",e.fillText("Cwm fjordbank glyphs vext quiz, \u{1F603}",2,15),e.fillStyle="rgba(102, 204, 0, 0.2)",e.font="18pt Arial",e.fillText("Cwm fjordbank glyphs vext quiz, \u{1F603}",4,45),e.globalCompositeOperation="multiply",e.fillStyle="rgb(255,0,255)",e.beginPath(),e.arc(50,50,50,0,2*Math.PI,!0),e.closePath(),e.fill(),e.fillStyle="rgb(0,255,255)",e.beginPath(),e.arc(100,50,50,0,2*Math.PI,!0),e.closePath(),e.fill(),e.fillStyle="rgb(255,255,0)",e.beginPath(),e.arc(75,100,50,0,2*Math.PI,!0),e.closePath(),e.fill(),e.fillStyle="rgb(255,0,255)",e.arc(75,75,75,0,2*Math.PI,!0),e.arc(75,75,25,0,2*Math.PI,!0),e.fill("evenodd"),h(t.toDataURL())}catch{return c}}async function Ae(){let t={hasModifiedCanvas:n,canvasFingerprint:n};return t.hasModifiedCanvas=await Rt(),t.canvasFingerprint=Ct(),t}function Ee(){let t=["deviceMemory","hardwareConcurrency","language","languages","platform"],e=[];for(let r of t){let i=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(navigator),r);i&&i.value?e.push("1"):e.push("0")}return e.join("")}function Pe(){return Math.random().toString(36).substring(2,15)}function We(){return new Date().getTime()}function Me(){return window.location.href}function G(t,e){let r=t.signals;return e==="iframe"?r.contexts.iframe.webdriver!==r.automation.webdriver||r.contexts.iframe.userAgent!==r.browser.userAgent||r.contexts.iframe.platform!==r.device.platform||r.contexts.iframe.memory!==r.device.memory||r.contexts.iframe.cpuCount!==r.device.cpuCount:r.contexts.webWorker.webdriver!==r.automation.webdriver||r.contexts.webWorker.userAgent!==r.browser.userAgent||r.contexts.webWorker.platform!==r.device.platform||r.contexts.webWorker.memory!==r.device.memory||r.contexts.webWorker.cpuCount!==r.device.cpuCount}function ke(){let t={bitmask:n,extensions:[]},e=document.body.hasAttribute("data-gr-ext-installed"),r=typeof window.ethereum<"u",i=document.getElementById("coupon-birds-drop-div")!==null,o=document.querySelector("deepl-input-controller")!==null,u=document.getElementById("monica-content-root")!==null,l=document.querySelector("chatgpt-sidebar")!==null,f=typeof window.__REQUESTLY__<"u",a=Array.from(document.querySelectorAll("*")).filter(w=>w.tagName.toLowerCase().startsWith("veepn-")).length>0;return t.bitmask=[e?"1":"0",r?"1":"0",i?"1":"0",o?"1":"0",u?"1":"0",l?"1":"0",f?"1":"0",a?"1":"0"].join(""),e&&t.extensions.push("grammarly"),r&&t.extensions.push("metamask"),i&&t.extensions.push("coupon-birds"),o&&t.extensions.push("deepl"),u&&t.extensions.push("monica-ai"),l&&t.extensions.push("sider-ai"),f&&t.extensions.push("requestly"),a&&t.extensions.push("veepn"),t}function d(t){try{return t()}catch{return!1}}function De(){let t={bitmask:n,chrome:d(()=>"chrome"in window),brave:d(()=>"brave"in navigator),applePaySupport:d(()=>"ApplePaySetup"in window),opera:d(()=>typeof window.opr<"u"||typeof window.onoperadetachedviewchange=="object"),serial:d(()=>window.navigator.serial!==void 0),attachShadow:d(()=>!!Element.prototype.attachShadow),caches:d(()=>!!window.caches),webAssembly:d(()=>!!window.WebAssembly&&!!window.WebAssembly.instantiate),buffer:d(()=>"Buffer"in window),showModalDialog:d(()=>"showModalDialog"in window),safari:d(()=>"safari"in window),webkitPrefixedFunction:d(()=>"webkitCancelAnimationFrame"in window),mozPrefixedFunction:d(()=>"mozGetUserMedia"in navigator),usb:d(()=>typeof window.USB=="function"),browserCapture:d(()=>typeof window.BrowserCaptureMediaStreamTrack=="function"),paymentRequestUpdateEvent:d(()=>typeof window.PaymentRequestUpdateEvent=="function"),pressureObserver:d(()=>typeof window.PressureObserver=="function"),audioSession:d(()=>"audioSession"in navigator),selectAudioOutput:d(()=>typeof navigator<"u"&&typeof navigator.mediaDevices<"u"&&typeof navigator.mediaDevices.selectAudioOutput=="function"),barcodeDetector:d(()=>"BarcodeDetector"in window),battery:d(()=>"getBattery"in navigator),devicePosture:d(()=>"DevicePosture"in window),documentPictureInPicture:d(()=>"documentPictureInPicture"in window),eyeDropper:d(()=>"EyeDropper"in window),editContext:d(()=>"EditContext"in window),fencedFrame:d(()=>"FencedFrameConfig"in window),sanitizer:d(()=>"Sanitizer"in window),otpCredential:d(()=>"OTPCredential"in window)},e=Object.keys(t).filter(r=>r!=="bitmask").map(r=>t[r]?"1":"0").join("");return t.bitmask=e,t}function Ie(){let t={prefersColorScheme:n,prefersReducedMotion:n,prefersReducedTransparency:n,colorGamut:n,pointer:n,anyPointer:n,hover:n,anyHover:n,colorDepth:n};try{window.matchMedia("(prefers-color-scheme: dark)").matches?t.prefersColorScheme="dark":window.matchMedia("(prefers-color-scheme: light)").matches?t.prefersColorScheme="light":t.prefersColorScheme=null,t.prefersReducedMotion=window.matchMedia("(prefers-reduced-motion: reduce)").matches,t.prefersReducedTransparency=window.matchMedia("(prefers-reduced-transparency: reduce)").matches,window.matchMedia("(color-gamut: rec2020)").matches?t.colorGamut="rec2020":window.matchMedia("(color-gamut: p3)").matches?t.colorGamut="p3":window.matchMedia("(color-gamut: srgb)").matches?t.colorGamut="srgb":t.colorGamut=null,window.matchMedia("(pointer: fine)").matches?t.pointer="fine":window.matchMedia("(pointer: coarse)").matches?t.pointer="coarse":window.matchMedia("(pointer: none)").matches?t.pointer="none":t.pointer=null,window.matchMedia("(any-pointer: fine)").matches?t.anyPointer="fine":window.matchMedia("(any-pointer: coarse)").matches?t.anyPointer="coarse":window.matchMedia("(any-pointer: none)").matches?t.anyPointer="none":t.anyPointer=null,t.hover=window.matchMedia("(hover: hover)").matches,t.anyHover=window.matchMedia("(any-hover: hover)").matches;let e=0;for(let r=0;r<=16;r++)window.matchMedia(`(color: ${r})`).matches&&(e=r);t.colorDepth=e}catch{m(t,c)}return t}function _e(t){let e=t.signals.device.screenResolution;return e.width===800&&e.height===600||e.availableWidth===800&&e.availableHeight===600||e.innerWidth===800&&e.innerHeight===600}function Oe(t){return t.signals.automation.webdriver===!0}function Fe(t){return!!t.signals.automation.selenium}function Te(t){return t.signals.automation.cdp===!0}function Ne(t){return t.signals.automation.playwright===!0}function Ue(t){return typeof t.signals.device.memory!="number"?!1:t.signals.device.memory>32||t.signals.device.memory<.25}function Le(t){return typeof t.signals.device.cpuCount!="number"?!1:t.signals.device.cpuCount>70}function He(t){let e=t.signals.browser.userAgent;return t.signals.browser.features.chrome===!1&&typeof e=="string"&&e.includes("Chrome")}function Ve(t){return t.signals.contexts.iframe.webdriver===!0}function je(t){return t.signals.contexts.webWorker.webdriver===!0}function Be(t){let e=t.signals.contexts.webWorker,r=t.signals.graphics.webGL;return e.vendor===c||e.renderer===c||r.vendor==="NA"||r.renderer==="NA"||e.vendor===S?!1:e.vendor!==r.vendor||e.renderer!==r.renderer}function Ge(t){return t.signals.contexts.webWorker.platform==="NA"||t.signals.contexts.webWorker.platform===c||t.signals.contexts.webWorker.platform===S?!1:t.signals.device.platform!==t.signals.contexts.webWorker.platform}function ze(t){return t.signals.contexts.iframe.platform==="NA"||t.signals.contexts.iframe.platform===c?!1:t.signals.device.platform!==t.signals.contexts.iframe.platform}function $e(t){return t.signals.automation.webdriverWritable===!0}function Qe(t){return t.signals.graphics.webGL.renderer.includes("SwiftShader")}function Ke(t){return t.signals.locale.internationalization.timezone==="UTC"}function qe(t){let e=t.signals.locale.languages.languages,r=t.signals.locale.languages.language;return r&&e&&Array.isArray(e)&&e.length>0?e[0]!==r:!1}function Je(t){return!!(t.signals.browser.features.chrome&&t.signals.browser.etsl!==33||t.signals.browser.features.safari&&t.signals.browser.etsl!==37||t.signals.browser.userAgent.includes("Firefox")&&t.signals.browser.etsl!==37)}function Ye(t){return[t.signals.browser.userAgent,t.signals.contexts.iframe.userAgent,t.signals.contexts.webWorker.userAgent].some(r=>/bot|headless/i.test(r.toLowerCase()))}function Ze(t){let e=t.signals.graphics.webgpu,r=t.signals.graphics.webGL,i=t.signals.browser.userAgent;return!!((r.vendor.includes("Apple")||r.renderer.includes("Apple"))&&!i.includes("Mac")||e.vendor.includes("apple")&&!i.includes("Mac")||e.vendor.includes("apple")&&!r.renderer.includes("Apple"))}function Xe(t){let e=t.signals.device.platform,r=t.signals.browser.userAgent,i=t.signals.browser.highEntropyValues.platform;return!!(r.includes("Mac")&&(e.includes("Win")||e.includes("Linux"))||r.includes("Windows")&&(e.includes("Mac")||e.includes("Linux"))||r.includes("Linux")&&(e.includes("Mac")||e.includes("Win"))||i!==c&&i!=="NA"&&(i.includes("Mac")&&(e.includes("Win")||e.includes("Linux"))||i.includes("Windows")&&(e.includes("Mac")||e.includes("Linux"))||i.includes("Linux")&&(e.includes("Mac")||e.includes("Win"))))}async function et(t,e){let r=new TextEncoder().encode(e),i=new TextEncoder().encode(t),o=new Uint8Array(i.length);for(let l=0;lg?"1":"0").join(""),l=[e.automation.webdriver===!0,e.automation.webdriverWritable===!0,e.automation.selenium===!0,e.automation.cdp===!0,e.automation.playwright===!0].map(g=>g?"1":"0").join(""),f=h(String(e.automation.navigatorPropertyDescriptors)).slice(0,4),a=`${l}h${f}`,w=typeof e.device.screenResolution.width=="number"?e.device.screenResolution.width:0,M=typeof e.device.screenResolution.height=="number"?e.device.screenResolution.height:0,U=typeof e.device.cpuCount=="number"?String(e.device.cpuCount).padStart(2,"0"):"00",k=typeof e.device.memory=="number"?String(Math.round(e.device.memory)).padStart(2,"0"):"00",D=[e.device.screenResolution.hasMultipleDisplays===!0,e.device.mediaQueries.prefersReducedMotion===!0,e.device.mediaQueries.prefersReducedTransparency===!0,e.device.mediaQueries.hover===!0,e.device.mediaQueries.anyHover===!0].map(g=>g?"1":"0").join(""),L=[e.device.platform,e.device.screenResolution.pixelDepth,e.device.screenResolution.colorDepth,e.device.multimediaDevices.speakers,e.device.multimediaDevices.microphones,e.device.multimediaDevices.webcams,e.device.mediaQueries.prefersColorScheme,e.device.mediaQueries.colorGamut,e.device.mediaQueries.pointer,e.device.mediaQueries.anyPointer,e.device.mediaQueries.colorDepth].map(g=>String(g)).join("|"),v=h(L).slice(0,6),H=`${w}x${M}c${U}m${k}b${D}h${v}`,R=typeof e.browser.features.bitmask=="string"?e.browser.features.bitmask:"0000000000",I=typeof e.browser.extensions.bitmask=="string"?e.browser.extensions.bitmask:"00000000",b=[e.browser.plugins.isValidPluginArray===!0,e.browser.plugins.pluginConsistency1===!0,e.browser.plugins.pluginOverflow===!0,e.browser.toSourceError.hasToSource===!0].map(g=>g?"1":"0").join(""),C=[e.browser.userAgent,e.browser.etsl,e.browser.maths,e.browser.plugins.pluginCount,e.browser.plugins.pluginNamesHash,e.browser.toSourceError.toSourceError,e.browser.highEntropyValues.architecture,e.browser.highEntropyValues.bitness,e.browser.highEntropyValues.platform,e.browser.highEntropyValues.platformVersion,e.browser.highEntropyValues.uaFullVersion,e.browser.highEntropyValues.mobile].map(g=>String(g)).join("|"),A=h(C).slice(0,6),_=`f${R}e${I}p${b}h${A}`,x=[e.graphics.canvas.hasModifiedCanvas===!0].map(g=>g?"1":"0").join(""),E=[e.graphics.webGL.vendor,e.graphics.webGL.renderer,e.graphics.webgpu.vendor,e.graphics.webgpu.architecture,e.graphics.webgpu.device,e.graphics.webgpu.description,e.graphics.canvas.canvasFingerprint].map(g=>String(g)).join("|"),P=h(E).slice(0,6),O=`${x}h${P}`,p=[e.codecs.hasMediaSource===!0].map(g=>g?"1":"0").join(""),F=[e.codecs.audioCanPlayTypeHash,e.codecs.videoCanPlayTypeHash,e.codecs.audioMediaSourceHash,e.codecs.videoMediaSourceHash,e.codecs.rtcAudioCapabilitiesHash,e.codecs.rtcVideoCapabilitiesHash].map(g=>String(g)).join("|"),T=h(F).slice(0,6),V=`${p}h${T}`,j=typeof e.locale.languages.language=="string"?e.locale.languages.language.slice(0,2).toLowerCase():"xx",B=Array.isArray(e.locale.languages.languages)?e.locale.languages.languages.length:0,ut=(typeof e.locale.internationalization.timezone=="string"?e.locale.internationalization.timezone:"unknown").replace(/[\/\s]/g,"-"),dt=[e.locale.internationalization.timezone,e.locale.internationalization.localeLanguage,Array.isArray(e.locale.languages.languages)?e.locale.languages.languages.join(","):e.locale.languages.languages,e.locale.languages.language].map(g=>String(g)).join("|"),pt=h(dt).slice(0,4),mt=`${j}${B}t${ut}_h${pt}`,gt=[G(this.fingerprint,"iframe"),G(this.fingerprint,"worker"),e.contexts.iframe.webdriver===!0,e.contexts.webWorker.webdriver===!0].map(g=>g?"1":"0").join(""),ft=[e.contexts.iframe.userAgent,e.contexts.iframe.platform,e.contexts.iframe.memory,e.contexts.iframe.cpuCount,e.contexts.iframe.language,e.contexts.webWorker.userAgent,e.contexts.webWorker.platform,e.contexts.webWorker.memory,e.contexts.webWorker.cpuCount,e.contexts.webWorker.language,e.contexts.webWorker.vendor,e.contexts.webWorker.renderer].map(g=>String(g)).join("|"),ht=h(ft).slice(0,6),yt=`${gt}h${ht}`;return[i,u,a,H,_,O,V,mt,yt].join("_")}catch(e){return console.error("Error generating fingerprint scanner id",e),c}}async encryptFingerprint(e){let r=__FP_ENCRYPTION_KEY__;return r.length>20&&r.indexOf("DEFAULT")>0&&r.indexOf("FPSCANNER")>0&&console.warn('[fpscanner] WARNING: Using default encryption key! Run "npx fpscanner build --key=your-secret-key" to inject your own key. See: https://github.com/antoinevastel/fpscanner#advanced-custom-builds'),await et(JSON.stringify(e),r)}getDetectionRules(){return[{name:"headlessChromeScreenResolution",severity:y,test:_e},{name:"hasWebdriver",severity:y,test:Oe},{name:"hasWebdriverWritable",severity:y,test:$e},{name:"hasSeleniumProperty",severity:y,test:Fe},{name:"hasCDP",severity:y,test:Te},{name:"hasPlaywright",severity:y,test:Ne},{name:"hasImpossibleDeviceMemory",severity:y,test:Ue},{name:"hasHighCPUCount",severity:y,test:Le},{name:"hasMissingChromeObject",severity:y,test:He},{name:"hasWebdriverIframe",severity:y,test:Ve},{name:"hasWebdriverWorker",severity:y,test:je},{name:"hasMismatchWebGLInWorker",severity:y,test:Be},{name:"hasMismatchPlatformIframe",severity:y,test:ze},{name:"hasMismatchPlatformWorker",severity:y,test:Ge},{name:"hasSwiftshaderRenderer",severity:"low",test:Qe},{name:"hasUTCTimezone",severity:Z,test:Ke},{name:"hasMismatchLanguages",severity:"low",test:qe},{name:"hasInconsistentEtsl",severity:y,test:Je},{name:"hasBotUserAgent",severity:y,test:Ye},{name:"hasGPUMismatch",severity:y,test:Ze},{name:"hasPlatformMismatch",severity:y,test:Xe}]}runDetectionRules(){let e=this.getDetectionRules(),r={headlessChromeScreenResolution:{detected:!1,severity:"high"},hasWebdriver:{detected:!1,severity:"high"},hasWebdriverWritable:{detected:!1,severity:"high"},hasSeleniumProperty:{detected:!1,severity:"high"},hasCDP:{detected:!1,severity:"high"},hasPlaywright:{detected:!1,severity:"high"},hasImpossibleDeviceMemory:{detected:!1,severity:"high"},hasHighCPUCount:{detected:!1,severity:"high"},hasMissingChromeObject:{detected:!1,severity:"high"},hasWebdriverIframe:{detected:!1,severity:"high"},hasWebdriverWorker:{detected:!1,severity:"high"},hasMismatchWebGLInWorker:{detected:!1,severity:"high"},hasMismatchPlatformIframe:{detected:!1,severity:"high"},hasMismatchPlatformWorker:{detected:!1,severity:"high"},hasSwiftshaderRenderer:{detected:!1,severity:"low"},hasUTCTimezone:{detected:!1,severity:"medium"},hasMismatchLanguages:{detected:!1,severity:"low"},hasInconsistentEtsl:{detected:!1,severity:"high"},hasBotUserAgent:{detected:!1,severity:"high"},hasGPUMismatch:{detected:!1,severity:"high"},hasPlatformMismatch:{detected:!1,severity:"high"}};for(let i of e)try{let o=i.test(this.fingerprint);r[i.name]={detected:o,severity:i.severity}}catch{r[i.name]={detected:!1,severity:i.severity}}return r}async collectFingerprint(e={encrypt:!0}){let{encrypt:r=!0,skipWorker:i=!1}=e,o=this.fingerprint.signals,u={webdriver:this.collectSignal(q),webdriverWritable:this.collectSignal(pe),selenium:this.collectSignal(de),cdp:this.collectSignal(ee),playwright:this.collectSignal(re),navigatorPropertyDescriptors:this.collectSignal(Ee),cpuCount:this.collectSignal(ne),memory:this.collectSignal(oe),platform:this.collectSignal(Y),screenResolution:this.collectSignal(ce),multimediaDevices:this.collectSignal(fe),mediaQueries:this.collectSignal(Ie),userAgent:this.collectSignal(J),browserFeatures:this.collectSignal(De),plugins:this.collectSignal(ge),browserExtensions:this.collectSignal(ke),highEntropyValues:this.collectSignal(me),etsl:this.collectSignal(ae),maths:this.collectSignal(ie),toSourceError:this.collectSignal(ve),webGL:this.collectSignal(te),webgpu:this.collectSignal(ue),canvas:this.collectSignal(Ae),mediaCodecs:this.collectSignal(Ce),internationalization:this.collectSignal(se),languages:this.collectSignal(le),iframe:this.collectSignal(he),webWorker:i?Promise.resolve({webdriver:S,userAgent:S,platform:S,memory:S,cpuCount:S,language:S,vendor:S,renderer:S}):this.collectSignal(ye),nonce:this.collectSignal(Pe),time:this.collectSignal(We),url:this.collectSignal(Me)},l=Object.keys(u),f=await Promise.all(Object.values(u)),a=Object.fromEntries(l.map((w,M)=>[w,f[M]]));return o.automation.webdriver=a.webdriver,o.automation.webdriverWritable=a.webdriverWritable,o.automation.selenium=a.selenium,o.automation.cdp=a.cdp,o.automation.playwright=a.playwright,o.automation.navigatorPropertyDescriptors=a.navigatorPropertyDescriptors,o.device.cpuCount=a.cpuCount,o.device.memory=a.memory,o.device.platform=a.platform,o.device.screenResolution=a.screenResolution,o.device.multimediaDevices=a.multimediaDevices,o.device.mediaQueries=a.mediaQueries,o.browser.userAgent=a.userAgent,o.browser.features=a.browserFeatures,o.browser.plugins=a.plugins,o.browser.extensions=a.browserExtensions,o.browser.highEntropyValues=a.highEntropyValues,o.browser.etsl=a.etsl,o.browser.maths=a.maths,o.browser.toSourceError=a.toSourceError,o.graphics.webGL=a.webGL,o.graphics.webgpu=a.webgpu,o.graphics.canvas=a.canvas,o.codecs=a.mediaCodecs,o.locale.internationalization=a.internationalization,o.locale.languages=a.languages,o.contexts.iframe=a.iframe,o.contexts.webWorker=a.webWorker,this.fingerprint.nonce=a.nonce,this.fingerprint.time=a.time,this.fingerprint.url=a.url,this.fingerprint.fastBotDetectionDetails=this.runDetectionRules(),this.fingerprint.fastBotDetection=Object.values(this.fingerprint.fastBotDetectionDetails).some(w=>w.detected),this.fingerprint.fsid=this.generateFingerprintScannerId(),r?await this.encryptFingerprint(JSON.stringify(this.fingerprint)):this.fingerprint}},rt=z;var At=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function N(t){let e=1779033703,r=3144134277,i=1013904242,o=2773480762,u=1359893119,l=2600822924,f=528734635,a=1541459225,w=t.length,M=w*8,U=64-(w+9)%64,k=w+1+(U===64?0:U)+8,D=new Uint8Array(k);D.set(t),D[w]=128;let L=new DataView(D.buffer);L.setUint32(k-4,M,!1);let v=new Int32Array(64);for(let I=0;I>>7|v[p-15]<<25)^(v[p-15]>>>18|v[p-15]<<14)^v[p-15]>>>3|0,T=(v[p-2]>>>17|v[p-2]<<15)^(v[p-2]>>>19|v[p-2]<<13)^v[p-2]>>>10|0;v[p]=v[p-16]+F+v[p-7]+T|0}let b=e,C=r,A=i,_=o,x=u,E=l,P=f,O=a;for(let p=0;p<64;p++){let F=(x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7)|0,T=x&E^~x&P|0,V=O+F+T+At[p]+v[p]|0,j=(b>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10)|0,B=b&C^b&A^C&A|0,K=j+B|0;O=P,P=E,E=x,x=_+V|0,_=A,A=C,C=b,b=V+K|0}e=e+b|0,r=r+C|0,i=i+A|0,o=o+_|0,u=u+x|0,l=l+E|0,f=f+P|0,a=a+O|0}let H=new Uint8Array(32),R=new DataView(H.buffer);return R.setUint32(0,e,!1),R.setUint32(4,r,!1),R.setUint32(8,i,!1),R.setUint32(12,o,!1),R.setUint32(16,u,!1),R.setUint32(20,l,!1),R.setUint32(24,f,!1),R.setUint32(28,a,!1),H}function ot(t){let e="";for(let r=0;r>4).toString(16)+(t[r]&15).toString(16);return e}function W(t){return new TextEncoder().encode(t)}function Et(t){return ot(N(W(t)))}function Pt(t,e){t.length>64&&(t=N(t));let r=new Uint8Array(64);r.set(t);let i=new Uint8Array(64),o=new Uint8Array(64);for(let a=0;a<64;a++)i[a]=r[a]^54,o[a]=r[a]^92;let u=new Uint8Array(64+e.length);u.set(i),u.set(e,64);let l=N(u),f=new Uint8Array(96);return f.set(o),f.set(l,64),N(f)}function Wt(t,e){return ot(Pt(W(t),W(e)))}var Mt="__CROWDSEC_POW_WORKER_PATH__";function kt(t,e){if(e<=0)return Promise.resolve("0");try{let r=new Worker(Mt);return new Promise(i=>{r.onmessage=o=>{r.terminate(),i(o.data)},r.onerror=()=>{r.terminate(),i(nt(t,e))},r.postMessage({p:t,d:e})})}catch{return Promise.resolve(nt(t,e))}}function nt(t,e){let r=0;for(;;){let i=t+r.toString(36),o=N(W(i)),u=e>>3,l=e&7,f=!0;for(let a=0;a0){let a=255<<8-l&255;(o[u]&a)!==0&&(f=!1)}if(f)return r.toString(36);r++}}function Dt(t,e){let r=W(t),i=W(e),o=new Uint8Array(i.length);for(let l=0;lt.json()).then(t=>{let e=typeof t?.status=="string"?t.status:"fail";it(e)}).catch(()=>{it("fail")});
diff --git a/pkg/appsec/challenge/js/fpscanner/src/crypto-helpers.ts b/pkg/appsec/challenge/js/fpscanner/src/crypto-helpers.ts
new file mode 100644
index 00000000000..26833cd4157
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/crypto-helpers.ts
@@ -0,0 +1,50 @@
+/**
+ * Simple and fast XOR-based encryption/decryption
+ * Note: This is NOT cryptographically secure - use only for obfuscation
+ */
+
+/**
+ * Encrypts a string using XOR cipher with the provided key
+ * @param plaintext - The string to encrypt
+ * @param key - The encryption key as a string
+ * @returns Encrypted string (base64 encoded)
+ */
+export async function encryptString(plaintext: string, key: string): Promise {
+ const keyBytes = new TextEncoder().encode(key);
+ const textBytes = new TextEncoder().encode(plaintext);
+ const encrypted = new Uint8Array(textBytes.length);
+
+ for (let i = 0; i < textBytes.length; i++) {
+ encrypted[i] = textBytes[i] ^ keyBytes[i % keyBytes.length];
+ }
+
+ // Convert to base64 for safe string representation
+ const binaryString = String.fromCharCode(...encrypted);
+ return btoa(binaryString);
+}
+
+/**
+ * Decrypts a string that was encrypted with encryptString
+ * @param ciphertext - The encrypted string (base64 encoded)
+ * @param key - The decryption key as a string (must match encryption key)
+ * @returns Decrypted string
+ */
+export async function decryptString(ciphertext: string, key: string): Promise {
+ // Decode from base64
+ const binaryString = atob(ciphertext);
+ const encrypted = new Uint8Array(binaryString.length);
+ for (let i = 0; i < binaryString.length; i++) {
+ encrypted[i] = binaryString.charCodeAt(i);
+ }
+
+ const keyBytes = new TextEncoder().encode(key);
+ const decrypted = new Uint8Array(encrypted.length);
+
+ // XOR is symmetric, so decryption is the same as encryption
+ for (let i = 0; i < encrypted.length; i++) {
+ decrypted[i] = encrypted[i] ^ keyBytes[i % keyBytes.length];
+ }
+
+ return new TextDecoder().decode(decrypted);
+}
+
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasBotUserAgent.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasBotUserAgent.ts
new file mode 100644
index 00000000000..c1a97c10ec1
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasBotUserAgent.ts
@@ -0,0 +1,11 @@
+import { Fingerprint } from "../types";
+
+export function hasBotUserAgent(fingerprint: Fingerprint) {
+ const userAgents = [
+ fingerprint.signals.browser.userAgent,
+ fingerprint.signals.contexts.iframe.userAgent,
+ fingerprint.signals.contexts.webWorker.userAgent,
+ ];
+
+ return userAgents.some(userAgent => /bot|headless/i.test(userAgent.toLowerCase()));
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasCDP.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasCDP.ts
new file mode 100644
index 00000000000..a49aa69fe11
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasCDP.ts
@@ -0,0 +1,5 @@
+import { Fingerprint } from "../types";
+
+export function hasCDP(fingerprint: Fingerprint) {
+ return fingerprint.signals.automation.cdp === true;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasContextMismatch.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasContextMismatch.ts
new file mode 100644
index 00000000000..e3155396d38
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasContextMismatch.ts
@@ -0,0 +1,19 @@
+import { Fingerprint } from "../types";
+
+// Not used as a detection rule since, more like an indicator
+export function hasContextMismatch(fingerprint: Fingerprint, context: 'iframe' | 'worker'): boolean {
+ const s = fingerprint.signals;
+ if (context === 'iframe') {
+ return s.contexts.iframe.webdriver !== s.automation.webdriver ||
+ s.contexts.iframe.userAgent !== s.browser.userAgent ||
+ s.contexts.iframe.platform !== s.device.platform ||
+ s.contexts.iframe.memory !== s.device.memory ||
+ s.contexts.iframe.cpuCount !== s.device.cpuCount;
+ } else {
+ return s.contexts.webWorker.webdriver !== s.automation.webdriver ||
+ s.contexts.webWorker.userAgent !== s.browser.userAgent ||
+ s.contexts.webWorker.platform !== s.device.platform ||
+ s.contexts.webWorker.memory !== s.device.memory ||
+ s.contexts.webWorker.cpuCount !== s.device.cpuCount;
+ }
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasGPUMismatch.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasGPUMismatch.ts
new file mode 100644
index 00000000000..4f34b96e6ea
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasGPUMismatch.ts
@@ -0,0 +1,25 @@
+import { Fingerprint } from "../types";
+
+// For the moment, we only detect GPU mismatches related to Apple OS/GPU
+
+export function hasGPUMismatch(fingerprint: Fingerprint) {
+ const gpu = fingerprint.signals.graphics.webgpu;
+ const webGL = fingerprint.signals.graphics.webGL;
+ const userAgent = fingerprint.signals.browser.userAgent;
+
+
+ // Inconsistencies around Apple OS/GPU
+ if ((webGL.vendor.includes('Apple') || webGL.renderer.includes('Apple')) && !userAgent.includes('Mac')) {
+ return true;
+ }
+
+ if (gpu.vendor.includes('apple') && !userAgent.includes('Mac')) {
+ return true;
+ }
+
+ if (gpu.vendor.includes('apple') && !webGL.renderer.includes('Apple')) {
+ return true;
+ }
+
+ return false;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasHeadlessChromeScreenResolution.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasHeadlessChromeScreenResolution.ts
new file mode 100644
index 00000000000..f3d39c34a80
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasHeadlessChromeScreenResolution.ts
@@ -0,0 +1,7 @@
+import { Fingerprint } from '../types';
+
+export function hasHeadlessChromeScreenResolution(fingerprint: Fingerprint) {
+ const screen = fingerprint.signals.device.screenResolution;
+
+ return (screen.width === 800 && screen.height === 600) || (screen.availableWidth === 800 && screen.availableHeight === 600) || (screen.innerWidth === 800 && screen.innerHeight === 600);
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasHighCPUCount.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasHighCPUCount.ts
new file mode 100644
index 00000000000..2242a063414
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasHighCPUCount.ts
@@ -0,0 +1,9 @@
+import { Fingerprint } from "../types";
+
+export function hasHighCPUCount(fingerprint: Fingerprint) {
+ if (typeof fingerprint.signals.device.cpuCount !== 'number') {
+ return false;
+ }
+
+ return fingerprint.signals.device.cpuCount > 70;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasImpossibleDeviceMemory.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasImpossibleDeviceMemory.ts
new file mode 100644
index 00000000000..4c4edc9e7b9
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasImpossibleDeviceMemory.ts
@@ -0,0 +1,9 @@
+import { Fingerprint } from "../types";
+
+export function hasImpossibleDeviceMemory(fingerprint: Fingerprint) {
+ if (typeof fingerprint.signals.device.memory !== 'number') {
+ return false;
+ }
+
+ return (fingerprint.signals.device.memory > 32 || fingerprint.signals.device.memory < 0.25);
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasInconsistentEtsl.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasInconsistentEtsl.ts
new file mode 100644
index 00000000000..0bbc49ba58d
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasInconsistentEtsl.ts
@@ -0,0 +1,21 @@
+import { Fingerprint } from "../types";
+
+export function hasInconsistentEtsl(fingerprint: Fingerprint) {
+
+ // On Chromium-based browsers, ETSL should be 33
+ if (fingerprint.signals.browser.features.chrome && fingerprint.signals.browser.etsl !== 33) {
+ return true;
+ }
+
+ // On Safari, ETSL should be 37
+ if (fingerprint.signals.browser.features.safari && fingerprint.signals.browser.etsl !== 37) {
+ return true;
+ }
+
+ // On Firefox, ETSL should be 37
+ if (fingerprint.signals.browser.userAgent.includes('Firefox') && fingerprint.signals.browser.etsl !== 37) {
+ return true;
+ }
+
+ return false;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasMismatchLanguages.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasMismatchLanguages.ts
new file mode 100644
index 00000000000..d1d38d7652d
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasMismatchLanguages.ts
@@ -0,0 +1,13 @@
+import { Fingerprint } from "../types";
+
+export function hasMismatchLanguages(fingerprint: Fingerprint) {
+ const languages = fingerprint.signals.locale.languages.languages;
+ const language = fingerprint.signals.locale.languages.language;
+
+
+ if (language && languages && Array.isArray(languages) && languages.length > 0) {
+ return languages[0] !== language;
+ }
+
+ return false;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasMismatchPlatformIframe.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasMismatchPlatformIframe.ts
new file mode 100644
index 00000000000..3bbcfbeb721
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasMismatchPlatformIframe.ts
@@ -0,0 +1,10 @@
+import { Fingerprint } from "../types";
+import { ERROR, NA } from "../signals/utils";
+
+export function hasMismatchPlatformIframe(fingerprint: Fingerprint) {
+ if (fingerprint.signals.contexts.iframe.platform === NA || fingerprint.signals.contexts.iframe.platform === ERROR) {
+ return false;
+ }
+
+ return fingerprint.signals.device.platform !== fingerprint.signals.contexts.iframe.platform;
+}
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasMismatchPlatformWorker.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasMismatchPlatformWorker.ts
new file mode 100644
index 00000000000..025598899f8
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasMismatchPlatformWorker.ts
@@ -0,0 +1,10 @@
+import { Fingerprint } from "../types";
+import { ERROR, NA, SKIPPED } from "../signals/utils";
+
+export function hasMismatchPlatformWorker(fingerprint: Fingerprint) {
+ if (fingerprint.signals.contexts.webWorker.platform === NA || fingerprint.signals.contexts.webWorker.platform === ERROR || fingerprint.signals.contexts.webWorker.platform === SKIPPED) {
+ return false;
+ }
+
+ return fingerprint.signals.device.platform !== fingerprint.signals.contexts.webWorker.platform;
+}
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasMismatchWebGLInWorker.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasMismatchWebGLInWorker.ts
new file mode 100644
index 00000000000..0ebe8a18337
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasMismatchWebGLInWorker.ts
@@ -0,0 +1,13 @@
+import { Fingerprint } from "../types";
+import { ERROR, NA, SKIPPED } from "../signals/utils";
+
+export function hasMismatchWebGLInWorker(fingerprint: Fingerprint) {
+ const worker = fingerprint.signals.contexts.webWorker;
+ const webGL = fingerprint.signals.graphics.webGL;
+
+ if (worker.vendor === ERROR || worker.renderer === ERROR || webGL.vendor === NA || webGL.renderer === NA || worker.vendor === SKIPPED) {
+ return false;
+ }
+
+ return worker.vendor !== webGL.vendor || worker.renderer !== webGL.renderer;
+}
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasMissingChromeObject.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasMissingChromeObject.ts
new file mode 100644
index 00000000000..2d12ac5e772
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasMissingChromeObject.ts
@@ -0,0 +1,6 @@
+import { Fingerprint } from "../types";
+
+export function hasMissingChromeObject(fingerprint: Fingerprint) {
+ const userAgent = fingerprint.signals.browser.userAgent;
+ return fingerprint.signals.browser.features.chrome === false && typeof userAgent === 'string' && userAgent.includes('Chrome');
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasPlatformMismatch.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasPlatformMismatch.ts
new file mode 100644
index 00000000000..9ea694173e2
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasPlatformMismatch.ts
@@ -0,0 +1,38 @@
+import { Fingerprint } from "../types";
+import { ERROR, NA } from "../signals/utils";
+
+export function hasPlatformMismatch(fingerprint: Fingerprint) {
+ const platform = fingerprint.signals.device.platform;
+ const userAgent = fingerprint.signals.browser.userAgent;
+ const highEntropyPlatform = fingerprint.signals.browser.highEntropyValues.platform;
+
+ if (userAgent.includes('Mac') && (platform.includes('Win') || platform.includes('Linux'))) {
+ return true;
+ }
+
+ if (userAgent.includes('Windows') && (platform.includes('Mac') || platform.includes('Linux'))) {
+ return true;
+ }
+
+ if (userAgent.includes('Linux') && (platform.includes('Mac') || platform.includes('Win'))) {
+ return true;
+ }
+
+
+ // Check applied only if highEntropyPlatform is not ERROR or NA
+ if (highEntropyPlatform !== ERROR && highEntropyPlatform !== NA) {
+ if (highEntropyPlatform.includes('Mac') && (platform.includes('Win') || platform.includes('Linux'))) {
+ return true;
+ }
+
+ if (highEntropyPlatform.includes('Windows') && (platform.includes('Mac') || platform.includes('Linux'))) {
+ return true;
+ }
+
+ if (highEntropyPlatform.includes('Linux') && (platform.includes('Mac') || platform.includes('Win'))) {
+ return true;
+ }
+ }
+
+ return false;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasPlaywright.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasPlaywright.ts
new file mode 100644
index 00000000000..d8ca3f62439
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasPlaywright.ts
@@ -0,0 +1,5 @@
+import { Fingerprint } from "../types";
+
+export function hasPlaywright(fingerprint: Fingerprint) {
+ return fingerprint.signals.automation.playwright === true;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasSeleniumProperty.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasSeleniumProperty.ts
new file mode 100644
index 00000000000..153c2d936bf
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasSeleniumProperty.ts
@@ -0,0 +1,5 @@
+import { Fingerprint } from "../types";
+
+export function hasSeleniumProperty(fingerprint: Fingerprint) {
+ return !!fingerprint.signals.automation.selenium;
+}
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasSwiftshaderRenderer.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasSwiftshaderRenderer.ts
new file mode 100644
index 00000000000..7e95d946b94
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasSwiftshaderRenderer.ts
@@ -0,0 +1,5 @@
+import { Fingerprint } from "../types";
+
+export function hasSwiftshaderRenderer(fingerprint: Fingerprint) {
+ return fingerprint.signals.graphics.webGL.renderer.includes('SwiftShader');
+}
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasUTCTimezone.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasUTCTimezone.ts
new file mode 100644
index 00000000000..b048798b14d
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasUTCTimezone.ts
@@ -0,0 +1,5 @@
+import { Fingerprint } from "../types";
+
+export function hasUTCTimezone(fingerprint: Fingerprint) {
+ return fingerprint.signals.locale.internationalization.timezone === 'UTC';
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasWebdriver.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasWebdriver.ts
new file mode 100644
index 00000000000..20854ac94b9
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasWebdriver.ts
@@ -0,0 +1,5 @@
+import { Fingerprint } from "../types";
+
+export function hasWebdriver(fingerprint: Fingerprint) {
+ return fingerprint.signals.automation.webdriver === true;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasWebdriverIframe.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasWebdriverIframe.ts
new file mode 100644
index 00000000000..223a4c350e4
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasWebdriverIframe.ts
@@ -0,0 +1,5 @@
+import { Fingerprint } from "../types";
+
+export function hasWebdriverIframe(fingerprint: Fingerprint) {
+ return fingerprint.signals.contexts.iframe.webdriver === true;
+}
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasWebdriverWorker.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasWebdriverWorker.ts
new file mode 100644
index 00000000000..7e3e10932b9
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasWebdriverWorker.ts
@@ -0,0 +1,5 @@
+import { Fingerprint } from "../types";
+
+export function hasWebdriverWorker(fingerprint: Fingerprint) {
+ return fingerprint.signals.contexts.webWorker.webdriver === true;
+}
diff --git a/pkg/appsec/challenge/js/fpscanner/src/detections/hasWebdriverWritable.ts b/pkg/appsec/challenge/js/fpscanner/src/detections/hasWebdriverWritable.ts
new file mode 100644
index 00000000000..26fddd9018f
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/detections/hasWebdriverWritable.ts
@@ -0,0 +1,5 @@
+import { Fingerprint } from "../types";
+
+export function hasWebdriverWritable(fingerprint: Fingerprint) {
+ return fingerprint.signals.automation.webdriverWritable === true;
+}
diff --git a/pkg/appsec/challenge/js/fpscanner/src/globals.d.ts b/pkg/appsec/challenge/js/fpscanner/src/globals.d.ts
new file mode 100644
index 00000000000..a072a6c658e
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/globals.d.ts
@@ -0,0 +1,10 @@
+/**
+ * Build-time constant injected via Vite's define option.
+ * This is replaced with the actual encryption key during the build process.
+ *
+ * Customers provide their key via:
+ * - npx fpscanner build --key=their-key
+ * - FINGERPRINT_KEY environment variable
+ * - .env file with FINGERPRINT_KEY=their-key
+ */
+declare const __FP_ENCRYPTION_KEY__: string;
diff --git a/pkg/appsec/challenge/js/fpscanner/src/index.ts b/pkg/appsec/challenge/js/fpscanner/src/index.ts
new file mode 100644
index 00000000000..b0e355ea390
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/index.ts
@@ -0,0 +1,698 @@
+// Import all signals
+import { webdriver } from './signals/webdriver';
+import { userAgent } from './signals/userAgent';
+import { platform } from './signals/platform';
+import { cdp } from './signals/cdp';
+import { webGL } from './signals/webGL';
+import { playwright } from './signals/playwright';
+import { cpuCount } from './signals/cpuCount';
+import { maths } from './signals/maths';
+import { memory } from './signals/memory';
+import { etsl } from './signals/etsl';
+import { internationalization } from './signals/internationalization';
+import { screenResolution } from './signals/screenResolution';
+import { languages } from './signals/languages';
+import { webgpu } from './signals/webgpu';
+import { hasSeleniumProperties } from './signals/seleniumProperties';
+import { webdriverWritable } from './signals/webdriverWritable';
+import { highEntropyValues } from './signals/highEntropyValues';
+import { plugins } from './signals/plugins';
+import { multimediaDevices } from './signals/multimediaDevices';
+import { iframe } from './signals/iframe';
+import { worker } from './signals/worker';
+import { toSourceError } from './signals/toSourceError';
+import { mediaCodecs } from './signals/mediaCodecs';
+import { canvas } from './signals/canvas';
+import { navigatorPropertyDescriptors } from './signals/navigatorPropertyDescriptors';
+import { nonce } from './signals/nonce';
+import { time } from './signals/time';
+import { pageURL } from './signals/url';
+import { hasContextMismatch } from './detections/hasContextMismatch';
+import { browserExtensions } from './signals/browserExtensions';
+import { browserFeatures } from './signals/browserFeatures';
+import { mediaQueries } from './signals/mediaQueries';
+
+// Fast Bot Detection tests
+import { hasHeadlessChromeScreenResolution } from './detections/hasHeadlessChromeScreenResolution';
+import { hasWebdriver } from './detections/hasWebdriver';
+import { hasSeleniumProperty } from './detections/hasSeleniumProperty';
+import { hasCDP } from './detections/hasCDP';
+import { hasPlaywright } from './detections/hasPlaywright';
+import { hasImpossibleDeviceMemory } from './detections/hasImpossibleDeviceMemory';
+import { hasHighCPUCount } from './detections/hasHighCPUCount';
+import { hasMissingChromeObject } from './detections/hasMissingChromeObject';
+import { hasWebdriverIframe } from './detections/hasWebdriverIframe';
+import { hasWebdriverWorker } from './detections/hasWebdriverWorker';
+import { hasMismatchWebGLInWorker } from './detections/hasMismatchWebGLInWorker';
+import { hasMismatchPlatformWorker } from './detections/hasMismatchPlatformWorker';
+import { hasMismatchPlatformIframe } from './detections/hasMismatchPlatformIframe';
+import { hasWebdriverWritable } from './detections/hasWebdriverWritable';
+import { hasSwiftshaderRenderer } from './detections/hasSwiftshaderRenderer';
+import { hasUTCTimezone } from './detections/hasUTCTimezone';
+import { hasMismatchLanguages } from './detections/hasMismatchLanguages';
+import { hasInconsistentEtsl } from './detections/hasInconsistentEtsl';
+import { hasBotUserAgent } from './detections/hasBotUserAgent';
+import { hasGPUMismatch } from './detections/hasGPUMismatch';
+import { hasPlatformMismatch } from './detections/hasPlatformMismatch';
+
+import { ERROR, HIGH, INIT, LOW, MEDIUM, SKIPPED, hashCode } from './signals/utils';
+import { encryptString } from './crypto-helpers';
+import { Fingerprint, FastBotDetectionDetails, DetectionRule, CollectFingerprintOptions } from './types';
+
+
+class FingerprintScanner {
+ private fingerprint: Fingerprint;
+
+ constructor() {
+ this.fingerprint = {
+ signals: {
+ // Automation/Bot detection signals
+ automation: {
+ webdriver: INIT,
+ webdriverWritable: INIT,
+ selenium: INIT,
+ cdp: INIT,
+ playwright: INIT,
+ navigatorPropertyDescriptors: INIT,
+ },
+ // Device hardware characteristics
+ device: {
+ cpuCount: INIT,
+ memory: INIT,
+ platform: INIT,
+ screenResolution: {
+ width: INIT,
+ height: INIT,
+ pixelDepth: INIT,
+ colorDepth: INIT,
+ availableWidth: INIT,
+ availableHeight: INIT,
+ innerWidth: INIT,
+ innerHeight: INIT,
+ hasMultipleDisplays: INIT,
+ },
+ multimediaDevices: {
+ speakers: INIT,
+ microphones: INIT,
+ webcams: INIT,
+ },
+ mediaQueries: {
+ prefersColorScheme: INIT,
+ prefersReducedMotion: INIT,
+ prefersReducedTransparency: INIT,
+ colorGamut: INIT,
+ pointer: INIT,
+ anyPointer: INIT,
+ hover: INIT,
+ anyHover: INIT,
+ colorDepth: INIT,
+ },
+ },
+ // Browser identity & features
+ browser: {
+ userAgent: INIT,
+ features: {
+ bitmask: INIT,
+ chrome: INIT,
+ brave: INIT,
+ applePaySupport: INIT,
+ opera: INIT,
+ serial: INIT,
+ attachShadow: INIT,
+ caches: INIT,
+ webAssembly: INIT,
+ buffer: INIT,
+ showModalDialog: INIT,
+ safari: INIT,
+ webkitPrefixedFunction: INIT,
+ mozPrefixedFunction: INIT,
+ usb: INIT,
+ browserCapture: INIT,
+ paymentRequestUpdateEvent: INIT,
+ pressureObserver: INIT,
+ audioSession: INIT,
+ selectAudioOutput: INIT,
+ barcodeDetector: INIT,
+ battery: INIT,
+ devicePosture: INIT,
+ documentPictureInPicture: INIT,
+ eyeDropper: INIT,
+ editContext: INIT,
+ fencedFrame: INIT,
+ sanitizer: INIT,
+ otpCredential: INIT,
+ },
+ plugins: {
+ isValidPluginArray: INIT,
+ pluginCount: INIT,
+ pluginNamesHash: INIT,
+ pluginConsistency1: INIT,
+ pluginOverflow: INIT,
+ },
+ extensions: {
+ bitmask: INIT,
+ extensions: INIT,
+ },
+ highEntropyValues: {
+ architecture: INIT,
+ bitness: INIT,
+ brands: INIT,
+ mobile: INIT,
+ model: INIT,
+ platform: INIT,
+ platformVersion: INIT,
+ uaFullVersion: INIT,
+ },
+ etsl: INIT,
+ maths: INIT,
+ toSourceError: {
+ toSourceError: INIT,
+ hasToSource: INIT,
+ },
+ },
+ // Graphics & rendering
+ graphics: {
+ webGL: {
+ vendor: INIT,
+ renderer: INIT,
+ },
+ webgpu: {
+ vendor: INIT,
+ architecture: INIT,
+ device: INIT,
+ description: INIT,
+ },
+ canvas: {
+ hasModifiedCanvas: INIT,
+ canvasFingerprint: INIT,
+ },
+ },
+ // Media codecs (at root level)
+ codecs: {
+ audioCanPlayTypeHash: INIT,
+ videoCanPlayTypeHash: INIT,
+ audioMediaSourceHash: INIT,
+ videoMediaSourceHash: INIT,
+ rtcAudioCapabilitiesHash: INIT,
+ rtcVideoCapabilitiesHash: INIT,
+ hasMediaSource: INIT,
+ },
+ // Locale & internationalization
+ locale: {
+ internationalization: {
+ timezone: INIT,
+ localeLanguage: INIT,
+ },
+ languages: {
+ languages: INIT,
+ language: INIT,
+ },
+ },
+ // Isolated execution contexts
+ contexts: {
+ iframe: {
+ webdriver: INIT,
+ userAgent: INIT,
+ platform: INIT,
+ memory: INIT,
+ cpuCount: INIT,
+ language: INIT,
+ },
+ webWorker: {
+ webdriver: INIT,
+ userAgent: INIT,
+ platform: INIT,
+ memory: INIT,
+ cpuCount: INIT,
+ language: INIT,
+ vendor: INIT,
+ renderer: INIT,
+ },
+ },
+ },
+ fsid: INIT,
+ nonce: INIT,
+ time: INIT,
+ url: INIT,
+ fastBotDetection: false,
+ fastBotDetectionDetails: {
+ headlessChromeScreenResolution: { detected: false, severity: 'high' },
+ hasWebdriver: { detected: false, severity: 'high' },
+ hasWebdriverWritable: { detected: false, severity: 'high' },
+ hasSeleniumProperty: { detected: false, severity: 'high' },
+ hasCDP: { detected: false, severity: 'high' },
+ hasPlaywright: { detected: false, severity: 'high' },
+ hasImpossibleDeviceMemory: { detected: false, severity: 'high' },
+ hasHighCPUCount: { detected: false, severity: 'high' },
+ hasMissingChromeObject: { detected: false, severity: 'high' },
+ hasWebdriverIframe: { detected: false, severity: 'high' },
+ hasWebdriverWorker: { detected: false, severity: 'high' },
+ hasMismatchWebGLInWorker: { detected: false, severity: 'high' },
+ hasMismatchPlatformIframe: { detected: false, severity: 'high' },
+ hasMismatchPlatformWorker: { detected: false, severity: 'high' },
+ hasSwiftshaderRenderer: { detected: false, severity: 'low' },
+ hasUTCTimezone: { detected: false, severity: 'medium' },
+ hasMismatchLanguages: { detected: false, severity: 'low' },
+ hasInconsistentEtsl: { detected: false, severity: 'high' },
+ hasBotUserAgent: { detected: false, severity: 'high' },
+ hasGPUMismatch: { detected: false, severity: 'high' },
+ hasPlatformMismatch: { detected: false, severity: 'high' },
+ },
+ };
+ }
+
+ private async collectSignal(signal: () => any) {
+ try {
+ return await signal();
+ } catch (e) {
+ return ERROR;
+ }
+ }
+
+ /**
+ * Generate a JA4-inspired fingerprint scanner ID
+ * Format: FS1________
+ *
+ * Each section is delimited by '_', allowing partial matching.
+ * Sections use the pattern: h where applicable.
+ * Bitmasks are extensible - new boolean fields are appended without breaking existing positions.
+ *
+ * Sections:
+ * - det: fastBotDetectionDetails bitmask (21 bits: headlessChromeScreenResolution, hasWebdriver,
+ * hasWebdriverWritable, hasSeleniumProperty, hasCDP, hasPlaywright, hasImpossibleDeviceMemory,
+ * hasHighCPUCount, hasMissingChromeObject, hasWebdriverIframe, hasWebdriverWorker,
+ * hasMismatchWebGLInWorker, hasMismatchPlatformIframe, hasMismatchPlatformWorker,
+ * hasMismatchLanguages, hasInconsistentEtsl, hasBotUserAgent, hasGPUMismatch, hasPlatformMismatch)
+ * - auto: automation bitmask (5 bits: webdriver, webdriverWritable, selenium, cdp, playwright) + hash
+ * - dev: WIDTHxHEIGHT + cpu + mem + device bitmask + hash of all device signals
+ * - brw: features.bitmask + extensions.bitmask + plugins bitmask (3 bits) + hash of browser signals
+ * - gfx: canvas bitmask (1 bit: hasModifiedCanvas) + hash of all graphics signals
+ * - cod: codecs bitmask (1 bit: hasMediaSource) + hash of all codec hashes
+ * - loc: language code (2 chars) + language count + hash of locale signals
+ * - ctx: context mismatch bitmask (2 bits: iframe, worker) + hash of all context signals
+ */
+ private generateFingerprintScannerId(): string {
+ try {
+ const s = this.fingerprint.signals;
+ const det = this.fingerprint.fastBotDetectionDetails;
+
+ // Section 1: Version
+ const version = 'FS1';
+
+ // Section 2: Detection bitmask - all 21 fastBotDetectionDetails booleans
+ // Order matches FastBotDetectionDetails interface for consistency
+ const detBitmask = [
+ det.headlessChromeScreenResolution.detected,
+ det.hasWebdriver.detected,
+ det.hasWebdriverWritable.detected,
+ det.hasSeleniumProperty.detected,
+ det.hasCDP.detected,
+ det.hasPlaywright.detected,
+ det.hasImpossibleDeviceMemory.detected,
+ det.hasHighCPUCount.detected,
+ det.hasMissingChromeObject.detected,
+ det.hasWebdriverIframe.detected,
+ det.hasWebdriverWorker.detected,
+ det.hasMismatchWebGLInWorker.detected,
+ det.hasMismatchPlatformIframe.detected,
+ det.hasMismatchPlatformWorker.detected,
+ det.hasSwiftshaderRenderer.detected,
+ det.hasUTCTimezone.detected,
+ det.hasMismatchLanguages.detected,
+ det.hasInconsistentEtsl.detected,
+ det.hasBotUserAgent.detected,
+ det.hasGPUMismatch.detected,
+ det.hasPlatformMismatch.detected,
+ // Add other detection rules output here
+ ].map(b => b ? '1' : '0').join('');
+ const detSection = detBitmask;
+
+ // Section 3: Automation - bitmask + hash of non-boolean fields
+ const autoBitmask = [
+ s.automation.webdriver === true,
+ s.automation.webdriverWritable === true,
+ s.automation.selenium === true,
+ s.automation.cdp === true,
+ s.automation.playwright === true,
+ ].map(b => b ? '1' : '0').join('');
+ const autoHash = hashCode(String(s.automation.navigatorPropertyDescriptors)).slice(0, 4);
+ const autoSection = `${autoBitmask}h${autoHash}`;
+
+ // Section 4: Device - screen dims + cpu + mem + bitmask + hash
+ const width = typeof s.device.screenResolution.width === 'number' ? s.device.screenResolution.width : 0;
+ const height = typeof s.device.screenResolution.height === 'number' ? s.device.screenResolution.height : 0;
+ const cpu = typeof s.device.cpuCount === 'number' ? String(s.device.cpuCount).padStart(2, '0') : '00';
+ const mem = typeof s.device.memory === 'number' ? String(Math.round(s.device.memory)).padStart(2, '0') : '00';
+ const devBitmask = [
+ s.device.screenResolution.hasMultipleDisplays === true,
+ s.device.mediaQueries.prefersReducedMotion === true,
+ s.device.mediaQueries.prefersReducedTransparency === true,
+ s.device.mediaQueries.hover === true,
+ s.device.mediaQueries.anyHover === true,
+ ].map(b => b ? '1' : '0').join('');
+ const devStr = [
+ s.device.platform,
+ s.device.screenResolution.pixelDepth,
+ s.device.screenResolution.colorDepth,
+ s.device.multimediaDevices.speakers,
+ s.device.multimediaDevices.microphones,
+ s.device.multimediaDevices.webcams,
+ s.device.mediaQueries.prefersColorScheme,
+ s.device.mediaQueries.colorGamut,
+ s.device.mediaQueries.pointer,
+ s.device.mediaQueries.anyPointer,
+ s.device.mediaQueries.colorDepth,
+ ].map(v => String(v)).join('|');
+ const devHash = hashCode(devStr).slice(0, 6);
+ const devSection = `${width}x${height}c${cpu}m${mem}b${devBitmask}h${devHash}`;
+
+ // Section 5: Browser - use existing bitmasks + plugins bitmask + hash
+ const featuresBitmask = typeof s.browser.features.bitmask === 'string' ? s.browser.features.bitmask : '0000000000';
+ const extensionsBitmask = typeof s.browser.extensions.bitmask === 'string' ? s.browser.extensions.bitmask : '00000000';
+ const pluginsBitmask = [
+ s.browser.plugins.isValidPluginArray === true,
+ s.browser.plugins.pluginConsistency1 === true,
+ s.browser.plugins.pluginOverflow === true,
+ s.browser.toSourceError.hasToSource === true,
+ ].map(b => b ? '1' : '0').join('');
+ const brwStr = [
+ s.browser.userAgent,
+ s.browser.etsl,
+ s.browser.maths,
+ s.browser.plugins.pluginCount,
+ s.browser.plugins.pluginNamesHash,
+ s.browser.toSourceError.toSourceError,
+ s.browser.highEntropyValues.architecture,
+ s.browser.highEntropyValues.bitness,
+ s.browser.highEntropyValues.platform,
+ s.browser.highEntropyValues.platformVersion,
+ s.browser.highEntropyValues.uaFullVersion,
+ s.browser.highEntropyValues.mobile,
+ ].map(v => String(v)).join('|');
+ const brwHash = hashCode(brwStr).slice(0, 6);
+ const brwSection = `f${featuresBitmask}e${extensionsBitmask}p${pluginsBitmask}h${brwHash}`;
+
+ // Section 6: Graphics - bitmask + hash
+ const gfxBitmask = [
+ s.graphics.canvas.hasModifiedCanvas === true,
+ ].map(b => b ? '1' : '0').join('');
+ const gfxStr = [
+ s.graphics.webGL.vendor,
+ s.graphics.webGL.renderer,
+ s.graphics.webgpu.vendor,
+ s.graphics.webgpu.architecture,
+ s.graphics.webgpu.device,
+ s.graphics.webgpu.description,
+ s.graphics.canvas.canvasFingerprint,
+ ].map(v => String(v)).join('|');
+ const gfxHash = hashCode(gfxStr).slice(0, 6);
+ const gfxSection = `${gfxBitmask}h${gfxHash}`;
+
+ // Section 7: Codecs - bitmask + hash of all codec hashes
+ const codBitmask = [
+ s.codecs.hasMediaSource === true,
+ ].map(b => b ? '1' : '0').join('');
+ const codStr = [
+ s.codecs.audioCanPlayTypeHash,
+ s.codecs.videoCanPlayTypeHash,
+ s.codecs.audioMediaSourceHash,
+ s.codecs.videoMediaSourceHash,
+ s.codecs.rtcAudioCapabilitiesHash,
+ s.codecs.rtcVideoCapabilitiesHash,
+ ].map(v => String(v)).join('|');
+ const codHash = hashCode(codStr).slice(0, 6);
+ const codSection = `${codBitmask}h${codHash}`;
+
+ // Section 8: Locale - language code + count + timezone + hash
+ const primaryLang = typeof s.locale.languages.language === 'string'
+ ? s.locale.languages.language.slice(0, 2).toLowerCase()
+ : 'xx';
+ const langCount = Array.isArray(s.locale.languages.languages) ? s.locale.languages.languages.length : 0;
+ // Sanitize timezone: replace / and spaces with - for fingerprint compatibility
+ const rawTimezone = typeof s.locale.internationalization.timezone === 'string'
+ ? s.locale.internationalization.timezone
+ : 'unknown';
+ const sanitizedTimezone = rawTimezone.replace(/[\/\s]/g, '-');
+ const locStr = [
+ s.locale.internationalization.timezone,
+ s.locale.internationalization.localeLanguage,
+ Array.isArray(s.locale.languages.languages) ? s.locale.languages.languages.join(',') : s.locale.languages.languages,
+ s.locale.languages.language,
+ ].map(v => String(v)).join('|');
+ const locHash = hashCode(locStr).slice(0, 4);
+ const locSection = `${primaryLang}${langCount}t${sanitizedTimezone}_h${locHash}`;
+
+ // Section 9: Contexts - mismatch bitmask + hash of all context signals
+ const ctxBitmask = [
+ hasContextMismatch(this.fingerprint, 'iframe'),
+ hasContextMismatch(this.fingerprint, 'worker'),
+ s.contexts.iframe.webdriver === true,
+ s.contexts.webWorker.webdriver === true,
+ ].map(b => b ? '1' : '0').join('');
+ const ctxStr = [
+ s.contexts.iframe.userAgent,
+ s.contexts.iframe.platform,
+ s.contexts.iframe.memory,
+ s.contexts.iframe.cpuCount,
+ s.contexts.iframe.language,
+ s.contexts.webWorker.userAgent,
+ s.contexts.webWorker.platform,
+ s.contexts.webWorker.memory,
+ s.contexts.webWorker.cpuCount,
+ s.contexts.webWorker.language,
+ s.contexts.webWorker.vendor,
+ s.contexts.webWorker.renderer,
+ ].map(v => String(v)).join('|');
+ const ctxHash = hashCode(ctxStr).slice(0, 6);
+ const ctxSection = `${ctxBitmask}h${ctxHash}`;
+
+ return [
+ version,
+ detSection,
+ autoSection,
+ devSection,
+ brwSection,
+ gfxSection,
+ codSection,
+ locSection,
+ ctxSection,
+ ].join('_');
+ } catch (e) {
+ console.error('Error generating fingerprint scanner id', e);
+ return ERROR;
+ }
+ }
+
+ private async encryptFingerprint(fingerprint: string) {
+ // Key is injected at build time via Vite's define option
+ // Customers run: npx fpscanner build --key=their-key
+ const key = __FP_ENCRYPTION_KEY__;
+
+ // Runtime safety check: warn if using the default sentinel key
+ // Use a dynamic check that prevents build-time optimization
+ if (key.length > 20 && key.indexOf('DEFAULT') > 0 && key.indexOf('FPSCANNER') > 0) {
+ console.warn(
+ '[fpscanner] WARNING: Using default encryption key! ' +
+ 'Run "npx fpscanner build --key=your-secret-key" to inject your own key. ' +
+ 'See: https://github.com/antoinevastel/fpscanner#advanced-custom-builds'
+ );
+ }
+
+ const enc = await encryptString(JSON.stringify(fingerprint), key);
+
+ return enc;
+ }
+
+ /**
+ * Detection rules with name and severity.
+ */
+ private getDetectionRules(): DetectionRule[] {
+ return [
+ { name: 'headlessChromeScreenResolution', severity: HIGH, test: hasHeadlessChromeScreenResolution },
+ { name: 'hasWebdriver', severity: HIGH, test: hasWebdriver },
+ { name: 'hasWebdriverWritable', severity: HIGH, test: hasWebdriverWritable },
+ { name: 'hasSeleniumProperty', severity: HIGH, test: hasSeleniumProperty },
+ { name: 'hasCDP', severity: HIGH, test: hasCDP },
+ { name: 'hasPlaywright', severity: HIGH, test: hasPlaywright },
+ { name: 'hasImpossibleDeviceMemory', severity: HIGH, test: hasImpossibleDeviceMemory },
+ { name: 'hasHighCPUCount', severity: HIGH, test: hasHighCPUCount },
+ { name: 'hasMissingChromeObject', severity: HIGH, test: hasMissingChromeObject },
+ { name: 'hasWebdriverIframe', severity: HIGH, test: hasWebdriverIframe },
+ { name: 'hasWebdriverWorker', severity: HIGH, test: hasWebdriverWorker },
+ { name: 'hasMismatchWebGLInWorker', severity: HIGH, test: hasMismatchWebGLInWorker },
+ { name: 'hasMismatchPlatformIframe', severity: HIGH, test: hasMismatchPlatformIframe },
+ { name: 'hasMismatchPlatformWorker', severity: HIGH, test: hasMismatchPlatformWorker },
+ { name: 'hasSwiftshaderRenderer', severity: LOW, test: hasSwiftshaderRenderer },
+ { name: 'hasUTCTimezone', severity: MEDIUM, test: hasUTCTimezone },
+ { name: 'hasMismatchLanguages', severity: LOW, test: hasMismatchLanguages },
+ { name: 'hasInconsistentEtsl', severity: HIGH, test: hasInconsistentEtsl },
+ { name: 'hasBotUserAgent', severity: HIGH, test: hasBotUserAgent },
+ { name: 'hasGPUMismatch', severity: HIGH, test: hasGPUMismatch },
+ { name: 'hasPlatformMismatch', severity: HIGH, test: hasPlatformMismatch },
+ ];
+ }
+
+ private runDetectionRules(): FastBotDetectionDetails {
+ const rules = this.getDetectionRules();
+ const results: FastBotDetectionDetails = {
+ headlessChromeScreenResolution: { detected: false, severity: 'high' },
+ hasWebdriver: { detected: false, severity: 'high' },
+ hasWebdriverWritable: { detected: false, severity: 'high' },
+ hasSeleniumProperty: { detected: false, severity: 'high' },
+ hasCDP: { detected: false, severity: 'high' },
+ hasPlaywright: { detected: false, severity: 'high' },
+ hasImpossibleDeviceMemory: { detected: false, severity: 'high' },
+ hasHighCPUCount: { detected: false, severity: 'high' },
+ hasMissingChromeObject: { detected: false, severity: 'high' },
+ hasWebdriverIframe: { detected: false, severity: 'high' },
+ hasWebdriverWorker: { detected: false, severity: 'high' },
+ hasMismatchWebGLInWorker: { detected: false, severity: 'high' },
+ hasMismatchPlatformIframe: { detected: false, severity: 'high' },
+ hasMismatchPlatformWorker: { detected: false, severity: 'high' },
+ hasSwiftshaderRenderer: { detected: false, severity: 'low' },
+ hasUTCTimezone: { detected: false, severity: 'medium' },
+ hasMismatchLanguages: { detected: false, severity: 'low' },
+ hasInconsistentEtsl: { detected: false, severity: 'high' },
+ hasBotUserAgent: { detected: false, severity: 'high' },
+ hasGPUMismatch: { detected: false, severity: 'high' },
+ hasPlatformMismatch: { detected: false, severity: 'high' },
+ };
+
+ for (const rule of rules) {
+ try {
+ const detected = rule.test(this.fingerprint);
+ (results as any)[rule.name] = { detected, severity: rule.severity };
+ } catch (e) {
+ (results as any)[rule.name] = { detected: false, severity: rule.severity };
+ }
+ }
+
+ return results;
+ }
+
+ async collectFingerprint(options: CollectFingerprintOptions = { encrypt: true }) {
+ const { encrypt = true, skipWorker = false } = options;
+ const s = this.fingerprint.signals;
+
+ // Define all signal collection tasks to run in parallel
+ const signalTasks = {
+ // Automation signals
+ webdriver: this.collectSignal(webdriver),
+ webdriverWritable: this.collectSignal(webdriverWritable),
+ selenium: this.collectSignal(hasSeleniumProperties),
+ cdp: this.collectSignal(cdp),
+ playwright: this.collectSignal(playwright),
+ navigatorPropertyDescriptors: this.collectSignal(navigatorPropertyDescriptors),
+ // Device signals
+ cpuCount: this.collectSignal(cpuCount),
+ memory: this.collectSignal(memory),
+ platform: this.collectSignal(platform),
+ screenResolution: this.collectSignal(screenResolution),
+ multimediaDevices: this.collectSignal(multimediaDevices),
+ mediaQueries: this.collectSignal(mediaQueries),
+ // Browser signals
+ userAgent: this.collectSignal(userAgent),
+ browserFeatures: this.collectSignal(browserFeatures),
+ plugins: this.collectSignal(plugins),
+ browserExtensions: this.collectSignal(browserExtensions),
+ highEntropyValues: this.collectSignal(highEntropyValues),
+ etsl: this.collectSignal(etsl),
+ maths: this.collectSignal(maths),
+ toSourceError: this.collectSignal(toSourceError),
+ // Graphics signals
+ webGL: this.collectSignal(webGL),
+ webgpu: this.collectSignal(webgpu),
+ canvas: this.collectSignal(canvas),
+ // Codecs
+ mediaCodecs: this.collectSignal(mediaCodecs),
+ // Locale signals
+ internationalization: this.collectSignal(internationalization),
+ languages: this.collectSignal(languages),
+ // Context signals
+ iframe: this.collectSignal(iframe),
+ webWorker: skipWorker
+ ? Promise.resolve({
+ webdriver: SKIPPED,
+ userAgent: SKIPPED,
+ platform: SKIPPED,
+ memory: SKIPPED,
+ cpuCount: SKIPPED,
+ language: SKIPPED,
+ vendor: SKIPPED,
+ renderer: SKIPPED,
+ })
+ : this.collectSignal(worker),
+ // Meta signals
+ nonce: this.collectSignal(nonce),
+ time: this.collectSignal(time),
+ url: this.collectSignal(pageURL),
+ };
+
+ // Run all signal collections in parallel
+ const keys = Object.keys(signalTasks) as (keyof typeof signalTasks)[];
+ const results = await Promise.all(Object.values(signalTasks));
+ const r = Object.fromEntries(keys.map((key, i) => [key, results[i]])) as Record;
+
+ // Assign results to fingerprint structure
+ // Automation
+ s.automation.webdriver = r.webdriver;
+ s.automation.webdriverWritable = r.webdriverWritable;
+ s.automation.selenium = r.selenium;
+ s.automation.cdp = r.cdp;
+ s.automation.playwright = r.playwright;
+ s.automation.navigatorPropertyDescriptors = r.navigatorPropertyDescriptors;
+ // Device
+ s.device.cpuCount = r.cpuCount;
+ s.device.memory = r.memory;
+ s.device.platform = r.platform;
+ s.device.screenResolution = r.screenResolution;
+ s.device.multimediaDevices = r.multimediaDevices;
+ s.device.mediaQueries = r.mediaQueries;
+ // Browser
+ s.browser.userAgent = r.userAgent;
+ s.browser.features = r.browserFeatures;
+ s.browser.plugins = r.plugins;
+ s.browser.extensions = r.browserExtensions;
+ s.browser.highEntropyValues = r.highEntropyValues;
+ s.browser.etsl = r.etsl;
+ s.browser.maths = r.maths;
+ s.browser.toSourceError = r.toSourceError;
+ // Graphics
+ s.graphics.webGL = r.webGL;
+ s.graphics.webgpu = r.webgpu;
+ s.graphics.canvas = r.canvas;
+ // Codecs
+ s.codecs = r.mediaCodecs;
+ // Locale
+ s.locale.internationalization = r.internationalization;
+ s.locale.languages = r.languages;
+ // Contexts
+ s.contexts.iframe = r.iframe;
+ s.contexts.webWorker = r.webWorker;
+ // Meta
+ this.fingerprint.nonce = r.nonce;
+ this.fingerprint.time = r.time;
+ this.fingerprint.url = r.url;
+
+ // Run detection rules (needed for fsid generation)
+ this.fingerprint.fastBotDetectionDetails = this.runDetectionRules();
+
+ // fastBotDetection = true if any detection rule was triggered
+ this.fingerprint.fastBotDetection = Object.values(this.fingerprint.fastBotDetectionDetails)
+ .some(result => result.detected);
+
+ // Generate fsid after all signals and detections are collected
+ this.fingerprint.fsid = this.generateFingerprintScannerId();
+
+ if (encrypt) {
+ const encryptedFingerprint = await this.encryptFingerprint(JSON.stringify(this.fingerprint));
+ return encryptedFingerprint;
+ }
+
+ // Return the raw fingerprint if no encryption is requested
+ return this.fingerprint;
+ }
+}
+
+export default FingerprintScanner;
+export * from './types';
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/browserExtensions.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/browserExtensions.ts
new file mode 100644
index 00000000000..eb7dc665a4c
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/browserExtensions.ts
@@ -0,0 +1,57 @@
+import { INIT } from "./utils";
+
+export function browserExtensions() {
+ const browserExtensionsData = {
+ bitmask: INIT,
+ extensions: [] as string[],
+ };
+
+ const hasGrammarly = document.body.hasAttribute('data-gr-ext-installed');
+ const hasMetamask = typeof (window as any).ethereum !=='undefined';
+ const hasCouponBirds = document.getElementById('coupon-birds-drop-div') !== null;
+ const hasDeepL = document.querySelector('deepl-input-controller') !== null;
+ const hasMonicaAI = document.getElementById('monica-content-root') !== null;
+ const hasSiderAI = document.querySelector('chatgpt-sidebar') !== null;
+ const hasRequestly = typeof (window as any).__REQUESTLY__ !== 'undefined';
+ const hasVeepn = Array.from(document.querySelectorAll('*'))
+ .filter(el => el.tagName.toLowerCase().startsWith('veepn-')).length > 0;
+
+ browserExtensionsData.bitmask = [
+ hasGrammarly ? '1' : '0',
+ hasMetamask ? '1' : '0',
+ hasCouponBirds ? '1' : '0',
+ hasDeepL ? '1' : '0',
+ hasMonicaAI ? '1' : '0',
+ hasSiderAI ? '1' : '0',
+ hasRequestly ? '1' : '0',
+ hasVeepn ? '1' : '0',
+ ].join('');
+
+
+ if (hasGrammarly) {
+ browserExtensionsData.extensions.push('grammarly');
+ }
+ if (hasMetamask) {
+ browserExtensionsData.extensions.push('metamask');
+ }
+ if (hasCouponBirds) {
+ browserExtensionsData.extensions.push('coupon-birds');
+ }
+ if (hasDeepL) {
+ browserExtensionsData.extensions.push('deepl');
+ }
+ if (hasMonicaAI) {
+ browserExtensionsData.extensions.push('monica-ai');
+ }
+ if (hasSiderAI) {
+ browserExtensionsData.extensions.push('sider-ai');
+ }
+ if (hasRequestly) {
+ browserExtensionsData.extensions.push('requestly');
+ }
+ if (hasVeepn) {
+ browserExtensionsData.extensions.push('veepn');
+ }
+
+ return browserExtensionsData;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/browserFeatures.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/browserFeatures.ts
new file mode 100644
index 00000000000..2eaf71415cf
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/browserFeatures.ts
@@ -0,0 +1,50 @@
+import { INIT } from "./utils";
+
+function safeCheck(check: () => boolean): boolean {
+ try {
+ return check();
+ } catch {
+ return false;
+ }
+}
+
+export function browserFeatures() {
+ const browserFeaturesData = {
+ bitmask: INIT,
+ chrome: safeCheck(() => 'chrome' in window),
+ brave: safeCheck(() => 'brave' in navigator),
+ applePaySupport: safeCheck(() => 'ApplePaySetup' in window),
+ opera: safeCheck(() => (typeof (window as any).opr !== "undefined") ||
+ (typeof (window as any).onoperadetachedviewchange === "object")),
+ serial: safeCheck(() => (window.navigator as any).serial !== undefined),
+ attachShadow: safeCheck(() => !!Element.prototype.attachShadow),
+ caches: safeCheck(() => !!window.caches),
+ webAssembly: safeCheck(() => !!window.WebAssembly && !!window.WebAssembly.instantiate),
+ buffer: safeCheck(() => 'Buffer' in window),
+ showModalDialog: safeCheck(() => 'showModalDialog' in window),
+ safari: safeCheck(() => 'safari' in window),
+ webkitPrefixedFunction: safeCheck(() => 'webkitCancelAnimationFrame' in window),
+ mozPrefixedFunction: safeCheck(() => 'mozGetUserMedia' in navigator),
+ usb: safeCheck(() => typeof (window as any).USB === 'function'),
+ browserCapture: safeCheck(() => typeof (window as any).BrowserCaptureMediaStreamTrack === 'function'),
+ paymentRequestUpdateEvent: safeCheck(() => typeof (window as any).PaymentRequestUpdateEvent === 'function'),
+ pressureObserver: safeCheck(() => typeof (window as any).PressureObserver === 'function'),
+ audioSession: safeCheck(() => 'audioSession' in navigator),
+ selectAudioOutput: safeCheck(() => typeof navigator !== 'undefined' && typeof navigator.mediaDevices !== 'undefined' && typeof (navigator.mediaDevices as any).selectAudioOutput === 'function'),
+ barcodeDetector: safeCheck(() => 'BarcodeDetector' in window),
+ battery: safeCheck(() => 'getBattery' in navigator),
+ devicePosture: safeCheck(() => 'DevicePosture' in window),
+ documentPictureInPicture: safeCheck(() => 'documentPictureInPicture' in window),
+ eyeDropper: safeCheck(() => 'EyeDropper' in window),
+ editContext: safeCheck(() => 'EditContext' in window),
+ fencedFrame: safeCheck(() => 'FencedFrameConfig' in window),
+ sanitizer: safeCheck(() => 'Sanitizer' in window),
+ otpCredential: safeCheck(() => 'OTPCredential' in window),
+ };
+
+ // set bitmask to 0/1 string based on browserFeaturesData, exclude bitmask property itself (you need to filter on the key)
+ // use the filter function to exclude the bitmask property itself
+ const bitmask = Object.keys(browserFeaturesData).filter((key) => key !== 'bitmask').map(key => (browserFeaturesData as any)[key] ? '1' : '0').join('');
+ browserFeaturesData.bitmask = bitmask;
+ return browserFeaturesData;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/canvas.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/canvas.ts
new file mode 100644
index 00000000000..d01e2d69b5c
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/canvas.ts
@@ -0,0 +1,84 @@
+import { ERROR, INIT, hashCode } from './utils';
+import { SignalValue } from '../types';
+
+async function hasModifiedCanvas(): Promise> {
+ return new Promise((resolve) => {
+
+ try {
+ const img = new Image();
+ const ctx = document.createElement('canvas').getContext('2d') as CanvasRenderingContext2D;
+ img.onload = () => {
+ ctx.drawImage(img, 0, 0);
+ resolve(ctx.getImageData(0, 0, 1, 1).data.filter(x => x === 0).length != 4);
+ };
+
+ img.onerror = () => {
+ resolve(ERROR);
+ };
+ img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=';
+ } catch (e) {
+ resolve(ERROR);
+ }
+ });
+}
+
+
+function getCanvasFingerprint(): SignalValue {
+ var canvas = document.createElement('canvas');
+ canvas.width = 400;
+ canvas.height = 200;
+ canvas.style.display = "inline";
+ var context = canvas.getContext("2d") as CanvasRenderingContext2D;
+
+ try {
+ context.rect(0, 0, 10, 10);
+ context.rect(2, 2, 6, 6);
+ context.textBaseline = "alphabetic";
+ context.fillStyle = "#f60";
+ context.fillRect(125, 1, 62, 20);
+ context.fillStyle = "#069";
+ context.font = "11pt no-real-font-123";
+ context.fillText("Cwm fjordbank glyphs vext quiz, 😃", 2, 15);
+ context.fillStyle = "rgba(102, 204, 0, 0.2)";
+ context.font = "18pt Arial";
+ context.fillText("Cwm fjordbank glyphs vext quiz, 😃", 4, 45);
+
+ context.globalCompositeOperation = "multiply";
+ context.fillStyle = "rgb(255,0,255)";
+ context.beginPath();
+ context.arc(50, 50, 50, 0, 2 * Math.PI, !0);
+ context.closePath();
+ context.fill();
+ context.fillStyle = "rgb(0,255,255)";
+ context.beginPath();
+ context.arc(100, 50, 50, 0, 2 * Math.PI, !0);
+ context.closePath();
+ context.fill();
+ context.fillStyle = "rgb(255,255,0)";
+ context.beginPath();
+ context.arc(75, 100, 50, 0, 2 * Math.PI, !0);
+ context.closePath();
+ context.fill();
+ context.fillStyle = "rgb(255,0,255)";
+ context.arc(75, 75, 75, 0, 2 * Math.PI, !0);
+ context.arc(75, 75, 25, 0, 2 * Math.PI, !0);
+ context.fill("evenodd");
+ return hashCode(canvas.toDataURL());
+
+ } catch (e) {
+ return ERROR;
+ }
+}
+
+export async function canvas() {
+ const canvasData = {
+ hasModifiedCanvas: INIT as SignalValue,
+ canvasFingerprint: INIT as SignalValue,
+ };
+
+ canvasData.hasModifiedCanvas = await hasModifiedCanvas();
+
+ canvasData.canvasFingerprint = getCanvasFingerprint();
+
+ return canvasData;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/cdp.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/cdp.ts
new file mode 100644
index 00000000000..406117d87fb
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/cdp.ts
@@ -0,0 +1,18 @@
+import { ERROR } from './utils';
+
+export function cdp() {
+ try {
+ let wasAccessed = false;
+ const originalPrepareStackTrace = (Error as any).prepareStackTrace;
+ (Error as any).prepareStackTrace = function () {
+ wasAccessed = true;
+ return originalPrepareStackTrace;
+ };
+ const err = new Error('');
+ console.log(err);
+
+ return wasAccessed;
+ } catch (e) {
+ return ERROR;
+ }
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/cpuCount.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/cpuCount.ts
new file mode 100644
index 00000000000..4522d4fb5ac
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/cpuCount.ts
@@ -0,0 +1,5 @@
+import { NA } from './utils';
+
+export function cpuCount() {
+ return navigator.hardwareConcurrency || NA;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/etsl.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/etsl.ts
new file mode 100644
index 00000000000..ce189b69320
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/etsl.ts
@@ -0,0 +1,3 @@
+export function etsl() {
+ return eval.toString().length;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/highEntropyValues.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/highEntropyValues.ts
new file mode 100644
index 00000000000..5a9eb7f0298
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/highEntropyValues.ts
@@ -0,0 +1,48 @@
+import { ERROR, INIT, NA, setObjectValues } from "./utils";
+
+export async function highEntropyValues() {
+ const navigator = window.navigator as any;
+ const highEntropyValues = {
+ architecture: INIT,
+ bitness: INIT,
+ brands: INIT,
+ mobile: INIT,
+ model: INIT,
+ platform: INIT,
+ platformVersion: INIT,
+ uaFullVersion: INIT,
+ };
+
+ if ('userAgentData' in navigator) {
+ try {
+ const ua = await navigator.userAgentData.getHighEntropyValues([
+ "architecture",
+ "bitness",
+ "brands",
+ "mobile",
+ "model",
+ "platform",
+ "platformVersion",
+ "uaFullVersion"
+ ]);
+
+ highEntropyValues.architecture = ua.architecture;
+ highEntropyValues.bitness = ua.bitness;
+ highEntropyValues.brands = ua.brands;
+ highEntropyValues.mobile = ua.mobile;
+ highEntropyValues.model = ua.model;
+ highEntropyValues.platform = ua.platform;
+ highEntropyValues.platformVersion = ua.platformVersion;
+ highEntropyValues.uaFullVersion = ua.uaFullVersion;
+
+
+ } catch (e) {
+ setObjectValues(highEntropyValues, ERROR);
+ }
+
+ } else {
+ setObjectValues(highEntropyValues, NA);
+ }
+
+ return highEntropyValues;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/iframe.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/iframe.ts
new file mode 100644
index 00000000000..842bcd8dfd3
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/iframe.ts
@@ -0,0 +1,42 @@
+import { ERROR, INIT, NA, setObjectValues } from './utils';
+
+export function iframe() {
+ const iframeData = {
+ webdriver: INIT,
+ userAgent: INIT,
+ platform: INIT,
+ memory: INIT,
+ cpuCount: INIT,
+ language: INIT,
+ };
+ const iframe = document.createElement('iframe');
+ let iframeAdded = false;
+
+ try {
+ iframe.style.display = 'none';
+ iframe.src = 'about:blank';
+ document.body.appendChild(iframe);
+ iframeAdded = true;
+
+ const iframeWindowNavigator = (iframe.contentWindow?.navigator as any);
+
+ iframeData.webdriver = iframeWindowNavigator.webdriver ?? false;
+ iframeData.userAgent = iframeWindowNavigator.userAgent ?? NA;
+ iframeData.platform = iframeWindowNavigator.platform ?? NA;
+ iframeData.memory = iframeWindowNavigator.deviceMemory ?? NA;
+ iframeData.cpuCount = iframeWindowNavigator.hardwareConcurrency ?? NA;
+ iframeData.language = iframeWindowNavigator.language ?? NA;
+ } catch (e) {
+ setObjectValues(iframeData, ERROR);
+ } finally {
+ if (iframeAdded) {
+ try {
+ document.body.removeChild(iframe);
+ } catch (_) {
+ // Ignore removal errors
+ }
+ }
+ }
+
+ return iframeData;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/internationalization.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/internationalization.ts
new file mode 100644
index 00000000000..5e9622c173b
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/internationalization.ts
@@ -0,0 +1,24 @@
+import { INIT, ERROR, NA } from "./utils";
+
+export function internationalization() {
+ const internationalizationData = {
+ timezone: INIT,
+ localeLanguage: INIT,
+ };
+
+ try {
+ if (typeof Intl !== 'undefined' && typeof Intl.DateTimeFormat !== 'undefined') {
+ const dtfOptions = Intl.DateTimeFormat().resolvedOptions();
+ internationalizationData.timezone = dtfOptions.timeZone;
+ internationalizationData.localeLanguage = dtfOptions.locale;
+ } else {
+ internationalizationData.timezone = NA;
+ internationalizationData.localeLanguage = NA;
+ }
+ } catch (e) {
+ internationalizationData.timezone = ERROR;
+ internationalizationData.localeLanguage = ERROR;
+ }
+
+ return internationalizationData;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/languages.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/languages.ts
new file mode 100644
index 00000000000..619c0d14551
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/languages.ts
@@ -0,0 +1,6 @@
+export function languages() {
+ return {
+ languages: navigator.languages,
+ language: navigator.language,
+ }
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/maths.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/maths.ts
new file mode 100644
index 00000000000..ba3e2125bbd
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/maths.ts
@@ -0,0 +1,30 @@
+import { hashCode } from './utils';
+
+export function maths() {
+ const results: number[] = [];
+ const testValue = 0.123456789;
+
+ // Math constants
+ const constants = ["E", "LN10", "LN2", "LOG10E", "LOG2E", "PI", "SQRT1_2", "SQRT2"];
+ constants.forEach(function (name) {
+ try {
+ results.push((Math as any)[name]);
+ } catch (e) {
+ results.push(-1);
+ }
+ });
+
+ // Math functions (can reveal VM/browser differences)
+ const mathFunctions = ["tan", "sin", "exp", "atan", "acosh", "asinh", "atanh", "expm1", "log1p", "sinh"];
+
+
+ mathFunctions.forEach(function (name) {
+ try {
+ results.push((Math as any)[name](testValue));
+ } catch (e) {
+ results.push(-1);
+ }
+ });
+
+ return hashCode(results.map(String).join(","));
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/mediaCodecs.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/mediaCodecs.ts
new file mode 100644
index 00000000000..48a4e2e8b7f
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/mediaCodecs.ts
@@ -0,0 +1,120 @@
+import { ERROR, NA, hashCode, setObjectValues } from './utils';
+
+
+const AUDIO_CODECS = [
+ 'audio/mp4; codecs="mp4a.40.2"',
+ 'audio/mpeg;',
+ 'audio/webm; codecs="vorbis"',
+ 'audio/ogg; codecs="vorbis"',
+ 'audio/wav; codecs="1"',
+ 'audio/ogg; codecs="speex"',
+ 'audio/ogg; codecs="flac"',
+ 'audio/3gpp; codecs="samr"',
+];
+
+const VIDEO_CODECS = [
+ 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',
+ 'video/mp4; codecs="avc1.42E01E"',
+ 'video/mp4; codecs="avc1.58A01E"',
+ 'video/mp4; codecs="avc1.4D401E"',
+ 'video/mp4; codecs="avc1.64001E"',
+ 'video/mp4; codecs="mp4v.20.8"',
+ 'video/mp4; codecs="mp4v.20.240"',
+ 'video/webm; codecs="vp8"',
+ 'video/ogg; codecs="theora"',
+ 'video/ogg; codecs="dirac"',
+ 'video/3gpp; codecs="mp4v.20.8"',
+ 'video/x-matroska; codecs="theora"',
+];
+
+
+function getCanPlayTypeSupport(codecs: string[], mediaType: 'audio' | 'video'): Record {
+ const result: Record = {};
+ try {
+ const element = document.createElement(mediaType);
+ for (const codec of codecs) {
+ try {
+ result[codec] = element.canPlayType(codec) || null;
+ } catch {
+ result[codec] = null;
+ }
+ }
+ } catch {
+ for (const codec of codecs) {
+ result[codec] = null;
+ }
+ }
+ return result;
+}
+
+function getMediaSourceSupport(codecs: string[]): Record {
+ const result: Record = {};
+ const MediaSource = window.MediaSource;
+
+ if (!MediaSource || typeof MediaSource.isTypeSupported !== 'function') {
+ for (const codec of codecs) {
+ result[codec] = null;
+ }
+ return result;
+ }
+
+ for (const codec of codecs) {
+ try {
+ result[codec] = MediaSource.isTypeSupported(codec);
+ } catch {
+ result[codec] = null;
+ }
+ }
+ return result;
+}
+
+function getRtcCapabilities(kind: 'audio' | 'video'): string | typeof NA | typeof ERROR {
+ try {
+ const RTCRtpReceiver = window.RTCRtpReceiver;
+ if (RTCRtpReceiver && typeof RTCRtpReceiver.getCapabilities === 'function') {
+ const capabilities = RTCRtpReceiver.getCapabilities(kind);
+ return hashCode(JSON.stringify(capabilities));
+ }
+ return NA;
+ } catch (e) {
+ return ERROR;
+ }
+}
+
+export function mediaCodecs() {
+ const mediaCodecsData = {
+ audioCanPlayTypeHash: NA as string | typeof NA | typeof ERROR,
+ videoCanPlayTypeHash: NA as string | typeof NA | typeof ERROR,
+ audioMediaSourceHash: NA as string | typeof NA | typeof ERROR,
+ videoMediaSourceHash: NA as string | typeof NA | typeof ERROR,
+ rtcAudioCapabilitiesHash: NA as string | typeof NA | typeof ERROR,
+ rtcVideoCapabilitiesHash: NA as string | typeof NA | typeof ERROR,
+ hasMediaSource: false,
+ };
+
+ try {
+ // Check MediaSource availability
+ mediaCodecsData.hasMediaSource = !!window.MediaSource;
+
+ // canPlayType support - hash the results
+ const audioCanPlayType = getCanPlayTypeSupport(AUDIO_CODECS, 'audio');
+ const videoCanPlayType = getCanPlayTypeSupport(VIDEO_CODECS, 'video');
+ mediaCodecsData.audioCanPlayTypeHash = hashCode(JSON.stringify(audioCanPlayType));
+ mediaCodecsData.videoCanPlayTypeHash = hashCode(JSON.stringify(videoCanPlayType));
+
+ // MediaSource.isTypeSupported - hash the results
+ const audioMediaSource = getMediaSourceSupport(AUDIO_CODECS);
+ const videoMediaSource = getMediaSourceSupport(VIDEO_CODECS);
+ mediaCodecsData.audioMediaSourceHash = hashCode(JSON.stringify(audioMediaSource));
+ mediaCodecsData.videoMediaSourceHash = hashCode(JSON.stringify(videoMediaSource));
+
+ // RTCRtpReceiver.getCapabilities - already returns hash
+ mediaCodecsData.rtcAudioCapabilitiesHash = getRtcCapabilities('audio');
+ mediaCodecsData.rtcVideoCapabilitiesHash = getRtcCapabilities('video');
+
+ } catch (e) {
+ setObjectValues(mediaCodecsData, ERROR);
+ }
+
+ return mediaCodecsData;
+}
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/mediaQueries.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/mediaQueries.ts
new file mode 100644
index 00000000000..f0cc8a5242a
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/mediaQueries.ts
@@ -0,0 +1,85 @@
+import { ERROR, INIT, setObjectValues } from './utils';
+
+export function mediaQueries() {
+ const mediaQueriesData = {
+ prefersColorScheme: INIT as string | null | typeof INIT | typeof ERROR,
+ prefersReducedMotion: INIT as boolean | typeof INIT | typeof ERROR,
+ prefersReducedTransparency: INIT as boolean | typeof INIT | typeof ERROR,
+ colorGamut: INIT as string | null | typeof INIT | typeof ERROR,
+ pointer: INIT as string | null | typeof INIT | typeof ERROR,
+ anyPointer: INIT as string | null | typeof INIT | typeof ERROR,
+ hover: INIT as boolean | typeof INIT | typeof ERROR,
+ anyHover: INIT as boolean | typeof INIT | typeof ERROR,
+ colorDepth: INIT as number | typeof INIT | typeof ERROR,
+ };
+
+ try {
+ // Prefers color scheme
+ if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
+ mediaQueriesData.prefersColorScheme = 'dark';
+ } else if (window.matchMedia('(prefers-color-scheme: light)').matches) {
+ mediaQueriesData.prefersColorScheme = 'light';
+ } else {
+ mediaQueriesData.prefersColorScheme = null;
+ }
+
+ // Prefers reduced motion
+ mediaQueriesData.prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
+
+ // Prefers reduced transparency
+ mediaQueriesData.prefersReducedTransparency = window.matchMedia('(prefers-reduced-transparency: reduce)').matches;
+
+ // Color gamut
+ if (window.matchMedia('(color-gamut: rec2020)').matches) {
+ mediaQueriesData.colorGamut = 'rec2020';
+ } else if (window.matchMedia('(color-gamut: p3)').matches) {
+ mediaQueriesData.colorGamut = 'p3';
+ } else if (window.matchMedia('(color-gamut: srgb)').matches) {
+ mediaQueriesData.colorGamut = 'srgb';
+ } else {
+ mediaQueriesData.colorGamut = null;
+ }
+
+ // Pointer
+ if (window.matchMedia('(pointer: fine)').matches) {
+ mediaQueriesData.pointer = 'fine';
+ } else if (window.matchMedia('(pointer: coarse)').matches) {
+ mediaQueriesData.pointer = 'coarse';
+ } else if (window.matchMedia('(pointer: none)').matches) {
+ mediaQueriesData.pointer = 'none';
+ } else {
+ mediaQueriesData.pointer = null;
+ }
+
+ // Any pointer
+ if (window.matchMedia('(any-pointer: fine)').matches) {
+ mediaQueriesData.anyPointer = 'fine';
+ } else if (window.matchMedia('(any-pointer: coarse)').matches) {
+ mediaQueriesData.anyPointer = 'coarse';
+ } else if (window.matchMedia('(any-pointer: none)').matches) {
+ mediaQueriesData.anyPointer = 'none';
+ } else {
+ mediaQueriesData.anyPointer = null;
+ }
+
+ // Hover
+ mediaQueriesData.hover = window.matchMedia('(hover: hover)').matches;
+
+ // Any hover
+ mediaQueriesData.anyHover = window.matchMedia('(any-hover: hover)').matches;
+
+ // Color depth - find the maximum supported color depth
+ let maxColorDepth = 0;
+ for (let c = 0; c <= 16; c++) {
+ if (window.matchMedia(`(color: ${c})`).matches) {
+ maxColorDepth = c;
+ }
+ }
+ mediaQueriesData.colorDepth = maxColorDepth;
+
+ } catch (e) {
+ setObjectValues(mediaQueriesData, ERROR);
+ }
+
+ return mediaQueriesData;
+}
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/memory.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/memory.ts
new file mode 100644
index 00000000000..06023c22e2e
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/memory.ts
@@ -0,0 +1,5 @@
+import { NA } from "./utils";
+
+export function memory() {
+ return (navigator as any).deviceMemory || NA;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/multimediaDevices.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/multimediaDevices.ts
new file mode 100644
index 00000000000..02793cce0ad
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/multimediaDevices.ts
@@ -0,0 +1,34 @@
+import { NA, setObjectValues } from "./utils";
+
+export async function multimediaDevices() {
+ return new Promise(async function (resolve) {
+ var deviceToCount = {
+ "audiooutput": 0,
+ "audioinput": 0,
+ "videoinput": 0
+ };
+
+ if (navigator.mediaDevices && navigator.mediaDevices.enumerateDevices) {
+ const devices = await navigator.mediaDevices.enumerateDevices();
+ if (typeof devices !== "undefined") {
+ for (var i = 0; i < devices.length; i++) {
+ var name = devices[i].kind as keyof typeof deviceToCount;
+ deviceToCount[name] = deviceToCount[name] + 1;
+ }
+
+ return resolve({
+ speakers: deviceToCount.audiooutput,
+ microphones: deviceToCount.audioinput,
+ webcams: deviceToCount.videoinput
+ });
+ } else {
+ setObjectValues(deviceToCount, NA);
+ return resolve(deviceToCount);
+ }
+
+ } else {
+ setObjectValues(deviceToCount, NA);
+ return resolve(deviceToCount);
+ }
+ });
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/navigatorPropertyDescriptors.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/navigatorPropertyDescriptors.ts
new file mode 100644
index 00000000000..13fe0e3e381
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/navigatorPropertyDescriptors.ts
@@ -0,0 +1,17 @@
+export function navigatorPropertyDescriptors() {
+ const properties = ['deviceMemory', 'hardwareConcurrency', 'language', 'languages', 'platform'];
+
+ const results = [];
+
+ for (const property of properties) {
+ const res = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(navigator), property);
+
+ if (res && res.value) {
+ results.push('1');
+ } else {
+ results.push('0');
+ }
+ }
+
+ return results.join('');
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/nonce.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/nonce.ts
new file mode 100644
index 00000000000..a0dd3a964f5
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/nonce.ts
@@ -0,0 +1,3 @@
+export function nonce() {
+ return Math.random().toString(36).substring(2, 15);
+}
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/platform.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/platform.ts
new file mode 100644
index 00000000000..3cb45b539cf
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/platform.ts
@@ -0,0 +1,3 @@
+export function platform() {
+ return navigator.platform;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/playwright.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/playwright.ts
new file mode 100644
index 00000000000..f25bc74c20f
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/playwright.ts
@@ -0,0 +1,3 @@
+export function playwright() {
+ return '__pwInitScripts' in window || '__playwright__binding__' in window;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/plugins.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/plugins.ts
new file mode 100644
index 00000000000..657114bba50
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/plugins.ts
@@ -0,0 +1,70 @@
+import { SignalValue } from "../types";
+import { INIT, NA, hashCode, ERROR, setObjectValues} from "./utils";
+
+function isValidPluginArray() {
+ if (!navigator.plugins) return false;
+ const str = typeof navigator.plugins.toString === "function"
+ ? navigator.plugins.toString()
+ : navigator.plugins.constructor && typeof navigator.plugins.constructor.toString === "function"
+ ? navigator.plugins.constructor.toString()
+ : typeof navigator.plugins;
+ return str === "[object PluginArray]" ||
+ str === "[object MSPluginsCollection]" ||
+ str === "[object HTMLPluginsCollection]";
+ }
+
+ function getPluginNamesHash() {
+ if (!navigator.plugins) return NA;
+
+ const pluginNames = [];
+ for (let i = 0; i < navigator.plugins.length; i++) {
+ pluginNames.push(navigator.plugins[i].name);
+ }
+ return hashCode(pluginNames.join(","));
+ }
+
+
+ function getPluginCount() {
+ if (!navigator.plugins) return NA;
+ return navigator.plugins.length;
+ }
+
+ function getPluginConsistency1() {
+ if (!navigator.plugins) return NA;
+ try {
+ return navigator.plugins[0] === navigator.plugins[0][0].enabledPlugin;
+ } catch (e) {
+ return ERROR;
+ }
+ }
+
+ function getPluginOverflow() {
+ if (!navigator.plugins) return NA;
+
+ try {
+ return navigator.plugins.item(4294967296) !== navigator.plugins[0];
+ } catch (e) {
+ return ERROR;
+ }
+ }
+
+export function plugins() {
+ const pluginsData = {
+ isValidPluginArray: INIT as SignalValue,
+ pluginCount: INIT as SignalValue,
+ pluginNamesHash: INIT as SignalValue,
+ pluginConsistency1: INIT as SignalValue,
+ pluginOverflow: INIT as SignalValue,
+ }
+
+ try {
+ pluginsData.isValidPluginArray = isValidPluginArray();
+ pluginsData.pluginCount = getPluginCount();
+ pluginsData.pluginNamesHash = getPluginNamesHash();
+ pluginsData.pluginConsistency1 = getPluginConsistency1();
+ pluginsData.pluginOverflow = getPluginOverflow();
+ } catch (e) {
+ setObjectValues(pluginsData, ERROR);
+ }
+ return pluginsData;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/screenResolution.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/screenResolution.ts
new file mode 100644
index 00000000000..f37426b6a4b
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/screenResolution.ts
@@ -0,0 +1,15 @@
+import { NA } from './utils';
+
+export function screenResolution() {
+ return {
+ width: window.screen.width,
+ height: window.screen.height,
+ pixelDepth: window.screen.pixelDepth,
+ colorDepth: window.screen.colorDepth,
+ availableWidth: window.screen.availWidth,
+ availableHeight: window.screen.availHeight,
+ innerWidth: window.innerWidth,
+ innerHeight: window.innerHeight,
+ hasMultipleDisplays: typeof (screen as any).isExtended !== 'undefined' ? (screen as any).isExtended : NA,
+ };
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/seleniumProperties.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/seleniumProperties.ts
new file mode 100644
index 00000000000..583568c1a28
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/seleniumProperties.ts
@@ -0,0 +1,40 @@
+export function hasSeleniumProperties() {
+ const seleniumProps = [
+ "__driver_evaluate",
+ "__webdriver_evaluate",
+ "__selenium_evaluate",
+ "__fxdriver_evaluate",
+ "__driver_unwrapped",
+ "__webdriver_unwrapped",
+ "__selenium_unwrapped",
+ "__fxdriver_unwrapped",
+ "_Selenium_IDE_Recorder",
+ "_selenium",
+ "calledSelenium",
+ "$cdc_asdjflasutopfhvcZLmcfl_",
+ "$chrome_asyncScriptInfo",
+ "__$webdriverAsyncExecutor",
+ "webdriver",
+ "__webdriverFunc",
+ "domAutomation",
+ "domAutomationController",
+ "__lastWatirAlert",
+ "__lastWatirConfirm",
+ "__lastWatirPrompt",
+ "__webdriver_script_fn",
+ "_WEBDRIVER_ELEM_CACHE"
+ ];
+
+ let hasSeleniumProperty = false;
+
+ for (let i = 0; i < seleniumProps.length; i++) {
+ if (seleniumProps[i] in window) {
+ hasSeleniumProperty = true;
+ break;
+ }
+ }
+
+ hasSeleniumProperty = hasSeleniumProperty || !!(document as any).__webdriver_script_fn || !!(window as any).domAutomation || !!(window as any).domAutomationController
+
+ return hasSeleniumProperty;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/time.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/time.ts
new file mode 100644
index 00000000000..81ca22b39bc
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/time.ts
@@ -0,0 +1,3 @@
+export function time() {
+ return new Date().getTime();
+}
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/toSourceError.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/toSourceError.ts
new file mode 100644
index 00000000000..b5820e411a1
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/toSourceError.ts
@@ -0,0 +1,27 @@
+import { INIT } from './utils';
+
+export function toSourceError() {
+ const toSourceErrorData = {
+ toSourceError: INIT,
+ hasToSource: false,
+ };
+
+ try {
+ (null as any).usdfsh;
+ } catch (e) {
+ toSourceErrorData.toSourceError = (e as Error).toString();
+ }
+
+ try {
+ throw "xyz";
+ } catch (e: any) {
+ try {
+ e.toSource();
+ toSourceErrorData.hasToSource = true;
+ } catch (e2) {
+ toSourceErrorData.hasToSource = false;
+ }
+ }
+
+ return toSourceErrorData;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/url.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/url.ts
new file mode 100644
index 00000000000..bfb122214cc
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/url.ts
@@ -0,0 +1,3 @@
+export function pageURL() {
+ return window.location.href;
+}
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/userAgent.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/userAgent.ts
new file mode 100644
index 00000000000..382582bdb01
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/userAgent.ts
@@ -0,0 +1,3 @@
+export function userAgent() {
+ return navigator.userAgent;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/utils.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/utils.ts
new file mode 100644
index 00000000000..3ddbf723399
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/utils.ts
@@ -0,0 +1,29 @@
+export const ERROR = 'ERROR';
+export const INIT = 'INIT';
+export const NA = 'NA';
+export const SKIPPED = 'SKIPPED';
+export const HIGH = 'high'
+export const LOW = 'low'
+export const MEDIUM = 'medium'
+
+
+export function hashCode(str: string) {
+ let hash = 0;
+ for (let i = 0, len = str.length; i < len; i++) {
+ let chr = str.charCodeAt(i);
+ hash = (hash << 5) - hash + chr;
+ hash |= 0;
+ }
+ return hash.toString(16).padStart(8, "0");
+}
+
+export function setObjectValues(object: any, value: any) {
+ for (const key in object) {
+ object[key] = value;
+ }
+}
+
+
+export function isFirefox() {
+ return (navigator as any).buildID === "20181001000000";
+}
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/webGL.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/webGL.ts
new file mode 100644
index 00000000000..1f5e08813ea
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/webGL.ts
@@ -0,0 +1,28 @@
+import { ERROR, INIT, NA, isFirefox, setObjectValues } from './utils';
+
+export function webGL() {
+ const webGLData = {
+ vendor: INIT,
+ renderer: INIT,
+ };
+
+ if (isFirefox()) {
+ setObjectValues(webGLData, NA);
+ return webGLData;
+ }
+
+ try {
+ var canvas = document.createElement('canvas');
+ var ctx = (canvas.getContext("webgl") || canvas.getContext("experimental-webgl")) as any;
+ if (ctx.getSupportedExtensions().indexOf("WEBGL_debug_renderer_info") >= 0) {
+ webGLData.vendor = ctx.getParameter(ctx.getExtension('WEBGL_debug_renderer_info').UNMASKED_VENDOR_WEBGL);
+ webGLData.renderer = ctx.getParameter(ctx.getExtension('WEBGL_debug_renderer_info').UNMASKED_RENDERER_WEBGL);
+ } else {
+ setObjectValues(webGLData, NA);
+ }
+ } catch (e) {
+ setObjectValues(webGLData, ERROR);
+ }
+
+ return webGLData;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/webdriver.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/webdriver.ts
new file mode 100644
index 00000000000..a11f60abf13
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/webdriver.ts
@@ -0,0 +1,3 @@
+export function webdriver() {
+ return navigator.webdriver;
+};
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/webdriverWritable.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/webdriverWritable.ts
new file mode 100644
index 00000000000..abdc1671dbf
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/webdriverWritable.ts
@@ -0,0 +1,15 @@
+export function webdriverWritable() {
+ try {
+ const prop = "webdriver";
+ const navigator = window.navigator as any;
+ if (!navigator[prop] && !navigator.hasOwnProperty(prop)) {
+ navigator[prop] = 1;
+ const writable = navigator[prop] === 1;
+ delete navigator[prop];
+ return writable;
+ }
+ return true;
+ } catch (e) {
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/webgpu.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/webgpu.ts
new file mode 100644
index 00000000000..4ac65e70751
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/webgpu.ts
@@ -0,0 +1,28 @@
+import { ERROR, INIT, NA, setObjectValues } from "./utils";
+
+export async function webgpu() {
+ const webGPUData = {
+ vendor: INIT,
+ architecture: INIT,
+ device: INIT,
+ description: INIT,
+ };
+
+ if ('gpu' in navigator) {
+ try {
+ const adapter = await (navigator as any).gpu.requestAdapter();
+ if (adapter) {
+ webGPUData.vendor = adapter.info.vendor;
+ webGPUData.architecture = adapter.info.architecture;
+ webGPUData.device = adapter.info.device;
+ webGPUData.description = adapter.info.description;
+ }
+ } catch (e) {
+ setObjectValues(webGPUData, ERROR);
+ }
+ } else {
+ setObjectValues(webGPUData, NA);
+ }
+
+ return webGPUData;
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/signals/worker.ts b/pkg/appsec/challenge/js/fpscanner/src/signals/worker.ts
new file mode 100644
index 00000000000..01864b91e70
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/signals/worker.ts
@@ -0,0 +1,101 @@
+import { ERROR, INIT, setObjectValues } from './utils';
+
+export async function worker() {
+ return new Promise((resolve) => {
+ const workerData = {
+ vendor: INIT,
+ renderer: INIT,
+ userAgent: INIT,
+ language: INIT,
+ platform: INIT,
+ memory: INIT,
+ cpuCount: INIT,
+ };
+
+ let worker: Worker | null = null;
+ let workerUrl: string | null = null;
+ let timeoutId: number | null = null;
+
+ const cleanup = () => {
+ if (timeoutId) clearTimeout(timeoutId);
+ if (worker) worker.terminate();
+ if (workerUrl) URL.revokeObjectURL(workerUrl);
+ };
+
+ try {
+ const workerCode = `try {
+ var fingerprintWorker = {};
+
+ fingerprintWorker.userAgent = navigator.userAgent;
+ fingerprintWorker.language = navigator.language;
+ fingerprintWorker.cpuCount = navigator.hardwareConcurrency;
+ fingerprintWorker.platform = navigator.platform;
+ fingerprintWorker.memory = navigator.deviceMemory;
+
+
+ var canvas = new OffscreenCanvas(1, 1);
+ fingerprintWorker.vendor = 'INIT';
+ fingerprintWorker.renderer = 'INIT';
+ var gl = canvas.getContext('webgl');
+ const isFirefox = navigator.userAgent.includes('Firefox');
+ try {
+ if (gl && !isFirefox) {
+ var glExt = gl.getExtension('WEBGL_debug_renderer_info');
+ fingerprintWorker.vendor = gl.getParameter(glExt.UNMASKED_VENDOR_WEBGL);
+ fingerprintWorker.renderer = gl.getParameter(glExt.UNMASKED_RENDERER_WEBGL);
+ } else {
+ fingerprintWorker.vendor = 'NA';
+ fingerprintWorker.renderer = 'NA';
+ }
+ } catch (_) {
+ fingerprintWorker.vendor = 'ERROR';
+ fingerprintWorker.renderer = 'ERROR';
+ }
+ self.postMessage(fingerprintWorker);
+ } catch (e) {
+ self.postMessage(fingerprintWorker);
+ }`
+
+
+ const blob = new Blob([workerCode], { type: 'application/javascript' });
+ workerUrl = URL.createObjectURL(blob);
+ worker = new Worker(workerUrl);
+
+ // Set timeout to prevent infinite hang
+ timeoutId = window.setTimeout(() => {
+ cleanup();
+ setObjectValues(workerData, ERROR);
+ resolve(workerData);
+ }, 2000);
+
+ worker.onmessage = function (e) {
+ try {
+ workerData.vendor = e.data.vendor;
+ workerData.renderer = e.data.renderer;
+ workerData.userAgent = e.data.userAgent;
+ workerData.language = e.data.language;
+ workerData.platform = e.data.platform;
+ workerData.memory = e.data.memory;
+ workerData.cpuCount = e.data.cpuCount;
+ } catch (_) {
+ setObjectValues(workerData, ERROR);
+ } finally {
+ cleanup();
+ resolve(workerData);
+ }
+ };
+
+ worker.onerror = function () {
+ cleanup();
+ setObjectValues(workerData, ERROR);
+ resolve(workerData);
+ };
+ } catch (e) {
+ cleanup();
+ setObjectValues(workerData, ERROR);
+ resolve(workerData);
+ }
+
+ });
+
+}
\ No newline at end of file
diff --git a/pkg/appsec/challenge/js/fpscanner/src/types.ts b/pkg/appsec/challenge/js/fpscanner/src/types.ts
new file mode 100644
index 00000000000..a627811e025
--- /dev/null
+++ b/pkg/appsec/challenge/js/fpscanner/src/types.ts
@@ -0,0 +1,260 @@
+import { ERROR, INIT, NA, SKIPPED } from './signals/utils';
+
+export type SignalValue = T | typeof ERROR | typeof INIT | typeof NA | typeof SKIPPED;
+
+export interface WebGLSignal {
+ vendor: SignalValue;
+ renderer: SignalValue;
+}
+
+export interface InternationalizationSignal {
+ timezone: SignalValue;
+ localeLanguage: SignalValue;
+}
+
+export interface ScreenResolutionSignal {
+ width: SignalValue;
+ height: SignalValue;
+ pixelDepth: SignalValue;
+ colorDepth: SignalValue;
+ availableWidth: SignalValue;
+ availableHeight: SignalValue;
+ innerWidth: SignalValue;
+ innerHeight: SignalValue;
+ hasMultipleDisplays: SignalValue;
+}
+
+export interface LanguagesSignal {
+ languages: SignalValue;
+ language: SignalValue;
+}
+
+export interface WebGPUSignal {
+ vendor: SignalValue;
+ architecture: SignalValue;
+ device: SignalValue;
+ description: SignalValue;
+}
+
+export interface IframeSignal {
+ webdriver: SignalValue;
+ userAgent: SignalValue;
+ platform: SignalValue;
+ memory: SignalValue;
+ cpuCount: SignalValue;
+ language: SignalValue;
+}
+
+export interface WebWorkerSignal {
+ webdriver: SignalValue;
+ userAgent: SignalValue;
+ platform: SignalValue;
+ memory: SignalValue;
+ cpuCount: SignalValue;
+ language: SignalValue;
+ vendor: SignalValue;
+ renderer: SignalValue;
+}
+
+export interface BrowserExtensionsSignal {
+ bitmask: SignalValue;
+ extensions: SignalValue;
+}
+
+export interface BrowserFeaturesSignal {
+ bitmask: SignalValue;
+ chrome: SignalValue;
+ brave: SignalValue;
+ applePaySupport: SignalValue;
+ opera: SignalValue;
+ serial: SignalValue;
+ attachShadow: SignalValue;
+ caches: SignalValue;
+ webAssembly: SignalValue;
+ buffer: SignalValue;
+ showModalDialog: SignalValue;
+ safari: SignalValue;
+ webkitPrefixedFunction: SignalValue;
+ mozPrefixedFunction: SignalValue;
+ usb: SignalValue;
+ browserCapture: SignalValue;
+ paymentRequestUpdateEvent: SignalValue;
+ pressureObserver: SignalValue;
+ audioSession: SignalValue;
+ selectAudioOutput: SignalValue;
+ barcodeDetector: SignalValue;
+ battery: SignalValue;
+ devicePosture: SignalValue;
+ documentPictureInPicture: SignalValue;
+ eyeDropper: SignalValue;
+ editContext: SignalValue;
+ fencedFrame: SignalValue;
+ sanitizer: SignalValue;
+ otpCredential: SignalValue;
+}
+
+export interface MediaQueriesSignal {
+ prefersColorScheme: SignalValue;
+ prefersReducedMotion: SignalValue;
+ prefersReducedTransparency: SignalValue;
+ colorGamut: SignalValue;
+ pointer: SignalValue;
+ anyPointer: SignalValue;
+ hover: SignalValue;
+ anyHover: SignalValue;
+ colorDepth: SignalValue;
+}
+
+export interface ToSourceErrorSignal {
+ toSourceError: SignalValue;
+ hasToSource: SignalValue;
+}
+
+export interface CanvasSignal {
+ hasModifiedCanvas: SignalValue;
+ canvasFingerprint: SignalValue;
+}
+
+export interface HighEntropyValuesSignal {
+ architecture: SignalValue;
+ bitness: SignalValue;
+ brands: SignalValue;
+ mobile: SignalValue;
+ model: SignalValue;
+ platform: SignalValue;
+ platformVersion: SignalValue;
+ uaFullVersion: SignalValue;
+}
+
+export interface PluginsSignal {
+ isValidPluginArray: SignalValue;
+ pluginCount: SignalValue;
+ pluginNamesHash: SignalValue;
+ pluginConsistency1: SignalValue;
+ pluginOverflow: SignalValue;
+}
+
+export interface MultimediaDevicesSignal {
+ speakers: SignalValue;
+ microphones: SignalValue;
+ webcams: SignalValue;
+}
+
+export interface MediaCodecsSignal {
+ audioCanPlayTypeHash: SignalValue;
+ videoCanPlayTypeHash: SignalValue;
+ audioMediaSourceHash: SignalValue;
+ videoMediaSourceHash: SignalValue;
+ rtcAudioCapabilitiesHash: SignalValue;
+ rtcVideoCapabilitiesHash: SignalValue;
+ hasMediaSource: SignalValue;
+}
+
+// Grouped signal interfaces
+export interface AutomationSignals {
+ webdriver: SignalValue;
+ webdriverWritable: SignalValue;
+ selenium: SignalValue;
+ cdp: SignalValue;
+ playwright: SignalValue;
+ navigatorPropertyDescriptors: SignalValue;
+}
+
+export interface DeviceSignals {
+ cpuCount: SignalValue;
+ memory: SignalValue;
+ platform: SignalValue;
+ screenResolution: ScreenResolutionSignal;
+ multimediaDevices: MultimediaDevicesSignal;
+ mediaQueries: MediaQueriesSignal;
+}
+
+export interface BrowserSignals {
+ userAgent: SignalValue;
+ features: BrowserFeaturesSignal;
+ plugins: PluginsSignal;
+ extensions: BrowserExtensionsSignal;
+ highEntropyValues: HighEntropyValuesSignal;
+ etsl: SignalValue;
+ maths: SignalValue;
+ toSourceError: ToSourceErrorSignal;
+}
+
+export interface GraphicsSignals {
+ webGL: WebGLSignal;
+ webgpu: WebGPUSignal;
+ canvas: CanvasSignal;
+}
+
+export interface LocaleSignals {
+ internationalization: InternationalizationSignal;
+ languages: LanguagesSignal;
+}
+
+export interface ContextsSignals {
+ iframe: IframeSignal;
+ webWorker: WebWorkerSignal;
+}
+
+export interface FingerprintSignals {
+ automation: AutomationSignals;
+ device: DeviceSignals;
+ browser: BrowserSignals;
+ graphics: GraphicsSignals;
+ codecs: MediaCodecsSignal;
+ locale: LocaleSignals;
+ contexts: ContextsSignals;
+}
+
+export interface FastBotDetectionDetails {
+ headlessChromeScreenResolution: DetectionRuleResult;
+ hasWebdriver: DetectionRuleResult;
+ hasWebdriverWritable: DetectionRuleResult;
+ hasSeleniumProperty: DetectionRuleResult;
+ hasCDP: DetectionRuleResult;
+ hasPlaywright: DetectionRuleResult;
+ hasImpossibleDeviceMemory: DetectionRuleResult;
+ hasHighCPUCount: DetectionRuleResult;
+ hasMissingChromeObject: DetectionRuleResult;
+ hasWebdriverIframe: DetectionRuleResult;
+ hasWebdriverWorker: DetectionRuleResult;
+ hasMismatchWebGLInWorker: DetectionRuleResult;
+ hasMismatchPlatformIframe: DetectionRuleResult;
+ hasMismatchPlatformWorker: DetectionRuleResult;
+ hasSwiftshaderRenderer: DetectionRuleResult;
+ hasUTCTimezone: DetectionRuleResult;
+ hasMismatchLanguages: DetectionRuleResult;
+ hasInconsistentEtsl: DetectionRuleResult;
+ hasBotUserAgent: DetectionRuleResult;
+ hasGPUMismatch: DetectionRuleResult;
+ hasPlatformMismatch: DetectionRuleResult;
+}
+export interface Fingerprint {
+ signals: FingerprintSignals;
+ fsid: string;
+ nonce: string;
+ time: SignalValue;
+ url: string;
+ fastBotDetection: boolean;
+ fastBotDetectionDetails: FastBotDetectionDetails;
+}
+
+export type DetectionSeverity = 'low' | 'medium' | 'high';
+
+export interface DetectionRuleResult {
+ detected: boolean;
+ severity: DetectionSeverity;
+}
+
+export interface DetectionRule {
+ name: string;
+ severity: DetectionSeverity;
+ test: (fingerprint: Fingerprint) => boolean;
+}
+
+export interface CollectFingerprintOptions {
+ encrypt?: boolean;
+ timeout?: number;
+ skipWorker?: boolean;
+}
+
diff --git a/pkg/appsec/challenge/js/generate.go b/pkg/appsec/challenge/js/generate.go
new file mode 100644
index 00000000000..ca068f252bf
--- /dev/null
+++ b/pkg/appsec/challenge/js/generate.go
@@ -0,0 +1,4 @@
+package js
+
+//go:generate go run ./cmd/bundle
+//go:generate go run ./cmd/obfuscate
diff --git a/pkg/appsec/challenge/js/js.go b/pkg/appsec/challenge/js/js.go
new file mode 100644
index 00000000000..4431d38b5dd
--- /dev/null
+++ b/pkg/appsec/challenge/js/js.go
@@ -0,0 +1,13 @@
+// This package contain all Javascript related code for challenge/fingerprinting by the WAF.
+// fpscanner is https://github.com/antoinevastel/fpscanner/
+// obfuscate is a custom wrapper around javascript obfuscator.
+// It uses a vendored bundle of javascript-obfuscator to avoir any dependancy on npm at build time.
+// The goal is to build a WASM module that can be used to dynamically obfuscate the challenge code at runtime.
+// We bundle both fpscanner and our custom fingerprinting code together, and this bundle is what is ob
+
+package js
+
+import _ "embed"
+
+//go:embed fpscanner/bundle.js
+var FPScannerBundle string
diff --git a/pkg/appsec/challenge/js/obfuscate/index.wasm.gz b/pkg/appsec/challenge/js/obfuscate/index.wasm.gz
new file mode 100644
index 00000000000..04bdf12130b
Binary files /dev/null and b/pkg/appsec/challenge/js/obfuscate/index.wasm.gz differ
diff --git a/pkg/appsec/challenge/js/obfuscate/javascript-obfuscator.js b/pkg/appsec/challenge/js/obfuscate/javascript-obfuscator.js
new file mode 100644
index 00000000000..eee36e008ca
--- /dev/null
+++ b/pkg/appsec/challenge/js/obfuscate/javascript-obfuscator.js
@@ -0,0 +1,54 @@
+/*!
+Copyright (C) 2016-2026 Timofei Kachalov
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.JavaScriptObfuscator=t():e.JavaScriptObfuscator=t()}(self,()=>(()=>{var __webpack_modules__={218:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.alphabetString=void 0,t.alphabetString="abcdefghijklmnopqrstuvwxyz"},410:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return(0,i.default)(e),e.replace(new RegExp("[".concat(t,"]+"),"g"),"")};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};e.exports=t.default,e.exports.default=t.default},561:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){(0,n.default)(e);var r=t?"\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F":"\\x00-\\x1F\\x7F";return(0,i.default)(e,r)};var n=a(r(83399)),i=a(r(410));function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default,e.exports.default=t.default},1391:function(e,t,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},s=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),o=0;o{if(t&&m.NodeGuards.isVariableDeclarationNode(e))return this.transformNode(e,t)}}:null}transformNode(e,t){if(!m.NodeGuards.isNodeWithStatements(t))return e;const r=g.NodeStatementUtils.getPreviousSiblingStatement(e);return r&&m.NodeGuards.isVariableDeclarationNode(r)?e.kind!==r.kind?e:(r.declarations.push(...e.declarations),f.VisitorOption.Remove):e}};t.VariableDeclarationsMergeTransformer=b,t.VariableDeclarationsMergeTransformer=b=o([(0,l.injectable)(),u(0,(0,l.inject)(d.ServiceIdentifiers.IRandomGenerator)),u(1,(0,l.inject)(d.ServiceIdentifiers.IOptions)),c("design:paramtypes",[Object,Object])],b)},1555:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.named=function(e){return(0,c.createTaggedDecorator)(new s.Metadata(o.NAMED_TAG,e))};var o=a(r(2006)),s=r(14425),c=r(24157)},1683:(e,t,r)=>{var n=r(54041).x,i=r(90251),a=/(\r?\n)/,o="$$$isSourceNode$$$";function s(e,t,r,n,i){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==i?null:i,this[o]=!0,null!=n&&this.add(n)}s.fromStringWithSourceMap=function(e,t,r){var n=new s,o=e.split(a),c=0,u=function(){return e()+(e()||"");function e(){return c=0;t--)this.prepend(e[t]);else{if(!e[o]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},s.prototype.walk=function(e){for(var t,r=0,n=this.children.length;r0){for(t=[],r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;if((0,n.default)(e),t.loose)return(0,i.default)(c,e.toLowerCase());return(0,i.default)(s,e)};var n=a(r(83399)),i=a(r(78644));function a(e){return e&&e.__esModule?e:{default:e}}var o={loose:!1},s=["true","false","1","0"],c=[].concat(s,["yes","no"]);e.exports=t.default,e.exports.default=t.default},2006:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NON_CUSTOM_TAG_KEYS=t.PRE_DESTROY=t.POST_CONSTRUCT=t.DESIGN_PARAM_TYPES=t.PARAM_TYPES=t.TAGGED_PROP=t.TAGGED=t.MULTI_INJECT_TAG=t.INJECT_TAG=t.OPTIONAL_TAG=t.UNMANAGED_TAG=t.NAME_TAG=t.NAMED_TAG=void 0,t.NAMED_TAG="named",t.NAME_TAG="name",t.UNMANAGED_TAG="unmanaged",t.OPTIONAL_TAG="optional",t.INJECT_TAG="inject",t.MULTI_INJECT_TAG="multi_inject",t.TAGGED="inversify:tagged",t.TAGGED_PROP="inversify:tagged_props",t.PARAM_TYPES="inversify:paramtypes",t.DESIGN_PARAM_TYPES="design:paramtypes",t.POST_CONSTRUCT="post_construct",t.PRE_DESTROY="pre_destroy",t.NON_CUSTOM_TAG_KEYS=[t.INJECT_TAG,t.MULTI_INJECT_TAG,t.NAME_TAG,t.UNMANAGED_TAG,t.NAMED_TAG,t.OPTIONAL_TAG]},2056:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return(0,n.default)(e),0===((t=(0,i.default)(t,o)).ignore_whitespace?e.trim().length:e.length)};var n=a(r(83399)),i=a(r(93610));function a(e){return e&&e.__esModule?e:{default:e}}var o={ignore_whitespace:!1};e.exports=t.default,e.exports.default=t.default},2070:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayScopeCallsWrapperTransformer=void 0;const o=r(71519),s=r(32287),c=r(96390),u=r(18436),l=r(68736),d=r(60056),f=r(76893),p=r(30386),h=r(23615);let m=class extends f.AbstractNodeTransformer{constructor(e,t,r,n,i,a){super(e,t),this.runAfter=[c.NodeTransformer.StringArrayRotateFunctionTransformer],this.visitedLexicalScopeNodesStackStorage=r,this.stringArrayStorage=n,this.stringArrayScopeCallsWrappersDataStorage=i,this.stringArrayTransformerCustomNodeFactory=a}getVisitor(e){return this.options.stringArrayWrappersCount&&e===u.NodeTransformationStage.StringArray?{enter:(e,t)=>{t&&h.NodeGuards.isNodeWithLexicalScopeStatements(e,t)&&this.onLexicalScopeNodeEnter(e)},leave:(e,t)=>{if(t&&h.NodeGuards.isNodeWithLexicalScopeStatements(e,t))return this.onLexicalScopeNodeLeave(),this.transformNode(e)}}:null}transformNode(e){var t;const r=null!==(t=this.stringArrayScopeCallsWrappersDataStorage.get(e))&&void 0!==t?t:null;if(!r)return e;const n=Object.values(r);for(const t of n){if(!t)continue;const{scopeCallsWrappersData:r}=t,n=r.length,i=this.getUpperStringArrayCallsWrapperData(t);for(let t=n-1;t>=0;t--){const n=r[t];this.getAndAppendStringArrayScopeCallsWrapperNode(e,n,i)}}return e}getRootStringArrayCallsWrapperData(e){const{encoding:t}=e;return{name:this.stringArrayStorage.getStorageCallsWrapperName(t),index:0,parameterIndexesData:null}}getUpperStringArrayCallsWrapperData(e){var t,r,n,i;const{encoding:a}=e,o=this.getRootStringArrayCallsWrapperData(e);if(!this.options.stringArrayWrappersChainedCalls)return o;const s=null!==(t=this.visitedLexicalScopeNodesStackStorage.getLastElement())&&void 0!==t?t:null;if(!s)return o;const c=null!==(r=this.stringArrayScopeCallsWrappersDataStorage.get(s))&&void 0!==r?r:null,u=null!==(i=null===(n=null==c?void 0:c[a])||void 0===n?void 0:n.scopeCallsWrappersData)&&void 0!==i?i:null;return(null==u?void 0:u.length)?this.randomGenerator.getRandomGenerator().pickone(u):o}getAndAppendStringArrayScopeCallsWrapperNode(e,t,r){let n;switch(this.options.stringArrayWrappersType){case d.StringArrayWrappersType.Function:{const i=this.randomGenerator.getRandomInteger(0,e.body.length-1);n=this.getStringArrayScopeCallsWrapperFunctionNode(t,r),p.NodeAppender.insertAtIndex(e,n,i);break}case d.StringArrayWrappersType.Variable:default:n=this.getStringArrayScopeCallsWrapperVariableNode(t,r),p.NodeAppender.prepend(e,n)}}getStringArrayScopeCallsWrapperVariableNode(e,t){const r=this.stringArrayTransformerCustomNodeFactory(l.StringArrayCustomNode.StringArrayScopeCallsWrapperVariableNode);return r.initialize(e,t),r.getNode()}getStringArrayScopeCallsWrapperFunctionNode(e,t){const r=this.stringArrayTransformerCustomNodeFactory(l.StringArrayCustomNode.StringArrayScopeCallsWrapperFunctionNode);return r.initialize(e,t),r.getNode()}onLexicalScopeNodeEnter(e){this.visitedLexicalScopeNodesStackStorage.push(e)}onLexicalScopeNodeLeave(){this.visitedLexicalScopeNodesStackStorage.pop()}};t.StringArrayScopeCallsWrapperTransformer=m,t.StringArrayScopeCallsWrapperTransformer=m=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),a(2,(0,o.inject)(s.ServiceIdentifiers.IVisitedLexicalScopeNodesStackStorage)),a(3,(0,o.inject)(s.ServiceIdentifiers.IStringArrayStorage)),a(4,(0,o.inject)(s.ServiceIdentifiers.IStringArrayScopeCallsWrappersDataStorage)),a(5,(0,o.inject)(s.ServiceIdentifiers.Factory__IStringArrayCustomNode)),i("design:paramtypes",[Object,Object,Object,Object,Object,Function])],m)},2665:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DebugProtectionFunctionTemplate=function(){return"\n function {debugProtectionFunctionName} (ret) {\n function debuggerProtection (counter) {\n {debuggerTemplate}\n \n debuggerProtection(++counter);\n }\n \n try {\n if (ret) {\n return debuggerProtection;\n } else {\n debuggerProtection(0);\n }\n } catch (y) {}\n }\n "}},2731:function(e,t,r){"use strict";var n,i,a=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},c=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),i=0;ir&&(n=Math.round(r+t*i.limitThreshold),n>t&&(n=t)),n}analyze(e){return this.analyzeRecursive(e.body)}analyzeRecursive(e){const t=i.getLimitIndex(e.length),r=[],n=e.length;for(let i=0;it);i++){const t=e[i];p.traverse(t,{enter:n=>{if(m.NodeGuards.isCallExpressionNode(n))return t.parentNode!==g.NodeStatementUtils.getParentNodeWithStatements(n)?p.VisitorOption.Skip:void this.analyzeCallExpressionNode(r,e,n)}})}return r}analyzeCallExpressionNode(e,t,r){i.calleeDataExtractorsList.forEach(n=>{const i=this.calleeDataExtractorFactory(n).extract(t,r.callee);i&&e.push({...i,callsGraph:this.analyzeRecursive(i.callee.body)})})}};t.CallsGraphAnalyzer=b,b.calleeDataExtractorsList=[h.CalleeDataExtractor.FunctionDeclarationCalleeDataExtractor,h.CalleeDataExtractor.FunctionExpressionCalleeDataExtractor,h.CalleeDataExtractor.ObjectExpressionCalleeDataExtractor],b.limitThresholdActivationLength=25,b.limitThreshold=.002,t.CallsGraphAnalyzer=b=i=s([(0,d.injectable)(),l(0,(0,d.inject)(f.ServiceIdentifiers.Factory__ICalleeDataExtractor)),u("design:paramtypes",[Function])],b)},2747:e=>{"use strict";e.exports={stdout:!1,stderr:!1}},2781:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Rc4Template=function(){return"\n const {rc4FunctionName} = function (str, key) {\n let s = [], j = 0, x, output = '';\n \n str = {atobFunctionName}(str);\n \n let i;\n \t \n for (i = 0; i < 256; i++) {\n s[i] = i;\n }\n \n for (i = 0; i < 256; i++) {\n j = (j + s[i] + key.charCodeAt(i % key.length)) % 256;\n x = s[i];\n s[i] = s[j];\n s[j] = x;\n }\n \n i = 0;\n j = 0;\n \n for (let y = 0; y < str.length; y++) {\n i = (i + 1) % 256;\n j = (j + s[i]) % 256;\n x = s[i];\n s[i] = s[j];\n s[j] = x;\n output += String.fromCharCode(str.charCodeAt(y) ^ s[(s[i] + s[j]) % 256]);\n }\n \n return output;\n }\n "}},2953:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DebugProtectionFunctionCallCodeHelper=void 0;const o=r(71519),s=r(32287),c=r(10548),u=r(83404),l=r(88318),d=r(25120);let f=class extends l.AbstractCustomCodeHelper{constructor(e,t,r,n,i){super(e,t,r,n,i)}initialize(e,t){this.debugProtectionFunctionName=e,this.callsControllerFunctionName=t}getNodeStructure(e){return d.NodeUtils.convertCodeToStructure(e)}getCodeHelperTemplate(){return this.customCodeHelperFormatter.formatTemplate((0,u.DebugProtectionFunctionCallTemplate)(),{debugProtectionFunctionName:this.debugProtectionFunctionName,callControllerFunctionName:this.callsControllerFunctionName})}};t.DebugProtectionFunctionCallCodeHelper=f,n([(0,c.initializable)(),i("design:type",String)],f.prototype,"callsControllerFunctionName",void 0),n([(0,c.initializable)(),i("design:type",String)],f.prototype,"debugProtectionFunctionName",void 0),t.DebugProtectionFunctionCallCodeHelper=f=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperFormatter)),a(2,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperObfuscator)),a(3,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(4,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Function,Object,Object,Object,Object])],f)},3158:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)(e),a.has(e)};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};var a=new Set(["004","008","010","012","016","020","024","028","031","032","036","040","044","048","050","051","052","056","060","064","068","070","072","074","076","084","086","090","092","096","100","104","108","112","116","120","124","132","136","140","144","148","152","156","158","162","166","170","174","175","178","180","184","188","191","192","196","203","204","208","212","214","218","222","226","231","232","233","234","238","239","242","246","248","250","254","258","260","262","266","268","270","275","276","288","292","296","300","304","308","312","316","320","324","328","332","334","336","340","344","348","352","356","360","364","368","372","376","380","384","388","392","398","400","404","408","410","414","417","418","422","426","428","430","434","438","440","442","446","450","454","458","462","466","470","474","478","480","484","492","496","498","499","500","504","508","512","516","520","524","528","531","533","534","535","540","548","554","558","562","566","570","574","578","580","581","583","584","585","586","591","598","600","604","608","612","616","620","624","626","630","634","638","642","643","646","652","654","659","660","662","663","666","670","674","678","682","686","688","690","694","702","703","704","705","706","710","716","724","728","729","732","740","744","748","752","756","760","762","764","768","772","776","780","784","788","792","795","796","798","800","804","807","818","826","831","832","833","834","840","850","854","858","860","862","876","882","887","894"]);e.exports=t.default,e.exports.default=t.default},3196:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t,r){(0,i.default)(t),null!=r&&r.eui&&(r.eui=String(r.eui));if(null!=r&&r.no_colons||null!=r&&r.no_separators)return"48"===r.eui?o.test(t):"64"===r.eui?u.test(t):o.test(t)||u.test(t);if("48"===(null==r?void 0:r.eui))return a.test(t)||s.test(t);if("64"===(null==r?void 0:r.eui))return c.test(t)||l.test(t);return e(t,{eui:"48"})||e(t,{eui:"64"})};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};var a=/^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){4}([0-9a-fA-F]{2})$/,o=/^([0-9a-fA-F]){12}$/,s=/^([0-9a-fA-F]{4}\.){2}([0-9a-fA-F]{4})$/,c=/^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){6}([0-9a-fA-F]{2})$/,u=/^([0-9a-fA-F]){16}$/,l=/^([0-9a-fA-F]{4}\.){3}([0-9a-fA-F]{4})$/;e.exports=t.default,e.exports.default=t.default},3654:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getReflectMetadata=function(e,t){return Reflect.getMetadata(t,e)}},3939:e=>{var t,r;t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r={rotl:function(e,t){return e<>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&r.rotl(e,8)|4278255360&r.rotl(e,24);for(var t=0;t0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],r=0,n=0;r>>5]|=e[r]<<24-n%32;return t},wordsToBytes:function(e){for(var t=[],r=0;r<32*e.length;r+=8)t.push(e[r>>>5]>>>24-r%32&255);return t},bytesToHex:function(e){for(var t=[],r=0;r>>4).toString(16)),t.push((15&e[r]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],r=0;r>>6*(3-a)&63)):r.push("=");return r.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var r=[],n=0,i=0;n>>6-2*i);return r}},e.exports=r},4058:e=>{"use strict";e.exports={stringReplaceAll:(e,t,r)=>{let n=e.indexOf(t);if(-1===n)return e;const i=t.length;let a=0,o="";do{o+=e.substr(a,n-a)+t+r,a=n+i,n=e.indexOf(t,a)}while(-1!==n);return o+=e.substr(a),o},stringEncaseCRLFWithFirstIndex:(e,t,r,n)=>{let i=0,a="";do{const o="\r"===e[n-1];a+=e.substr(i,(o?n-1:n)-i)+t+(o?"\r\n":"\n")+r,i=n+1,n=e.indexOf("\n",i)}while(-1!==n);return a+=e.substr(i),a}}},4185:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},o=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DictionaryIdentifierNamesGenerator=void 0;const s=r(71519),c=r(32287),u=r(34003),l=r(32504);let d=n=class extends u.AbstractIdentifierNamesGenerator{constructor(e,t,r){super(e,t),this.arrayUtils=r,this.identifierNamesSet=new Set(this.getInitialIdentifierNames(this.options.identifiersDictionary)),this.identifiersIterator=this.identifierNamesSet.values()}static incrementIdentifierName(e){let t="",r=!1;for(const n of e)r||n!==n.toUpperCase()?r||n!==n.toLowerCase()?t+=n:(t+=n.toUpperCase(),r=!0):t+=n.toLowerCase();return r?t:null}generateNext(){const e=this.generateNewDictionaryName();return this.preserveName(e),e}generateForGlobalScope(){return this.generateForGlobalScopeInternal(e=>this.isValidIdentifierName(e))}generateForGlobalScopeWithAllScopesValidation(){return this.generateForGlobalScopeInternal(e=>this.isValidIdentifierNameInAllScopes(e))}generateForLexicalScope(e){const t=[e,...l.NodeLexicalScopeUtils.getLexicalScopes(e)],r=this.generateNewDictionaryName(e=>this.isValidIdentifierNameInLexicalScopes(e,t));return this.preserveNameForLexicalScope(r,e),r}generateForLabel(e){return this.generateNewDictionaryName()}generateForGlobalScopeInternal(e){const t=this.options.identifiersPrefix?`${this.options.identifiersPrefix}`:"",r=this.generateNewDictionaryName(r=>e(`${t}${r}`)),n=`${t}${r}`;return this.preserveName(n),n}generateNewDictionaryName(e){const t=()=>{var r;if(!this.identifierNamesSet.size)throw new Error("Too many identifiers in the code, add more words to identifiers dictionary");const n=this.identifiersIterator.next();if(!n.done){const i=n.value;return(null!==(r=null==e?void 0:e(i))&&void 0!==r?r:this.isValidIdentifierName(i))?n.value:t()}return this.identifierNamesSet=new Set(this.getIncrementedIdentifierNames([...this.identifierNamesSet])),this.identifiersIterator=this.identifierNamesSet.values(),t()};return t()}getInitialIdentifierNames(e){const t=e.filter(Boolean).map(e=>e.toLowerCase());return this.arrayUtils.shuffle(t)}getIncrementedIdentifierNames(e){const t=[];for(const r of e){const e=n.incrementIdentifierName(r);e&&t.push(e)}return this.arrayUtils.shuffle(t)}};t.DictionaryIdentifierNamesGenerator=d,t.DictionaryIdentifierNamesGenerator=d=n=i([(0,s.injectable)(),o(0,(0,s.inject)(c.ServiceIdentifiers.IRandomGenerator)),o(1,(0,s.inject)(c.ServiceIdentifiers.IOptions)),o(2,(0,s.inject)(c.ServiceIdentifiers.IArrayUtils)),a("design:paramtypes",[Object,Object,Object])],d)},4223:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NO_ADDITIONAL_NODES_PRESET=void 0;const n=r(93844),i=r(72167),a=r(36833),o=r(54042),s=r(48096),c=r(70885),u=r(60056),l=r(66822);t.NO_ADDITIONAL_NODES_PRESET=Object.freeze({compact:!0,controlFlowFlattening:!1,controlFlowFlatteningThreshold:0,deadCodeInjection:!1,deadCodeInjectionThreshold:0,debugProtection:!1,debugProtectionInterval:0,disableConsoleOutput:!1,domainLock:[],domainLockRedirectUrl:"about:blank",exclude:[],forceTransformStrings:[],identifierNamesGenerator:n.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator,identifiersPrefix:"",identifiersDictionary:[],ignoreImports:!1,inputFileName:"",log:!1,numbersToExpressions:!1,renameGlobals:!1,renameProperties:!1,renamePropertiesMode:a.RenamePropertiesMode.Safe,reservedNames:[],reservedStrings:[],stringArrayRotate:!1,seed:0,selfDefending:!1,stringArrayShuffle:!1,simplify:!1,sourceMap:!1,sourceMapBaseUrl:"",sourceMapFileName:"",sourceMapMode:o.SourceMapMode.Separate,sourceMapSourcesMode:s.SourceMapSourcesMode.SourcesContent,splitStrings:!1,splitStringsChunkLength:0,stringArray:!1,stringArrayCallsTransform:!1,stringArrayCallsTransformThreshold:0,stringArrayEncoding:[c.StringArrayEncoding.None],stringArrayIndexesType:[l.StringArrayIndexesType.HexadecimalNumber],stringArrayIndexShift:!1,stringArrayWrappersChainedCalls:!1,stringArrayWrappersCount:0,stringArrayWrappersParametersMaxCount:2,stringArrayWrappersType:u.StringArrayWrappersType.Variable,stringArrayThreshold:0,target:i.ObfuscationTarget.Browser,transformObjectKeys:!1,unicodeEscapeSequence:!1})},4533:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BlockStatementSimplifyTransformer=void 0;const o=r(71519),s=r(32287),c=r(96390),u=r(18436),l=r(21818),d=r(23615),f=r(91363),p=r(25120);let h=class extends l.AbstractStatementSimplifyTransformer{constructor(e,t){super(e,t),this.runAfter=[c.NodeTransformer.VariableDeclarationsMergeTransformer]}getVisitor(e){return e===u.NodeTransformationStage.Simplifying?{leave:(e,t)=>{if(t&&d.NodeGuards.isBlockStatementNode(e))return this.transformNode(e,t)}}:null}transformNode(e,t){const r=this.getStatementSimplifyData(e);if(!r)return e;const n=this.getPartialStatement(r),i=d.NodeGuards.isBlockStatementNode(n)?n:f.NodeFactory.blockStatementNode([n]);return p.NodeUtils.parentizeNode(i,t)}};t.BlockStatementSimplifyTransformer=h,t.BlockStatementSimplifyTransformer=h=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object,Object])],h)},5036:function(e,t,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},s=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),o=0;o{const n=this.nodeTransformerFactory(r);return n.getVisitor(t)?{...e,[r]:n}:e},{})}mergeVisitorsForDirection(e,t){const r=e.length;return r?(n,i)=>{if(m.NodeMetadata.isIgnoredNode(n))return f.VisitorOption.Skip;for(let a=0;ae}};t.NodeTransformersRunner=g,t.NodeTransformersRunner=g=o([(0,l.injectable)(),u(0,(0,l.inject)(d.ServiceIdentifiers.Factory__INodeTransformer)),u(1,(0,l.inject)(d.ServiceIdentifiers.INodeTransformerNamesGroupsBuilder)),c("design:paramtypes",[Function,Object])],g)},5265:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LazyServiceIdentifier=void 0;const n=r(82151);Object.defineProperty(t,"LazyServiceIdentifier",{enumerable:!0,get:function(){return n.LazyServiceIdentifier}})},5502:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalVariableServiceWorkerTemplate=function(){return"const that = typeof global === 'object' ? global : this;"}},5643:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getFunctionName=void 0,t.getDependencies=function(e,t){return(0,o.getTargets)(e)(t)},t.getBaseClassDependencyCount=function e(t,r){var n=Object.getPrototypeOf(r.prototype).constructor;if(n!==Object){var i=(0,o.getTargets)(t)(n),a=i.map(function(e){return e.metadata.filter(function(e){return e.key===s.UNMANAGED_TAG})}),c=[].concat.apply([],a).length,u=i.length-c;return u>0?u:e(t,n)}return 0};var o=r(69687),s=a(r(2006)),c=r(92172);Object.defineProperty(t,"getFunctionName",{enumerable:!0,get:function(){return c.getFunctionName}})},5830:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if((0,n.default)(e),t=(0,i.default)(t,d),!(0,a.default)(e,","))return!1;var r=e.split(",");if(r[0].startsWith("(")&&!r[1].endsWith(")")||r[1].endsWith(")")&&!r[0].startsWith("("))return!1;if(t.checkDMS)return u.test(r[0])&&l.test(r[1]);return s.test(r[0])&&c.test(r[1])};var n=o(r(83399)),i=o(r(93610)),a=o(r(94636));function o(e){return e&&e.__esModule?e:{default:e}}var s=/^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/,c=/^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/,u=/^(([1-8]?\d)\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|90\D+0\D+0)\D+[NSns]?$/i,l=/^\s*([1-7]?\d{1,2}\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|180\D+0\D+0)\D+[EWew]?$/i,d={checkDMS:!1};e.exports=t.default,e.exports.default=t.default},6377:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.FunctionControlFlowStorage=void 0;const o=r(71519),s=r(32287),c=r(11440);let u=class extends c.MapStorage{constructor(e,t,r){super(e,t),this.identifierNamesGenerator=r(t)}};t.FunctionControlFlowStorage=u,t.FunctionControlFlowStorage=u=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),a(2,(0,o.inject)(s.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),i("design:paramtypes",[Object,Object,Function])],u)},6480:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayRotateFunctionCodeHelper=void 0;const o=r(71519),s=r(32287),c=r(10548),u=r(71780),l=r(88318),d=r(25120);let f=class extends l.AbstractCustomCodeHelper{constructor(e,t,r,n,i){super(e,t,r,n,i)}initialize(e,t,r){this.stringArrayFunctionName=e,this.comparisonValue=t,this.comparisonExpressionNode=r}getNodeStructure(e){return d.NodeUtils.convertCodeToStructure(e)}getCodeHelperTemplate(){const e=d.NodeUtils.convertStructureToCode([this.comparisonExpressionNode]);return this.customCodeHelperFormatter.formatTemplate((0,u.StringArrayRotateFunctionTemplate)(),{comparisonExpressionCode:e,comparisonValue:this.comparisonValue,stringArrayFunctionName:this.stringArrayFunctionName})}};t.StringArrayRotateFunctionCodeHelper=f,n([(0,c.initializable)(),i("design:type",Number)],f.prototype,"comparisonValue",void 0),n([(0,c.initializable)(),i("design:type",Object)],f.prototype,"comparisonExpressionNode",void 0),n([(0,c.initializable)(),i("design:type",String)],f.prototype,"stringArrayFunctionName",void 0),t.StringArrayRotateFunctionCodeHelper=f=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperFormatter)),a(2,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperObfuscator)),a(3,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(4,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Function,Object,Object,Object,Object])],f)},6596:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.tryAndThrowErrorIfStackOverflow=void 0,t.isStackOverflowException=s;var o=a(r(95507));function s(e){return e instanceof RangeError||e.message===o.STACK_OVERFLOW}t.tryAndThrowErrorIfStackOverflow=function(e,t){try{return e()}catch(e){if(s(e))throw t();throw e}}},6768:function(e,t,r){"use strict";var n,i,a=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},c=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),i=0;i{if(b.NodeGuards.isWhileStatementNode(e))return p.VisitorOption.Skip;i.isProhibitedStatementNode(e)&&(t=!1)}}),t}getVisitor(e){return this.options.controlFlowFlattening&&e===m.NodeTransformationStage.ControlFlowFlattening?{leave:(e,t)=>{if(t&&b.NodeGuards.isBlockStatementNode(e))return this.transformNode(e,t)}}:null}transformNode(e,t){if(this.randomGenerator.getMathRandom()>this.options.controlFlowFlatteningThreshold||!i.canTransformBlockStatementNode(e))return e;const r=e.body,n=this.arrayUtils.createWithRange(r.length),a=this.arrayUtils.shuffle(n),o=new Map(a.map((e,t)=>[e,t])),s=n.map(e=>o.get(e)),c=this.controlFlowCustomNodeFactory(h.ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode);c.initialize(r,a,s);const u=c.getNode()[0];return y.NodeUtils.parentizeNode(u,t),u}};t.BlockStatementControlFlowTransformer=S,t.BlockStatementControlFlowTransformer=S=i=s([(0,d.injectable)(),l(0,(0,d.inject)(f.ServiceIdentifiers.Factory__IControlFlowCustomNode)),l(1,(0,d.inject)(f.ServiceIdentifiers.IArrayUtils)),l(2,(0,d.inject)(f.ServiceIdentifiers.IRandomGenerator)),l(3,(0,d.inject)(f.ServiceIdentifiers.IOptions)),u("design:paramtypes",[Function,Object,Object,Object])],S)},6782:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return(0,i.default)(e),function(e){var t="\\d{".concat(e.digits_after_decimal[0],"}");e.digits_after_decimal.forEach(function(e,r){0!==r&&(t="".concat(t,"|\\d{").concat(e,"}"))});var r="(".concat(e.symbol.replace(/\W/,function(e){return"\\".concat(e)}),")").concat(e.require_symbol?"":"?"),n="-?",i="[1-9]\\d{0,2}(\\".concat(e.thousands_separator,"\\d{3})*"),a="(".concat(["0","[1-9]\\d*",i].join("|"),")?"),o="(\\".concat(e.decimal_separator,"(").concat(t,"))").concat(e.require_decimal?"":"?"),s=a+(e.allow_decimal||e.require_decimal?o:"");e.allow_negatives&&!e.parens_for_negatives&&(e.negative_sign_after_digits?s+=n:e.negative_sign_before_digits&&(s=n+s));e.allow_negative_sign_placeholder?s="( (?!\\-))?".concat(s):e.allow_space_after_symbol?s=" ?".concat(s):e.allow_space_after_digits&&(s+="( (?!$))?");e.symbol_after_digits?s+=r:s=r+s;e.allow_negatives&&(e.parens_for_negatives?s="(\\(".concat(s,"\\)|").concat(s,")"):e.negative_sign_before_digits||e.negative_sign_after_digits||(s=n+s));return new RegExp("^(?!-? )(?=.*\\d)".concat(s,"$"))}(t=(0,n.default)(t,o)).test(e)};var n=a(r(93610)),i=a(r(83399));function a(e){return e&&e.__esModule?e:{default:e}}var o={symbol:"$",require_symbol:!1,allow_space_after_symbol:!1,symbol_after_digits:!1,allow_negatives:!0,parens_for_negatives:!1,negative_sign_before_digits:!1,negative_sign_after_digits:!1,allow_negative_sign_placeholder:!1,thousands_separator:",",decimal_separator:".",allow_decimal:!0,require_decimal:!1,digits_after_decimal:[2],allow_space_after_digits:!1};e.exports=t.default,e.exports.default=t.default},6928:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},o=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MangledShuffledIdentifierNamesGenerator=void 0;const s=r(71519),c=r(32287),u=r(23877),l=r(218),d=r(98376),f=r(68983);let p=n=class extends f.MangledIdentifierNamesGenerator{constructor(e,t,r,n){super(t,r,n),this.arrayUtils=e}initialize(){this.initializeNameSequence([...`${u.numbersString}`,...this.arrayUtils.shuffle([...`${l.alphabetString}${d.alphabetStringUppercase}`])])}initializeNameSequence(e){this.getNameSequence()||(n.shuffledNameSequence=e)}getNameSequence(){return n.shuffledNameSequence}};t.MangledShuffledIdentifierNamesGenerator=p,i([(0,s.postConstruct)(),a("design:type",Function),a("design:paramtypes",[]),a("design:returntype",void 0)],p.prototype,"initialize",null),t.MangledShuffledIdentifierNamesGenerator=p=n=i([(0,s.injectable)(),o(0,(0,s.inject)(c.ServiceIdentifiers.IArrayUtils)),o(1,(0,s.inject)(c.ServiceIdentifiers.IRandomGenerator)),o(2,(0,s.inject)(c.ServiceIdentifiers.IOptions)),o(3,(0,s.inject)(c.ServiceIdentifiers.ISetUtils)),a("design:paramtypes",[Object,Object,Object,Object])],p)},7071:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)(e),d.test(e)};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};var a="(([a-zA-Z]{2,3}(-".concat("([A-Za-z]{3}(-[A-Za-z]{3}){0,2})",")?)|([a-zA-Z]{5,8}))"),o="(".concat("(\\d|[A-W]|[Y-Z]|[a-w]|[y-z])","(-[A-Za-z0-9]{2,8})+)"),s="(x(-[A-Za-z0-9]{1,8})+)",c="(".concat("((en-GB-oed)|(i-ami)|(i-bnn)|(i-default)|(i-enochian)|(i-hak)|(i-klingon)|(i-lux)|(i-mingo)|(i-navajo)|(i-pwn)|(i-tao)|(i-tay)|(i-tsu)|(sgn-BE-FR)|(sgn-BE-NL)|(sgn-CH-DE))","|").concat("((art-lojban)|(cel-gaulish)|(no-bok)|(no-nyn)|(zh-guoyu)|(zh-hakka)|(zh-min)|(zh-min-nan)|(zh-xiang))",")"),u="(-|_)",l="".concat(a,"(").concat(u).concat("([A-Za-z]{4})",")?(").concat(u).concat("([A-Za-z]{2}|\\d{3})",")?(").concat(u).concat("([A-Za-z0-9]{5,8}|(\\d[A-Z-a-z0-9]{3}))",")*(").concat(u).concat(o,")*(").concat(u).concat(s,")?"),d=new RegExp("(^".concat(s,"$)|(^").concat(c,"$)|(^").concat(l,"$)"));e.exports=t.default,e.exports.default=t.default},7155:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.simplifyingTransformersModule=void 0;const n=r(71519),i=r(32287),a=r(96390),o=r(4533),s=r(60498),c=r(46183),u=r(1391);t.simplifyingTransformersModule=new n.ContainerModule(e=>{e(i.ServiceIdentifiers.INodeTransformer).to(o.BlockStatementSimplifyTransformer).whenTargetNamed(a.NodeTransformer.BlockStatementSimplifyTransformer),e(i.ServiceIdentifiers.INodeTransformer).to(s.ExpressionStatementsMergeTransformer).whenTargetNamed(a.NodeTransformer.ExpressionStatementsMergeTransformer),e(i.ServiceIdentifiers.INodeTransformer).to(c.IfStatementSimplifyTransformer).whenTargetNamed(a.NodeTransformer.IfStatementSimplifyTransformer),e(i.ServiceIdentifiers.INodeTransformer).to(u.VariableDeclarationsMergeTransformer).whenTargetNamed(a.NodeTransformer.VariableDeclarationsMergeTransformer)})},7520:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getClassMetadataPropertiesFromMetadataReader=function(e,t){const r=t.getPropertiesMetadata(e),i=new Map;for(const t of Reflect.ownKeys(r)){const a=r[t];i.set(t,(0,n.getPropertyMetadataFromLegacyMetadata)(e,t,a))}return i};const n=r(23498)},7673:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if((0,n.default)(e),(t=(0,i.default)(t,c)).crockford)return s.test(e);if(e.length%8==0&&o.test(e))return!0;return!1};var n=a(r(83399)),i=a(r(93610));function a(e){return e&&e.__esModule?e:{default:e}}var o=/^[A-Z2-7]+=*$/,s=/^[A-HJKMNP-TV-Z0-9]+$/,c={crockford:!1};e.exports=t.default,e.exports.default=t.default},8156:e=>{"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},8461:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){(0,i.default)(e);var r=a;(t=t||{}).allow_hyphens&&(r=o);if(!r.test(e))return!1;e=e.replace(/-/g,"");for(var n=0,s=2,c=0;c<14;c++){var u=e.substring(14-c-1,14-c),l=parseInt(u,10)*s;n+=l>=10?l%10+1:l,1===s?s+=1:s-=1}if((10-n%10)%10!==parseInt(e.substring(14,15),10))return!1;return!0};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};var a=/^[0-9]{15}$/,o=/^\d{2}-\d{6}-\d{6}-\d{1}$/;e.exports=t.default,e.exports.default=t.default},8507:(e,t,r)=>{const n=r(15659);function i(e){const t=function(){const e={},t=Object.keys(n);for(let r=t.length,n=0;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getClassMetadataFromMetadataReader=function(e,t){const r=(0,n.getReflectMetadata)(e,i.POST_CONSTRUCT),s=(0,n.getReflectMetadata)(e,i.PRE_DESTROY);return{constructorArguments:(0,a.getClassMetadataConstructorArgumentsFromMetadataReader)(e,t),lifecycle:{postConstructMethodName:r?.value,preDestroyMethodName:s?.value},properties:(0,o.getClassMetadataPropertiesFromMetadataReader)(e,t)}};const n=r(59517),i=r(83313),a=r(86249),o=r(7520)},9696:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoggingMessage=void 0;r(91576);var n;!function(e){e.EmptySourceCode="Empty source code. Obfuscation canceled...",e.ObfuscationCompleted="Obfuscation completed. Total time: %s sec.",e.ObfuscationStarted="Obfuscation started...",e.RandomGeneratorSeed="Random generator seed: %s...",e.CodeTransformationStage="Code transformation stage: %s...",e.NodeTransformationStage="AST transformation stage: %s...",e.Version="Version: %s",e.JavaScriptObfuscatorProAdFirstPart="🛡️ JavaScript Obfuscator Pro is now available — with powerful Virtual Machine-based obfuscation\n(bytecode virtualization, anti-decompilation, unique opcode and VM structure each compilation, and more).",e.JavaScriptObfuscatorProAdSecondPart="👉️ Get your API key at https://obfuscator.io and start using Virtual Machine obfuscation with javascript-obfuscator package."}(n||(t.LoggingMessage=n={}))},9750:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getClassMetadataProperties=function(e){const t=(0,n.getReflectMetadata)(e,i.TAGGED_PROP),r=new Map;if(void 0!==t)for(const n of Reflect.ownKeys(t)){const i=t[n];r.set(n,(0,a.getPropertyMetadataFromLegacyMetadata)(e,n,i))}return r};const n=r(59517),i=r(83313),a=r(23498)},9756:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},o=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.StringLiteralControlFlowReplacer=void 0;const s=r(71519),c=r(32287),u=r(96747),l=r(94914),d=r(23615),f=r(90253);let p=n=class extends l.AbstractControlFlowReplacer{constructor(e,t,r,n){super(e,t,r,n)}replace(e,t,r){if(d.NodeGuards.isPropertyNode(t)&&t.key===e)return e;if(!f.NodeLiteralUtils.isStringLiteralNode(e)||e.value.length<3)return e;const i=e.value,a=this.controlFlowCustomNodeFactory(u.ControlFlowCustomNode.LiteralNode);a.initialize(e);const o=this.insertCustomNodeToControlFlowStorage(a,r,i,n.usingExistingIdentifierChance);return this.getControlFlowStorageCallNode(r.getStorageId(),o)}getControlFlowStorageCallNode(e,t){const r=this.controlFlowCustomNodeFactory(u.ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode);r.initialize(e,t);const n=r.getNode()[0];if(!n||!d.NodeGuards.isExpressionStatementNode(n))throw new Error("`controlFlowStorageCallCustomNode.getNode()[0]` should returns array with `ExpressionStatement` node");return n.expression}};t.StringLiteralControlFlowReplacer=p,p.usingExistingIdentifierChance=1,t.StringLiteralControlFlowReplacer=p=n=i([(0,s.injectable)(),o(0,(0,s.inject)(c.ServiceIdentifiers.Factory__IControlFlowCustomNode)),o(1,(0,s.inject)(c.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),o(2,(0,s.inject)(c.ServiceIdentifiers.IRandomGenerator)),o(3,(0,s.inject)(c.ServiceIdentifiers.IOptions)),a("design:paramtypes",[Function,Function,Object,Object])],p)},10094:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.base64alphabetSwapped=void 0;const n=r(98376),i=r(218),a=r(23877);t.base64alphabetSwapped=`${i.alphabetString}${n.alphabetStringUppercase}${a.numbersString}+/=`},10548:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initializable=function(){return(e,t)=>{const l=e[c];if(!l||"function"!=typeof l)throw new Error(`\`${c}\` method with initialization logic not found. \`@${r}\` decorator requires \`${c}\` method`);return u(i,!1,e),u(a,new Set,e),u(o,new Set,e),function(e){const t=Object.getOwnPropertyNames(e),r=new Set([c,s]);t.forEach(t=>{var s;const u=Reflect.getMetadata(a,e),l=Reflect.getMetadata(o,e);if(r.has(t)||u.has(t)||l.has(t))return;if("function"!=typeof e[t])return;const d=null!==(s=Object.getOwnPropertyDescriptor(e,t))&&void 0!==s?s:n,f=d.value;Object.defineProperty(e,t,{...d,value(){if(!Reflect.getMetadata(i,this))throw new Error(`Class should be initialized with \`${c}()\` method`);return f.apply(this,arguments)}}),l.add(t)})}(e),function(e,t){var r;const a=null!==(r=Object.getOwnPropertyDescriptor(e,c))&&void 0!==r?r:n,o=a.value;Object.defineProperty(e,c,{...a,value:function(){Reflect.defineMetadata(i,!0,this);const e=o.apply(this,arguments);return this[t],e}})}(e,t),function(e,t){var r;const i=Reflect.getMetadata(a,e);i.add(t);const o=`_${t.toString()}`,s=null!==(r=Object.getOwnPropertyDescriptor(e,o))&&void 0!==r?r:n;return Object.defineProperty(e,t,{...s,get:function(){if(void 0===this[o])throw new Error(`Property \`${t.toString()}\` is not initialized! Initialize it first!`);return this[o]},set:function(e){this[o]=e}}),s}(e,t)}};const r="initializable",n={configurable:!0,enumerable:!0},i="_initialized",a="_initializablePropertiesSet",o="_wrappedMethodsSet",s="constructor",c="initialize";function u(e,t,r){Reflect.hasMetadata(e,r)||Reflect.defineMetadata(e,t,r)}},10618:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},o=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayTransformer=void 0;const s=r(71519),c=r(32287),u=r(96390),l=r(18436),d=r(68736),f=r(60056),p=r(76893),h=r(23615),m=r(90253),g=r(12720),b=r(25120);let y=n=class extends p.AbstractNodeTransformer{constructor(e,t,r,n,i,a,o,s,c){super(e,t),this.runAfter=[u.NodeTransformer.StringArrayRotateFunctionTransformer],this.literalNodesCacheStorage=r,this.visitedLexicalScopeNodesStackStorage=n,this.stringArrayStorage=i,this.stringArrayScopeCallsWrappersDataStorage=a,this.stringArrayStorageAnalyzer=o,this.identifierNamesGenerator=s(t),this.stringArrayTransformerCustomNodeFactory=c}getVisitor(e){return e===l.NodeTransformationStage.StringArray?{enter:(e,t)=>{if(h.NodeGuards.isProgramNode(e)&&this.prepareNode(e),t&&h.NodeGuards.isLiteralNode(e)&&!g.NodeMetadata.isStringArrayCallLiteralNode(e))return this.transformNode(e,t)}}:null}prepareNode(e){this.options.stringArray&&this.stringArrayStorageAnalyzer.analyze(e),this.options.stringArrayShuffle&&this.stringArrayStorage.shuffleStorage(),this.options.stringArrayRotate&&this.stringArrayStorage.rotateStorage()}transformNode(e,t){if(!m.NodeLiteralUtils.isStringLiteralNode(e)||m.NodeLiteralUtils.isProhibitedLiteralNode(e,t))return e;const r=e.value,n=this.stringArrayStorageAnalyzer.getItemDataForLiteralNode(e),i=this.literalNodesCacheStorage.buildKey(r,n);let a;if(this.literalNodesCacheStorage.shouldUseCachedValue(i,n)){const e=this.literalNodesCacheStorage.get(i);a=b.NodeUtils.clone(e)}else a=n?this.getStringArrayCallNode(n):e,this.literalNodesCacheStorage.set(i,a);return b.NodeUtils.parentizeNode(a,t),a}getStringArrayCallNode(e){const t=this.getStringArrayScopeCallsWrapperData(e),{decodeKey:r,index:n}=e,i=this.stringArrayTransformerCustomNodeFactory(d.StringArrayCustomNode.StringArrayCallNode);i.initialize(n,this.stringArrayStorage.getIndexShiftAmount(),t,r);const a=i.getNode()[0];if(!h.NodeGuards.isExpressionStatementNode(a))throw new Error("`stringArrayCallCustomNode.getNode()[0]` should returns array with `ExpressionStatement` node");return a.expression}getStringArrayScopeCallsWrapperData(e){return this.options.stringArrayWrappersCount?this.getUpperStringArrayScopeCallsWrapperData(e):this.getRootStringArrayScopeCallsWrapperData(e)}getRootStringArrayScopeCallsWrapperData(e){const{encoding:t}=e;return{name:this.stringArrayStorage.getStorageCallsWrapperName(t),index:0,parameterIndexesData:null}}getUpperStringArrayScopeCallsWrapperData(e){var t,r,n;const{encoding:i}=e,a=null!==(t=this.visitedLexicalScopeNodesStackStorage.getLastElement())&&void 0!==t?t:null;if(!a)throw new Error("Cannot find current lexical scope body node");const o=null!==(n=null===(r=this.getAndUpdateStringArrayScopeCallsWrappersDataByEncoding(a,e)[i])||void 0===r?void 0:r.scopeCallsWrappersData)&&void 0!==n?n:[];return this.randomGenerator.getRandomGenerator().pickone(o)}getAndUpdateStringArrayScopeCallsWrappersDataByEncoding(e,t){var r,n,i;const{encoding:a}=t,o=null!==(r=this.stringArrayScopeCallsWrappersDataStorage.get(e))&&void 0!==r?r:{};if((null!==(i=null===(n=o[a])||void 0===n?void 0:n.scopeCallsWrappersData)&&void 0!==i?i:[]).length===this.options.stringArrayWrappersCount)return o;const s={name:h.NodeGuards.isProgramNode(e)?this.identifierNamesGenerator.generateForGlobalScope():this.identifierNamesGenerator.generateNext(),index:this.getStringArrayCallsWrapperShiftedIndex(),parameterIndexesData:this.getStringArrayCallsWrapperParameterIndexesData()};let c=o[a];return c?c.scopeCallsWrappersData.push(s):(c={encoding:a,scopeCallsWrappersData:[s]},o[a]=c),this.stringArrayScopeCallsWrappersDataStorage.set(e,o),o}getStringArrayCallsWrapperShiftedIndex(){return this.options.stringArrayWrappersType===f.StringArrayWrappersType.Function?this.randomGenerator.getRandomInteger(n.minShiftedIndexValue,n.maxShiftedIndexValue):0}getStringArrayCallsWrapperParameterIndexesData(){if(this.options.stringArrayWrappersType!==f.StringArrayWrappersType.Function)return null;const e=this.options.stringArrayWrappersParametersMaxCount-1,t=this.randomGenerator.getRandomInteger(0,e);return{valueIndexParameterIndex:t,decodeKeyParameterIndex:this.randomGenerator.getRandomIntegerExcluding(0,e,[t])}}};t.StringArrayTransformer=y,y.minShiftedIndexValue=-1e3,y.maxShiftedIndexValue=1e3,t.StringArrayTransformer=y=n=i([(0,s.injectable)(),o(0,(0,s.inject)(c.ServiceIdentifiers.IRandomGenerator)),o(1,(0,s.inject)(c.ServiceIdentifiers.IOptions)),o(2,(0,s.inject)(c.ServiceIdentifiers.ILiteralNodesCacheStorage)),o(3,(0,s.inject)(c.ServiceIdentifiers.IVisitedLexicalScopeNodesStackStorage)),o(4,(0,s.inject)(c.ServiceIdentifiers.IStringArrayStorage)),o(5,(0,s.inject)(c.ServiceIdentifiers.IStringArrayScopeCallsWrappersDataStorage)),o(6,(0,s.inject)(c.ServiceIdentifiers.IStringArrayStorageAnalyzer)),o(7,(0,s.inject)(c.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),o(8,(0,s.inject)(c.ServiceIdentifiers.Factory__IStringArrayCustomNode)),a("design:paramtypes",[Object,Object,Object,Object,Object,Object,Object,Function,Function])],y)},10676:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if((0,i.default)(e),t in a)return a[t](e);if("any"===t){for(var r in a){if((0,a[r])(e))return!0}return!1}throw new Error("Invalid locale '".concat(t,"'"))};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};var a={"cs-CZ":function(e){return/^(([ABCDEFHIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(e)},"de-DE":function(e){return/^((A|AA|AB|AC|AE|AH|AK|AM|AN|AÖ|AP|AS|AT|AU|AW|AZ|B|BA|BB|BC|BE|BF|BH|BI|BK|BL|BM|BN|BO|BÖ|BS|BT|BZ|C|CA|CB|CE|CO|CR|CW|D|DA|DD|DE|DH|DI|DL|DM|DN|DO|DU|DW|DZ|E|EA|EB|ED|EE|EF|EG|EH|EI|EL|EM|EN|ER|ES|EU|EW|F|FB|FD|FF|FG|FI|FL|FN|FO|FR|FS|FT|FÜ|FW|FZ|G|GA|GC|GD|GE|GF|GG|GI|GK|GL|GM|GN|GÖ|GP|GR|GS|GT|GÜ|GV|GW|GZ|H|HA|HB|HC|HD|HE|HF|HG|HH|HI|HK|HL|HM|HN|HO|HP|HR|HS|HU|HV|HX|HY|HZ|IK|IL|IN|IZ|J|JE|JL|K|KA|KB|KC|KE|KF|KG|KH|KI|KK|KL|KM|KN|KO|KR|KS|KT|KU|KW|KY|L|LA|LB|LC|LD|LF|LG|LH|LI|LL|LM|LN|LÖ|LP|LR|LU|M|MA|MB|MC|MD|ME|MG|MH|MI|MK|ML|MM|MN|MO|MQ|MR|MS|MÜ|MW|MY|MZ|N|NB|ND|NE|NF|NH|NI|NK|NM|NÖ|NP|NR|NT|NU|NW|NY|NZ|OA|OB|OC|OD|OE|OF|OG|OH|OK|OL|OP|OS|OZ|P|PA|PB|PE|PF|PI|PL|PM|PN|PR|PS|PW|PZ|R|RA|RC|RD|RE|RG|RH|RI|RL|RM|RN|RO|RP|RS|RT|RU|RV|RW|RZ|S|SB|SC|SE|SG|SI|SK|SL|SM|SN|SO|SP|SR|ST|SU|SW|SY|SZ|TE|TF|TG|TO|TP|TR|TS|TT|TÜ|ÜB|UE|UH|UL|UM|UN|V|VB|VG|VK|VR|VS|W|WA|WB|WE|WF|WI|WK|WL|WM|WN|WO|WR|WS|WT|WÜ|WW|WZ|Z|ZE|ZI|ZP|ZR|ZW|ZZ)[- ]?[A-Z]{1,2}[- ]?\d{1,4}|(ABG|ABI|AIB|AIC|ALF|ALZ|ANA|ANG|ANK|APD|ARN|ART|ASL|ASZ|AUR|AZE|BAD|BAR|BBG|BCH|BED|BER|BGD|BGL|BID|BIN|BIR|BIT|BIW|BKS|BLB|BLK|BNA|BOG|BOH|BOR|BOT|BRA|BRB|BRG|BRK|BRL|BRV|BSB|BSK|BTF|BÜD|BUL|BÜR|BÜS|BÜZ|CAS|CHA|CLP|CLZ|COC|COE|CUX|DAH|DAN|DAU|DBR|DEG|DEL|DGF|DIL|DIN|DIZ|DKB|DLG|DON|DUD|DÜW|EBE|EBN|EBS|ECK|EIC|EIL|EIN|EIS|EMD|EMS|ERB|ERH|ERK|ERZ|ESB|ESW|FDB|FDS|FEU|FFB|FKB|FLÖ|FOR|FRG|FRI|FRW|FTL|FÜS|GAN|GAP|GDB|GEL|GEO|GER|GHA|GHC|GLA|GMN|GNT|GOA|GOH|GRA|GRH|GRI|GRM|GRZ|GTH|GUB|GUN|GVM|HAB|HAL|HAM|HAS|HBN|HBS|HCH|HDH|HDL|HEB|HEF|HEI|HER|HET|HGN|HGW|HHM|HIG|HIP|HMÜ|HOG|HOH|HOL|HOM|HOR|HÖS|HOT|HRO|HSK|HST|HVL|HWI|IGB|ILL|JÜL|KEH|KEL|KEM|KIB|KLE|KLZ|KÖN|KÖT|KÖZ|KRU|KÜN|KUS|KYF|LAN|LAU|LBS|LBZ|LDK|LDS|LEO|LER|LEV|LIB|LIF|LIP|LÖB|LOS|LRO|LSZ|LÜN|LUP|LWL|MAB|MAI|MAK|MAL|MED|MEG|MEI|MEK|MEL|MER|MET|MGH|MGN|MHL|MIL|MKK|MOD|MOL|MON|MOS|MSE|MSH|MSP|MST|MTK|MTL|MÜB|MÜR|MYK|MZG|NAB|NAI|NAU|NDH|NEA|NEB|NEC|NEN|NES|NEW|NMB|NMS|NOH|NOL|NOM|NOR|NVP|NWM|OAL|OBB|OBG|OCH|OHA|ÖHR|OHV|OHZ|OPR|OSL|OVI|OVL|OVP|PAF|PAN|PAR|PCH|PEG|PIR|PLÖ|PRÜ|QFT|QLB|RDG|REG|REH|REI|RID|RIE|ROD|ROF|ROK|ROL|ROS|ROT|ROW|RSL|RÜD|RÜG|SAB|SAD|SAN|SAW|SBG|SBK|SCZ|SDH|SDL|SDT|SEB|SEE|SEF|SEL|SFB|SFT|SGH|SHA|SHG|SHK|SHL|SIG|SIM|SLE|SLF|SLK|SLN|SLS|SLÜ|SLZ|SMÜ|SOB|SOG|SOK|SÖM|SON|SPB|SPN|SRB|SRO|STA|STB|STD|STE|STL|SUL|SÜW|SWA|SZB|TBB|TDO|TET|TIR|TÖL|TUT|UEM|UER|UFF|USI|VAI|VEC|VER|VIB|VIE|VIT|VOH|WAF|WAK|WAN|WAR|WAT|WBS|WDA|WEL|WEN|WER|WES|WHV|WIL|WIS|WIT|WIZ|WLG|WMS|WND|WOB|WOH|WOL|WOR|WOS|WRN|WSF|WST|WSW|WTL|WTM|WUG|WÜM|WUN|WUR|WZL|ZEL|ZIG)[- ]?(([A-Z][- ]?\d{1,4})|([A-Z]{2}[- ]?\d{1,3})))[- ]?(E|H)?$/.test(e)},"de-LI":function(e){return/^FL[- ]?\d{1,5}[UZ]?$/.test(e)},"en-IN":function(e){return/^[A-Z]{2}[ -]?[0-9]{1,2}(?:[ -]?[A-Z])(?:[ -]?[A-Z]*)?[ -]?[0-9]{4}$/.test(e)},"en-SG":function(e){return/^[A-Z]{3}[ -]?[\d]{4}[ -]?[A-Z]{1}$/.test(e)},"es-AR":function(e){return/^(([A-Z]{2} ?[0-9]{3} ?[A-Z]{2})|([A-Z]{3} ?[0-9]{3}))$/.test(e)},"fi-FI":function(e){return/^(?=.{4,7})(([A-Z]{1,3}|[0-9]{1,3})[\s-]?([A-Z]{1,3}|[0-9]{1,5}))$/.test(e)},"hu-HU":function(e){return/^((((?!AAA)(([A-NPRSTVZWXY]{1})([A-PR-Z]{1})([A-HJ-NPR-Z]))|(A[ABC]I)|A[ABC]O|A[A-W]Q|BPI|BPO|UCO|UDO|XAO)-(?!000)\d{3})|(M\d{6})|((CK|DT|CD|HC|H[ABEFIKLMNPRSTVX]|MA|OT|R[A-Z]) \d{2}-\d{2})|(CD \d{3}-\d{3})|(C-(C|X) \d{4})|(X-(A|B|C) \d{4})|(([EPVZ]-\d{5}))|(S A[A-Z]{2} \d{2})|(SP \d{2}-\d{2}))$/.test(e)},"pt-BR":function(e){return/^[A-Z]{3}[ -]?[0-9][A-Z][0-9]{2}|[A-Z]{3}[ -]?[0-9]{4}$/.test(e)},"pt-PT":function(e){return/^(([A-Z]{2}[ -·]?[0-9]{2}[ -·]?[0-9]{2})|([0-9]{2}[ -·]?[A-Z]{2}[ -·]?[0-9]{2})|([0-9]{2}[ -·]?[0-9]{2}[ -·]?[A-Z]{2})|([A-Z]{2}[ -·]?[0-9]{2}[ -·]?[A-Z]{2}))$/.test(e)},"sq-AL":function(e){return/^[A-Z]{2}[- ]?((\d{3}[- ]?(([A-Z]{2})|T))|(R[- ]?\d{3}))$/.test(e)},"sv-SE":function(e){return/^[A-HJ-PR-UW-Z]{3} ?[\d]{2}[A-HJ-PR-UW-Z1-9]$|(^[A-ZÅÄÖ ]{2,7}$)/.test(e.trim())},"en-PK":function(e){return/(^[A-Z]{2}((\s|-){0,1})[0-9]{3,4}((\s|-)[0-9]{2}){0,1}$)|(^[A-Z]{3}((\s|-){0,1})[0-9]{3,4}((\s|-)[0-9]{2}){0,1}$)|(^[A-Z]{4}((\s|-){0,1})[0-9]{3,4}((\s|-)[0-9]{2}){0,1}$)|(^[A-Z]((\s|-){0,1})[0-9]{4}((\s|-)[0-9]{2}){0,1}$)/.test(e.trim())}};e.exports=t.default,e.exports.default=t.default},10734:(e,t,r)=>{const n=r(15659),i=r(8507),a={};Object.keys(n).forEach(e=>{a[e]={},Object.defineProperty(a[e],"channels",{value:n[e].channels}),Object.defineProperty(a[e],"labels",{value:n[e].labels});const t=i(e);Object.keys(t).forEach(r=>{const n=t[r];a[e][r]=function(e){const t=function(...t){const r=t[0];if(null==r)return r;r.length>1&&(t=r);const n=e(t);if("object"==typeof n)for(let e=n.length,t=0;t1&&(t=r),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(n)})}),e.exports=a},10955:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ApiError=void 0;class r extends Error{constructor(e,t,r){super(e),this.name="ApiError",this.statusCode=t,this.response=r}}t.ApiError=r},10958:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.unmanaged=function(){return function(e,t,r){var n=new s.Metadata(o.UNMANAGED_TAG,!0);(0,c.tagParameter)(e,t,r,n)}};var o=a(r(2006)),s=r(14425),c=r(24157)},11440:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MapStorage=void 0;const o=r(71519),s=r(32287),c=r(10548);let u=class{constructor(e,t){this.randomGenerator=e,this.options=t}initialize(){this.storage=new Map,this.storageId=this.randomGenerator.getRandomString(6)}get(e){return this.storage.get(e)}getOrThrow(e){const t=this.get(e);if(!t)throw new Error(`No value found in map storage with key \`${e}\``);return t}getKeyOf(e){for(const[t,r]of this.storage)if(e===r)return t;return null}getLength(){return this.storage.size}getStorage(){return this.storage}getStorageAsDictionary(){return Object.fromEntries(this.storage)}getStorageId(){return this.storageId}has(e){return this.storage.has(e)}mergeWith(e,t=!1){this.storage=new Map([...this.storage,...e.getStorage()]),t&&(this.storageId=e.getStorageId())}set(e,t){this.storage.set(e,t)}};t.MapStorage=u,n([(0,c.initializable)(),i("design:type",String)],u.prototype,"storageId",void 0),n([(0,c.initializable)(),i("design:type",Map)],u.prototype,"storage",void 0),n([(0,o.postConstruct)(),i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",void 0)],u.prototype,"initialize",null),t.MapStorage=u=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object,Object])],u)},11839:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PRESET=void 0;const n=r(93844),i=r(72167),a=r(94838),o=r(36833),s=r(54042),c=r(48096),u=r(66822),l=r(70885),d=r(60056);t.DEFAULT_PRESET=Object.freeze({compact:!0,config:"",controlFlowFlattening:!1,controlFlowFlatteningThreshold:.75,deadCodeInjection:!1,deadCodeInjectionThreshold:.4,debugProtection:!1,debugProtectionInterval:0,disableConsoleOutput:!1,domainLock:[],domainLockRedirectUrl:"about:blank",exclude:[],forceTransformStrings:[],identifierNamesCache:null,identifierNamesGenerator:n.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator,identifiersPrefix:"",identifiersDictionary:[],ignoreImports:!1,inputFileName:"",log:!1,numbersToExpressions:!1,optionsPreset:a.OptionsPreset.Default,renameGlobals:!1,renameProperties:!1,renamePropertiesMode:o.RenamePropertiesMode.Safe,reservedNames:[],reservedStrings:[],stringArrayRotate:!0,seed:0,selfDefending:!1,stringArrayShuffle:!0,simplify:!0,sourceMap:!1,sourceMapBaseUrl:"",sourceMapFileName:"",sourceMapMode:s.SourceMapMode.Separate,sourceMapSourcesMode:c.SourceMapSourcesMode.SourcesContent,splitStrings:!1,splitStringsChunkLength:10,stringArray:!0,stringArrayCallsTransform:!1,stringArrayCallsTransformThreshold:.5,stringArrayEncoding:[l.StringArrayEncoding.None],stringArrayIndexesType:[u.StringArrayIndexesType.HexadecimalNumber],stringArrayIndexShift:!0,stringArrayWrappersChainedCalls:!0,stringArrayWrappersCount:1,stringArrayWrappersParametersMaxCount:2,stringArrayWrappersType:d.StringArrayWrappersType.Variable,stringArrayThreshold:.75,target:i.ObfuscationTarget.Browser,transformObjectKeys:!1,unicodeEscapeSequence:!1})},11980:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayHexadecimalNumericStringIndexNode=void 0;const o=r(71519),s=r(32287),c=r(79883),u=r(91363),l=r(57876);let d=class extends c.AbstractStringArrayIndexNode{constructor(e,t){super(e,t)}getNode(e){const t=l.NumberUtils.toHex(e);return u.NodeFactory.literalNode(t)}};t.StringArrayHexadecimalNumericStringIndexNode=d,t.StringArrayHexadecimalNumericStringIndexNode=d=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object,Object])],d)},12408:function(e,t,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},s=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),o=0;o{if(d.NodeGuards.isFunctionExpressionNode(e)&&n&&d.NodeGuards.isVariableDeclaratorNode(n)&&d.NodeGuards.isIdentifierNode(n.id)&&n.id.name===t)return r=e.body,u.VisitorOption.Break}}),r}};t.FunctionExpressionCalleeDataExtractor=p,t.FunctionExpressionCalleeDataExtractor=p=o([(0,c.injectable)()],p)},12483:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if((0,i.default)(e),t){var r=new RegExp("[".concat(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"]+$"),"g");return e.replace(r,"")}var n=e.length-1;for(;/\s/.test(e.charAt(n));)n-=1;return e.slice(0,n+1)};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};e.exports=t.default,e.exports.default=t.default},12505:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.CalleeDataExtractor=void 0,function(e){e.FunctionDeclarationCalleeDataExtractor="FunctionDeclarationCalleeDataExtractor",e.FunctionExpressionCalleeDataExtractor="FunctionExpressionCalleeDataExtractor",e.ObjectExpressionCalleeDataExtractor="ObjectExpressionCalleeDataExtractor"}(r||(t.CalleeDataExtractor=r={}))},12720:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeMetadata=void 0;class r{static set(e,t){var r;e.metadata=Object.assign(null!==(r=e.metadata)&&void 0!==r?r:{},t)}static get(e,t){return void 0!==e.metadata?e.metadata[t]:void 0}static isEvalHostNode(e){return!0===r.get(e,"evalHostNode")}static isForceTransformNode(e){return!0===r.get(e,"forceTransformNode")}static isIgnoredNode(e){return!0===r.get(e,"ignoredNode")}static isPropertyKeyToRenameNode(e){return!0===r.get(e,"propertyKeyToRenameNode")}static isStringArrayCallLiteralNode(e){return!0===r.get(e,"stringArrayCallLiteralNode")}}t.NodeMetadata=r},12798:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DomainLockRule=void 0;const n=r(65063);t.DomainLockRule=e=>{if(e.domainLock.length){const t=[];for(const r of e.domainLock)t.push(n.Utils.extractDomainFrom(r));e={...e,domainLock:t}}return e}},12818:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getConstructorArgumentMetadataFromLegacyMetadata=function(e,t,r){try{return(0,a.getClassElementMetadataFromLegacyMetadata)(r)}catch(r){throw n.InversifyCoreError.isErrorOfKind(r,i.InversifyCoreErrorKind.missingInjectionDecorator)?new n.InversifyCoreError(i.InversifyCoreErrorKind.missingInjectionDecorator,`Expected a single @inject, @multiInject or @unmanaged decorator at type "${e.name}" at constructor arguments at index "${t.toString()}"`,{cause:r}):r}};const n=r(21773),i=r(94931),a=r(44063)},12920:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nodeTransformersModule=void 0;const n=r(59404),i=r(71519),a=r(32287),o=r(75252);t.nodeTransformersModule=new i.ContainerModule(e=>{e(a.ServiceIdentifiers.Factory__INodeTransformer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.INodeTransformer)),e(a.ServiceIdentifiers.INodeTransformerNamesGroupsBuilder).to(o.NodeTransformerNamesGroupsBuilder).inSingletonScope()})},12930:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},o=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ObfuscatingGuardsTransformer=void 0;const s=r(71519),c=r(32287),u=r(96390),l=r(18436),d=r(85032),f=r(50275),p=r(76893),h=r(23615),m=r(12720);let g=n=class extends p.AbstractNodeTransformer{constructor(e,t,r){super(t,r),this.runAfter=[u.NodeTransformer.ParentificationTransformer,u.NodeTransformer.VariablePreserveTransformer],this.obfuscatingGuards=n.obfuscatingGuardsList.map(e)}getVisitor(e){return e===l.NodeTransformationStage.Preparing?{enter:(e,t)=>this.transformNode(e,t)}:null}transformNode(e,t){const r=this.obfuscatingGuards.map(t=>t.check(e));return this.setNodeMetadata(e,r),e}setNodeMetadata(e,t){let r=!1,n=!1;t.every(e=>e===f.ObfuscatingGuardResult.Transform)||(r=t.includes(f.ObfuscatingGuardResult.ForceTransform),n=!r&&t.includes(f.ObfuscatingGuardResult.Ignore)),m.NodeMetadata.set(e,{forceTransformNode:r&&!h.NodeGuards.isProgramNode(e),ignoredNode:n&&!h.NodeGuards.isProgramNode(e)})}};t.ObfuscatingGuardsTransformer=g,g.obfuscatingGuardsList=[d.ObfuscatingGuard.BlackListObfuscatingGuard,d.ObfuscatingGuard.ConditionalCommentObfuscatingGuard,d.ObfuscatingGuard.ForceTransformStringObfuscatingGuard,d.ObfuscatingGuard.IgnoredImportObfuscatingGuard,d.ObfuscatingGuard.ImportMetaObfuscationGuard,d.ObfuscatingGuard.ProcessEnvObfuscationGuard,d.ObfuscatingGuard.ReservedStringObfuscatingGuard],t.ObfuscatingGuardsTransformer=g=n=i([(0,s.injectable)(),o(0,(0,s.inject)(c.ServiceIdentifiers.Factory__INodeGuard)),o(1,(0,s.inject)(c.ServiceIdentifiers.IRandomGenerator)),o(2,(0,s.inject)(c.ServiceIdentifiers.IOptions)),a("design:paramtypes",[Function,Object,Object])],g)},12991:e=>{"use strict";const t=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,r=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,n=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,i=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,a=new Map([["n","\n"],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a",""]]);function o(e){const t="u"===e[0],r="{"===e[1];return t&&!r&&5===e.length||"x"===e[0]&&3===e.length?String.fromCharCode(parseInt(e.slice(1),16)):t&&r?String.fromCodePoint(parseInt(e.slice(2,-1),16)):a.get(e)||e}function s(e,t){const r=[],a=t.trim().split(/\s*,\s*/g);let s;for(const t of a){const a=Number(t);if(Number.isNaN(a)){if(!(s=t.match(n)))throw new Error(`Invalid Chalk template style argument: ${t} (in style '${e}')`);r.push(s[2].replace(i,(e,t,r)=>t?o(t):r))}else r.push(a)}return r}function c(e){r.lastIndex=0;const t=[];let n;for(;null!==(n=r.exec(e));){const e=n[1];if(n[2]){const r=s(e,n[2]);t.push([e].concat(r))}else t.push([e])}return t}function u(e,t){const r={};for(const e of t)for(const t of e.styles)r[t[0]]=e.inverse?null:t.slice(1);let n=e;for(const[e,t]of Object.entries(r))if(Array.isArray(t)){if(!(e in n))throw new Error(`Unknown Chalk style: ${e}`);n=t.length>0?n[e](...t):n[e]}return n}e.exports=(e,r)=>{const n=[],i=[];let a=[];if(r.replace(t,(t,r,s,l,d,f)=>{if(r)a.push(o(r));else if(l){const t=a.join("");a=[],i.push(0===n.length?t:u(e,n)(t)),n.push({inverse:s,styles:c(l)})}else if(d){if(0===n.length)throw new Error("Found extraneous } in Chalk template literal");i.push(u(e,n)(a.join(""))),a=[],n.pop()}else a.push(f)}),i.push(a.join("")),n.length>0){const e=`Chalk template literal is missing ${n.length} closing bracket${1===n.length?"":"s"} (\`}\`)`;throw new Error(e)}return i.join("")}},13013:function(e,t,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),o=0;o"),s=`...${n.slice(i,a).replace(/^\s+/,"")}...`;throw new Error(`ERROR at line ${r.line}: ${t}\n${o} ${s}`)}}t.ASTParserFacade=l,l.colorError=u.default.red,l.nearestSymbolsCount=15,l.sourceTypes=["script","module"]},13165:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFirstArrayDuplicate=function(e){for(var t=new Set,r=0,n=e;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.farsiLocales=t.englishLocales=t.dotDecimal=t.decimal=t.commaDecimal=t.bengaliLocales=t.arabicLocales=t.alphanumeric=t.alpha=void 0;for(var r,n=t.alpha={"en-US":/^[A-Z]+$/i,"az-AZ":/^[A-VXYZÇƏĞİıÖŞÜ]+$/i,"bg-BG":/^[А-Я]+$/i,"cs-CZ":/^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,"da-DK":/^[A-ZÆØÅ]+$/i,"de-DE":/^[A-ZÄÖÜß]+$/i,"el-GR":/^[Α-ώ]+$/i,"es-ES":/^[A-ZÁÉÍÑÓÚÜ]+$/i,"fa-IR":/^[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی]+$/i,"fi-FI":/^[A-ZÅÄÖ]+$/i,"fr-FR":/^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"it-IT":/^[A-ZÀÉÈÌÎÓÒÙ]+$/i,"ja-JP":/^[ぁ-んァ-ヶヲ-゚一-龠ー・。、]+$/i,"nb-NO":/^[A-ZÆØÅ]+$/i,"nl-NL":/^[A-ZÁÉËÏÓÖÜÚ]+$/i,"nn-NO":/^[A-ZÆØÅ]+$/i,"hu-HU":/^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,"pl-PL":/^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,"ru-RU":/^[А-ЯЁ]+$/i,"kk-KZ":/^[А-ЯЁ\u04D8\u04B0\u0406\u04A2\u0492\u04AE\u049A\u04E8\u04BA]+$/i,"sl-SI":/^[A-ZČĆĐŠŽ]+$/i,"sk-SK":/^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,"sr-RS@latin":/^[A-ZČĆŽŠĐ]+$/i,"sr-RS":/^[А-ЯЂЈЉЊЋЏ]+$/i,"sv-SE":/^[A-ZÅÄÖ]+$/i,"th-TH":/^[ก-๐\s]+$/i,"tr-TR":/^[A-ZÇĞİıÖŞÜ]+$/i,"uk-UA":/^[А-ЩЬЮЯЄIЇҐі]+$/i,"vi-VN":/^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,"ko-KR":/^[ㄱ-ㅎㅏ-ㅣ가-힣]*$/,"ku-IQ":/^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,ar:/^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,he:/^[א-ת]+$/,fa:/^['آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی']+$/i,bn:/^['ঀঁংঃঅআইঈউঊঋঌএঐওঔকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ়ঽািীুূৃৄেৈোৌ্ৎৗড়ঢ়য়ৠৡৢৣৰৱ৲৳৴৵৶৷৸৹৺৻']+$/,eo:/^[ABCĈD-GĜHĤIJĴK-PRSŜTUŬVZ]+$/i,"hi-IN":/^[\u0900-\u0961]+[\u0972-\u097F]*$/i,"si-LK":/^[\u0D80-\u0DFF]+$/,"ta-IN":/^[\u0B80-\u0BFF]+$/i,"te-IN":/^[\u0C00-\u0C7F]+$/i,"kn-IN":/^[\u0C80-\u0CFF]+$/i,"ml-IN":/^[\u0D00-\u0D7F]+$/i,"gu-IN":/^[\u0A80-\u0AFF]+$/i,"pa-IN":/^[\u0A00-\u0A7F]+$/i,"or-IN":/^[\u0B00-\u0B7F]+$/i},i=t.alphanumeric={"en-US":/^[0-9A-Z]+$/i,"az-AZ":/^[0-9A-VXYZÇƏĞİıÖŞÜ]+$/i,"bg-BG":/^[0-9А-Я]+$/i,"cs-CZ":/^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,"da-DK":/^[0-9A-ZÆØÅ]+$/i,"de-DE":/^[0-9A-ZÄÖÜß]+$/i,"el-GR":/^[0-9Α-ω]+$/i,"es-ES":/^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,"fi-FI":/^[0-9A-ZÅÄÖ]+$/i,"fr-FR":/^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"it-IT":/^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i,"ja-JP":/^[0-90-9ぁ-んァ-ヶヲ-゚一-龠ー・。、]+$/i,"hu-HU":/^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i,"nb-NO":/^[0-9A-ZÆØÅ]+$/i,"nl-NL":/^[0-9A-ZÁÉËÏÓÖÜÚ]+$/i,"nn-NO":/^[0-9A-ZÆØÅ]+$/i,"pl-PL":/^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[0-9A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,"ru-RU":/^[0-9А-ЯЁ]+$/i,"kk-KZ":/^[0-9А-ЯЁ\u04D8\u04B0\u0406\u04A2\u0492\u04AE\u049A\u04E8\u04BA]+$/i,"sl-SI":/^[0-9A-ZČĆĐŠŽ]+$/i,"sk-SK":/^[0-9A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,"sr-RS@latin":/^[0-9A-ZČĆŽŠĐ]+$/i,"sr-RS":/^[0-9А-ЯЂЈЉЊЋЏ]+$/i,"sv-SE":/^[0-9A-ZÅÄÖ]+$/i,"th-TH":/^[ก-๙\s]+$/i,"tr-TR":/^[0-9A-ZÇĞİıÖŞÜ]+$/i,"uk-UA":/^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,"ko-KR":/^[0-9ㄱ-ㅎㅏ-ㅣ가-힣]*$/,"ku-IQ":/^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,"vi-VN":/^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,ar:/^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,he:/^[0-9א-ת]+$/,fa:/^['0-9آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی۱۲۳۴۵۶۷۸۹۰']+$/i,bn:/^['ঀঁংঃঅআইঈউঊঋঌএঐওঔকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ়ঽািীুূৃৄেৈোৌ্ৎৗড়ঢ়য়ৠৡৢৣ০১২৩৪৫৬৭৮৯ৰৱ৲৳৴৵৶৷৸৹৺৻']+$/,eo:/^[0-9ABCĈD-GĜHĤIJĴK-PRSŜTUŬVZ]+$/i,"hi-IN":/^[\u0900-\u0963]+[\u0966-\u097F]*$/i,"si-LK":/^[0-9\u0D80-\u0DFF]+$/,"ta-IN":/^[0-9\u0B80-\u0BFF.]+$/i,"te-IN":/^[0-9\u0C00-\u0C7F.]+$/i,"kn-IN":/^[0-9\u0C80-\u0CFF.]+$/i,"ml-IN":/^[0-9\u0D00-\u0D7F.]+$/i,"gu-IN":/^[0-9\u0A80-\u0AFF.]+$/i,"pa-IN":/^[0-9\u0A00-\u0A7F.]+$/i,"or-IN":/^[0-9\u0B00-\u0B7F.]+$/i},a=t.decimal={"en-US":".",ar:"٫"},o=t.englishLocales=["AU","GB","HK","IN","NZ","ZA","ZM"],s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reservedIdentifierNames=void 0,t.reservedIdentifierNames=["byte","case","char","do","else","enum","eval","for","goto","if","in","int","let","long","new","null","this","true","try","var","void","with","Array","Attr","Audio","Blob","Cache","Date","Error","Event","Feed","File","Hz","Image","Intl","Lock","Map","Math","Node","Proxy","Range","Rect","Set","Table","Text","Touch"]},13447:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getFactoryDetails=t.ensureFullyBound=t.multiBindToService=void 0;var o=a(r(95507)),s=r(27801),c=r(92172),u=r(62817);t.multiBindToService=function(e){return function(t){return function(){for(var r=[],n=0;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeadCodeInjectionThresholdRule=void 0;t.DeadCodeInjectionThresholdRule=e=>(0===e.deadCodeInjectionThreshold&&(e={...e,deadCodeInjection:!1,deadCodeInjectionThreshold:0}),e)},13662:function(e,t,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},s=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),o=0;o{if(t&&m.NodeGuards.isProgramNode(e))return this.transformNode(e,t)}}:null}transformNode(e,t){return this.scopeIdentifiersTraverser.traverseScopeIdentifiers(e,t,e=>{const{isGlobalDeclaration:t,variable:r,variableLexicalScopeNode:n}=e;if(!this.options.renameGlobals&&t){if(!r.defs.every(e=>"ImportBinding"===e.type||"CatchClause"===e.type))return}this.transformScopeVariableIdentifiers(r,n,t)}),e}transformScopeVariableIdentifiers(e,t,r){var n;const i=null!==(n=e.identifiers[0])&&void 0!==n?n:null;i&&this.isReplaceableIdentifierNode(i,t,e)&&(this.storeIdentifierName(i,t,r),this.replaceIdentifierName(i,t,e))}storeIdentifierName(e,t,r){r?this.identifierReplacer.storeGlobalName(e,t):this.identifierReplacer.storeLocalName(e,t)}replaceIdentifierName(e,t,r){const n=this.identifierReplacer.replace(e,t);r.identifiers.forEach(e=>{e.name=n.name}),r.references.forEach(t=>{t.identifier.name=e.name})}isReplaceableIdentifierNode(e,t,r){const n=e.parentNode;return!(!n||g.NodeMetadata.isIgnoredNode(e)||this.isProhibitedPropertyIdentifierNode(e,n)||this.isProhibitedPropertyAssignmentPatternIdentifierNode(e,n)||this.isProhibitedClassDeclarationNameIdentifierNode(r,e,n)||this.isProhibitedExportNamedClassDeclarationIdentifierNode(e,n)||this.isProhibitedExportNamedFunctionDeclarationIdentifierNode(e,n)||this.isProhibitedExportNamedVariableDeclarationIdentifierNode(e,n)||this.isProhibitedImportSpecifierNode(e,n)||this.isProhibitedVariableNameUsedInObjectPatternNode(r,e,t)||m.NodeGuards.isLabelIdentifierNode(e,n))}isProhibitedClassDeclarationNameIdentifierNode(e,t,r){return m.NodeGuards.isClassDeclarationNode(e.scope.block)&&m.NodeGuards.isClassDeclarationNode(r)&&r.id===t}isProhibitedExportNamedClassDeclarationIdentifierNode(e,t){return m.NodeGuards.isClassDeclarationNode(t)&&t.id===e&&!!t.parentNode&&m.NodeGuards.isExportNamedDeclarationNode(t.parentNode)}isProhibitedExportNamedFunctionDeclarationIdentifierNode(e,t){return m.NodeGuards.isFunctionDeclarationNode(t)&&t.id===e&&!!t.parentNode&&m.NodeGuards.isExportNamedDeclarationNode(t.parentNode)}isProhibitedExportNamedVariableDeclarationIdentifierNode(e,t){return m.NodeGuards.isVariableDeclaratorNode(t)&&t.id===e&&!!t.parentNode&&m.NodeGuards.isVariableDeclarationNode(t.parentNode)&&!!t.parentNode.parentNode&&m.NodeGuards.isExportNamedDeclarationNode(t.parentNode.parentNode)}isProhibitedImportSpecifierNode(e,t){return m.NodeGuards.isImportSpecifierNode(t)&&t.imported.name===t.local.name}isProhibitedPropertyIdentifierNode(e,t){return m.NodeGuards.isPropertyNode(t)&&!t.computed&&m.NodeGuards.isIdentifierNode(t.key)&&m.NodeGuards.isIdentifierNode(e)&&t.shorthand&&t.key.name===e.name}isProhibitedPropertyAssignmentPatternIdentifierNode(e,t){return m.NodeGuards.isAssignmentPatternNode(t)&&t.left===e&&!!t.parentNode&&m.NodeGuards.isPropertyNode(t.parentNode)&&m.NodeGuards.isIdentifierNode(t.left)&&m.NodeGuards.isIdentifierNode(t.parentNode.key)&&t.left.name===t.parentNode.key.name}isProhibitedVariableNameUsedInObjectPatternNode(e,t,r){let n=this.lexicalScopesWithObjectPatternWithoutDeclarationMap.get(r);if(!1===n)return!1;if(!e.defs.some(e=>"var"===e.kind))return!1;let i=!1;return f.traverse(r,{enter:(e,r)=>{if(m.NodeGuards.isObjectPatternNode(e)&&r&&m.NodeGuards.isAssignmentExpressionNode(r)){n=!0;const r=e.properties;for(const e of r)if(i=m.NodeGuards.isPropertyNode(e)&&!e.computed&&e.shorthand&&m.NodeGuards.isIdentifierNode(e.key)&&t.name===e.key.name,i)return f.VisitorOption.Break}}}),this.lexicalScopesWithObjectPatternWithoutDeclarationMap.set(r,null!=n&&n),i}};t.ScopeIdentifiersTransformer=b,t.ScopeIdentifiersTransformer=b=o([(0,l.injectable)(),u(0,(0,l.inject)(d.ServiceIdentifiers.IIdentifierReplacer)),u(1,(0,l.inject)(d.ServiceIdentifiers.IRandomGenerator)),u(2,(0,l.inject)(d.ServiceIdentifiers.IOptions)),u(3,(0,l.inject)(d.ServiceIdentifiers.IScopeIdentifiersTraverser)),c("design:paramtypes",[Object,Object,Object,Object])],b)},13735:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return(0,n.default)(e),(0,i.default)(e)%parseInt(t,10)===0};var n=a(r(83399)),i=a(r(33752));function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default,e.exports.default=t.default},13752:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)(e),e=Date.parse(e),isNaN(e)?null:new Date(e)};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};e.exports=t.default,e.exports.default=t.default},14325:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if((0,i.default)(e),!a.test(e))return!1;for(var t=0,r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValidationErrorsFormatter=void 0;class r{static format(e){return e.reduce((e,t)=>[...e,r.formatWithNestedConstraints(t)],[]).join("\n")}static formatWithNestedConstraints(e){const t=e.constraints;if(!t)return`\`${e.property}\` error\n`;return`${`\`${e.property}\` errors:\n`}${Object.keys(t).map(e=>` - ${t[e]}\n`).join()}`}}t.ValidationErrorsFormatter=r},14425:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;var o=a(r(2006)),s=function(){function e(e,t){this.key=e,this.value=t}return e.prototype.toString=function(){return this.key===o.NAMED_TAG?"named: ".concat(String(this.value).toString()," "):"tagged: { key:".concat(this.key.toString(),", value: ").concat(String(this.value)," }")},e}();t.Metadata=s},14613:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.utilsModule=void 0;const n=r(71519),i=r(32287),a=r(36202),o=r(49081),s=r(48211),c=r(22292),u=r(99319),l=r(30486),d=r(62717);t.utilsModule=new n.ContainerModule(e=>{e(i.ServiceIdentifiers.IArrayUtils).to(a.ArrayUtils).inSingletonScope(),e(i.ServiceIdentifiers.IRandomGenerator).to(l.RandomGenerator).inSingletonScope(),e(i.ServiceIdentifiers.ICryptUtils).to(o.CryptUtils).inSingletonScope(),e(i.ServiceIdentifiers.ICryptUtilsStringArray).to(s.CryptUtilsStringArray).inSingletonScope(),e(i.ServiceIdentifiers.IEscapeSequenceEncoder).to(c.EscapeSequenceEncoder).inSingletonScope(),e(i.ServiceIdentifiers.ILevelledTopologicalSorter).to(u.LevelledTopologicalSorter),e(i.ServiceIdentifiers.ISetUtils).to(d.SetUtils).inSingletonScope()})},14866:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.preDestroy=void 0;var o=a(r(95507)),s=a(r(2006)),c=(0,r(44872).propertyEventDecorator)(s.PRE_DESTROY,o.MULTIPLE_PRE_DESTROY_METHODS);t.preDestroy=c},15061:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DebugProtectionFunctionCodeHelper=void 0;const o=r(71519),s=r(32287),c=r(72167),u=r(10548),l=r(83142),d=r(23787),f=r(2665),p=r(88318),h=r(25120);let m=class extends p.AbstractCustomCodeHelper{constructor(e,t,r,n,i){super(e,t,r,n,i)}initialize(e){this.debugProtectionFunctionName=e}getNodeStructure(e){return h.NodeUtils.convertCodeToStructure(e)}getCodeHelperTemplate(){const e=this.options.target!==c.ObfuscationTarget.BrowserNoEval?(0,l.DebuggerTemplate)():(0,d.DebuggerTemplateNoEval)();return this.customCodeHelperFormatter.formatTemplate((0,f.DebugProtectionFunctionTemplate)(),{debuggerTemplate:e,debugProtectionFunctionName:this.debugProtectionFunctionName})}};t.DebugProtectionFunctionCodeHelper=m,n([(0,u.initializable)(),i("design:type",String)],m.prototype,"debugProtectionFunctionName",void 0),t.DebugProtectionFunctionCodeHelper=m=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperFormatter)),a(2,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperObfuscator)),a(3,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(4,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Function,Object,Object,Object,Object])],m)},15140:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.CodeTransformerNamesGroupsBuilder=void 0;const i=r(71519),a=r(17412);let o=class extends a.AbstractTransformerNamesGroupsBuilder{};t.CodeTransformerNamesGroupsBuilder=o,t.CodeTransformerNamesGroupsBuilder=o=n([(0,i.injectable)()],o)},15236:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DebugProtectionFunctionIntervalCodeHelper=void 0;const o=r(71519),s=r(32287),c=r(72167),u=r(10548),l=r(90828),d=r(44010),f=r(88318),p=r(25120);let h=class extends f.AbstractCustomCodeHelper{constructor(e,t,r,n,i){super(e,t,r,n,i)}initialize(e,t){this.debugProtectionFunctionName=e,this.debugProtectionInterval=t}getNodeStructure(e){return p.NodeUtils.convertCodeToStructure(e)}getCodeHelperTemplate(){const e=this.options.target!==c.ObfuscationTarget.BrowserNoEval?this.getGlobalVariableTemplate():(0,d.GlobalVariableNoEvalTemplate)();return this.customCodeHelperFormatter.formatTemplate((0,l.DebugProtectionFunctionIntervalTemplate)(),{debugProtectionFunctionName:this.debugProtectionFunctionName,debugProtectionInterval:this.debugProtectionInterval,globalVariableTemplate:e})}};t.DebugProtectionFunctionIntervalCodeHelper=h,n([(0,u.initializable)(),i("design:type",String)],h.prototype,"debugProtectionFunctionName",void 0),n([(0,u.initializable)(),i("design:type",Number)],h.prototype,"debugProtectionInterval",void 0),t.DebugProtectionFunctionIntervalCodeHelper=h=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperFormatter)),a(2,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperObfuscator)),a(3,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(4,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Function,Object,Object,Object,Object])],h)},15426:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayEncodingRule=void 0;const n=r(70885);t.StringArrayEncodingRule=e=>(e.stringArrayEncoding.length||(e={...e,stringArrayEncoding:[n.StringArrayEncoding.None]}),e)},15639:function(e,t,r){"use strict";var n,i,a=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},c=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),i=0;i{if(t&&S.NodeGuards.isLiteralNode(e))return this.transformNode(e,t)}}:null}transformNode(e,t){if(v.NodeLiteralUtils.isProhibitedLiteralNode(e,t))return e;const r=this.transformLiteralNodeByChunkLength(e,i.firstPassChunkLength),n=p.replace(r,{enter:(e,t)=>{if(S.NodeGuards.isLiteralNode(e))return this.transformLiteralNodeByChunkLength(e,this.options.splitStringsChunkLength)}});return _.NodeUtils.parentizeNode(n,t),_.NodeUtils.parentizeAst(n),n}transformLiteralNodeByChunkLength(e,t){if(!v.NodeLiteralUtils.isStringLiteralNode(e))return e;const r=h.length(e.value);if(t>=r)return e;const n=i.chunkString(e.value,r,t);return this.transformStringChunksToBinaryExpressionNode(n)}transformStringChunksToBinaryExpressionNode(e){const t=e.length;if(t<2)throw new Error("First and second chunks values should not be empty");let r=y.NodeFactory.binaryExpressionNode("+",y.NodeFactory.literalNode(e[0]),y.NodeFactory.literalNode(e[1]));for(let n=2;n{const n=r(8156),i={};for(const e of Object.keys(n))i[n[e]]=e;const a={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};e.exports=a;for(const e of Object.keys(a)){if(!("channels"in a[e]))throw new Error("missing channels property: "+e);if(!("labels"in a[e]))throw new Error("missing channel labels property: "+e);if(a[e].labels.length!==a[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:r}=a[e];delete a[e].channels,delete a[e].labels,Object.defineProperty(a[e],"channels",{value:t}),Object.defineProperty(a[e],"labels",{value:r})}function o(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}a.rgb.hsl=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=a-i;let s,c;a===i?s=0:t===a?s=(r-n)/o:r===a?s=2+(n-t)/o:n===a&&(s=4+(t-r)/o),s=Math.min(60*s,360),s<0&&(s+=360);const u=(i+a)/2;return c=a===i?0:u<=.5?o/(a+i):o/(2-a-i),[s,100*c,100*u]},a.rgb.hsv=function(e){let t,r,n,i,a;const o=e[0]/255,s=e[1]/255,c=e[2]/255,u=Math.max(o,s,c),l=u-Math.min(o,s,c),d=function(e){return(u-e)/6/l+.5};return 0===l?(i=0,a=0):(a=l/u,t=d(o),r=d(s),n=d(c),o===u?i=n-r:s===u?i=1/3+t-n:c===u&&(i=2/3+r-t),i<0?i+=1:i>1&&(i-=1)),[360*i,100*a,100*u]},a.rgb.hwb=function(e){const t=e[0],r=e[1];let n=e[2];const i=a.rgb.hsl(e)[0],o=1/255*Math.min(t,Math.min(r,n));return n=1-1/255*Math.max(t,Math.max(r,n)),[i,100*o,100*n]},a.rgb.cmyk=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,i=Math.min(1-t,1-r,1-n);return[100*((1-t-i)/(1-i)||0),100*((1-r-i)/(1-i)||0),100*((1-n-i)/(1-i)||0),100*i]},a.rgb.keyword=function(e){const t=i[e];if(t)return t;let r,a=1/0;for(const t of Object.keys(n)){const i=o(e,n[t]);i.04045?((t+.055)/1.055)**2.4:t/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;return[100*(.4124*t+.3576*r+.1805*n),100*(.2126*t+.7152*r+.0722*n),100*(.0193*t+.1192*r+.9505*n)]},a.rgb.lab=function(e){const t=a.rgb.xyz(e);let r=t[0],n=t[1],i=t[2];r/=95.047,n/=100,i/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;return[116*n-16,500*(r-n),200*(n-i)]},a.hsl.rgb=function(e){const t=e[0]/360,r=e[1]/100,n=e[2]/100;let i,a,o;if(0===r)return o=255*n,[o,o,o];i=n<.5?n*(1+r):n+r-n*r;const s=2*n-i,c=[0,0,0];for(let e=0;e<3;e++)a=t+1/3*-(e-1),a<0&&a++,a>1&&a--,o=6*a<1?s+6*(i-s)*a:2*a<1?i:3*a<2?s+(i-s)*(2/3-a)*6:s,c[e]=255*o;return c},a.hsl.hsv=function(e){const t=e[0];let r=e[1]/100,n=e[2]/100,i=r;const a=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,i*=a<=1?a:2-a;return[t,100*(0===n?2*i/(a+i):2*r/(n+r)),100*((n+r)/2)]},a.hsv.rgb=function(e){const t=e[0]/60,r=e[1]/100;let n=e[2]/100;const i=Math.floor(t)%6,a=t-Math.floor(t),o=255*n*(1-r),s=255*n*(1-r*a),c=255*n*(1-r*(1-a));switch(n*=255,i){case 0:return[n,c,o];case 1:return[s,n,o];case 2:return[o,n,c];case 3:return[o,s,n];case 4:return[c,o,n];case 5:return[n,o,s]}},a.hsv.hsl=function(e){const t=e[0],r=e[1]/100,n=e[2]/100,i=Math.max(n,.01);let a,o;o=(2-r)*n;const s=(2-r)*i;return a=r*i,a/=s<=1?s:2-s,a=a||0,o/=2,[t,100*a,100*o]},a.hwb.rgb=function(e){const t=e[0]/360;let r=e[1]/100,n=e[2]/100;const i=r+n;let a;i>1&&(r/=i,n/=i);const o=Math.floor(6*t),s=1-n;a=6*t-o,1&o&&(a=1-a);const c=r+a*(s-r);let u,l,d;switch(o){default:case 6:case 0:u=s,l=c,d=r;break;case 1:u=c,l=s,d=r;break;case 2:u=r,l=s,d=c;break;case 3:u=r,l=c,d=s;break;case 4:u=c,l=r,d=s;break;case 5:u=s,l=r,d=c}return[255*u,255*l,255*d]},a.cmyk.rgb=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100,i=e[3]/100;return[255*(1-Math.min(1,t*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i)),255*(1-Math.min(1,n*(1-i)+i))]},a.xyz.rgb=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100;let i,a,o;return i=3.2406*t+-1.5372*r+-.4986*n,a=-.9689*t+1.8758*r+.0415*n,o=.0557*t+-.204*r+1.057*n,i=i>.0031308?1.055*i**(1/2.4)-.055:12.92*i,a=a>.0031308?1.055*a**(1/2.4)-.055:12.92*a,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),o=Math.min(Math.max(0,o),1),[255*i,255*a,255*o]},a.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;return[116*r-16,500*(t-r),200*(r-n)]},a.lab.xyz=function(e){let t,r,n;r=(e[0]+16)/116,t=e[1]/500+r,n=r-e[2]/200;const i=r**3,a=t**3,o=n**3;return r=i>.008856?i:(r-16/116)/7.787,t=a>.008856?a:(t-16/116)/7.787,n=o>.008856?o:(n-16/116)/7.787,t*=95.047,r*=100,n*=108.883,[t,r,n]},a.lab.lch=function(e){const t=e[0],r=e[1],n=e[2];let i;i=360*Math.atan2(n,r)/2/Math.PI,i<0&&(i+=360);return[t,Math.sqrt(r*r+n*n),i]},a.lch.lab=function(e){const t=e[0],r=e[1],n=e[2]/360*2*Math.PI;return[t,r*Math.cos(n),r*Math.sin(n)]},a.rgb.ansi16=function(e,t=null){const[r,n,i]=e;let o=null===t?a.rgb.hsv(e)[2]:t;if(o=Math.round(o/50),0===o)return 30;let s=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return 2===o&&(s+=60),s},a.hsv.ansi16=function(e){return a.rgb.ansi16(a.hsv.rgb(e),e[2])},a.rgb.ansi256=function(e){const t=e[0],r=e[1],n=e[2];if(t===r&&r===n)return t<8?16:t>248?231:Math.round((t-8)/247*24)+232;return 16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},a.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const r=.5*(1+~~(e>50));return[(1&t)*r*255,(t>>1&1)*r*255,(t>>2&1)*r*255]},a.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;e-=16;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},a.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},a.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let r=t[0];3===t[0].length&&(r=r.split("").map(e=>e+e).join(""));const n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},a.rgb.hcg=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,i=Math.max(Math.max(t,r),n),a=Math.min(Math.min(t,r),n),o=i-a;let s,c;return s=o<1?a/(1-o):0,c=o<=0?0:i===t?(r-n)/o%6:i===r?2+(n-t)/o:4+(t-r)/o,c/=6,c%=1,[360*c,100*o,100*s]},a.hsl.hcg=function(e){const t=e[1]/100,r=e[2]/100,n=r<.5?2*t*r:2*t*(1-r);let i=0;return n<1&&(i=(r-.5*n)/(1-n)),[e[0],100*n,100*i]},a.hsv.hcg=function(e){const t=e[1]/100,r=e[2]/100,n=t*r;let i=0;return n<1&&(i=(r-n)/(1-n)),[e[0],100*n,100*i]},a.hcg.rgb=function(e){const t=e[0]/360,r=e[1]/100,n=e[2]/100;if(0===r)return[255*n,255*n,255*n];const i=[0,0,0],a=t%1*6,o=a%1,s=1-o;let c=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return c=(1-r)*n,[255*(r*i[0]+c),255*(r*i[1]+c),255*(r*i[2]+c)]},a.hcg.hsv=function(e){const t=e[1]/100,r=t+e[2]/100*(1-t);let n=0;return r>0&&(n=t/r),[e[0],100*n,100*r]},a.hcg.hsl=function(e){const t=e[1]/100,r=e[2]/100*(1-t)+.5*t;let n=0;return r>0&&r<.5?n=t/(2*r):r>=.5&&r<1&&(n=t/(2*(1-r))),[e[0],100*n,100*r]},a.hcg.hwb=function(e){const t=e[1]/100,r=t+e[2]/100*(1-t);return[e[0],100*(r-t),100*(1-r)]},a.hwb.hcg=function(e){const t=e[1]/100,r=1-e[2]/100,n=r-t;let i=0;return n<1&&(i=(r-n)/(1-n)),[e[0],100*n,100*i]},a.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},a.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},a.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},a.gray.hsl=function(e){return[0,0,e[0]]},a.gray.hsv=a.gray.hsl,a.gray.hwb=function(e){return[0,100,e[0]]},a.gray.cmyk=function(e){return[0,0,0,e[0]]},a.gray.lab=function(e){return[e[0],0,0]},a.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(r.length)+r},a.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},15882:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayScopeCallsWrapperFunctionNode=void 0;const o=r(71519),s=r(32287),c=r(10548),u=r(35126),l=r(91363),d=r(25120);let f=class extends u.AbstractStringArrayCallNode{constructor(e,t,r,n,i,a,o){super(e,t,r,n,i,a,o)}initialize(e,t){this.stringArrayScopeCallsWrapperData=e,this.upperStringArrayCallsWrapperData=t}getNodeStructure(){var e,t,r,n,i,a,o,s;const c=l.NodeFactory.identifierNode(this.randomGenerator.getRandomString(6)),f=l.NodeFactory.identifierNode(this.randomGenerator.getRandomString(6)),p=this.getUpperStringArrayCallNode(c,this.getStringArrayIndexNode(this.stringArrayScopeCallsWrapperData.index-this.upperStringArrayCallsWrapperData.index)),h=this.arrayUtils.fillWithRange(this.stringArrayScopeCallsWrapperData.parameterIndexesData?this.options.stringArrayWrappersParametersMaxCount:u.AbstractStringArrayCallNode.stringArrayRootCallsWrapperParametersCount,()=>this.getFakeParameterNode());h.splice(null!==(t=null===(e=this.stringArrayScopeCallsWrapperData.parameterIndexesData)||void 0===e?void 0:e.valueIndexParameterIndex)&&void 0!==t?t:0,1,c),h.splice(null!==(n=null===(r=this.stringArrayScopeCallsWrapperData.parameterIndexesData)||void 0===r?void 0:r.decodeKeyParameterIndex)&&void 0!==n?n:1,1,f);const m=this.arrayUtils.fillWithRange(this.upperStringArrayCallsWrapperData.parameterIndexesData?this.options.stringArrayWrappersParametersMaxCount:u.AbstractStringArrayCallNode.stringArrayRootCallsWrapperParametersCount,e=>this.getUpperStringArrayCallNode(h[e],this.getFakeUpperStringArrayIndexNode()));m.splice(null!==(a=null===(i=this.upperStringArrayCallsWrapperData.parameterIndexesData)||void 0===i?void 0:i.valueIndexParameterIndex)&&void 0!==a?a:0,1,p),m.splice(null!==(s=null===(o=this.upperStringArrayCallsWrapperData.parameterIndexesData)||void 0===o?void 0:o.decodeKeyParameterIndex)&&void 0!==s?s:1,1,f);const g=l.NodeFactory.functionDeclarationNode(this.stringArrayScopeCallsWrapperData.name,h,l.NodeFactory.blockStatementNode([l.NodeFactory.returnStatementNode(l.NodeFactory.callExpressionNode(l.NodeFactory.identifierNode(this.upperStringArrayCallsWrapperData.name),m))])),b=g;d.NodeUtils.parentizeAst(b);for(const e of h)e.name=this.identifierNamesGenerator.generateForLexicalScope(g);return[b]}getUpperStringArrayCallNode(e,t){return l.NodeFactory.binaryExpressionNode("-",e,t)}getFakeParameterNode(){return l.NodeFactory.identifierNode(this.randomGenerator.getRandomString(6))}getFakeUpperStringArrayIndexNode(){return this.getStringArrayIndexNode(this.randomGenerator.getRandomInteger(0,500))}};t.StringArrayScopeCallsWrapperFunctionNode=f,n([(0,c.initializable)(),i("design:type",Object)],f.prototype,"upperStringArrayCallsWrapperData",void 0),n([(0,c.initializable)(),i("design:type",Object)],f.prototype,"stringArrayScopeCallsWrapperData",void 0),t.StringArrayScopeCallsWrapperFunctionNode=f=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.Factory__IStringArrayIndexNode)),a(2,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperFormatter)),a(3,(0,o.inject)(s.ServiceIdentifiers.IStringArrayStorage)),a(4,(0,o.inject)(s.ServiceIdentifiers.IArrayUtils)),a(5,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(6,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Function,Function,Object,Object,Object,Object,Object])],f)},16128:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SourceCode=void 0;t.SourceCode=class{constructor(e,t){this.sourceCode=e,this.sourceMap=t}getSourceCode(){return this.sourceCode}getSourceMap(){return this.sourceMap}toString(){return this.sourceCode}}},16586:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTargetsFromMetadataProviders=function(e,t){return function(r){const o=e(r);let s=(0,i.getBaseType)(r);for(;void 0!==s&&s!==Object;){const e=t(s);for(const[t,r]of e)o.properties.has(t)||o.properties.set(t,r);s=(0,i.getBaseType)(s)}const c=[];for(const e of o.constructorArguments)if(e.kind!==n.ClassElementMetadataKind.unmanaged){const t=e.targetName??"";c.push(new a.LegacyTargetImpl(t,e,"ConstructorArgument"))}for(const[e,t]of o.properties)if(t.kind!==n.ClassElementMetadataKind.unmanaged){const r=t.targetName??e;c.push(new a.LegacyTargetImpl(r,t,"ClassProperty"))}return c}};const n=r(86277),i=r(55028),a=r(80877)},16744:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.codeTransformersModule=void 0;const n=r(59404),i=r(71519),a=r(32287),o=r(30102),s=r(15140),c=r(64522);t.codeTransformersModule=new i.ContainerModule(e=>{e(a.ServiceIdentifiers.Factory__ICodeTransformer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.ICodeTransformer)),e(a.ServiceIdentifiers.ICodeTransformerNamesGroupsBuilder).to(s.CodeTransformerNamesGroupsBuilder).inSingletonScope(),e(a.ServiceIdentifiers.ICodeTransformer).to(c.HashbangOperatorTransformer).whenTargetNamed(o.CodeTransformer.HashbangOperatorTransformer)})},16811:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Plan=void 0;var r=function(e,t){this.parentContext=e,this.rootRequest=t};t.Plan=r},17092:(e,t,r)=>{var n=r(32364);t.encode=function(e){var t,r="",i=function(e){return e<0?1+(-e<<1):0+(e<<1)}(e);do{t=31&i,(i>>>=5)>0&&(t|=32),r+=n.encode(t)}while(i>0);return r},t.decode=function(e,t,r){var i,a,o,s,c=e.length,u=0,l=0;do{if(t>=c)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(a=n.decode(e.charCodeAt(t++))))throw new Error("Invalid base64 digit: "+e.charAt(t-1));i=!!(32&a),u+=(a&=31)<>1,1&~o?s:-s),r.rest=t}},17115:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";(0,n.default)(e);var r=e.split("/");if(2!==r.length)return!1;if(!o.test(r[1]))return!1;if(r[1].length>1&&r[1].startsWith("0"))return!1;if(!(0,i.default)(r[0],t))return!1;var a=null;switch(String(t)){case"4":a=s;break;case"6":a=c;break;default:a=(0,i.default)(r[0],"6")?c:s}return r[1]<=a&&r[1]>=0};var n=a(r(83399)),i=a(r(35372));function a(e){return e&&e.__esModule?e:{default:e}}var o=/^\d{1,3}$/,s=32,c=128;e.exports=t.default,e.exports.default=t.default},17179:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;(0,i.default)(e);var r=function(e){var t=function(e){var t={};return Array.from(e).forEach(function(e){t[e]?t[e]+=1:t[e]=1}),t}(e),r={length:e.length,uniqueChars:Object.keys(t).length,uppercaseCount:0,lowercaseCount:0,numberCount:0,symbolCount:0};return Object.keys(t).forEach(function(e){o.test(e)?r.uppercaseCount+=t[e]:s.test(e)?r.lowercaseCount+=t[e]:c.test(e)?r.numberCount+=t[e]:u.test(e)&&(r.symbolCount+=t[e])}),r}(e);if((t=(0,n.default)(t||{},l)).returnScore)return function(e,t){var r=0;r+=e.uniqueChars*t.pointsPerUnique,r+=(e.length-e.uniqueChars)*t.pointsPerRepeat,e.lowercaseCount>0&&(r+=t.pointsForContainingLower);e.uppercaseCount>0&&(r+=t.pointsForContainingUpper);e.numberCount>0&&(r+=t.pointsForContainingNumber);e.symbolCount>0&&(r+=t.pointsForContainingSymbol);return r}(r,t);return r.length>=t.minLength&&r.lowercaseCount>=t.minLowercase&&r.uppercaseCount>=t.minUppercase&&r.numberCount>=t.minNumbers&&r.symbolCount>=t.minSymbols};var n=a(r(93610)),i=a(r(83399));function a(e){return e&&e.__esModule?e:{default:e}}var o=/^[A-Z]$/,s=/^[a-z]$/,c=/^[0-9]$/,u=/^[-#!$@£%^&*()_+|~=`{}\[\]:";'<>?,.\/\\ ]$/,l={minLength:8,minLowercase:1,minUppercase:1,minNumbers:1,minSymbols:1,returnScore:!1,pointsPerUnique:1,pointsPerRepeat:.5,pointsForContainingLower:10,pointsForContainingUpper:10,pointsForContainingNumber:10,pointsForContainingSymbol:10};e.exports=t.default,e.exports.default=t.default},17336:(e,t,r)=>{var n=r(75617);e.exports=function(e,t){return new Promise(function(r,i){var a,o=t||{};function s(e){i(e||new Error("Aborted"))}function c(e,t){e.bail?s(e):a.retry(e)?o.onRetry&&o.onRetry(e,t):i(a.mainError())}"randomize"in o||(o.randomize=!0),(a=n.operation(o)).attempt(function(t){var n;try{n=e(s,t)}catch(e){return void c(e,t)}Promise.resolve(n).then(r).catch(function(e){c(e,t)})})})}},17412:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractTransformerNamesGroupsBuilder=void 0;const o=r(71519),s=r(32287);let c=class{constructor(e){this.levelledTopologicalSorter=e}build(e){const t=Object.keys(e),r=this.buildTransformersRelationEdges(t,e);for(const[e,t]of r)this.levelledTopologicalSorter.add(e,t);return this.levelledTopologicalSorter.sortByGroups()}buildTransformersRelationEdges(e,t){const r=[];for(const n of e){const e=t[n].runAfter;if(!(null==e?void 0:e.length))r.push([n,null]);else for(const i of e){void 0===t[i]?r.push([n,null]):r.push([i,n])}}return r}};t.AbstractTransformerNamesGroupsBuilder=c,t.AbstractTransformerNamesGroupsBuilder=c=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.ILevelledTopologicalSorter)),i("design:paramtypes",[Object])],c)},17604:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InputFileNameRule=void 0;const n=r(19793);t.InputFileNameRule=e=>{let{inputFileName:t}=e;return t&&(t=t.replace(/^\/+/,"").split(n.StringSeparator.Dot).slice(0,-1).join(n.StringSeparator.Dot)||t,e={...e,inputFileName:`${t}.js`}),e}},17793:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertingTransformersModule=void 0;const n=r(71519),i=r(59404),a=r(32287),o=r(96390),s=r(46263),c=r(35614),u=r(17893),l=r(66826),d=r(30664),f=r(77344),p=r(61936),h=r(23908),m=r(60739),g=r(34516),b=r(88691),y=r(78134),S=r(15639),v=r(80391);t.convertingTransformersModule=new n.ContainerModule(e=>{e(a.ServiceIdentifiers.INodeTransformer).to(u.BooleanLiteralTransformer).whenTargetNamed(o.NodeTransformer.BooleanLiteralTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(l.ExportSpecifierTransformer).whenTargetNamed(o.NodeTransformer.ExportSpecifierTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(d.MemberExpressionTransformer).whenTargetNamed(o.NodeTransformer.MemberExpressionTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(f.ClassFieldTransformer).whenTargetNamed(o.NodeTransformer.ClassFieldTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(p.NumberLiteralTransformer).whenTargetNamed(o.NodeTransformer.NumberLiteralTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(h.NumberToNumericalExpressionTransformer).whenTargetNamed(o.NodeTransformer.NumberToNumericalExpressionTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(m.ObjectExpressionKeysTransformer).whenTargetNamed(o.NodeTransformer.ObjectExpressionKeysTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(b.ObjectExpressionTransformer).whenTargetNamed(o.NodeTransformer.ObjectExpressionTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(y.ObjectPatternPropertiesTransformer).whenTargetNamed(o.NodeTransformer.ObjectPatternPropertiesTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(S.SplitStringTransformer).whenTargetNamed(o.NodeTransformer.SplitStringTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(v.TemplateLiteralTransformer).whenTargetNamed(o.NodeTransformer.TemplateLiteralTransformer),e(a.ServiceIdentifiers.IObjectExpressionExtractor).to(g.ObjectExpressionToVariableDeclarationExtractor).whenTargetNamed(s.ObjectExpressionExtractor.ObjectExpressionToVariableDeclarationExtractor),e(a.ServiceIdentifiers.IObjectExpressionExtractor).to(c.BasePropertiesExtractor).whenTargetNamed(s.ObjectExpressionExtractor.BasePropertiesExtractor),e(a.ServiceIdentifiers.Factory__IObjectExpressionExtractor).toFactory(i.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.IObjectExpressionExtractor))})},17893:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanLiteralTransformer=void 0;const o=r(71519),s=r(32287),c=r(18436),u=r(76893),l=r(23615),d=r(25120),f=r(91363);let p=class extends u.AbstractNodeTransformer{constructor(e,t){super(e,t)}getVisitor(e){return e===c.NodeTransformationStage.Converting?{enter:(e,t)=>{if(t&&l.NodeGuards.isLiteralNode(e))return this.transformNode(e,t)}}:null}transformNode(e,t){if("boolean"!=typeof e.value)return e;const r=e.value?this.getTrueUnaryExpressionNode():this.getFalseUnaryExpressionNode();return d.NodeUtils.parentizeNode(r,t),r}getTrueUnaryExpressionNode(){return f.NodeFactory.unaryExpressionNode("!",this.getFalseUnaryExpressionNode())}getFalseUnaryExpressionNode(){return f.NodeFactory.unaryExpressionNode("!",f.NodeFactory.arrayExpressionNode())}};t.BooleanLiteralTransformer=p,t.BooleanLiteralTransformer=p=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object,Object])],p)},18316:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayCallsWrapperRc4CodeHelper=void 0;const i=r(71519),a=r(54618),o=r(2781),s=r(32047),c=r(51507);let u=class extends c.StringArrayCallsWrapperCodeHelper{getDecodeStringArrayTemplate(){const e=this.randomGenerator.getRandomString(6),t=this.randomGenerator.getRandomString(6),r=this.customCodeHelperFormatter.formatTemplate((0,a.AtobTemplate)(this.options.selfDefending),{atobFunctionName:e}),n=this.customCodeHelperFormatter.formatTemplate((0,o.Rc4Template)(),{atobFunctionName:e,rc4FunctionName:t}),i=this.getSelfDefendingTemplate();return this.customCodeHelperFormatter.formatTemplate((0,s.StringArrayRC4DecodeTemplate)(this.randomGenerator),{atobPolyfill:r,rc4FunctionName:t,rc4Polyfill:n,selfDefendingCode:i,stringArrayCallsWrapperName:this.stringArrayCallsWrapperName,stringArrayFunctionName:this.stringArrayFunctionName})}};t.StringArrayCallsWrapperRc4CodeHelper=u,t.StringArrayCallsWrapperRc4CodeHelper=u=n([(0,i.injectable)()],u)},18436:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.NodeTransformationStage=void 0,function(e){e.ControlFlowFlattening="ControlFlowFlattening",e.Converting="Converting",e.DeadCodeInjection="DeadCodeInjection",e.Finalizing="Finalizing",e.Initializing="Initializing",e.Preparing="Preparing",e.RenameIdentifiers="RenameIdentifiers",e.RenameProperties="RenameProperties",e.Simplifying="Simplifying",e.StringArray="StringArray"}(r||(t.NodeTransformationStage=r={}))},18649:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.IsAllowedForObfuscationTargets=function(e,t){return(r,n)=>{(0,i.registerDecorator)({propertyName:n,constraints:[e],name:"IsAllowedForObfuscationTargets",options:t,target:r.constructor,validator:{validate(t,r){const i=r.object,o=s.DEFAULT_PRESET[n];return(0,a.default)(t,o)||e.includes(i.target)},defaultMessage:t=>`This option allowed only for obfuscation targets: ${e.join(`${o.StringSeparator.Comma} `)}`}})}};const i=r(90804),a=n(r(32017)),o=r(19793),s=r(11839)},19e3:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.StringControlFlowStorage=void 0;const o=r(71519),s=r(32287),c=r(6377);let u=class extends c.FunctionControlFlowStorage{constructor(e,t,r){super(e,t,r)}initialize(){super.initialize(),this.storageId=this.identifierNamesGenerator.generateForGlobalScope()}};t.StringControlFlowStorage=u,t.StringControlFlowStorage=u=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),a(2,(0,o.inject)(s.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),i("design:paramtypes",[Object,Object,Function])],u)},19158:function(e,t,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},s=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),o=0;o{if(t&&m.NodeGuards.isLabeledStatementNode(e))return this.transformNode(e,t)}}:null}transformNode(e,t){const r=g.NodeLexicalScopeUtils.getLexicalScope(e);return r?(this.storeLabeledStatementName(e,r),this.replaceLabeledStatementName(e,r),e):e}storeLabeledStatementName(e,t){this.identifierReplacer.storeLocalName(e.label,t)}replaceLabeledStatementName(e,t){f.replace(e,{enter:(e,r)=>{if(r&&m.NodeGuards.isLabelIdentifierNode(e,r)){const r=this.identifierReplacer.replace(e,t);e.name=r.name}}})}};t.LabeledStatementTransformer=b,t.LabeledStatementTransformer=b=o([(0,l.injectable)(),u(0,(0,l.inject)(d.ServiceIdentifiers.IIdentifierReplacer)),u(1,(0,l.inject)(d.ServiceIdentifiers.IRandomGenerator)),u(2,(0,l.inject)(d.ServiceIdentifiers.IOptions)),c("design:paramtypes",[Object,Object,Object])],b)},19225:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},o=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ScopeIdentifiersTraverser=void 0;const s=r(71519),c=r(32287),u=r(23615);let l=n=class{constructor(e){this.scopeAnalyzer=e}traverseScopeIdentifiers(e,t,r){this.scopeAnalyzer.analyze(e);const n=this.scopeAnalyzer.acquireScope(e);this.traverseScopeIdentifiersRecursive(n,n,r)}traverseScopeThroughIdentifiers(e,t,r){this.scopeAnalyzer.analyze(e);const n=this.scopeAnalyzer.acquireScope(e);this.traverseScopeThroughIdentifiersRecursive(n,n,r)}traverseScopeIdentifiersRecursive(e,t,r){const i=t.variableScope,a=u.NodeGuards.isNodeWithBlockLexicalScope(i.block)?i.block:null,o=n.globalScopeNames.includes(i.type);if(a){for(const s of t.variables){if(s.name===n.argumentsVariableName)continue;r({isGlobalDeclaration:o,isBubblingDeclaration:s.identifiers.some(e=>e.parentNode&&u.NodeGuards.isPropertyNode(e.parentNode)&&e.parentNode.shorthand),rootScope:e,variable:s,variableScope:i,variableLexicalScopeNode:a})}for(const n of t.childScopes)this.traverseScopeIdentifiersRecursive(e,n,r)}}traverseScopeThroughIdentifiersRecursive(e,t,r){const i=t.variableScope,a=u.NodeGuards.isNodeWithBlockLexicalScope(i.block)?i.block:null,o=n.globalScopeNames.includes(i.type);if(a){for(const e of t.through)r({isGlobalDeclaration:o,reference:e,variableLexicalScopeNode:a});for(const n of t.childScopes)this.traverseScopeThroughIdentifiersRecursive(e,n,r)}}};t.ScopeIdentifiersTraverser=l,l.argumentsVariableName="arguments",l.globalScopeNames=["global","module"],t.ScopeIdentifiersTraverser=l=n=i([(0,s.injectable)(),o(0,(0,s.inject)(c.ServiceIdentifiers.IScopeAnalyzer)),a("design:paramtypes",[Object])],l)},19266:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r;if((0,n.default)(e),"[object Array]"===Object.prototype.toString.call(t)){var a=[];for(r in t)({}).hasOwnProperty.call(t,r)&&(a[r]=(0,i.default)(t[r]));return a.indexOf(e)>=0}if("object"===o(t))return t.hasOwnProperty(e);if(t&&"function"==typeof t.indexOf)return t.indexOf(e)>=0;return!1};var n=a(r(83399)),i=a(r(45772));function a(e){return e&&e.__esModule?e:{default:e}}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}e.exports=t.default,e.exports.default=t.default},19384:(e,t,r)=>{"use strict";var n=r(65606);Object.defineProperty(t,"__esModule",{value:!0});var i=r(45906),a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(88262)),o=r(65903);function s(e){return function(t){if(!t.token.startsWith("vercel_blob_client_"))throw new(0,i.BlobError)(`${e} must be called with a client token`);if(void 0!==t.addRandomSuffix||void 0!==t.allowOverwrite||void 0!==t.cacheControlMaxAge)throw new(0,i.BlobError)(`${e} doesn't allow \`addRandomSuffix\`, \`cacheControlMaxAge\` or \`allowOverwrite\`. Configure these options at the server side when generating client tokens.`)}}var c=i.createPutMethod.call(void 0,{allowedOptions:["contentType"],extraChecks:s("client/`put`")}),u=i.createCreateMultipartUploadMethod.call(void 0,{allowedOptions:["contentType"],extraChecks:s("client/`createMultipartUpload`")}),l=i.createCreateMultipartUploaderMethod.call(void 0,{allowedOptions:["contentType"],extraChecks:s("client/`createMultipartUpload`")}),d=i.createUploadPartMethod.call(void 0,{allowedOptions:["contentType"],extraChecks:s("client/`multipartUpload`")}),f=i.createCompleteMultipartUploadMethod.call(void 0,{allowedOptions:["contentType"],extraChecks:s("client/`completeMultipartUpload`")}),p=i.createPutMethod.call(void 0,{allowedOptions:["contentType"],extraChecks(e){if(void 0===e.handleUploadUrl)throw new(0,i.BlobError)("client/`upload` requires the 'handleUploadUrl' parameter");if(void 0!==e.addRandomSuffix||void 0!==e.createPutExtraChecks||void 0!==e.cacheControlMaxAge)throw new(0,i.BlobError)("client/`upload` doesn't allow `addRandomSuffix`, `cacheControlMaxAge` or `allowOverwrite`. Configure these options at the server side when generating client tokens.")},async getToken(e,t){var r,n;return async function(e){const{handleUploadUrl:t,pathname:r}=e,n=function(e){try{return Boolean(new URL(e))}catch(e){return!1}}(t)?t:function(e){return new URL(e,location.href).href}(t),a={type:g.generateClientToken,payload:{pathname:r,clientPayload:e.clientPayload,multipart:e.multipart}},s=await o.fetch.call(void 0,n,{method:"POST",body:JSON.stringify(a),headers:{"content-type":"application/json",...e.headers},signal:e.abortSignal});if(!s.ok)throw new(0,i.BlobError)("Failed to retrieve the client token");try{const{clientToken:e}=await s.json();return e}catch(e){throw new(0,i.BlobError)("Failed to retrieve the client token")}}({handleUploadUrl:t.handleUploadUrl,pathname:e,clientPayload:null!=(r=t.clientPayload)?r:null,multipart:null!=(n=t.multipart)&&n,headers:t.headers})}});async function h(e){return globalThis.crypto.subtle.importKey("raw",(new TextEncoder).encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"])}async function m({token:e,signature:t,body:r}){const n=e;if(!globalThis.crypto){const e=a.createHmac("sha256",n).update(r).digest("hex"),i=Buffer.from(e),o=Buffer.from(t);return i.length===o.length&&a.timingSafeEqual(i,o)}return await globalThis.crypto.subtle.verify("HMAC",await h(e),function(e){if(e.length%2!=0)throw new RangeError("Expected string to be an even number of characters");const t=new Uint8Array(e.length/2);for(let r=0;r{r(54041).x,r(47446),t.SourceNode=r(1683).SourceNode},19793:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.StringSeparator=void 0,function(e){e.Comma=",",e.Dot=".",e.VerticalLine="|"}(r||(t.StringSeparator=r={}))},20088:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},o=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayCodeHelperGroup=void 0;const s=r(71519),c=r(32287),u=r(10548),l=r(79011),d=r(70885),f=r(87415),p=r(30386);let h=n=class extends f.AbstractCustomCodeHelperGroup{constructor(e,t,r,n,i){super(r,n,i),this.customCodeHelperFactory=e,this.stringArrayStorage=t}appendOnFinalizingStage(e,t){if(!this.stringArrayStorage.getLength())return;const r=p.NodeAppender.getScopeStatements(e);this.appendCustomNodeIfExist(l.CustomCodeHelper.StringArray,t=>{p.NodeAppender.insertAtIndex(e,t.getNode(),this.getScopeStatementRandomIndex(r))});for(const t of this.options.stringArrayEncoding){const n=this.getStringArrayCallsWrapperCodeHelperName(t);this.appendCustomNodeIfExist(n,t=>{p.NodeAppender.insertAtIndex(e,t.getNode(),this.getScopeStatementRandomIndex(r))})}}initialize(){if(this.customCodeHelpers=new Map,!this.options.stringArray)return;const e=this.stringArrayStorage.getStorageName(),t=this.customCodeHelperFactory(l.CustomCodeHelper.StringArray);t.initialize(this.stringArrayStorage,e),this.customCodeHelpers.set(l.CustomCodeHelper.StringArray,t);for(const t of this.options.stringArrayEncoding){const r=this.getStringArrayCallsWrapperCodeHelperName(t),n=this.customCodeHelperFactory(r),i=this.stringArrayStorage.getStorageCallsWrapperName(t);n.initialize(e,i,this.stringArrayStorage.getIndexShiftAmount()),this.customCodeHelpers.set(r,n)}}getStringArrayCallsWrapperCodeHelperName(e){var t;return null!==(t=n.stringArrayCallsWrapperCodeHelperMap.get(e))&&void 0!==t?t:l.CustomCodeHelper.StringArrayCallsWrapper}getScopeStatementRandomIndex(e){return this.randomGenerator.getRandomInteger(0,Math.max(0,e.length))}};t.StringArrayCodeHelperGroup=h,h.stringArrayCallsWrapperCodeHelperMap=new Map([[d.StringArrayEncoding.None,l.CustomCodeHelper.StringArrayCallsWrapper],[d.StringArrayEncoding.Base64,l.CustomCodeHelper.StringArrayCallsWrapperBase64],[d.StringArrayEncoding.Rc4,l.CustomCodeHelper.StringArrayCallsWrapperRc4]]),i([(0,u.initializable)(),a("design:type",Map)],h.prototype,"customCodeHelpers",void 0),t.StringArrayCodeHelperGroup=h=n=i([(0,s.injectable)(),o(0,(0,s.inject)(c.ServiceIdentifiers.Factory__ICustomCodeHelper)),o(1,(0,s.inject)(c.ServiceIdentifiers.IStringArrayStorage)),o(2,(0,s.inject)(c.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),o(3,(0,s.inject)(c.ServiceIdentifiers.IRandomGenerator)),o(4,(0,s.inject)(c.ServiceIdentifiers.IOptions)),a("design:paramtypes",[Function,Object,Function,Object,Object])],h)},20652:e=>{function t(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}
+/*!
+ * Determine if an object is a Buffer
+ *
+ * @author Feross Aboukhadijeh
+ * @license MIT
+ */
+e.exports=function(e){return null!=e&&(t(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&t(e.slice(0,0))}(e)||!!e._isBuffer)}},20795:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.typeConstraint=t.namedConstraint=t.taggedConstraint=t.traverseAncerstors=void 0;var o=a(r(2006)),s=r(14425),c=function(e,t){var r=e.parentRequest;return null!==r&&(!!t(r)||c(r,t))};t.traverseAncerstors=c;var u=function(e){return function(t){var r=function(r){return null!==r&&null!==r.target&&r.target.matchesTag(e)(t)};return r.metaData=new s.Metadata(e,t),r}};t.taggedConstraint=u;var l=u(o.NAMED_TAG);t.namedConstraint=l;t.typeConstraint=function(e){return function(t){var r=null;if(null!==t){if(r=t.bindings[0],"string"==typeof e)return r.serviceIdentifier===e;var n=t.bindings[0].implementationType;return e===n}return!1}}},21069:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.customCodeHelpersModule=void 0;const n=r(59404),i=r(71519),a=r(32287),o=r(79011),s=r(71332),c=r(48498),u=r(51774),l=r(40043),d=r(56370),f=r(20088),p=r(63871),h=r(64712),m=r(62402),g=r(2953),b=r(15236),y=r(15061),S=r(50229),v=r(28609),_=r(87381),C=r(51507),A=r(42540),E=r(18316),x=r(31691),N=r(6480);t.customCodeHelpersModule=new i.ContainerModule(e=>{e(a.ServiceIdentifiers.ICustomCodeHelper).to(p.ConsoleOutputDisableCodeHelper).whenTargetNamed(o.CustomCodeHelper.ConsoleOutputDisable),e(a.ServiceIdentifiers.ICustomCodeHelper).to(g.DebugProtectionFunctionCallCodeHelper).whenTargetNamed(o.CustomCodeHelper.DebugProtectionFunctionCall),e(a.ServiceIdentifiers.ICustomCodeHelper).to(b.DebugProtectionFunctionIntervalCodeHelper).whenTargetNamed(o.CustomCodeHelper.DebugProtectionFunctionInterval),e(a.ServiceIdentifiers.ICustomCodeHelper).to(y.DebugProtectionFunctionCodeHelper).whenTargetNamed(o.CustomCodeHelper.DebugProtectionFunction),e(a.ServiceIdentifiers.ICustomCodeHelper).to(S.DomainLockCodeHelper).whenTargetNamed(o.CustomCodeHelper.DomainLock),e(a.ServiceIdentifiers.ICustomCodeHelper).to(v.CallsControllerFunctionCodeHelper).whenTargetNamed(o.CustomCodeHelper.CallsControllerFunction),e(a.ServiceIdentifiers.ICustomCodeHelper).to(_.SelfDefendingCodeHelper).whenTargetNamed(o.CustomCodeHelper.SelfDefending),e(a.ServiceIdentifiers.ICustomCodeHelper).to(C.StringArrayCallsWrapperCodeHelper).whenTargetNamed(o.CustomCodeHelper.StringArrayCallsWrapper),e(a.ServiceIdentifiers.ICustomCodeHelper).to(A.StringArrayCallsWrapperBase64CodeHelper).whenTargetNamed(o.CustomCodeHelper.StringArrayCallsWrapperBase64),e(a.ServiceIdentifiers.ICustomCodeHelper).to(E.StringArrayCallsWrapperRc4CodeHelper).whenTargetNamed(o.CustomCodeHelper.StringArrayCallsWrapperRc4),e(a.ServiceIdentifiers.ICustomCodeHelper).to(x.StringArrayCodeHelper).whenTargetNamed(o.CustomCodeHelper.StringArray),e(a.ServiceIdentifiers.ICustomCodeHelper).to(N.StringArrayRotateFunctionCodeHelper).whenTargetNamed(o.CustomCodeHelper.StringArrayRotateFunction),e(a.ServiceIdentifiers.ICustomCodeHelperGroup).to(c.ConsoleOutputCodeHelperGroup).whenTargetNamed(s.CustomCodeHelperGroup.ConsoleOutput),e(a.ServiceIdentifiers.ICustomCodeHelperGroup).to(u.DebugProtectionCodeHelperGroup).whenTargetNamed(s.CustomCodeHelperGroup.DebugProtection),e(a.ServiceIdentifiers.ICustomCodeHelperGroup).to(l.DomainLockCustomCodeHelperGroup).whenTargetNamed(s.CustomCodeHelperGroup.DomainLock),e(a.ServiceIdentifiers.ICustomCodeHelperGroup).to(d.SelfDefendingCodeHelperGroup).whenTargetNamed(s.CustomCodeHelperGroup.SelfDefending),e(a.ServiceIdentifiers.ICustomCodeHelperGroup).to(f.StringArrayCodeHelperGroup).whenTargetNamed(s.CustomCodeHelperGroup.StringArray),e(a.ServiceIdentifiers.Factory__ICustomCodeHelper).toFactory(n.InversifyContainerFacade.getFactory(a.ServiceIdentifiers.ICustomCodeHelper)),e(a.ServiceIdentifiers.Factory__ICustomCodeHelperGroup).toFactory(n.InversifyContainerFacade.getFactory(a.ServiceIdentifiers.ICustomCodeHelperGroup)),e(a.ServiceIdentifiers.ICustomCodeHelperFormatter).to(h.CustomCodeHelperFormatter).inSingletonScope(),e(a.ServiceIdentifiers.ICustomCodeHelperObfuscator).to(m.CustomCodeHelperObfuscator).inSingletonScope()})},21146:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CustomCodeHelpersTransformer=void 0;const o=r(71519),s=r(32287),c=r(96390),u=r(18436),l=r(76893),d=r(23615);let f=class extends l.AbstractNodeTransformer{constructor(e,t,r,n,i){super(n,i),this.runAfter=[c.NodeTransformer.ParentificationTransformer,c.NodeTransformer.VariablePreserveTransformer],this.callsGraphData=[],this.callsGraphAnalyzer=e,this.prevailingKindOfVariablesAnalyzer=t,this.customCodeHelperGroupStorage=r}getVisitor(e){return e===u.NodeTransformationStage.Preparing?{leave:(e,t)=>{if(d.NodeGuards.isProgramNode(e))return this.prepareNode(e,t),this.appendCustomNodesForPreparingStage(e,t),this.transformNode(e,t)}}:{leave:(t,r)=>(d.NodeGuards.isProgramNode(t)&&this.appendCustomNodesForStage(e,t,r),t)}}prepareNode(e,t){this.callsGraphData=this.callsGraphAnalyzer.analyze(e),this.prevailingKindOfVariablesAnalyzer.analyze(e)}transformNode(e,t){return e}appendCustomNodesForPreparingStage(e,t){this.customCodeHelperGroupStorage.getStorage().forEach(t=>{var r;t.initialize(),null===(r=t.appendOnPreparingStage)||void 0===r||r.call(t,e,this.callsGraphData)})}appendCustomNodesForStage(e,t,r){this.customCodeHelperGroupStorage.getStorage().forEach(r=>{var n;null===(n=r[`appendOn${e}Stage`])||void 0===n||n.call(r,t,this.callsGraphData)})}};t.CustomCodeHelpersTransformer=f,t.CustomCodeHelpersTransformer=f=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.ICallsGraphAnalyzer)),a(1,(0,o.inject)(s.ServiceIdentifiers.IPrevailingKindOfVariablesAnalyzer)),a(2,(0,o.inject)(s.ServiceIdentifiers.TCustomNodeGroupStorage)),a(3,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(4,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object,Object,Object,Object,Object])],f)},21186:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.DeadCodeInjectionCustomNode=void 0,function(e){e.BlockStatementDeadCodeInjectionNode="BlockStatementDeadCodeInjectionNode"}(r||(t.DeadCodeInjectionCustomNode=r={}))},21385:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.finalizingTransformersModule=void 0;const n=r(71519),i=r(32287),a=r(96390),o=r(25360),s=r(30490);t.finalizingTransformersModule=new n.ContainerModule(e=>{e(i.ServiceIdentifiers.INodeTransformer).to(o.DirectivePlacementTransformer).whenTargetNamed(a.NodeTransformer.DirectivePlacementTransformer),e(i.ServiceIdentifiers.INodeTransformer).to(s.EscapeSequenceTransformer).whenTargetNamed(a.NodeTransformer.EscapeSequenceTransformer)})},21666:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if((0,i.default)(e),t&&t.no_symbols)return o.test(e);return new RegExp("^[+-]?([0-9]*[".concat((t||{}).locale?a.decimal[t.locale]:".","])?[0-9]+$")).test(e)};var n,i=(n=r(83399))&&n.__esModule?n:{default:n},a=r(13237);var o=/^[0-9]+$/;e.exports=t.default,e.exports.default=t.default},21773:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InversifyCoreError=t.isAppErrorSymbol=void 0,t.isAppErrorSymbol=Symbol.for("@inversifyjs/core/InversifyCoreError");class r extends Error{[t.isAppErrorSymbol];kind;constructor(e,r,n){super(r,n),this[t.isAppErrorSymbol]=!0,this.kind=e}static is(e){return"object"==typeof e&&null!==e&&!0===e[t.isAppErrorSymbol]}static isErrorOfKind(e,t){return r.is(e)&&e.kind===t}}t.InversifyCoreError=r},21818:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractStatementSimplifyTransformer=void 0;const o=r(71519),s=r(32287),c=r(96390),u=r(76893),l=r(23615),d=r(91363);let f=class extends u.AbstractNodeTransformer{constructor(e,t){super(e,t),this.runAfter=[c.NodeTransformer.ExpressionStatementsMergeTransformer,c.NodeTransformer.VariableDeclarationsMergeTransformer]}getStatementSimplifyData(e){if(!e)return null;if(!l.NodeGuards.isBlockStatementNode(e))return{leadingStatements:[e],trailingStatement:null,hasReturnStatement:!1,hasSingleExpression:!1};const{startIndex:t,unwrappedExpressions:r,hasReturnStatement:n,hasStatementsAfterReturnStatement:i}=this.collectIteratedStatementsSimplifyData(e);if(i)return{leadingStatements:e.body,trailingStatement:null,hasReturnStatement:!1,hasSingleExpression:!1};const a=this.getLeadingStatements(e,t);if(!r.length)return{leadingStatements:a,trailingStatement:null,hasReturnStatement:n,hasSingleExpression:!1};const o=1===r.length,s=o?r[0]:d.NodeFactory.sequenceExpressionNode(r);return{leadingStatements:a,trailingStatement:{statement:n?d.NodeFactory.returnStatementNode(s):d.NodeFactory.expressionStatementNode(s),expression:s},hasReturnStatement:n,hasSingleExpression:o}}collectIteratedStatementsSimplifyData(e){const t=e.body.length,r=[];let n=!1,i=!1,a=null;for(let o=t-1;o>=0;o--){const s=e.body[o];if(l.NodeGuards.isExpressionStatementNode(s))l.NodeGuards.isSequenceExpressionNode(s.expression)?r.unshift(...s.expression.expressions):r.unshift(s.expression),a=o;else{if(!l.NodeGuards.isReturnStatementNode(s)||!s.argument)break;r.unshift(s.argument),n=!0,i=o!==t-1,a=o}}return{startIndex:a,unwrappedExpressions:r,hasReturnStatement:n,hasStatementsAfterReturnStatement:i}}getLeadingStatements(e,t){return null===t?e.body:0===t?[]:e.body.slice(0,t)}getPartialStatement(e){return!e.leadingStatements.length&&e.trailingStatement?e.trailingStatement.statement:d.NodeFactory.blockStatementNode([...e.leadingStatements.length?e.leadingStatements:[],...e.trailingStatement?[e.trailingStatement.statement]:[]])}};t.AbstractStatementSimplifyTransformer=f,t.AbstractStatementSimplifyTransformer=f=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object,Object])],f)},21965:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractCodeTransformer=void 0;const o=r(71519),s=r(32287);let c=class{constructor(e,t){this.randomGenerator=e,this.options=t}};t.AbstractCodeTransformer=c,t.AbstractCodeTransformer=c=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object,Object])],c)},22292:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceEncoder=void 0;const a=r(71519);let o=n=class{constructor(){this.stringsCache=new Map}encode(e,t){const r=`${e}-${String(t)}`;if(this.stringsCache.has(r))return this.stringsCache.get(r);let i,a;const o=e.replace(n.replaceRegExp,e=>t||n.forceEscapeCharactersRegExp.test(e)?(n.ASCIICharactersRegExp.test(e)?(i="\\x",a="00"):(i="\\u",a="0000"),`${i}${(a+e.charCodeAt(0).toString(16)).slice(-a.length)}`):e);return this.stringsCache.set(r,o),this.stringsCache.set(`${o}-${String(t)}`,o),o}};t.EscapeSequenceEncoder=o,o.ASCIICharactersRegExp=/[\x00-\x7F]/,o.forceEscapeCharactersRegExp=/[\x00-\x1F\x7F-\x9F'"\\\s]/,o.replaceRegExp=/[\s\S]/g,t.EscapeSequenceEncoder=o=n=i([(0,a.injectable)()],o)},22671:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.updateReflectMetadata=function(e,t,r,i){const a=(0,n.getReflectMetadata)(e,t)??r,o=i(a);Reflect.defineMetadata(t,o,e)};const n=r(3654)},22767:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ControlFlowFlatteningThresholdRule=void 0;t.ControlFlowFlatteningThresholdRule=e=>(0===e.controlFlowFlatteningThreshold&&(e={...e,controlFlowFlattening:!1,controlFlowFlatteningThreshold:0}),e)},23334:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BindingWhenOnSyntax=void 0;var n=r(42903),i=r(36744),a=function(){function e(e){this._binding=e,this._bindingWhenSyntax=new i.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new n.BindingOnSyntax(this._binding)}return e.prototype.when=function(e){return this._bindingWhenSyntax.when(e)},e.prototype.whenTargetNamed=function(e){return this._bindingWhenSyntax.whenTargetNamed(e)},e.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},e.prototype.whenTargetTagged=function(e,t){return this._bindingWhenSyntax.whenTargetTagged(e,t)},e.prototype.whenInjectedInto=function(e){return this._bindingWhenSyntax.whenInjectedInto(e)},e.prototype.whenParentNamed=function(e){return this._bindingWhenSyntax.whenParentNamed(e)},e.prototype.whenParentTagged=function(e,t){return this._bindingWhenSyntax.whenParentTagged(e,t)},e.prototype.whenAnyAncestorIs=function(e){return this._bindingWhenSyntax.whenAnyAncestorIs(e)},e.prototype.whenNoAncestorIs=function(e){return this._bindingWhenSyntax.whenNoAncestorIs(e)},e.prototype.whenAnyAncestorNamed=function(e){return this._bindingWhenSyntax.whenAnyAncestorNamed(e)},e.prototype.whenAnyAncestorTagged=function(e,t){return this._bindingWhenSyntax.whenAnyAncestorTagged(e,t)},e.prototype.whenNoAncestorNamed=function(e){return this._bindingWhenSyntax.whenNoAncestorNamed(e)},e.prototype.whenNoAncestorTagged=function(e,t){return this._bindingWhenSyntax.whenNoAncestorTagged(e,t)},e.prototype.whenAnyAncestorMatches=function(e){return this._bindingWhenSyntax.whenAnyAncestorMatches(e)},e.prototype.whenNoAncestorMatches=function(e){return this._bindingWhenSyntax.whenNoAncestorMatches(e)},e.prototype.onActivation=function(e){return this._bindingOnSyntax.onActivation(e)},e.prototype.onDeactivation=function(e){return this._bindingOnSyntax.onDeactivation(e)},e}();t.BindingWhenOnSyntax=a},23498:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPropertyMetadataFromLegacyMetadata=function(e,t,r){try{return(0,a.getClassElementMetadataFromLegacyMetadata)(r)}catch(r){throw n.InversifyCoreError.isErrorOfKind(r,i.InversifyCoreErrorKind.missingInjectionDecorator)?new n.InversifyCoreError(i.InversifyCoreErrorKind.missingInjectionDecorator,`Expected a single @inject, @multiInject or @unmanaged decorator at type "${e.name}" at property "${t.toString()}"`,{cause:r}):r}};const n=r(21773),i=r(94931),a=r(44063)},23615:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeGuards=void 0;const n=r(81568);class i{static isArrayPatternNode(e){return e.type===n.NodeType.ArrayPattern}static isArrowFunctionExpressionNode(e){return e.type===n.NodeType.ArrowFunctionExpression}static isAssignmentExpressionNode(e){return e.type===n.NodeType.AssignmentExpression}static isAssignmentPatternNode(e){return e.type===n.NodeType.AssignmentPattern}static isAwaitExpressionNode(e){return e.type===n.NodeType.AwaitExpression}static isBigIntLiteralNode(e){return i.isLiteralNode(e)&&!!e.bigint}static isBlockStatementNode(e){return e.type===n.NodeType.BlockStatement}static isBreakStatementNode(e){return e.type===n.NodeType.BreakStatement}static isCallExpressionNode(e){return e.type===n.NodeType.CallExpression}static isChainExpressionNode(e){return e.type===n.NodeType.ChainExpression}static isClassBodyNode(e){return e.type===n.NodeType.ClassBody}static isClassDeclarationNode(e){return e.type===n.NodeType.ClassDeclaration&&null!==e.id}static isConditionalExpressionNode(e){return e.type===n.NodeType.ConditionalExpression}static isContinueStatementNode(e){return e.type===n.NodeType.ContinueStatement}static isDirectiveNode(e){return e.type===n.NodeType.ExpressionStatement&&"directive"in e}static isDoWhileStatementNode(e){return e.type===n.NodeType.DoWhileStatement}static isExportAllDeclarationNode(e){return e.type===n.NodeType.ExportAllDeclaration}static isExportNamedDeclarationNode(e){return e.type===n.NodeType.ExportNamedDeclaration}static isExportSpecifierNode(e){return e.type===n.NodeType.ExportSpecifier}static isExpressionStatementNode(e){return e.type===n.NodeType.ExpressionStatement&&!("directive"in e)}static isForStatementNode(e){return e.type===n.NodeType.ForStatement}static isForInStatementNode(e){return e.type===n.NodeType.ForInStatement}static isForOfStatementNode(e){return e.type===n.NodeType.ForOfStatement}static isFunctionNode(e){return i.isFunctionDeclarationNode(e)||i.isFunctionExpressionNode(e)||i.isArrowFunctionExpressionNode(e)}static isFunctionDeclarationNode(e){return e.type===n.NodeType.FunctionDeclaration&&null!==e.id}static isFunctionExpressionNode(e){return e.type===n.NodeType.FunctionExpression}static isIdentifierNode(e){return e.type===n.NodeType.Identifier}static isIfStatementNode(e){return e.type===n.NodeType.IfStatement}static isIfStatementNodeWithSingleStatementBody(e){return!!i.isIfStatementNode(e)&&(!i.isBlockStatementNode(e.consequent)||!!e.alternate&&!i.isBlockStatementNode(e.alternate))}static isImportDeclarationNode(e){return e.type===n.NodeType.ImportDeclaration}static isImportExpressionNode(e){return e.type===n.NodeType.ImportExpression}static isImportSpecifierNode(e){return e.type===n.NodeType.ImportSpecifier}static isLabelIdentifierNode(e,t){const r=i.isLabeledStatementNode(t)&&t.label===e,n=i.isContinueStatementNode(t)&&t.label===e,a=i.isBreakStatementNode(t)&&t.label===e;return r||n||a}static isLabeledStatementNode(e){return e.type===n.NodeType.LabeledStatement}static isLiteralNode(e){return e.type===n.NodeType.Literal}static isLogicalExpressionNode(e){return e.type===n.NodeType.LogicalExpression}static isLoopStatementNode(e){return i.isForStatementNode(e)||i.isForInStatementNode(e)||i.isForOfStatementNode(e)||i.isWhileStatementNode(e)||i.isDoWhileStatementNode(e)}static isMemberExpressionNode(e){return e.type===n.NodeType.MemberExpression}static isMetaPropertyNode(e){return e.type===n.NodeType.MetaProperty}static isMethodDefinitionNode(e){return e.type===n.NodeType.MethodDefinition}static isNewExpressionNode(e){return e.type===n.NodeType.NewExpression}static isNode(e){return e&&void 0!==!e.type}static isNodeWithLexicalScope(e){return i.isProgramNode(e)||i.isFunctionNode(e)}static isNodeWithBlockLexicalScope(e){return i.isNodeWithLexicalScope(e)||i.isBlockStatementNode(e)||i.isStaticBlockNode(e)}static isNodeWithSingleStatementBody(e){return i.isIfStatementNode(e)?i.isIfStatementNodeWithSingleStatementBody(e):(i.isForStatementNode(e)||i.isForOfStatementNode(e)||i.isForInStatementNode(e)||i.isWhileStatementNode(e)||i.isDoWhileStatementNode(e)||i.isWithStatementNode(e)||i.isLabeledStatementNode(e))&&!i.isBlockStatementNode(e.body)}static isNodeWithLexicalScopeStatements(e,t){return i.isProgramNode(e)||i.isBlockStatementNode(e)&&i.nodesWithLexicalStatements.includes(t.type)}static isNodeWithStatements(e){return i.isProgramNode(e)||i.isBlockStatementNode(e)||i.isStaticBlockNode(e)||i.isSwitchCaseNode(e)}static isNodeWithComments(e){return Boolean(e.leadingComments)||Boolean(e.trailingComments)}static isObjectPatternNode(e){return e.type===n.NodeType.ObjectPattern}static isObjectExpressionNode(e){return e.type===n.NodeType.ObjectExpression}static isPrivateIdentifierNode(e){return e.type===n.NodeType.PrivateIdentifier}static isProgramNode(e){return e.type===n.NodeType.Program}static isPropertyNode(e){return e.type===n.NodeType.Property}static isPropertyDefinitionNode(e){return e.type===n.NodeType.PropertyDefinition}static isRestElementNode(e){return e.type===n.NodeType.RestElement}static isReturnStatementNode(e){return e.type===n.NodeType.ReturnStatement}static isSequenceExpressionNode(e){return e.type===n.NodeType.SequenceExpression}static isSpreadElementNode(e){return e.type===n.NodeType.SpreadElement}static isStaticBlockNode(e){return e.type===n.NodeType.StaticBlock}static isSuperNode(e){return e.type===n.NodeType.Super}static isSwitchCaseNode(e){return e.type===n.NodeType.SwitchCase}static isTaggedTemplateExpressionNode(e){return e.type===n.NodeType.TaggedTemplateExpression}static isTemplateLiteralNode(e){return e.type===n.NodeType.TemplateLiteral}static isThisExpressionNode(e){return e.type===n.NodeType.ThisExpression}static isUnaryExpressionNode(e){return e.type===n.NodeType.UnaryExpression}static isVariableDeclarationNode(e){return e.type===n.NodeType.VariableDeclaration}static isVariableDeclaratorNode(e){return e.type===n.NodeType.VariableDeclarator}static isWithStatementNode(e){return e.type===n.NodeType.WithStatement}static isWhileStatementNode(e){return e.type===n.NodeType.WhileStatement}static isYieldExpressionNode(e){return e.type===n.NodeType.YieldExpression}}t.NodeGuards=i,i.nodesWithLexicalStatements=[n.NodeType.ArrowFunctionExpression,n.NodeType.FunctionDeclaration,n.NodeType.FunctionExpression,n.NodeType.MethodDefinition]},23641:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,n.default)(e),function(e,t){var r=e.replace(/[\s\-]+/gi,"").toUpperCase(),n=r.slice(0,2).toUpperCase(),a=n in o;if(t.whitelist){if(!function(e){if(e.filter(function(e){return!(e in o)}).length>0)return!1;return!0}(t.whitelist))return!1;if(!(0,i.default)(t.whitelist,n))return!1}if(t.blacklist){if((0,i.default)(t.blacklist,n))return!1}return a&&o[n].test(r)}(e,t)&&function(e){var t=e.replace(/[^A-Z0-9]+/gi,"").toUpperCase();return 1===(t.slice(4)+t.slice(0,4)).replace(/[A-Z]/g,function(e){return e.charCodeAt(0)-55}).match(/\d{1,7}/g).reduce(function(e,t){return Number(e+t)%97},"")}(e)},t.locales=void 0;var n=a(r(83399)),i=a(r(78644));function a(e){return e&&e.__esModule?e:{default:e}}var o={AD:/^(AD[0-9]{2})\d{8}[A-Z0-9]{12}$/,AE:/^(AE[0-9]{2})\d{3}\d{16}$/,AL:/^(AL[0-9]{2})\d{8}[A-Z0-9]{16}$/,AT:/^(AT[0-9]{2})\d{16}$/,AZ:/^(AZ[0-9]{2})[A-Z0-9]{4}\d{20}$/,BA:/^(BA[0-9]{2})\d{16}$/,BE:/^(BE[0-9]{2})\d{12}$/,BG:/^(BG[0-9]{2})[A-Z]{4}\d{6}[A-Z0-9]{8}$/,BH:/^(BH[0-9]{2})[A-Z]{4}[A-Z0-9]{14}$/,BR:/^(BR[0-9]{2})\d{23}[A-Z]{1}[A-Z0-9]{1}$/,BY:/^(BY[0-9]{2})[A-Z0-9]{4}\d{20}$/,CH:/^(CH[0-9]{2})\d{5}[A-Z0-9]{12}$/,CR:/^(CR[0-9]{2})\d{18}$/,CY:/^(CY[0-9]{2})\d{8}[A-Z0-9]{16}$/,CZ:/^(CZ[0-9]{2})\d{20}$/,DE:/^(DE[0-9]{2})\d{18}$/,DK:/^(DK[0-9]{2})\d{14}$/,DO:/^(DO[0-9]{2})[A-Z]{4}\d{20}$/,DZ:/^(DZ\d{24})$/,EE:/^(EE[0-9]{2})\d{16}$/,EG:/^(EG[0-9]{2})\d{25}$/,ES:/^(ES[0-9]{2})\d{20}$/,FI:/^(FI[0-9]{2})\d{14}$/,FO:/^(FO[0-9]{2})\d{14}$/,FR:/^(FR[0-9]{2})\d{10}[A-Z0-9]{11}\d{2}$/,GB:/^(GB[0-9]{2})[A-Z]{4}\d{14}$/,GE:/^(GE[0-9]{2})[A-Z0-9]{2}\d{16}$/,GI:/^(GI[0-9]{2})[A-Z]{4}[A-Z0-9]{15}$/,GL:/^(GL[0-9]{2})\d{14}$/,GR:/^(GR[0-9]{2})\d{7}[A-Z0-9]{16}$/,GT:/^(GT[0-9]{2})[A-Z0-9]{4}[A-Z0-9]{20}$/,HR:/^(HR[0-9]{2})\d{17}$/,HU:/^(HU[0-9]{2})\d{24}$/,IE:/^(IE[0-9]{2})[A-Z]{4}\d{14}$/,IL:/^(IL[0-9]{2})\d{19}$/,IQ:/^(IQ[0-9]{2})[A-Z]{4}\d{15}$/,IR:/^(IR[0-9]{2})0\d{2}0\d{18}$/,IS:/^(IS[0-9]{2})\d{22}$/,IT:/^(IT[0-9]{2})[A-Z]{1}\d{10}[A-Z0-9]{12}$/,JO:/^(JO[0-9]{2})[A-Z]{4}\d{22}$/,KW:/^(KW[0-9]{2})[A-Z]{4}[A-Z0-9]{22}$/,KZ:/^(KZ[0-9]{2})\d{3}[A-Z0-9]{13}$/,LB:/^(LB[0-9]{2})\d{4}[A-Z0-9]{20}$/,LC:/^(LC[0-9]{2})[A-Z]{4}[A-Z0-9]{24}$/,LI:/^(LI[0-9]{2})\d{5}[A-Z0-9]{12}$/,LT:/^(LT[0-9]{2})\d{16}$/,LU:/^(LU[0-9]{2})\d{3}[A-Z0-9]{13}$/,LV:/^(LV[0-9]{2})[A-Z]{4}[A-Z0-9]{13}$/,MA:/^(MA[0-9]{26})$/,MC:/^(MC[0-9]{2})\d{10}[A-Z0-9]{11}\d{2}$/,MD:/^(MD[0-9]{2})[A-Z0-9]{20}$/,ME:/^(ME[0-9]{2})\d{18}$/,MK:/^(MK[0-9]{2})\d{3}[A-Z0-9]{10}\d{2}$/,MR:/^(MR[0-9]{2})\d{23}$/,MT:/^(MT[0-9]{2})[A-Z]{4}\d{5}[A-Z0-9]{18}$/,MU:/^(MU[0-9]{2})[A-Z]{4}\d{19}[A-Z]{3}$/,MZ:/^(MZ[0-9]{2})\d{21}$/,NL:/^(NL[0-9]{2})[A-Z]{4}\d{10}$/,NO:/^(NO[0-9]{2})\d{11}$/,PK:/^(PK[0-9]{2})[A-Z0-9]{4}\d{16}$/,PL:/^(PL[0-9]{2})\d{24}$/,PS:/^(PS[0-9]{2})[A-Z]{4}[A-Z0-9]{21}$/,PT:/^(PT[0-9]{2})\d{21}$/,QA:/^(QA[0-9]{2})[A-Z]{4}[A-Z0-9]{21}$/,RO:/^(RO[0-9]{2})[A-Z]{4}[A-Z0-9]{16}$/,RS:/^(RS[0-9]{2})\d{18}$/,SA:/^(SA[0-9]{2})\d{2}[A-Z0-9]{18}$/,SC:/^(SC[0-9]{2})[A-Z]{4}\d{20}[A-Z]{3}$/,SE:/^(SE[0-9]{2})\d{20}$/,SI:/^(SI[0-9]{2})\d{15}$/,SK:/^(SK[0-9]{2})\d{20}$/,SM:/^(SM[0-9]{2})[A-Z]{1}\d{10}[A-Z0-9]{12}$/,SV:/^(SV[0-9]{2})[A-Z0-9]{4}\d{20}$/,TL:/^(TL[0-9]{2})\d{19}$/,TN:/^(TN[0-9]{2})\d{20}$/,TR:/^(TR[0-9]{2})\d{5}[A-Z0-9]{17}$/,UA:/^(UA[0-9]{2})\d{6}[A-Z0-9]{19}$/,VA:/^(VA[0-9]{2})\d{18}$/,VG:/^(VG[0-9]{2})[A-Z]{4}\d{16}$/,XK:/^(XK[0-9]{2})\d{16}$/};t.locales=Object.keys(o)},23684:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Binding=void 0;var n=r(27801),i=r(38615),a=function(){function e(e,t){this.id=(0,i.id)(),this.activated=!1,this.serviceIdentifier=e,this.scope=t,this.type=n.BindingTypeEnum.Invalid,this.constraint=function(e){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.onDeactivation=null,this.dynamicValue=null}return e.prototype.clone=function(){var t=new e(this.serviceIdentifier,this.scope);return t.activated=t.scope===n.BindingScopeEnum.Singleton&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.factory=this.factory,t.provider=this.provider,t.constraint=this.constraint,t.onActivation=this.onActivation,t.onDeactivation=this.onDeactivation,t.cache=this.cache,t},e}();t.Binding=a},23787:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DebuggerTemplateNoEval=function(){return"\n if (typeof counter === 'string') {\n const func = function () {\n while (true) {}\n };\n \n return func();\n } else {\n if (('' + counter / counter)['length'] !== 1 || counter % 20 === 0) {\n debugger;\n } else {\n debugger;\n }\n \n }\n "}},23877:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numbersString=void 0,t.numbersString="0123456789"},23908:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.NumberToNumericalExpressionTransformer=void 0;const o=r(71519),s=r(32287),c=r(18436),u=r(76893),l=r(23615),d=r(91363),f=r(94556),p=r(57876),h=r(94766);let m=class extends u.AbstractNodeTransformer{constructor(e,t,r){super(t,r),this.numberNumericalExpressionAnalyzer=e}getVisitor(e){return this.options.numbersToExpressions&&e===c.NodeTransformationStage.Converting?{leave:(e,t)=>{if(t&&l.NodeGuards.isLiteralNode(e))return this.transformNode(e,t)}}:null}transformNode(e,t){if("number"!=typeof e.value)return e;if(l.NodeGuards.isPropertyNode(t)&&!t.computed)return e;const r=e.value,[n,i]=p.NumberUtils.extractIntegerAndDecimalParts(r),a=this.numberNumericalExpressionAnalyzer.analyze(n,f.NumberNumericalExpressionAnalyzer.defaultAdditionalPartsCount);return i?h.NumericalExpressionDataToNodeConverter.convertFloatNumberData(a,i,this.getNumberNumericalExpressionLiteralNode):h.NumericalExpressionDataToNodeConverter.convertIntegerNumberData(a,this.getNumberNumericalExpressionLiteralNode)}getNumberNumericalExpressionLiteralNode(e,t){const r=d.NodeFactory.literalNode(e);return t?r:d.NodeFactory.unaryExpressionNode("-",r)}};t.NumberToNumericalExpressionTransformer=m,t.NumberToNumericalExpressionTransformer=m=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.INumberNumericalExpressionAnalyzer)),a(1,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(2,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object,Object,Object])],m)},24116:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IsInputFileName=void 0;const n=r(90804),i=r(48096);t.IsInputFileName=()=>(e,t)=>{(0,n.IsString)()(e,t),(0,n.ValidateIf)(({sourceMapSourcesMode:e})=>e===i.SourceMapSourcesMode.Sources)(e,t),(0,n.IsNotEmpty)()(e,t)}},24157:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.decorate=function(e,t,r){"number"==typeof r?f([p(r,e)],t):"string"==typeof r?Reflect.decorate([e],t,r):f([e],t)},t.tagParameter=u,t.tagProperty=l,t.createTaggedDecorator=function(e){return function(t,r,n){"number"==typeof n?u(t,r,n,e):l(t,r,e)}};var o=a(r(95507)),s=a(r(2006)),c=r(13165);function u(e,t,r,n){!function(e){if(void 0!==e)throw new Error(o.INVALID_DECORATOR_OPERATION)}(t),d(s.TAGGED,e,r.toString(),n)}function l(e,t,r){if(void 0!==e.prototype)throw new Error(o.INVALID_DECORATOR_OPERATION);d(s.TAGGED_PROP,e.constructor,t,r)}function d(e,t,r,n){var i=function(e){var t=[];if(Array.isArray(e)){t=e;var r=(0,c.getFirstArrayDuplicate)(t.map(function(e){return e.key}));if(void 0!==r)throw new Error("".concat(o.DUPLICATED_METADATA," ").concat(r.toString()))}else t=[e];return t}(n),a={};Reflect.hasOwnMetadata(e,t)&&(a=Reflect.getMetadata(e,t));var s=a[r];if(void 0===s)s=[];else for(var u=function(e){if(i.some(function(t){return t.key===e.key}))throw new Error("".concat(o.DUPLICATED_METADATA," ").concat(e.key.toString()))},l=0,d=s;l{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayWrappersChainedCallsRule=void 0;t.StringArrayWrappersChainedCallsRule=e=>(0===e.stringArrayWrappersCount&&(e={...e,stringArrayWrappersChainedCalls:!1,stringArrayWrappersCount:0}),e)},24641:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)(e),a.test(e)};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};var a=/^#?([0-9A-F]{3}|[0-9A-F]{4}|[0-9A-F]{6}|[0-9A-F]{8})$/i;e.exports=t.default,e.exports.default=t.default},24712:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsNormalizer=void 0;const a=r(71519),o=r(22767),s=r(60509),c=r(13450),u=r(65889),l=r(12798),d=r(36264),f=r(17604),p=r(88996),h=r(48983),m=r(89420),g=r(31309),b=r(51066),y=r(43735),S=r(73661),v=r(15426),_=r(24248);let C=n=class{normalize(e){let t={...e};for(const e of n.normalizerRules)t=e(t);return t}};t.OptionsNormalizer=C,C.normalizerRules=[o.ControlFlowFlatteningThresholdRule,s.DeadCodeInjectionRule,c.DeadCodeInjectionThresholdRule,u.DomainLockRedirectUrlRule,l.DomainLockRule,d.IdentifierNamesCacheRule,f.InputFileNameRule,p.SeedRule,h.SelfDefendingRule,m.SourceMapBaseUrlRule,g.SourceMapFileNameRule,b.SplitStringsChunkLengthRule,y.StringArrayRule,S.StringArrayCallsTransformThresholdRule,v.StringArrayEncodingRule,_.StringArrayWrappersChainedCallsRule],t.OptionsNormalizer=C=n=i([(0,a.injectable)()],C)},24808:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.BlackListObfuscatingGuard=void 0;const o=r(71519),s=r(50275),c=r(23615);let u=n=class{constructor(){this.blackListGuardsLength=n.blackListGuards.length}check(e){for(let t=0;t(p.parentizeNode(e,t),d.NodeGuards.isLiteralNode(e)&&p.addXVerbatimPropertyTo(e),f.NodeMetadata.set(e,{ignoredNode:!1}),e)}),t.body}static convertStructureToCode(e){return e.reduce((e,t)=>e+s.generate(t,{sourceMapWithCode:!0}).code,"")}static getUnaryExpressionArgumentNode(e){return d.NodeGuards.isUnaryExpressionNode(e.argument)?p.getUnaryExpressionArgumentNode(e.argument):e.argument}static parentizeAst(e){var t;const r=null!==(t=e.parentNode)&&void 0!==t?t:null;return c.replace(e,{enter:p.parentizeNode}),r&&(e.parentNode=r),e}static parentizeNode(e,t){return e.parentNode=null!=t?t:e,e}static cloneRecursive(e){if(null===e)return e;if("object"!=typeof e)return e;const t={};return Object.keys(e).forEach(r=>{var n;if("parentNode"===r)return;const i=null!==(n=e[r])&&void 0!==n?n:null;let a;a=null===i||i instanceof RegExp?i:i instanceof Array?i.map(p.cloneRecursive):"object"==typeof i?p.cloneRecursive(i):i,t[r]=a}),t}}t.NodeUtils=p},25191:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.controlFlowTransformersModule=void 0;const n=r(59404),i=r(71519),a=r(32287),o=r(80231),s=r(96390),c=r(55613),u=r(6768),l=r(76822),d=r(59070),f=r(83595),p=r(70906),h=r(83682),m=r(9756);t.controlFlowTransformersModule=new i.ContainerModule(e=>{e(a.ServiceIdentifiers.INodeTransformer).to(u.BlockStatementControlFlowTransformer).whenTargetNamed(s.NodeTransformer.BlockStatementControlFlowTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(d.FunctionControlFlowTransformer).whenTargetNamed(s.NodeTransformer.FunctionControlFlowTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(h.StringArrayControlFlowTransformer).whenTargetNamed(s.NodeTransformer.StringArrayControlFlowTransformer),e(a.ServiceIdentifiers.IControlFlowReplacer).to(c.BinaryExpressionControlFlowReplacer).whenTargetNamed(o.ControlFlowReplacer.BinaryExpressionControlFlowReplacer),e(a.ServiceIdentifiers.IControlFlowReplacer).to(l.CallExpressionControlFlowReplacer).whenTargetNamed(o.ControlFlowReplacer.CallExpressionControlFlowReplacer),e(a.ServiceIdentifiers.IControlFlowReplacer).to(f.LogicalExpressionControlFlowReplacer).whenTargetNamed(o.ControlFlowReplacer.LogicalExpressionControlFlowReplacer),e(a.ServiceIdentifiers.IControlFlowReplacer).to(p.StringArrayCallControlFlowReplacer).whenTargetNamed(o.ControlFlowReplacer.StringArrayCallControlFlowReplacer),e(a.ServiceIdentifiers.IControlFlowReplacer).to(m.StringLiteralControlFlowReplacer).whenTargetNamed(o.ControlFlowReplacer.StringLiteralControlFlowReplacer),e(a.ServiceIdentifiers.Factory__IControlFlowReplacer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.IControlFlowReplacer))})},25360:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DirectivePlacementTransformer=void 0;const o=r(71519),s=r(32287),c=r(18436),u=r(96390),l=r(76893),d=r(30386),f=r(23615),p=r(25120);let h=class extends l.AbstractNodeTransformer{constructor(e,t){super(e,t),this.runAfter=[u.NodeTransformer.CustomCodeHelpersTransformer],this.lexicalScopeDirectives=new WeakMap}getVisitor(e){switch(e){case c.NodeTransformationStage.Preparing:return{enter:(e,t)=>{if(t&&f.NodeGuards.isNodeWithLexicalScopeStatements(e,t))return this.analyzeNode(e,t)}};case c.NodeTransformationStage.Finalizing:return{enter:(e,t)=>{if(t&&f.NodeGuards.isNodeWithLexicalScopeStatements(e,t))return this.transformNode(e,t)}};default:return null}}analyzeNode(e,t){var r;if(!f.NodeGuards.isNodeWithLexicalScope(t))return e;const n=null!==(r=e.body[0])&&void 0!==r?r:null;return n&&f.NodeGuards.isDirectiveNode(n)&&this.lexicalScopeDirectives.set(t,n),e}transformNode(e,t){if(!f.NodeGuards.isNodeWithLexicalScope(t))return e;const r=this.lexicalScopeDirectives.get(t);if(r){const t=p.NodeUtils.clone(r);d.NodeAppender.prepend(e,[t]),e.body=e.body.filter(e=>e!==r)}return e}};t.DirectivePlacementTransformer=h,t.DirectivePlacementTransformer=h=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object,Object])],h)},25748:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)(e),a.test(e)||o.test(e)};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};var a=/^(bc1|tb1|bc1p|tb1p)[ac-hj-np-z02-9]{39,58}$/,o=/^(1|2|3|m)[A-HJ-NP-Za-km-z1-9]{25,39}$/;e.exports=t.default,e.exports.default=t.default},25860:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ControlFlowStorage=void 0,function(e){e.FunctionControlFlowStorage="function-control-flow-storage",e.StringControlFlowStorage="string-control-flow-storage"}(r||(t.ControlFlowStorage=r={}))},26617:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if((0,i.default)(e),a.test(e))return!0;return!1};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};var a=/^[A-HJ-NP-Za-km-z1-9]*$/;e.exports=t.default,e.exports.default=t.default},27349:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if((0,i.default)(e),0!==e.indexOf("magnet:?"))return!1;return a.test(e)};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};var a=/(?:^magnet:\?|[^?&]&)xt(?:\.1)?=urn:(?:(?:aich|bitprint|btih|ed2k|ed2khash|kzhash|md5|sha1|tree:tiger):[a-z0-9]{32}(?:[a-z0-9]{8})?|btmh:1220[a-z0-9]{64})(?:$|&)/i;e.exports=t.default,e.exports.default=t.default},27418:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SelfDefendingTemplate=function(){return"\n const {selfDefendingFunctionName} = {callControllerFunctionName}(this, function () {\n return {selfDefendingFunctionName}\n .toString()\n .search('(((.+)+)+)+$')\n .toString()\n .constructor({selfDefendingFunctionName})\n .search('(((.+)+)+)+$');\n });\n \n {selfDefendingFunctionName}();\n "}},27480:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.base64alphabet=void 0;const n=r(98376),i=r(218),a=r(23877);t.base64alphabet=`${n.alphabetStringUppercase}${i.alphabetString}${a.numbersString}+/=`},27600:function(e,t,r){"use strict";var n,i,a=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},c=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),i=0;i{if(t)return g.NodeMetadata.isIgnoredNode(e)?p.VisitorOption.Skip:void(h.NodeGuards.isLiteralNode(e)&&this.analyzeLiteralNode(e,t))}})}analyzeLiteralNode(e,t){m.NodeLiteralUtils.isStringLiteralNode(e)&&(m.NodeLiteralUtils.isProhibitedLiteralNode(e,t)||this.shouldAddValueToStringArray(e)&&this.addItemDataForLiteralNode(e))}addItemDataForLiteralNode(e){this.stringArrayStorageData.set(e,this.stringArrayStorage.getOrThrow(e.value))}getItemDataForLiteralNode(e){return this.stringArrayStorageData.get(e)}shouldAddValueToStringArray(e){return!!g.NodeMetadata.isForceTransformNode(e)||e.value.length>=i.minimumLengthForStringArray&&!!this.options.stringArrayThreshold&&this.randomGenerator.getMathRandom()<=this.options.stringArrayThreshold}};t.StringArrayStorageAnalyzer=b,b.minimumLengthForStringArray=3,t.StringArrayStorageAnalyzer=b=i=s([(0,d.injectable)(),l(0,(0,d.inject)(f.ServiceIdentifiers.IStringArrayStorage)),l(1,(0,d.inject)(f.ServiceIdentifiers.IRandomGenerator)),l(2,(0,d.inject)(f.ServiceIdentifiers.IOptions)),u("design:paramtypes",[Object,Object,Object])],b)},27680:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CallExpressionFunctionNode=void 0;const o=r(71519),s=r(32287),c=r(10548),u=r(57013),l=r(91363),d=r(25120),f=r(23615);let p=class extends u.AbstractCustomNode{constructor(e,t,r,n){super(e,t,r,n)}initialize(e,t){this.expressionArguments=e,this.isChainExpressionParent=t}getNodeStructure(){const e=l.NodeFactory.identifierNode("callee"),t=[],r=[],n=this.expressionArguments.length;for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){(0,i.default)(e);var t=Number(e.slice(-1));return s.test(e)&&t===(r=e,n=10-r.slice(0,-1).split("").map(function(e,t){return Number(e)*function(e,t){return e===a||e===o?t%2==0?3:1:t%2==0?1:3}(r.length,t)}).reduce(function(e,t){return e+t},0)%10,n<10?n:0);var r,n};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};var a=8,o=14,s=/^(\d{8}|\d{13}|\d{14})$/;e.exports=t.default,e.exports.default=t.default},27801:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TargetTypeEnum=t.BindingTypeEnum=t.BindingScopeEnum=void 0;t.BindingScopeEnum={Request:"Request",Singleton:"Singleton",Transient:"Transient"};t.BindingTypeEnum={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"};t.TargetTypeEnum={ClassProperty:"ClassProperty",ConstructorArgument:"ConstructorArgument",Variable:"Variable"}},28609:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CallsControllerFunctionCodeHelper=void 0;const o=r(71519),s=r(32287),c=r(18436),u=r(10548),l=r(79820),d=r(88318),f=r(25120);let p=class extends d.AbstractCustomCodeHelper{constructor(e,t,r,n,i){super(e,t,r,n,i)}initialize(e,t){this.nodeTransformationStage=e,this.callsControllerFunctionName=t}getNodeStructure(e){return f.NodeUtils.convertCodeToStructure(e)}getCodeHelperTemplate(){return this.nodeTransformationStage===c.NodeTransformationStage.Finalizing?this.customCodeHelperObfuscator.obfuscateTemplate(this.customCodeHelperFormatter.formatTemplate((0,l.SingleCallControllerTemplate)(),{callControllerFunctionName:this.callsControllerFunctionName})):this.customCodeHelperFormatter.formatTemplate((0,l.SingleCallControllerTemplate)(),{callControllerFunctionName:this.callsControllerFunctionName})}};t.CallsControllerFunctionCodeHelper=p,n([(0,u.initializable)(),i("design:type",String)],p.prototype,"callsControllerFunctionName",void 0),n([(0,u.initializable)(),i("design:type",String)],p.prototype,"nodeTransformationStage",void 0),t.CallsControllerFunctionCodeHelper=p=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperFormatter)),a(2,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperObfuscator)),a(3,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(4,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Function,Object,Object,Object,Object])],p)},28650:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assertConstructorMetadataArrayFilled=function(e,t){const r=[];for(let e=0;e0)throw new n.InversifyCoreError(i.InversifyCoreErrorKind.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}" at constructor indexes "${r.join('", "')}".\n\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)};const n=r(21773),i=r(94931)},28901:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BlockStatementControlFlowFlatteningNode=void 0;const o=r(71519),s=r(32287),c=r(19793),u=r(10548),l=r(57013),d=r(91363),f=r(23615),p=r(25120);let h=class extends l.AbstractCustomNode{constructor(e,t,r,n){super(e,t,r,n)}initialize(e,t,r){this.blockStatementBody=e,this.shuffledKeys=t,this.originalKeysIndexesInShuffledArray=r}getNodeStructure(){const e=this.randomGenerator.getRandomString(6),t=this.randomGenerator.getRandomString(6),r=d.NodeFactory.blockStatementNode([d.NodeFactory.variableDeclarationNode([d.NodeFactory.variableDeclaratorNode(d.NodeFactory.identifierNode(e),d.NodeFactory.callExpressionNode(d.NodeFactory.memberExpressionNode(d.NodeFactory.literalNode(this.originalKeysIndexesInShuffledArray.join(c.StringSeparator.VerticalLine)),d.NodeFactory.identifierNode("split")),[d.NodeFactory.literalNode(c.StringSeparator.VerticalLine)]))],"const"),d.NodeFactory.variableDeclarationNode([d.NodeFactory.variableDeclaratorNode(d.NodeFactory.identifierNode(t),d.NodeFactory.literalNode(0))],"let"),d.NodeFactory.whileStatementNode(d.NodeFactory.literalNode(!0),d.NodeFactory.blockStatementNode([d.NodeFactory.switchStatementNode(d.NodeFactory.memberExpressionNode(d.NodeFactory.identifierNode(e),d.NodeFactory.updateExpressionNode("++",d.NodeFactory.identifierNode(t)),!0),this.shuffledKeys.map((e,t)=>{const r=this.blockStatementBody[e],n=[r];return f.NodeGuards.isReturnStatementNode(r)||n.push(d.NodeFactory.continueStatement()),d.NodeFactory.switchCaseNode(d.NodeFactory.literalNode(String(t)),n)})),d.NodeFactory.breakStatement()]))]);return p.NodeUtils.parentizeAst(r),[r]}};t.BlockStatementControlFlowFlatteningNode=h,n([(0,u.initializable)(),i("design:type",Array)],h.prototype,"blockStatementBody",void 0),n([(0,u.initializable)(),i("design:type",Array)],h.prototype,"originalKeysIndexesInShuffledArray",void 0),n([(0,u.initializable)(),i("design:type",Array)],h.prototype,"shuffledKeys",void 0),t.BlockStatementControlFlowFlatteningNode=h=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperFormatter)),a(2,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(3,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Function,Object,Object,Object])],h)},29172:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){(0,n.default)(e);var t=e.split(".");if(3!==t.length)return!1;return t.reduce(function(e,t){return e&&(0,i.default)(t,{urlSafe:!0})},!0)};var n=a(r(83399)),i=a(r(98274));function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default,e.exports.default=t.default},29285:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r,n;(0,i.default)(e),"object"===a(t)?(r=t.min||0,n=t.max):(r=arguments[1]||0,n=arguments[2]);var o=e.match(/[^\uFE0F\uFE0E][\uFE0F\uFE0E]/g)||[],s=e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)||[],c=e.length-o.length-s.length,u=c>=r&&(void 0===n||c<=n);if(u&&Array.isArray(null==t?void 0:t.discreteLengths))return t.discreteLengths.some(function(e){return e===c});return u};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}e.exports=t.default,e.exports.default=t.default},29378:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Lookup=void 0;var o=a(r(95507)),s=r(76804),c=function(){function e(){this._map=new Map}return e.prototype.getMap=function(){return this._map},e.prototype.add=function(e,t){if(this._checkNonNulish(e),null==t)throw new Error(o.NULL_ARGUMENT);var r=this._map.get(e);void 0!==r?r.push(t):this._map.set(e,[t])},e.prototype.get=function(e){this._checkNonNulish(e);var t=this._map.get(e);if(void 0!==t)return t;throw new Error(o.KEY_NOT_FOUND)},e.prototype.remove=function(e){if(this._checkNonNulish(e),!this._map.delete(e))throw new Error(o.KEY_NOT_FOUND)},e.prototype.removeIntersection=function(e){var t=this;this.traverse(function(r,n){var i=e.hasKey(r)?e.get(r):void 0;if(void 0!==i){var a=n.filter(function(e){return!i.some(function(t){return e===t})});t._setValue(r,a)}})},e.prototype.removeByCondition=function(e){var t=this,r=[];return this._map.forEach(function(n,i){for(var a=[],o=0,s=n;o0?this._map.set(e,t):this._map.delete(e)},e}();t.Lookup=c},29666:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)(e),a.test(e)},t.fullWidth=void 0;var n,i=(n=r(83399))&&n.__esModule?n:{default:n};var a=t.fullWidth=/[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/},29947:e=>{"use strict";e.exports=()=>{const e="\\ud800-\\udfff",t=`[${e}]`,r="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]",n="\\ud83c[\\udffb-\\udfff]",i=`[^${e}]`,a="(?:\\uD83C[\\uDDE6-\\uDDFF]){2}",o="[\\ud800-\\udbff][\\udc00-\\udfff]",s="[\\uD83D\\uDC69\\uD83C\\uDFFB\\u200D\\uD83C\\uDF93]",c=`${`(?:${r}|${n})`}?`,u="[\\ufe0e\\ufe0f]?",l=u+c+`(?:\\u200d(?:${[i,a,o].join("|")})${u+c})*`,d=`(?:${[`${i}${r}?`,r,a,o,t,s].join("|")})`;return new RegExp(`(?:\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40(?:\\udc65|\\udc73|\\udc77)\\udb40(?:\\udc6e|\\udc63|\\udc6c)\\udb40(?:\\udc67|\\udc74|\\udc73)\\udb40\\udc7f)|${n}(?=${n})|${d+l}`,"g")}},30102:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.CodeTransformer=void 0,function(e){e.HashbangOperatorTransformer="HashbangOperatorTransformer"}(r||(t.CodeTransformer=r={}))},30221:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DeadCodeInjectionIdentifiersTransformer=void 0;const o=r(71519),s=r(32287),c=r(18436),u=r(76893),l=r(23615);let d=class extends u.AbstractNodeTransformer{constructor(e,t,r,n){super(t,r),this.identifierReplacer=e,this.scopeIdentifiersTraverser=n}getVisitor(e){return e===c.NodeTransformationStage.RenameIdentifiers?{enter:(e,t)=>{if(t&&l.NodeGuards.isProgramNode(e))return this.transformNode(e,t)}}:null}transformNode(e,t){return this.scopeIdentifiersTraverser.traverseScopeThroughIdentifiers(e,t,e=>{const{reference:t,variableLexicalScopeNode:r}=e;this.transformScopeThroughIdentifiers(t,r)}),e}transformScopeThroughIdentifiers(e,t){if(e.resolved)return;const r=e.identifier;this.storeIdentifierName(r,t),this.replaceIdentifierName(r,t,e)}storeIdentifierName(e,t){this.identifierReplacer.storeLocalName(e,t)}replaceIdentifierName(e,t,r){const n=this.identifierReplacer.replace(e,t);r.identifier.name=n.name}};t.DeadCodeInjectionIdentifiersTransformer=d,t.DeadCodeInjectionIdentifiersTransformer=d=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IIdentifierReplacer)),a(1,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(2,(0,o.inject)(s.ServiceIdentifiers.IOptions)),a(3,(0,o.inject)(s.ServiceIdentifiers.IScopeIdentifiersTraverser)),i("design:paramtypes",[Object,Object,Object,Object])],d)},30317:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return(0,n.default)((0,i.default)(e,t),t)};var n=a(r(12483)),i=a(r(62309));function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default,e.exports.default=t.default},30386:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeAppender=void 0;const n=r(23615);class i{static append(e,t){t=i.parentizeScopeStatementsBeforeAppend(e,t);const r=i.getScopeStatements(e).concat(t);i.setScopeStatements(e,r)}static appendToOptimalBlockScope(e,t,r,n=0){const a=e.length?i.getOptimalBlockScope(e,n):t;i.prepend(a,r)}static getOptimalBlockScope(e,t,r=1/0){const n=e[t];if(r<=0)throw new Error("Invalid `deep` argument value. Value should be bigger then 0.");return r>1&&n.callsGraph.length?i.getOptimalBlockScope(n.callsGraph,0,--r):n.callee}static getScopeStatements(e){return n.NodeGuards.isSwitchCaseNode(e)?e.consequent:e.body}static insertBefore(e,t,r){const n=i.getScopeStatements(e).indexOf(r);i.insertAtIndex(e,t,n)}static insertAfter(e,t,r){const n=i.getScopeStatements(e).indexOf(r);i.insertAtIndex(e,t,n+1)}static insertAtIndex(e,t,r){t=i.parentizeScopeStatementsBeforeAppend(e,t),i.setScopeStatements(e,[...i.getScopeStatements(e).slice(0,r),...t,...i.getScopeStatements(e).slice(r)])}static prepend(e,t){const r=(t=i.parentizeScopeStatementsBeforeAppend(e,t)).concat(i.getScopeStatements(e));i.setScopeStatements(e,r)}static remove(e,t){const r=i.getScopeStatements(e),n=r.indexOf(t);if(-1===n)return;const a=[...r];a.splice(n,1),i.setScopeStatements(e,a)}static parentizeScopeStatementsBeforeAppend(e,t){return t.forEach(t=>{t.parentNode=e}),t}static setScopeStatements(e,t){n.NodeGuards.isSwitchCaseNode(e)?e.consequent=t:e.body=t}}t.NodeAppender=i},30486:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},o=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RandomGenerator=void 0;const c=r(71519),u=r(32287),l=s(r(83503)),d=r(97677),f=r(10548),p=r(218),h=r(98376);let m=n=class{constructor(e,t){this.sourceCode=e,this.options=t}initialize(){this.randomGenerator=new d.Chance(this.getRawSeed())}getMathRandom(){return this.getRandomInteger(0,99999)/1e5}getRandomGenerator(){return this.randomGenerator}getRandomInteger(e,t){return this.getRandomGenerator().integer({min:e,max:t})}getRandomIntegerExcluding(e,t,r){const n=[];for(let i=e;i<=t;i++)r.includes(i)||n.push(i);return this.randomGenerator.pickone(n)}getRandomString(e,t=n.randomGeneratorPool){return this.getRandomGenerator().string({length:e,pool:t})}getInputSeed(){return this.options.seed.toString()}getRawSeed(){const e=this.getInputSeed();if(`${e}`.split("|").length>1)return e;return`${e}|${(0,l.default)(this.sourceCode.getSourceCode())}`}};t.RandomGenerator=m,m.randomGeneratorPool=`${p.alphabetString}${h.alphabetStringUppercase}`,i([(0,f.initializable)(),a("design:type",Object)],m.prototype,"randomGenerator",void 0),i([(0,c.postConstruct)(),a("design:type",Function),a("design:paramtypes",[]),a("design:returntype",void 0)],m.prototype,"initialize",null),t.RandomGenerator=m=n=i([(0,c.injectable)(),o(0,(0,c.inject)(u.ServiceIdentifiers.ISourceCode)),o(1,(0,c.inject)(u.ServiceIdentifiers.IOptions)),a("design:paramtypes",[Object,Object])],m)},30490:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceTransformer=void 0;const o=r(71519),s=r(32287),c=r(18436),u=r(96390),l=r(76893),d=r(23615),f=r(90253),p=r(91363),h=r(25120);let m=class extends l.AbstractNodeTransformer{constructor(e,t,r){super(e,t),this.runAfter=[u.NodeTransformer.CustomCodeHelpersTransformer],this.escapeSequenceEncoder=r}getVisitor(e){return e===c.NodeTransformationStage.Finalizing?{enter:(e,t)=>{if(d.NodeGuards.isLiteralNode(e))return this.transformNode(e,t)}}:null}transformNode(e,t){if(!f.NodeLiteralUtils.isStringLiteralNode(e))return e;const r=this.escapeSequenceEncoder.encode(e.value,this.options.unicodeEscapeSequence),n=p.NodeFactory.literalNode(r);return h.NodeUtils.parentizeNode(n,t),n}};t.EscapeSequenceTransformer=m,t.EscapeSequenceTransformer=m=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),a(2,(0,o.inject)(s.ServiceIdentifiers.IEscapeSequenceEncoder)),i("design:paramtypes",[Object,Object,Object])],m)},30607:function(e,t,r){"use strict";var n,i=r(65606),a=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),i=0;il.blobUploadThreshold?this.obfuscateWithBlobUpload(n,r):this.obfuscateDirect(n,r)}async obfuscateDirect(e,t){const r={"Content-Type":"application/json",Accept:"application/x-ndjson",Authorization:`Bearer ${this.config.apiToken}`},n=new AbortController,i=setTimeout(()=>n.abort(),this.config.timeout);let a=l.apiUrl;this.config.version&&(a=`${l.apiUrl}?version=${encodeURIComponent(this.config.version)}`);try{const o=await fetch(a,{method:"POST",headers:r,body:e,signal:n.signal});return clearTimeout(i),this.handleStreamingResponse(o,t)}catch(e){if(clearTimeout(i),e instanceof Error&&"AbortError"===e.name)throw new c.ApiError("Request timeout",408);throw e}}async obfuscateWithBlobUpload(e,t){null==t||t("Uploading large file...");const r=await this.uploadToBlob(e);null==t||t("File uploaded, starting obfuscation...");const n={"Content-Type":"application/json",Accept:"application/x-ndjson",Authorization:`Bearer ${this.config.apiToken}`},i=new AbortController,a=setTimeout(()=>i.abort(),this.config.timeout);let o=l.apiUrl;this.config.version&&(o=`${l.apiUrl}?version=${encodeURIComponent(this.config.version)}`);try{const e=await fetch(o,{method:"POST",headers:n,body:JSON.stringify({blobUrl:r}),signal:i.signal});return clearTimeout(a),this.handleStreamingResponse(e,t)}catch(e){if(clearTimeout(a),e instanceof Error&&"AbortError"===e.name)throw new c.ApiError("Request timeout",408);throw e}}async uploadToBlob(e){const t="obfuscate-request.json",r=await this.getUploadToken(t);return this.uploadWithClientToken(r,t,e)}async getUploadToken(e){var t;const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const i=await fetch(l.uploadTokenUrl,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.config.apiToken}`},body:JSON.stringify({pathname:e}),signal:r.signal});clearTimeout(n);const a=await i.text();let o;try{o=JSON.parse(a)}catch(e){throw new c.ApiError(a||"Failed to get upload token",i.status)}if(!i.ok)throw new c.ApiError(null!==(t=o.error)&&void 0!==t?t:"Failed to get upload token",i.status);if(!o.clientToken)throw new c.ApiError("No client token returned",500);return o.clientToken}catch(e){if(clearTimeout(n),e instanceof c.ApiError)throw e;if(e instanceof Error&&"AbortError"===e.name)throw new c.ApiError("Token request timeout",408);throw e}}async uploadWithClientToken(e,t,n){const i=await Promise.resolve().then(()=>s(r(19384))),a=new AbortController,o=setTimeout(()=>a.abort(),12e4);try{const r=await i.put(t,n,{access:"public",token:e});return clearTimeout(o),r.url}catch(e){if(clearTimeout(o),e instanceof c.ApiError)throw e;if(e instanceof Error&&"AbortError"===e.name)throw new c.ApiError("Upload timeout",408);if(e instanceof Error)throw new c.ApiError(`Upload failed: ${e.message}`,500);throw e}}async handleStreamingResponse(e,t){var r;const n=(await e.text()).trim().split("\n"),i=[];for(const e of n)if(e.trim())try{const r=JSON.parse(e);i.push(r),"progress"===r.type&&r.message&&t&&t(r.message)}catch(e){}const a=i.find(e=>"error"===e.type);if(a)throw new c.ApiError(null!==(r=a.message)&&void 0!==r?r:"Unknown API error",e.status);const o=this.reassembleChunkedResponse(i);if(!o.code)throw new c.ApiError("No result received from API",500);return new u.ProApiObfuscationResult(o.code,o.sourceMap||"")}reassembleChunkedResponse(e){var t,r,n;const i=[],a=[];let o={code:"",sourceMap:""};for(const s of e)switch(s.type){case"chunk":"code"===s.field&&void 0!==s.data&&void 0!==s.index?i[s.index]=s.data:"sourceMap"===s.field&&void 0!==s.data&&void 0!==s.index&&(a[s.index]=s.data);break;case"chunk_end":o.code=i.join(""),o.sourceMap=null!==(t=a.join("")||s.sourceMap)&&void 0!==t?t:"";break;case"result":o={code:null!==(r=s.code)&&void 0!==r?r:"",sourceMap:null!==(n=s.sourceMap)&&void 0!==n?n:""}}return o}}t.ProApiClient=l,l.apiHost=i.env.OBFUSCATOR_API_HOST||"https://obfuscator.io",l.apiUrl=`${l.apiHost}/api/v1/obfuscate`,l.uploadTokenUrl=`${l.apiHost}/api/v1/upload/token`,l.defaultTimeout=3e5,l.blobUploadThreshold=4613734.4},30664:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MemberExpressionTransformer=void 0;const o=r(71519),s=r(32287),c=r(18436),u=r(76893),l=r(91363),d=r(23615),f=r(12720);let p=class extends u.AbstractNodeTransformer{constructor(e,t){super(e,t)}getVisitor(e){return e===c.NodeTransformationStage.Converting?{enter:(e,t)=>{if(t&&d.NodeGuards.isMemberExpressionNode(e))return this.transformNode(e,t)}}:null}transformNode(e,t){if(f.NodeMetadata.isIgnoredNode(e.object)||f.NodeMetadata.isIgnoredNode(e.property))return e;if(d.NodeGuards.isIdentifierNode(e.property)){if(e.computed)return e;e.computed=!0,e.property=l.NodeFactory.literalNode(e.property.name)}return e}};t.MemberExpressionTransformer=p,t.MemberExpressionTransformer=p=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object,Object])],p)},31252:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,n.default)(e),(0,i.default)(e)&&24===e.length};var n=a(r(83399)),i=a(r(82002));function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default,e.exports.default=t.default},31309:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SourceMapFileNameRule=void 0;const n=r(19793);t.SourceMapFileNameRule=e=>{let{sourceMapFileName:t}=e;if(t){t=t.replace(/^\/+/,"").replace(/(?:\.js)?(?:\.map)?$/,"");let r=t.split(n.StringSeparator.Dot);const i=r.length,a=r[i-1];i>1&&a.length<=3&&(r=r.slice(0,-1)),t=r.join(n.StringSeparator.Dot),e={...e,sourceMapFileName:`${t}.js.map`}}return e}},31449:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)(e),a.fullWidth.test(e)&&o.halfWidth.test(e)};var n,i=(n=r(83399))&&n.__esModule?n:{default:n},a=r(29666),o=r(49534);e.exports=t.default,e.exports.default=t.default},31601:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.injectBase=function(e){return function(t){return function(r,o,s){if(void 0===t){var c="function"==typeof r?r.name:r.constructor.name;throw new Error((0,n.UNDEFINED_INJECT_ANNOTATION)(c))}(0,a.createTaggedDecorator)(new i.Metadata(e,t))(r,o,s)}}};var n=r(95507),i=r(14425),a=r(24157)},31691:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayCodeHelper=void 0;const o=r(71519),s=r(32287),c=r(10548),u=r(65104),l=r(88318),d=r(25120),f=r(37004);let p=class extends l.AbstractCustomCodeHelper{constructor(e,t,r,n,i){super(e,t,r,n,i)}initialize(e,t){this.stringArrayStorage=e,this.stringArrayFunctionName=t}getNodeStructure(e){return d.NodeUtils.convertCodeToStructure(e)}getCodeHelperTemplate(){const e=this.identifierNamesGenerator.generateNext();return this.customCodeHelperFormatter.formatTemplate((0,u.StringArrayTemplate)(),{stringArrayFunctionName:this.stringArrayFunctionName,stringArrayName:e,stringArrayStorageItems:this.getEncodedStringArrayStorageItems()})}getEncodedStringArrayStorageItems(){return Array.from(this.stringArrayStorage.getStorage().values()).map(e=>`'${f.StringUtils.escapeJsString(e.encodedValue)}'`).toString()}};t.StringArrayCodeHelper=p,n([(0,c.initializable)(),i("design:type",Object)],p.prototype,"stringArrayStorage",void 0),n([(0,c.initializable)(),i("design:type",String)],p.prototype,"stringArrayFunctionName",void 0),t.StringArrayCodeHelper=p=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperFormatter)),a(2,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperObfuscator)),a(3,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(4,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Function,Object,Object,Object,Object])],p)},31954:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)(e),a.test(e)};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};var a=/^[A-Z]{2}[0-9A-Z]{3}\d{2}\d{5}$/;e.exports=t.default,e.exports.default=t.default},32017:e=>{"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,i,a;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(i=n;0!==i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(a=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=n;0!==i--;)if(!Object.prototype.hasOwnProperty.call(r,a[i]))return!1;for(i=n;0!==i--;){var o=a[i];if(!e(t[o],r[o]))return!1}return!0}return t!=t&&r!=r}},32047:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayRC4DecodeTemplate=function(e){const t=e.getRandomString(6),r=e.getRandomString(6),n=e.getRandomString(6),i=e.getRandomString(6);return`\n if ({stringArrayCallsWrapperName}.${t} === undefined) {\n {atobPolyfill}\n {rc4Polyfill}\n {stringArrayCallsWrapperName}.${r} = {rc4FunctionName};\n \n {stringArrayCallsWrapperName}.${n} = {};\n \n {stringArrayCallsWrapperName}.${t} = true;\n }\n \n const firstValue = stringArray[0];\n const cacheKey = index + firstValue;\n const cachedValue = {stringArrayCallsWrapperName}.${n}[cacheKey];\n\n if (!cachedValue) {\n if ({stringArrayCallsWrapperName}.${i} === undefined) {\n {selfDefendingCode}\n \n {stringArrayCallsWrapperName}.${i} = true;\n }\n \n value = {stringArrayCallsWrapperName}.${r}(value, key);\n {stringArrayCallsWrapperName}.${n}[cacheKey] = value;\n } else {\n value = cachedValue;\n }\n `}},32287:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ServiceIdentifiers=void 0,function(e){e.Factory__ICalleeDataExtractor="Factory",e.Factory__ICodeTransformer="Factory",e.Factory__IControlFlowCustomNode="Factory",e.Factory__IControlFlowReplacer="Factory",e.Factory__ICustomCodeHelper="Factory",e.Factory__ICustomCodeHelperGroup="Factory",e.Factory__IDeadCodeInjectionCustomNode="Factory",e.Factory__IIdentifierNamesGenerator="Factory",e.Factory__INodeGuard="Factory",e.Factory__INodeTransformer="Factory",e.Factory__IObfuscationResult="Factory",e.Factory__IObjectExpressionKeysTransformerCustomNode="Factory",e.Factory__IObjectExpressionExtractor="Factory",e.Factory__IStringArrayCustomNode="Factory",e.Factory__IStringArrayIndexNode="Factory",e.Factory__TControlFlowStorage="Factory",e.IArrayUtils="IArrayUtils",e.ICalleeDataExtractor="ICalleeDataExtractor",e.ICallsGraphAnalyzer="ICallsGraphAnalyzer",e.ICodeTransformer="ICodeTransformer",e.ICodeTransformerNamesGroupsBuilder="ICodeTransformerNamesGroupsBuilder",e.ICodeTransformersRunner="ICodeTransformersRunner",e.IControlFlowStorage="IControlFlowStorage",e.ICryptUtils="ICryptUtils",e.ICryptUtilsStringArray="ICryptUtilsStringArray",e.ICustomCodeHelper="ICustomCodeHelper",e.ICustomCodeHelperGroup="ICustomCodeHelperGroup",e.IControlFlowReplacer="IControlFlowReplacer",e.ICustomCodeHelperFormatter="ICustomCodeHelperFormatter",e.ICustomCodeHelperObfuscator="ICustomCodeHelperObfuscator",e.IEscapeSequenceEncoder="IEscapeSequenceEncoder",e.IGlobalIdentifierNamesCacheStorage="IGlobalIdentifierNamesCacheStorage",e.IIdentifierNamesGenerator="IIdentifierNamesGenerator",e.IIdentifierReplacer="IIdentifierReplacer",e.IJavaScriptObfuscator="IJavaScriptObfuscator",e.ILevelledTopologicalSorter="ILevelledTopologicalSorter",e.ILiteralNodesCacheStorage="ILiteralNodesCacheStorage",e.ILogger="ILogger",e.INodeGuard="INodeGuard",e.INodeTransformer="INodeTransformer",e.INodeTransformerNamesGroupsBuilder="INodeTransformerNamesGroupsBuilder",e.INodeTransformersRunner="INodeTransformersRunner",e.INumberNumericalExpressionAnalyzer="INumberNumericalExpressionAnalyzer",e.IObfuscationResult="IObfuscationResult",e.IOptions="IOptions",e.IOptionsNormalizer="IOptionsNormalizer",e.IPrevailingKindOfVariablesAnalyzer="IPrevailingKindOfVariablesAnalyzer",e.IPropertyIdentifierNamesCacheStorage="IPropertyIdentifierNamesCacheStorage",e.IObjectExpressionExtractor="IObjectExpressionExtractor",e.IRandomGenerator="IRandomGenerator",e.IRenamePropertiesReplacer="IRenamePropertiesReplacer",e.IScopeIdentifiersTraverser="IScopeIdentifiersTraverser",e.ISetUtils="ISetUtils",e.ISourceCode="ISourceCode",e.IScopeAnalyzer="IScopeAnalyzer",e.IStringArrayIndexNode="IStringArrayIndexNode",e.IStringArrayScopeCallsWrappersDataStorage="IStringArrayScopeCallsWrappersDataStorage",e.IStringArrayStorage="IStringArrayStorage",e.IStringArrayStorageAnalyzer="IStringArrayStorageAnalyzer",e.IThroughIdentifierReplacer="IThroughIdentifierReplacer",e.IVisitedLexicalScopeNodesStackStorage="IVisitedLexicalScopeNodesStackStorage",e.Newable__ICustomNode="Newable",e.TCustomNodeGroupStorage="TCustomNodeGroupStorage",e.TInputOptions="TInputOptions"}(r||(t.ServiceIdentifiers=r={}))},32337:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if((0,a.default)(e),0!==e.indexOf("mailto:"))return!1;var r=s(e.replace("mailto:","").split("?"),2),o=r[0],u=r[1],l=void 0===u?"":u;if(!o&&!l)return!0;var d=function(e){var t=new Set(["subject","body","cc","bcc"]),r={cc:"",bcc:""},n=!1,i=e.split("&");if(i.length>4)return!1;var a,o=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=c(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}(i);try{for(o.s();!(a=o.n()).done;){var u=s(a.value.split("="),2),l=u[0],d=u[1];if(l&&!t.has(l)){n=!0;break}!d||"cc"!==l&&"bcc"!==l||(r[l]=d),l&&t.delete(l)}}catch(e){o.e(e)}finally{o.f()}return!n&&r}(l);if(!d)return!1;return"".concat(o,",").concat(d.cc,",").concat(d.bcc).split(",").every(function(e){return!(e=(0,n.default)(e," "))||(0,i.default)(e,t)})};var n=o(r(30317)),i=o(r(69517)),a=o(r(83399));function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,s=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return u(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");t.encode=function(e){if(0<=e&&e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeLexicalScopeUtils=void 0;const n=r(23615);class i{static getLexicalScope(e){return i.getLexicalScopesRecursive(e,1)[0]}static getLexicalScopes(e){return i.getLexicalScopesRecursive(e)}static getLexicalScopesRecursive(e,t=1/0,r=[],a=0){if(r.length>=t)return r;const o=e.parentNode;if(!o)throw new ReferenceError("`parentNode` property of given node is `undefined`");return n.NodeGuards.isNodeWithLexicalScope(e)&&r.push(e),e!==o?i.getLexicalScopesRecursive(o,t,r,++a):r}}t.NodeLexicalScopeUtils=i},32644:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},o=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.IgnoredImportObfuscatingGuard=void 0;const s=r(71519),c=r(50275),u=r(32287),l=r(23615);let d=n=class{constructor(e){this.options=e}static isDynamicImport(e){return l.NodeGuards.isImportExpressionNode(e)}static isRequireImport(e){return l.NodeGuards.isCallExpressionNode(e)&&l.NodeGuards.isIdentifierNode(e.callee)&&"require"===e.callee.name}check(e){if(this.options.ignoreImports){if(n.isDynamicImport(e)||n.isRequireImport(e))return c.ObfuscatingGuardResult.Ignore}return c.ObfuscatingGuardResult.Transform}};t.IgnoredImportObfuscatingGuard=d,t.IgnoredImportObfuscatingGuard=d=n=i([(0,s.injectable)(),o(0,(0,s.inject)(u.ServiceIdentifiers.IOptions)),a("design:paramtypes",[Object])],d)},32795:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ControlFlowStorageNode=void 0;const o=r(71519),s=r(32287),c=r(10548),u=r(57013),l=r(91363),d=r(23615);let f=class extends u.AbstractCustomNode{constructor(e,t,r,n){super(e,t,r,n)}initialize(e){this.controlFlowStorage=e}getNodeStructure(){const e=[],t=this.controlFlowStorage.getStorage();for(const[r,n]of t){const t=n.getNode()[0];if(!d.NodeGuards.isExpressionStatementNode(t))throw new Error("Function node for control flow storage object should be passed inside the `ExpressionStatement` node!");e.push(l.NodeFactory.propertyNode(l.NodeFactory.identifierNode(r),t.expression))}return[l.NodeFactory.variableDeclarationNode([l.NodeFactory.variableDeclaratorNode(l.NodeFactory.identifierNode(this.controlFlowStorage.getStorageId()),l.NodeFactory.objectExpressionNode(e))],"const")]}};t.ControlFlowStorageNode=f,n([(0,c.initializable)(),i("design:type",Object)],f.prototype,"controlFlowStorage",void 0),t.ControlFlowStorageNode=f=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperFormatter)),a(2,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(3,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Function,Object,Object,Object])],f)},33078:(e,t)=>{"use strict";const r={ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],AwaitExpression:["argument"],BinaryExpression:["left","right"],BlockStatement:["body"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExperimentalRestProperty:["argument"],ExperimentalSpreadProperty:["argument"],ExportAllDeclaration:["exported","source","attributes"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source","attributes"],ExportSpecifier:["local","exported"],ExpressionStatement:["expression"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportAttribute:["key","value"],ImportDeclaration:["specifiers","source","attributes"],ImportDefaultSpecifier:["local"],ImportExpression:["source","options"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXClosingFragment:[],JSXElement:["openingElement","children","closingElement"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXFragment:["openingFragment","children","closingFragment"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes"],JSXOpeningFragment:[],JSXSpreadAttribute:["argument"],JSXSpreadChild:["expression"],JSXText:[],LabeledStatement:["label","body"],Literal:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],StaticBlock:["body"],Super:[],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},n=Object.keys(r);for(const e of n)Object.freeze(r[e]);Object.freeze(r);const i=new Set(["parent","leadingComments","trailingComments"]);function a(e){return!i.has(e)&&"_"!==e[0]}t.KEYS=r,t.getKeys=function(e){return Object.keys(e).filter(a)},t.unionWith=function(e){const t=Object.assign({},r);for(const r of Object.keys(e))if(Object.hasOwn(t,r)){const n=new Set(e[r]);for(const e of t[r])n.add(e);t[r]=Object.freeze(Array.from(n))}else t[r]=Object.freeze(Array.from(e[r]));return Object.freeze(t)}},33389:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.WeakMapStorage=void 0;const o=r(71519),s=r(32287),c=r(10548);let u=class{constructor(e,t){this.randomGenerator=e,this.options=t}initialize(){this.storage=new Map,this.storageId=this.randomGenerator.getRandomString(6)}get(e){return this.storage.get(e)}getOrThrow(e){const t=this.get(e);if(!t)throw new Error(`No value found in weak map storage with key \`${e}\``);return t}getStorage(){return this.storage}getStorageId(){return this.storageId}has(e){return this.storage.has(e)}set(e,t){this.storage.set(e,t)}};t.WeakMapStorage=u,n([(0,c.initializable)(),i("design:type",String)],u.prototype,"storageId",void 0),n([(0,c.initializable)(),i("design:type",WeakMap)],u.prototype,"storage",void 0),n([(0,o.postConstruct)(),i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",void 0)],u.prototype,"initialize",null),t.WeakMapStorage=u=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object,Object])],u)},33655:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.multiInject=void 0;var o=a(r(2006)),s=(0,r(31601).injectBase)(o.MULTI_INJECT_TAG);t.multiInject=s},33752:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)(e)?parseFloat(e):NaN};var n,i=(n=r(50995))&&n.__esModule?n:{default:n};e.exports=t.default,e.exports.default=t.default},33906:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)(e,{allow_leading_zeroes:!1,min:0,max:65535})};var n,i=(n=r(76084))&&n.__esModule?n:{default:n};e.exports=t.default,e.exports.default=t.default},33973:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return(0,i.default)(e),new RegExp("^[a-fA-F0-9]{".concat(a[t],"}$")).test(e)};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};var a={md5:32,md4:32,sha1:40,sha256:64,sha384:96,sha512:128,ripemd128:32,ripemd160:40,tiger128:32,tiger160:40,tiger192:48,crc32:8,crc32b:8};e.exports=t.default,e.exports.default=t.default},34003:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractIdentifierNamesGenerator=void 0;const o=r(71519),s=r(32287),c=r(23615);let u=class{constructor(e,t){this.preservedNamesSet=new Set,this.lexicalScopesPreservedNamesMap=new WeakMap,this.allLexicalScopePreservedNames=new Set,this.randomGenerator=e,this.options=t}generate(e,t){return c.NodeGuards.isProgramNode(e)?this.generateForGlobalScope():this.generateForLexicalScope(e)}preserveName(e){this.preservedNamesSet.add(e)}preserveNameForLexicalScope(e,t){var r;const n=null!==(r=this.lexicalScopesPreservedNamesMap.get(t))&&void 0!==r?r:new Set;n.add(e),this.lexicalScopesPreservedNamesMap.set(t,n),this.allLexicalScopePreservedNames.add(e)}isValidIdentifierName(e){return!this.isReservedName(e)&&!this.preservedNamesSet.has(e)}isValidIdentifierNameInLexicalScopes(e,t){var r;if(!this.isValidIdentifierName(e))return!1;for(const n of t){const t=null!==(r=this.lexicalScopesPreservedNamesMap.get(n))&&void 0!==r?r:null;if(t&&t.has(e))return!1}return!0}isValidIdentifierNameInAllScopes(e){return!!this.isValidIdentifierName(e)&&!this.allLexicalScopePreservedNames.has(e)}isReservedName(e){return!!this.options.reservedNames.length&&this.options.reservedNames.some(t=>null!==new RegExp(t,"g").exec(e))}};t.AbstractIdentifierNamesGenerator=u,t.AbstractIdentifierNamesGenerator=u=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object,Object])],u)},34516:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectExpressionToVariableDeclarationExtractor=void 0;const o=r(71519),s=r(32287),c=r(63726),u=r(30386),l=r(23615),d=r(50027),f=r(25120),p=r(32504);let h=class{constructor(e){this.objectExpressionKeysTransformerCustomNodeFactory=e}extract(e,t){return this.transformObjectExpressionToVariableDeclaration(e,t)}transformObjectExpressionToVariableDeclaration(e,t){var r;const n=d.NodeStatementUtils.getScopeOfNode(t),i=l.NodeGuards.isNodeWithLexicalScope(n)?n:null!==(r=p.NodeLexicalScopeUtils.getLexicalScope(n))&&void 0!==r?r:null;if(!i)throw new Error("Cannot find lexical scope node for the host statement node");const a=e.properties,o=this.getObjectExpressionHostNode(i,a),s=[o];u.NodeAppender.insertBefore(n,s,t),f.NodeUtils.parentizeAst(o),f.NodeUtils.parentizeNode(o,n);return{nodeToReplace:this.getObjectExpressionIdentifierNode(o),objectExpressionHostStatement:o,objectExpressionNode:this.getObjectExpressionNode(o)}}getObjectExpressionHostNode(e,t){const r=this.objectExpressionKeysTransformerCustomNodeFactory(c.ObjectExpressionKeysTransformerCustomNode.ObjectExpressionVariableDeclarationHostNode);r.initialize(e,t);const n=r.getNode()[0];if(!n||!l.NodeGuards.isVariableDeclarationNode(n))throw new Error("`objectExpressionHostCustomNode.getNode()[0]` should returns array with `VariableDeclaration` node");return n}getObjectExpressionIdentifierNode(e){const t=e.declarations[0].id;if(!l.NodeGuards.isIdentifierNode(t))throw new Error("`objectExpressionHostNode` should contain `VariableDeclarator` node with `Identifier` id property");return t}getObjectExpressionNode(e){var t;const r=null!==(t=e.declarations[0].init)&&void 0!==t?t:null;if(!r||!l.NodeGuards.isObjectExpressionNode(r))throw new Error("`objectExpressionHostNode` should contain `VariableDeclarator` node with `ObjectExpression` init property");return r}};t.ObjectExpressionToVariableDeclarationExtractor=h,t.ObjectExpressionToVariableDeclarationExtractor=h=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.Factory__IObjectExpressionKeysTransformerCustomNode)),i("design:paramtypes",[Function])],h)},34608:(e,t)=>{!function e(t){"use strict";var r,n,i,a,o,s;function c(e){var t,r,n={};for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]="object"==typeof r&&null!==r?c(r):r);return n}function u(e,t){this.parent=e,this.key=t}function l(e,t,r,n){this.node=e,this.path=t,this.wrap=r,this.ref=n}function d(){}function f(e){return null!=e&&("object"==typeof e&&"string"==typeof e.type)}function p(e,t){return(e===r.ObjectExpression||e===r.ObjectPattern)&&"properties"===t}function h(e,t){for(var r=e.length-1;r>=0;--r)if(e[r].node===t)return!0;return!1}function m(e,t){return(new d).traverse(e,t)}function g(e,t){var r;return r=function(e,t){var r,n,i,a;for(n=e.length,i=0;n;)t(e[a=i+(r=n>>>1)])?n=r:(i=a+1,n-=r+1);return i}(t,function(t){return t.range[0]>e.range[0]}),e.extendedRange=[e.range[0],e.range[1]],r!==t.length&&(e.extendedRange[1]=t[r].range[0]),(r-=1)>=0&&(e.extendedRange[0]=t[r].range[1]),e}return r={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",PrivateIdentifier:"PrivateIdentifier",Program:"Program",Property:"Property",PropertyDefinition:"PropertyDefinition",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",StaticBlock:"StaticBlock",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"},i={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],StaticBlock:["body"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},n={Break:a={},Skip:o={},Remove:s={}},u.prototype.replace=function(e){this.parent[this.key]=e},u.prototype.remove=function(){return Array.isArray(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)},d.prototype.path=function(){var e,t,r,n,i;function a(e,t){if(Array.isArray(t))for(r=0,n=t.length;r=0;)if(y=s[d=b[m]])if(Array.isArray(y)){for(g=y.length;(g-=1)>=0;)if(y[g]&&!h(n,y[g])){if(p(c,b[m]))i=new l(y[g],[d,g],"Property",null);else{if(!f(y[g]))continue;i=new l(y[g],[d,g],null,null)}r.push(i)}}else if(f(y)){if(h(n,y))continue;r.push(new l(y,d,null,null))}}}else if(i=n.pop(),u=this.__execute(t.leave,i),this.__state===a||u===a)return},d.prototype.replace=function(e,t){var r,n,i,c,d,h,m,g,b,y,S,v,_;function C(e){var t,n,i,a;if(e.ref.remove())for(n=e.ref.key,a=e.ref.parent,t=r.length;t--;)if((i=r[t]).ref&&i.ref.parent===a){if(i.ref.key=0;)if(y=i[_=b[m]])if(Array.isArray(y)){for(g=y.length;(g-=1)>=0;)if(y[g]){if(p(c,b[m]))h=new l(y[g],[_,g],"Property",new u(y,g));else{if(!f(y[g]))continue;h=new l(y[g],[_,g],null,new u(y,g))}r.push(h)}}else f(y)&&r.push(new l(y,_,null,new u(i,_)))}}else if(h=n.pop(),void 0!==(d=this.__execute(t.leave,h))&&d!==a&&d!==o&&d!==s&&h.ref.replace(d),this.__state!==s&&d!==s||C(h),this.__state===a||d===a)return v.root;return v.root},t.Syntax=r,t.traverse=m,t.replace=function(e,t){return(new d).replace(e,t)},t.attachComments=function(e,t,r){var i,a,o,s,u=[];if(!e.range)throw new Error("attachComments needs range information");if(!r.length){if(t.length){for(o=0,a=t.length;oe.range[0]);)t.extendedRange[1]===e.range[0]?(e.leadingComments||(e.leadingComments=[]),e.leadingComments.push(t),u.splice(s,1)):s+=1;return s===u.length?n.Break:u[s].extendedRange[0]>e.range[1]?n.Skip:void 0}}),s=0,m(e,{leave:function(e){for(var t;se.range[1]?n.Skip:void 0}}),e},t.VisitorKeys=i,t.VisitorOption=n,t.Controller=d,t.cloneEnvironment=function(){return e({})},t}(t)},35041:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},o=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.EvalCallExpressionTransformer=void 0;const s=r(71519),c=r(32287),u=r(96390),l=r(18436),d=r(76893),f=r(91363),p=r(23615),h=r(12720),m=r(25120),g=r(37004);let b=n=class extends d.AbstractNodeTransformer{constructor(e,t){super(e,t),this.runAfter=[u.NodeTransformer.EscapeSequenceTransformer,u.NodeTransformer.ParentificationTransformer,u.NodeTransformer.VariablePreserveTransformer]}static extractEvalStringFromCallExpressionArgument(e){return p.NodeGuards.isLiteralNode(e)?n.extractEvalStringFromLiteralNode(e):p.NodeGuards.isTemplateLiteralNode(e)?n.extractEvalStringFromTemplateLiteralNode(e):null}static extractEvalStringFromLiteralNode(e){return"string"==typeof e.value?e.value:null}static extractEvalStringFromTemplateLiteralNode(e){var t;const r=e.quasis;return 1!==r.length||e.expressions.length?null:null!==(t=r[0].value.cooked)&&void 0!==t?t:null}getVisitor(e){switch(e){case l.NodeTransformationStage.Preparing:return{enter:(e,t)=>{if(t)return this.transformNode(e,t)}};case l.NodeTransformationStage.Finalizing:return{leave:(e,t)=>{if(t)return this.restoreNode(e,t)}};default:return null}}transformNode(e,t){if(!(t&&p.NodeGuards.isCallExpressionNode(e)&&p.NodeGuards.isIdentifierNode(e.callee)&&"eval"===e.callee.name))return e;const r=e.arguments[0];if(!r)return e;const i=n.extractEvalStringFromCallExpressionArgument(r);if(!i)return e;let a;try{a=m.NodeUtils.convertCodeToStructure(i)}catch(t){return e}const o=f.NodeFactory.functionExpressionNode([],f.NodeFactory.blockStatementNode(a));return h.NodeMetadata.set(o,{evalHostNode:!0}),m.NodeUtils.parentizeAst(o),m.NodeUtils.parentizeNode(o,t),o}restoreNode(e,t){if(!this.isEvalRootAstHostNode(e))return e;const r=e.body.body,n=m.NodeUtils.convertStructureToCode(r);return f.NodeFactory.callExpressionNode(f.NodeFactory.identifierNode("eval"),[f.NodeFactory.literalNode(g.StringUtils.escapeJsString(n))])}isEvalRootAstHostNode(e){return h.NodeMetadata.isEvalHostNode(e)}};t.EvalCallExpressionTransformer=b,t.EvalCallExpressionTransformer=b=n=i([(0,s.injectable)(),o(0,(0,s.inject)(c.ServiceIdentifiers.IRandomGenerator)),o(1,(0,s.inject)(c.ServiceIdentifiers.IOptions)),a("design:paramtypes",[Object,Object])],b)},35126:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},o=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractStringArrayCallNode=void 0;const s=r(71519),c=r(32287),u=r(66822),l=r(38094),d=r(57013),f=r(91363),p=r(12720),h=r(25120);let m=n=class extends d.AbstractCustomNode{constructor(e,t,r,n,i,a,o){super(e,r,a,o),this.stringArrayIndexNodeFactory=t,this.stringArrayStorage=n,this.arrayUtils=i}getStringArrayIndexNode(e){var t;const r=e>=0,i=Math.abs(e),a=this.randomGenerator.getRandomGenerator().pickone(this.options.stringArrayIndexesType),o=null!==(t=n.stringArrayIndexNodesMap.get(a))&&void 0!==t?t:null;if(!o)throw new Error("Invalid string array index node name");const s=this.stringArrayIndexNodeFactory(o).getNode(i);p.NodeMetadata.set(s,{stringArrayCallLiteralNode:!0});const c=r?s:f.NodeFactory.unaryExpressionNode("-",s);return h.NodeUtils.parentizeAst(c),c}getRc4KeyLiteralNode(e){const t=f.NodeFactory.literalNode(e);return p.NodeMetadata.set(t,{stringArrayCallLiteralNode:!0}),t}};t.AbstractStringArrayCallNode=m,m.stringArrayRootCallsWrapperParametersCount=2,m.stringArrayIndexNodesMap=new Map([[u.StringArrayIndexesType.HexadecimalNumber,l.StringArrayIndexNode.StringArrayHexadecimalNumberIndexNode],[u.StringArrayIndexesType.HexadecimalNumericString,l.StringArrayIndexNode.StringArrayHexadecimalNumericStringIndexNode]]),t.AbstractStringArrayCallNode=m=n=i([(0,s.injectable)(),o(0,(0,s.inject)(c.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),o(1,(0,s.inject)(c.ServiceIdentifiers.Factory__IStringArrayIndexNode)),o(2,(0,s.inject)(c.ServiceIdentifiers.ICustomCodeHelperFormatter)),o(3,(0,s.inject)(c.ServiceIdentifiers.IStringArrayStorage)),o(4,(0,s.inject)(c.ServiceIdentifiers.IArrayUtils)),o(5,(0,s.inject)(c.ServiceIdentifiers.IRandomGenerator)),o(6,(0,s.inject)(c.ServiceIdentifiers.IOptions)),a("design:paramtypes",[Function,Function,Object,Object,Object,Object,Object])],m)},35355:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ParentificationTransformer=void 0;const o=r(71519),s=r(32287),c=r(18436),u=r(76893),l=r(25120);let d=class extends u.AbstractNodeTransformer{constructor(e,t){super(e,t)}getVisitor(e){return e===c.NodeTransformationStage.Preparing?{enter:(e,t)=>this.transformNode(e,t)}:null}transformNode(e,t){return l.NodeUtils.parentizeNode(e,t)}};t.ParentificationTransformer=d,t.ParentificationTransformer=d=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object,Object])],d)},35372:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,i.default)(t);var n=("object"===a(r)?r.version:arguments[1])||"";if(!n)return e(t,{version:4})||e(t,{version:6});if("4"===n.toString())return c.test(t);if("6"===n.toString())return l.test(t);return!1};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}var o="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",s="(".concat(o,"[.]){3}").concat(o),c=new RegExp("^".concat(s,"$")),u="(?:[0-9a-fA-F]{1,4})",l=new RegExp("^("+"(?:".concat(u,":){7}(?:").concat(u,"|:)|")+"(?:".concat(u,":){6}(?:").concat(s,"|:").concat(u,"|:)|")+"(?:".concat(u,":){5}(?::").concat(s,"|(:").concat(u,"){1,2}|:)|")+"(?:".concat(u,":){4}(?:(:").concat(u,"){0,1}:").concat(s,"|(:").concat(u,"){1,3}|:)|")+"(?:".concat(u,":){3}(?:(:").concat(u,"){0,2}:").concat(s,"|(:").concat(u,"){1,4}|:)|")+"(?:".concat(u,":){2}(?:(:").concat(u,"){0,3}:").concat(s,"|(:").concat(u,"){1,5}|:)|")+"(?:".concat(u,":){1}(?:(:").concat(u,"){0,4}:").concat(s,"|(:").concat(u,"){1,6}|:)|")+"(?::((?::".concat(u,"){0,5}:").concat(s,"|(?::").concat(u,"){1,7}|:))")+")(%[0-9a-zA-Z.]{1,})?$");e.exports=t.default,e.exports.default=t.default},35614:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.BasePropertiesExtractor=void 0;const a=r(71519),o=r(30386),s=r(91363),c=r(23615),u=r(50027),l=r(25120);let d=n=class{static getPropertyNodeKeyName(e){const t=e.key;return!c.NodeGuards.isLiteralNode(t)||"string"!=typeof t.value&&"number"!=typeof t.value?c.NodeGuards.isIdentifierNode(t)?t.name:null:t.value.toString()}static isProhibitedPropertyNode(e){return"init"!==e.kind}static isProhibitedPattern(e){return!e||c.NodeGuards.isObjectPatternNode(e)||c.NodeGuards.isArrayPatternNode(e)||c.NodeGuards.isAssignmentPatternNode(e)||c.NodeGuards.isRestElementNode(e)}static shouldCreateLiteralNode(e){return!e.computed||e.computed&&!!e.key&&c.NodeGuards.isLiteralNode(e.key)}extract(e,t){const r=e.parentNode;return r&&c.NodeGuards.isVariableDeclaratorNode(r)&&c.NodeGuards.isIdentifierNode(r.id)?this.transformObjectExpressionNode(e,t,r.id):{nodeToReplace:e,objectExpressionHostStatement:t,objectExpressionNode:e}}transformObjectExpressionNode(e,t,r){const n=e.properties,[i,a]=this.extractPropertiesToExpressionStatements(n,t,r),s=u.NodeStatementUtils.getScopeOfNode(t);return this.filterExtractedObjectExpressionProperties(e,a),o.NodeAppender.insertAfter(s,i,t),i.forEach(e=>{l.NodeUtils.parentizeAst(e),l.NodeUtils.parentizeNode(e,s)}),{nodeToReplace:e,objectExpressionHostStatement:t,objectExpressionNode:e}}extractPropertiesToExpressionStatements(e,t,r){const i=[],a=[];for(let o=e.length-1;o>=0;o--){const u=e[o];if(c.NodeGuards.isSpreadElementNode(u))break;if(n.isProhibitedPropertyNode(u))continue;const l=u.value;if(n.isProhibitedPattern(l))continue;const d=n.getPropertyNodeKeyName(u);if(!d)continue;const f=n.shouldCreateLiteralNode(u)?s.NodeFactory.literalNode(d):s.NodeFactory.identifierNode(d),p=s.NodeFactory.memberExpressionNode(r,f,!0),h=s.NodeFactory.expressionStatementNode(s.NodeFactory.assignmentExpressionNode("=",p,l));c.NodeGuards.isObjectExpressionNode(u.value)&&this.transformObjectExpressionNode(u.value,t,p),i.unshift(h),a.unshift(o)}return[i,a]}filterExtractedObjectExpressionProperties(e,t){const r=new Set(t);e.properties=e.properties.filter((e,t)=>!r.has(t))}};t.BasePropertiesExtractor=d,t.BasePropertiesExtractor=d=n=i([(0,a.injectable)()],d)},36202:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ArrayUtils=void 0;const o=r(71519),s=r(32287);let c=class{constructor(e){this.randomGenerator=e}createWithRange(e){const t=[];for(let r=0;ri&&(n=a,i=e),r[a]=e}return n}getLastElement(e){return this.getLastElementByIndex(e,0)}getLastElementByIndex(e,t){var r;return null!==(r=e[e.length-1-t])&&void 0!==r?r:void 0}rotate(e,t){const r=e.length;if(!r)throw new ReferenceError("Cannot rotate empty array.");if(t<=0)return e;const n=t%r;return 0===n?[...e]:[...e.slice(-n),...e.slice(0,-n)]}shuffle(e){const t=[...e];for(let e=t.length;e;e--){const r=Math.floor(this.randomGenerator.getMathRandom()*e);[t[e-1],t[r]]=[t[r],t[e-1]]}return t}};t.ArrayUtils=c,t.ArrayUtils=c=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),i("design:paramtypes",[Object])],c)},36264:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdentifierNamesCacheRule=void 0;t.IdentifierNamesCacheRule=e=>{let t=e.identifierNamesCache;return t&&!t.globalIdentifiers&&(t={...t,globalIdentifiers:{}}),t&&!t.propertyIdentifiers&&(t={...t,propertyIdentifiers:{}}),e={...e,identifierNamesCache:t}}},36323:(e,t,r)=>{!function(){"use strict";t.ast=r(62890),t.code=r(67989),t.keyword=r(83921)}()},36338:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LegacyQueryableStringImpl=void 0;t.LegacyQueryableStringImpl=class{#e;constructor(e){this.#e=e}startsWith(e){return this.#e.startsWith(e)}endsWith(e){return this.#e.endsWith(e)}contains(e){return this.#e.includes(e)}equals(e){return this.#e===e}value(){return this.#e}}},36744:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BindingWhenSyntax=void 0;var n=r(42903),i=r(20795),a=function(){function e(e){this._binding=e}return e.prototype.when=function(e){return this._binding.constraint=e,new n.BindingOnSyntax(this._binding)},e.prototype.whenTargetNamed=function(e){return this._binding.constraint=(0,i.namedConstraint)(e),new n.BindingOnSyntax(this._binding)},e.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(e){return null!==e&&(null!==e.target&&!e.target.isNamed()&&!e.target.isTagged())},new n.BindingOnSyntax(this._binding)},e.prototype.whenTargetTagged=function(e,t){return this._binding.constraint=(0,i.taggedConstraint)(e)(t),new n.BindingOnSyntax(this._binding)},e.prototype.whenInjectedInto=function(e){return this._binding.constraint=function(t){return null!==t&&(0,i.typeConstraint)(e)(t.parentRequest)},new n.BindingOnSyntax(this._binding)},e.prototype.whenParentNamed=function(e){return this._binding.constraint=function(t){return null!==t&&(0,i.namedConstraint)(e)(t.parentRequest)},new n.BindingOnSyntax(this._binding)},e.prototype.whenParentTagged=function(e,t){return this._binding.constraint=function(r){return null!==r&&(0,i.taggedConstraint)(e)(t)(r.parentRequest)},new n.BindingOnSyntax(this._binding)},e.prototype.whenAnyAncestorIs=function(e){return this._binding.constraint=function(t){return null!==t&&(0,i.traverseAncerstors)(t,(0,i.typeConstraint)(e))},new n.BindingOnSyntax(this._binding)},e.prototype.whenNoAncestorIs=function(e){return this._binding.constraint=function(t){return null!==t&&!(0,i.traverseAncerstors)(t,(0,i.typeConstraint)(e))},new n.BindingOnSyntax(this._binding)},e.prototype.whenAnyAncestorNamed=function(e){return this._binding.constraint=function(t){return null!==t&&(0,i.traverseAncerstors)(t,(0,i.namedConstraint)(e))},new n.BindingOnSyntax(this._binding)},e.prototype.whenNoAncestorNamed=function(e){return this._binding.constraint=function(t){return null!==t&&!(0,i.traverseAncerstors)(t,(0,i.namedConstraint)(e))},new n.BindingOnSyntax(this._binding)},e.prototype.whenAnyAncestorTagged=function(e,t){return this._binding.constraint=function(r){return null!==r&&(0,i.traverseAncerstors)(r,(0,i.taggedConstraint)(e)(t))},new n.BindingOnSyntax(this._binding)},e.prototype.whenNoAncestorTagged=function(e,t){return this._binding.constraint=function(r){return null!==r&&!(0,i.traverseAncerstors)(r,(0,i.taggedConstraint)(e)(t))},new n.BindingOnSyntax(this._binding)},e.prototype.whenAnyAncestorMatches=function(e){return this._binding.constraint=function(t){return null!==t&&(0,i.traverseAncerstors)(t,e)},new n.BindingOnSyntax(this._binding)},e.prototype.whenNoAncestorMatches=function(e){return this._binding.constraint=function(t){return null!==t&&!(0,i.traverseAncerstors)(t,e)},new n.BindingOnSyntax(this._binding)},e}();t.BindingWhenSyntax=a},36791:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayBase64DecodeTemplate=function(e){const t=e.getRandomString(6),r=e.getRandomString(6),n=e.getRandomString(6);return`\n if ({stringArrayCallsWrapperName}.${t} === undefined) {\n {atobPolyfill}\n {stringArrayCallsWrapperName}.${r} = {atobFunctionName};\n\n {stringArrayCallsWrapperName}.${n} = {};\n \n {stringArrayCallsWrapperName}.${t} = true;\n }\n \n const firstValue = stringArray[0];\n const cacheKey = index + firstValue;\n const cachedValue = {stringArrayCallsWrapperName}.${n}[cacheKey];\n \n if (!cachedValue) {\n {selfDefendingCode}\n \n value = {stringArrayCallsWrapperName}.${r}(value);\n {stringArrayCallsWrapperName}.${n}[cacheKey] = value;\n } else {\n value = cachedValue;\n }\n `}},36833:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RenamePropertiesMode=void 0;const n=r(65063);t.RenamePropertiesMode=n.Utils.makeEnum({Safe:"safe",Unsafe:"unsafe"})},37004:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.StringUtils=void 0;const i=n(r(69560));t.StringUtils=class{static escapeJsString(e){return(0,i.default)(e)}}},37612:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)(e),e===e.toLowerCase()};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};e.exports=t.default,e.exports.default=t.default},37694:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayCallsWrapperTemplate=function(){return"\n function {stringArrayCallsWrapperName} (index, key) {\n index = index - {indexShiftAmount};\n\n const stringArray = {stringArrayFunctionName}();\n let value = stringArray[index];\n \n {decodeCodeHelperTemplate}\n\n return value;\n }\n "}},37956:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(63437),i=r(51851);function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=a(n),s=a(i);function c(e,t="Assertion failed."){if(!e)throw new Error(t)}class u{constructor(e,t,r,n,i,a,o){this.identifier=e,this.from=t,this.tainted=!1,this.resolved=null,this.flag=r,this.isWrite()&&(this.writeExpr=n,this.partial=a,this.init=o),this.__maybeImplicitGlobal=i}isStatic(){return!this.tainted&&this.resolved&&this.resolved.scope.isStatic()}isWrite(){return!!(this.flag&u.WRITE)}isRead(){return!!(this.flag&u.READ)}isReadOnly(){return this.flag===u.READ}isWriteOnly(){return this.flag===u.WRITE}isReadWrite(){return this.flag===u.RW}}u.READ=1,u.WRITE=2,u.RW=3;class l{constructor(e,t){this.name=e,this.identifiers=[],this.references=[],this.defs=[],this.tainted=!1,this.stack=!0,this.scope=t}}l.CatchClause="CatchClause",l.Parameter="Parameter",l.FunctionName="FunctionName",l.ClassName="ClassName",l.Variable="Variable",l.ImportBinding="ImportBinding",l.ImplicitGlobalVariable="ImplicitGlobalVariable";class d{constructor(e,t,r,n,i,a){this.type=e,this.name=t,this.node=r,this.parent=n,this.index=i,this.kind=a}}class f extends d{constructor(e,t,r,n){super(l.Parameter,e,t,null,r,null),this.rest=n}}const{Syntax:p}=o.default;function h(e){return e.type===l.ClassName||e.type===l.Variable&&"var"!==e.parent.kind}class m{constructor(e,t,r,n,i){this.type=t,this.set=new Map,this.taints=new Map,this.dynamic="global"===this.type||"with"===this.type,this.block=n,this.through=[],this.variables=[],this.references=[],this.variableScope="global"===this.type||"module"===this.type||"function"===this.type||"class-field-initializer"===this.type||"class-static-block"===this.type?this:r.variableScope,this.functionExpressionScope=!1,this.directCallToEvalScope=!1,this.thisFound=!1,this.__left=[],this.upper=r,this.isStrict=!!e.isStrictModeSupported()&&function(e,t,r){let n;if(e.upper&&e.upper.isStrict)return!0;if(r)return!0;if("class"===e.type||"module"===e.type)return!0;if("block"===e.type||"switch"===e.type)return!1;if("function"===e.type){if(t.type===p.ArrowFunctionExpression&&t.body.type!==p.BlockStatement)return!1;if(n=t.type===p.Program?t:t.body,!n)return!1}else{if("global"!==e.type)return!1;n=t}for(let e=0,t=n.body.length;e0&&r.every(h)}__staticCloseRef(e){this.__resolve(e)||this.__delegateToUpperScope(e)}__dynamicCloseRef(e){let t=this;do{t.through.push(e),t=t.upper}while(t)}__globalCloseRef(e){this.__shouldStaticallyCloseForGlobal(e)?this.__staticCloseRef(e):this.__dynamicCloseRef(e)}__close(e){let t;t=this.__shouldStaticallyClose(e)?this.__staticCloseRef:"global"!==this.type?this.__dynamicCloseRef:this.__globalCloseRef;for(let e=0,r=this.__left.length;ee.name.range[0]>=r))}}class E extends m{constructor(e,t,r){super(e,"for",t,r,!1)}}class x extends m{constructor(e,t,r){super(e,"class",t,r,!1)}}class N extends m{constructor(e,t,r){super(e,"class-field-initializer",t,r,!0)}}class I extends m{constructor(e,t,r){super(e,"class-static-block",t,r,!0)}}class T{constructor(e){this.scopes=[],this.globalScope=null,this.__nodeToScope=new WeakMap,this.__currentScope=null,this.__options=e,this.__declaredVariables=new WeakMap}__isOptimistic(){return this.__options.optimistic}__ignoreEval(){return this.__options.ignoreEval}__isJSXEnabled(){return!0===this.__options.jsx}isGlobalReturn(){return this.__options.nodejsScope||"commonjs"===this.__options.sourceType}isModule(){return"module"===this.__options.sourceType}isImpliedStrict(){return this.__options.impliedStrict}isStrictModeSupported(){return this.__options.ecmaVersion>=5}__get(e){return this.__nodeToScope.get(e)}getDeclaredVariables(e){return this.__declaredVariables.get(e)||[]}acquire(e,t){function r(e){return"function"!==e.type||!e.functionExpressionScope}const n=this.__get(e);if(!n||0===n.length)return null;if(1===n.length)return n[0];if(t)for(let e=n.length-1;e>=0;--e){const t=n[e];if(r(t))return t}else for(let e=0,t=n.length;e=6}}const{Syntax:D}=o.default;class O extends s.default.Visitor{static isPattern(e){const t=e.type;return t===D.Identifier||t===D.ObjectPattern||t===D.ArrayPattern||t===D.SpreadElement||t===D.RestElement||t===D.AssignmentPattern}constructor(e,t,r){super(null,e),this.rootPattern=t,this.callback=r,this.assignments=[],this.rightHandNodes=[],this.restElements=[]}Identifier(e){const t=this.restElements.at(-1)||null;this.callback(e,{topLevel:e===this.rootPattern,rest:null!=t&&t.argument===e,assignments:this.assignments})}Property(e){e.computed&&this.rightHandNodes.push(e.key),this.visit(e.value)}ArrayPattern(e){for(let t=0,r=e.elements.length;t{this.rightHandNodes.push(e)}),this.visit(e.callee)}}const{Syntax:M}=o.default;class R extends s.default.Visitor{constructor(e,t){super(null,t.options),this.declaration=e,this.referencer=t}visitImport(e,t){this.referencer.visitPattern(e,e=>{this.referencer.currentScope().__define(e,new d(l.ImportBinding,e,t,this.declaration,null,null))})}ImportNamespaceSpecifier(e){const t=e.local||e.id;t&&this.visitImport(t,e)}ImportDefaultSpecifier(e){const t=e.local||e.id;this.visitImport(t,e)}ImportSpecifier(e){const t=e.local||e.id;e.name?this.visitImport(e.name,e):this.visitImport(t,e)}}class F extends s.default.Visitor{constructor(e,t){super(null,e),this.options=e,this.scopeManager=t,this.parent=null,this.isInnerMethodDefinition=!1}currentScope(){return this.scopeManager.__currentScope}close(e){for(;this.currentScope()&&e===this.currentScope().block;)this.scopeManager.__currentScope=this.currentScope().__close(this.scopeManager)}pushInnerMethodDefinition(e){const t=this.isInnerMethodDefinition;return this.isInnerMethodDefinition=e,t}popInnerMethodDefinition(e){this.isInnerMethodDefinition=e}referencingDefaultValue(e,t,r,n){const i=this.currentScope();t.forEach(t=>{i.__referencing(e,u.WRITE,t.right,r,e!==t.left,n)})}visitPattern(e,t,r){let n=t,i=r;"function"==typeof t&&(i=t,n={processRightHandNodes:!1}),function(e,t,r,n){const i=new O(e,t,n);i.visit(t),null!=r&&i.rightHandNodes.forEach(r.visit,r)}(this.options,e,n.processRightHandNodes?this:null,i)}visitFunction(e){let t,r;e.type===M.FunctionDeclaration&&this.currentScope().__define(e.id,new d(l.FunctionName,e.id,e,null,null,null)),e.type===M.FunctionExpression&&e.id&&this.scopeManager.__nestFunctionExpressionNameScope(e),this.scopeManager.__nestFunctionScope(e,this.isInnerMethodDefinition);const n=this;function i(r,i){n.currentScope().__define(r,new f(r,e,t,i.rest)),n.referencingDefaultValue(r,i.assignments,null,!0)}for(t=0,r=e.params.length;t{this.currentScope().__define(t,new f(t,e,e.params.length,!0))}),e.body&&(e.body.type===M.BlockStatement?this.visitChildren(e.body):this.visit(e.body)),this.close(e)}visitClass(e){e.type===M.ClassDeclaration&&this.currentScope().__define(e.id,new d(l.ClassName,e.id,e,null,null,null)),this.scopeManager.__nestClassScope(e),e.id&&this.currentScope().__define(e.id,new d(l.ClassName,e.id,e)),this.visit(e.superClass),this.visit(e.body),this.close(e)}visitProperty(e){let t;e.computed&&this.visit(e.key);const r=e.type===M.MethodDefinition;r&&(t=this.pushInnerMethodDefinition(!0)),this.visit(e.value),r&&this.popInnerMethodDefinition(t)}visitForIn(e){e.left.type===M.VariableDeclaration&&"var"!==e.left.kind&&this.scopeManager.__nestForScope(e),e.left.type===M.VariableDeclaration?(this.visit(e.left),this.visitPattern(e.left.declarations[0].id,t=>{this.currentScope().__referencing(t,u.WRITE,e.right,null,!0,!0)})):this.visitPattern(e.left,{processRightHandNodes:!0},(t,r)=>{let n=null;this.currentScope().isStrict||(n={pattern:t,node:e}),this.referencingDefaultValue(t,r.assignments,n,!1),this.currentScope().__referencing(t,u.WRITE,e.right,n,!0,!1)}),this.visit(e.right),this.visit(e.body),this.close(e)}visitVariableDeclaration(e,t,r,n){const i=r.declarations[n],a=i.init;this.visitPattern(i.id,{processRightHandNodes:!0},(o,s)=>{e.__define(o,new d(t,o,i,r,n,r.kind)),this.referencingDefaultValue(o,s.assignments,null,!0),a&&this.currentScope().__referencing(o,u.WRITE,a,null,!s.topLevel,!0)})}AssignmentExpression(e){O.isPattern(e.left)?"="===e.operator?this.visitPattern(e.left,{processRightHandNodes:!0},(t,r)=>{let n=null;this.currentScope().isStrict||(n={pattern:t,node:e}),this.referencingDefaultValue(t,r.assignments,n,!1),this.currentScope().__referencing(t,u.WRITE,e.right,n,!r.topLevel,!1)}):this.currentScope().__referencing(e.left,u.RW,e.right):this.visit(e.left),this.visit(e.right)}CatchClause(e){this.scopeManager.__nestCatchScope(e),this.visitPattern(e.param,{processRightHandNodes:!0},(t,r)=>{this.currentScope().__define(t,new d(l.CatchClause,t,e,null,null,null)),this.referencingDefaultValue(t,r.assignments,null,!0)}),this.visit(e.body),this.close(e)}Program(e){this.scopeManager.__nestGlobalScope(e),this.scopeManager.isGlobalReturn()&&(this.currentScope().isStrict=!1,this.scopeManager.__nestFunctionScope(e,!1)),this.scopeManager.__isES6()&&this.scopeManager.isModule()&&this.scopeManager.__nestModuleScope(e),this.scopeManager.isStrictModeSupported()&&this.scopeManager.isImpliedStrict()&&(this.currentScope().isStrict=!0),this.visitChildren(e),this.close(e)}Identifier(e){this.currentScope().__referencing(e)}PrivateIdentifier(){}UpdateExpression(e){O.isPattern(e.argument)?this.currentScope().__referencing(e.argument,u.RW,null):this.visitChildren(e)}MemberExpression(e){this.visit(e.object),e.computed&&this.visit(e.property)}Property(e){this.visitProperty(e)}PropertyDefinition(e){const{computed:t,key:r,value:n}=e;t&&this.visit(r),n&&(this.scopeManager.__nestClassFieldInitializerScope(n),this.visit(n),this.close(n))}StaticBlock(e){this.scopeManager.__nestClassStaticBlockScope(e),this.visitChildren(e),this.close(e)}MethodDefinition(e){this.visitProperty(e)}BreakStatement(){}ContinueStatement(){}LabeledStatement(e){this.visit(e.body)}ForStatement(e){e.init&&e.init.type===M.VariableDeclaration&&"var"!==e.init.kind&&this.scopeManager.__nestForScope(e),this.visitChildren(e),this.close(e)}ClassExpression(e){this.visitClass(e)}ClassDeclaration(e){this.visitClass(e)}CallExpression(e){this.scopeManager.__ignoreEval()||e.callee.type!==M.Identifier||"eval"!==e.callee.name||this.currentScope().variableScope.__detectEval(),this.visitChildren(e)}BlockStatement(e){this.scopeManager.__isES6()&&this.scopeManager.__nestBlockScope(e),this.visitChildren(e),this.close(e)}ThisExpression(){this.currentScope().variableScope.__detectThis()}WithStatement(e){this.visit(e.object),this.scopeManager.__nestWithScope(e),this.visit(e.body),this.close(e)}VariableDeclaration(e){const t="var"===e.kind?this.currentScope().variableScope:this.currentScope();for(let r=0,n=e.declarations.length;r{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayIndexNode=void 0,function(e){e.StringArrayHexadecimalNumberIndexNode="StringArrayHexadecimalNumberIndexNode",e.StringArrayHexadecimalNumericStringIndexNode="StringArrayHexadecimalNumericStringIndexNode"}(r||(t.StringArrayIndexNode=r={}))},38615:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.id=function(){return r++};var r=0},38630:(e,t,r)=>{
+/*! *****************************************************************************
+Copyright (C) Microsoft. All rights reserved.
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at http://www.apache.org/licenses/LICENSE-2.0
+
+THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
+WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
+MERCHANTABLITY OR NON-INFRINGEMENT.
+
+See the Apache Version 2.0 License for specific language governing permissions
+and limitations under the License.
+***************************************************************************** */
+var n;!function(e){!function(){var t="object"==typeof globalThis?globalThis:"object"==typeof r.g?r.g:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(e){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(e){}}(),n=i(e);function i(e,t){return function(r,n){Object.defineProperty(e,r,{configurable:!0,writable:!0,value:n}),t&&t(r,n)}}void 0!==t.Reflect&&(n=i(t.Reflect,n)),function(e,t){var r=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,i=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",a=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",o="function"==typeof Object.create,s={__proto__:[]}instanceof Array,c=!o&&!s,u={create:o?function(){return de(Object.create(null))}:s?function(){return de({__proto__:null})}:function(){return de({})},has:c?function(e,t){return r.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return r.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},l=Object.getPrototypeOf(Function),d="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:ce(),f="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:ue(),p="function"==typeof WeakMap?WeakMap:le(),h=n?Symbol.for("@reflect-metadata:registry"):void 0,m=ie(),g=ae(m);function b(e,t,r,n){if(k(r)){if(!W(e))throw new TypeError;if(!X(t))throw new TypeError;return I(e,t)}if(!W(e))throw new TypeError;if(!j(t))throw new TypeError;if(!j(n)&&!k(n)&&!L(n))throw new TypeError;return L(n)&&(n=void 0),T(e,t,r=K(r),n)}function y(e,t){function r(r,n){if(!j(r))throw new TypeError;if(!k(n)&&!Y(n))throw new TypeError;F(e,t,r,n)}return r}function S(e,t,r,n){if(!j(r))throw new TypeError;return k(n)||(n=K(n)),F(e,t,r,n)}function v(e,t,r){if(!j(t))throw new TypeError;return k(r)||(r=K(r)),D(e,t,r)}function _(e,t,r){if(!j(t))throw new TypeError;return k(r)||(r=K(r)),O(e,t,r)}function C(e,t,r){if(!j(t))throw new TypeError;return k(r)||(r=K(r)),M(e,t,r)}function A(e,t,r){if(!j(t))throw new TypeError;return k(r)||(r=K(r)),R(e,t,r)}function E(e,t){if(!j(e))throw new TypeError;return k(t)||(t=K(t)),P(e,t)}function x(e,t){if(!j(e))throw new TypeError;return k(t)||(t=K(t)),w(e,t)}function N(e,t,r){if(!j(t))throw new TypeError;if(k(r)||(r=K(r)),!j(t))throw new TypeError;k(r)||(r=K(r));var n=se(t,r,!1);return!k(n)&&n.OrdinaryDeleteMetadata(e,t,r)}function I(e,t){for(var r=e.length-1;r>=0;--r){var n=(0,e[r])(t);if(!k(n)&&!L(n)){if(!X(n))throw new TypeError;t=n}}return t}function T(e,t,r,n){for(var i=e.length-1;i>=0;--i){var a=(0,e[i])(t,r,n);if(!k(a)&&!L(a)){if(!j(a))throw new TypeError;n=a}}return n}function D(e,t,r){if(O(e,t,r))return!0;var n=re(t);return!L(n)&&D(e,n,r)}function O(e,t,r){var n=se(t,r,!1);return!k(n)&&U(n.OrdinaryHasOwnMetadata(e,t,r))}function M(e,t,r){if(O(e,t,r))return R(e,t,r);var n=re(t);return L(n)?void 0:M(e,n,r)}function R(e,t,r){var n=se(t,r,!1);if(!k(n))return n.OrdinaryGetOwnMetadata(e,t,r)}function F(e,t,r,n){se(r,n,!0).OrdinaryDefineOwnMetadata(e,t,r,n)}function P(e,t){var r=w(e,t),n=re(e);if(null===n)return r;var i=P(n,t);if(i.length<=0)return r;if(r.length<=0)return i;for(var a=new f,o=[],s=0,c=r;s=0&&e=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}();return function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var r=this._find(e,!0);return this._values[r]=t,this},t.prototype.delete=function(t){var r=this._find(t,!1);if(r>=0){for(var n=this._keys.length,i=r+1;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.renamePropertiesTransformersModule=void 0;const n=r(71519),i=r(32287),a=r(96390),o=r(57192),s=r(42504);t.renamePropertiesTransformersModule=new n.ContainerModule(e=>{e(i.ServiceIdentifiers.INodeTransformer).to(s.RenamePropertiesTransformer).whenTargetNamed(a.NodeTransformer.RenamePropertiesTransformer),e(i.ServiceIdentifiers.IRenamePropertiesReplacer).to(o.RenamePropertiesReplacer)})},40043:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomainLockCustomCodeHelperGroup=void 0;const o=r(71519),s=r(32287),c=r(10548),u=r(79011),l=r(18436),d=r(87415),f=r(30386),p=r(32504);let h=class extends d.AbstractCustomCodeHelperGroup{constructor(e,t,r,n){super(t,r,n),this.customCodeHelperFactory=e}appendOnPreparingStage(e,t){var r;if(!this.options.domainLock.length)return;const n=this.getRandomCallsGraphIndex(t.length),i=t.length?f.NodeAppender.getOptimalBlockScope(t,n):e,a=t.length?f.NodeAppender.getOptimalBlockScope(t,n,1):e,o=null!==(r=p.NodeLexicalScopeUtils.getLexicalScope(i))&&void 0!==r?r:null,s=o?this.identifierNamesGenerator.generate(o):this.identifierNamesGenerator.generateNext(),c=o?this.identifierNamesGenerator.generate(o):this.identifierNamesGenerator.generateNext();this.appendCustomNodeIfExist(u.CustomCodeHelper.DomainLock,e=>{e.initialize(c,s),f.NodeAppender.prepend(i,e.getNode())}),this.appendCustomNodeIfExist(u.CustomCodeHelper.CallsControllerFunction,e=>{e.initialize(l.NodeTransformationStage.Preparing,c),f.NodeAppender.prepend(a,e.getNode())})}initialize(){if(this.customCodeHelpers=new Map,!this.options.domainLock.length)return;const e=this.customCodeHelperFactory(u.CustomCodeHelper.DomainLock),t=this.customCodeHelperFactory(u.CustomCodeHelper.CallsControllerFunction);this.customCodeHelpers.set(u.CustomCodeHelper.DomainLock,e),this.customCodeHelpers.set(u.CustomCodeHelper.CallsControllerFunction,t)}};t.DomainLockCustomCodeHelperGroup=h,n([(0,c.initializable)(),i("design:type",Map)],h.prototype,"customCodeHelpers",void 0),t.DomainLockCustomCodeHelperGroup=h=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.Factory__ICustomCodeHelper)),a(1,(0,o.inject)(s.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),a(2,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(3,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Function,Function,Object,Object])],h)},40700:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return(0,i.default)(e),e===t};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};e.exports=t.default,e.exports.default=t.default},41129:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getDescription=function(e){return e.toString().slice(r,n)};const r=7,n=-1},41163:(e,t)=>{function r(e,n,i,a,o,s){var c=Math.floor((n-e)/2)+e,u=o(i,a[c],!0);return 0===u?c:u>0?n-c>1?r(c,n,i,a,o,s):s==t.LEAST_UPPER_BOUND?n1?r(e,c,i,a,o,s):s==t.LEAST_UPPER_BOUND?c:e<0?-1:e}t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2,t.search=function(e,n,i,a){if(0===n.length)return-1;var o=r(-1,n.length,e,n,i,a||t.GREATEST_LOWER_BOUND);if(o<0)return-1;for(;o-1>=0&&0===i(n[o],n[o-1],!0);)--o;return o}},42504:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},o=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenamePropertiesTransformer=void 0;const s=r(71519),c=r(32287),u=r(18436),l=r(36833),d=r(76893),f=r(23615),p=r(90253),h=r(12720);let m=n=class extends d.AbstractNodeTransformer{constructor(e,t,r){super(t,r),this.renamePropertiesReplacer=e}static isValidPropertyNode(e,t){return!f.NodeGuards.isIdentifierNode(t)||!e.computed}getVisitor(e){switch(e){case u.NodeTransformationStage.Preparing:return{enter:(e,t)=>{t&&this.prepareNode(e,t)}};case u.NodeTransformationStage.RenameProperties:return{enter:(e,t)=>{if(t)return this.transformNode(e,t)}};default:return null}}prepareNode(e,t){f.NodeGuards.isPropertyNode(t)&&t.key===e||f.NodeGuards.isMemberExpressionNode(t)&&t.property===e||f.NodeGuards.isMethodDefinitionNode(t)&&t.key===e||f.NodeGuards.isPropertyDefinitionNode(t)&&t.key===e?h.NodeMetadata.set(e,{propertyKeyToRenameNode:!0}):this.options.renamePropertiesMode===l.RenamePropertiesMode.Safe&&this.analyzeAutoExcludedPropertyNames(e,t)}transformNode(e,t){if(!f.NodeGuards.isIdentifierNode(e)&&!f.NodeGuards.isLiteralNode(e))return e;if(!h.NodeMetadata.isPropertyKeyToRenameNode(e))return e;const r=f.NodeGuards.isPropertyNode(t);return(r||f.NodeGuards.isPropertyDefinitionNode(t)||f.NodeGuards.isMemberExpressionNode(t)||f.NodeGuards.isMethodDefinitionNode(t))&&!n.isValidPropertyNode(t,e)?e:(r&&(t.shorthand=!1),this.renamePropertiesReplacer.replace(e))}analyzeAutoExcludedPropertyNames(e,t){f.NodeGuards.isLiteralNode(e)&&p.NodeLiteralUtils.isStringLiteralNode(e)&&this.renamePropertiesReplacer.excludePropertyName(e.value)}};t.RenamePropertiesTransformer=m,t.RenamePropertiesTransformer=m=n=i([(0,s.injectable)(),o(0,(0,s.inject)(c.ServiceIdentifiers.IRenamePropertiesReplacer)),o(1,(0,s.inject)(c.ServiceIdentifiers.IRandomGenerator)),o(2,(0,s.inject)(c.ServiceIdentifiers.IOptions)),a("design:paramtypes",[Object,Object,Object])],m)},42540:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayCallsWrapperBase64CodeHelper=void 0;const i=r(71519),a=r(54618),o=r(36791),s=r(51507);let c=class extends s.StringArrayCallsWrapperCodeHelper{getDecodeStringArrayTemplate(){const e=this.randomGenerator.getRandomString(6),t=this.customCodeHelperFormatter.formatTemplate((0,a.AtobTemplate)(this.options.selfDefending),{atobFunctionName:e}),r=this.getSelfDefendingTemplate();return this.customCodeHelperFormatter.formatTemplate((0,o.StringArrayBase64DecodeTemplate)(this.randomGenerator),{atobPolyfill:t,atobFunctionName:e,selfDefendingCode:r,stringArrayCallsWrapperName:this.stringArrayCallsWrapperName,stringArrayFunctionName:this.stringArrayFunctionName})}};t.StringArrayCallsWrapperBase64CodeHelper=c,t.StringArrayCallsWrapperBase64CodeHelper=c=n([(0,i.injectable)()],c)},42792:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConsoleOutputDisableTemplate=function(){return"\n const {consoleLogDisableFunctionName} = {callControllerFunctionName}(this, function () {\n {globalVariableTemplate}\n\n const consoleObject = (that.console = that.console || {});\n const methods = ['log', 'warn', 'info', 'error', 'exception', 'table', 'trace'];\n\n for (let index = 0; index < methods.length; index++){\n const func = {callControllerFunctionName}.constructor.prototype.bind({callControllerFunctionName});\n const methodName = methods[index];\n const originalFunction = consoleObject[methodName] || func;\n\n func.__proto__ = {callControllerFunctionName}.bind({callControllerFunctionName});\n func.toString = originalFunction.toString.bind(originalFunction);\n \n consoleObject[methodName] = func;\n }\n });\n\n {consoleLogDisableFunctionName}();\n "}},42903:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BindingOnSyntax=void 0;var n=r(36744),i=function(){function e(e){this._binding=e}return e.prototype.onActivation=function(e){return this._binding.onActivation=e,new n.BindingWhenSyntax(this._binding)},e.prototype.onDeactivation=function(e){return this._binding.onDeactivation=e,new n.BindingWhenSyntax(this._binding)},e}();t.BindingOnSyntax=i},43214:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if((0,i.default)(e),t)return"1"===e||/^true$/i.test(e);return"0"!==e&&!/^false$/i.test(e)&&""!==e};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};e.exports=t.default,e.exports.default=t.default},43254:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deadCodeInjectionTransformersModule=void 0;const n=r(71519),i=r(32287),a=r(96390),o=r(83951);t.deadCodeInjectionTransformersModule=new n.ContainerModule(e=>{e(i.ServiceIdentifiers.INodeTransformer).to(o.DeadCodeInjectionTransformer).whenTargetNamed(a.NodeTransformer.DeadCodeInjectionTransformer)})},43302:(e,t,r)=>{var n=r(90251);function i(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}i.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},i.prototype.add=function(e){var t,r,i,a,o,s;t=this._last,r=e,i=t.generatedLine,a=r.generatedLine,o=t.generatedColumn,s=r.generatedColumn,a>i||a==i&&s>=o||n.compareByGeneratedPositionsInflated(t,r)<=0?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},i.prototype.toArray=function(){return this._sorted||(this._array.sort(n.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},t.P=i},43459:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)(e),a.test(e)};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};var a=/[\uD800-\uDBFF][\uDC00-\uDFFF]/;e.exports=t.default,e.exports.default=t.default},43663:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Readable:()=>n});const n={toWeb(){throw new Error("Vercel Blob: Sorry, we cannot get a Readable stream in this environment. If you see this message please open an issue here: https://github.com/vercel/storage/ with details on your environment.")}}},43735:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayRule=void 0;const n=r(70885);t.StringArrayRule=e=>(e.stringArray||(e={...e,stringArray:!1,stringArrayCallsTransform:!1,stringArrayCallsTransformThreshold:0,stringArrayEncoding:[n.StringArrayEncoding.None],stringArrayIndexShift:!1,stringArrayRotate:!1,stringArrayShuffle:!1,stringArrayWrappersChainedCalls:!1,stringArrayWrappersCount:0,stringArrayThreshold:0}),e)},43801:(e,t)=>{function r(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function n(e,t,i,a){if(i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalVariableNoEvalTemplate=function(){return"\n const that = (typeof window !== 'undefined'\n ? window\n : (typeof process === 'object' &&\n typeof require === 'function' &&\n typeof global === 'object')\n ? global\n : this);\n "}},44063:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getClassElementMetadataFromLegacyMetadata=function(e){const t=e.find(e=>e.key===a.INJECT_TAG),r=e.find(e=>e.key===a.MULTI_INJECT_TAG);if(void 0!==e.find(e=>e.key===a.UNMANAGED_TAG))return function(e,t){if(void 0!==t||void 0!==e)throw new n.InversifyCoreError(i.InversifyCoreErrorKind.missingInjectionDecorator,"Expected a single @inject, @multiInject or @unmanaged metadata");return{kind:o.ClassElementMetadataKind.unmanaged}}(t,r);if(void 0===r&&void 0===t)throw new n.InversifyCoreError(i.InversifyCoreErrorKind.missingInjectionDecorator,"Expected @inject, @multiInject or @unmanaged metadata");const s=e.find(e=>e.key===a.NAMED_TAG),c=e.find(e=>e.key===a.OPTIONAL_TAG),u=e.find(e=>e.key===a.NAME_TAG);return{kind:void 0===t?o.ClassElementMetadataKind.multipleInjection:o.ClassElementMetadataKind.singleInjection,name:s?.value,optional:void 0!==c,tags:new Map(e.filter(e=>a.NON_CUSTOM_TAG_KEYS.every(t=>e.key!==t)).map(e=>[e.key,e.value])),targetName:u?.value,value:void 0===t?r?.value:t.value}};const n=r(21773),i=r(94931),a=r(83313),o=r(86277)},44173:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ArrayStorage=void 0;const o=r(71519),s=r(32287),c=r(10548);let u=class{constructor(e,t){this.storageLength=0,this.randomGenerator=e,this.options=t}initialize(){this.storage=[],this.storageId=this.randomGenerator.getRandomString(6)}delete(e){var t;const r=null!==(t=this.storage.splice(e,1)[0])&&void 0!==t?t:void 0;return r&&this.storageLength--,r}get(e){return this.storage[e]}getOrThrow(e){const t=this.get(e);if(!t)throw new Error(`No value found in array storage with key \`${e}\``);return t}getKeyOf(e){const t=this.storage.indexOf(e);return t>=0?t:null}getLength(){return this.storageLength}getStorage(){return this.storage}getStorageId(){return this.storageId}mergeWith(e,t=!1){this.storage=[...this.storage,...e.getStorage()],t&&(this.storageId=e.getStorageId())}set(e,t){e===this.storageLength?this.storage.push(t):this.storage.splice(e,0,t),this.storageLength++}};t.ArrayStorage=u,n([(0,c.initializable)(),i("design:type",Array)],u.prototype,"storage",void 0),n([(0,c.initializable)(),i("design:type",String)],u.prototype,"storageId",void 0),n([(0,o.postConstruct)(),i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",void 0)],u.prototype,"initialize",null),t.ArrayStorage=u=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object,Object])],u)},44269:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CallExpressionControlFlowStorageCallNode=void 0;const o=r(71519),s=r(32287),c=r(10548),u=r(57013),l=r(91363),d=r(25120);let f=class extends u.AbstractCustomNode{constructor(e,t,r,n){super(e,t,r,n)}initialize(e,t,r,n){this.controlFlowStorageName=e,this.controlFlowStorageKey=t,this.callee=r,this.expressionArguments=n}getNodeStructure(){const e=l.NodeFactory.expressionStatementNode(l.NodeFactory.callExpressionNode(l.NodeFactory.memberExpressionNode(l.NodeFactory.identifierNode(this.controlFlowStorageName),l.NodeFactory.identifierNode(this.controlFlowStorageKey)),[this.callee,...this.expressionArguments]));return d.NodeUtils.parentizeAst(e),[e]}};t.CallExpressionControlFlowStorageCallNode=f,n([(0,c.initializable)(),i("design:type",Object)],f.prototype,"callee",void 0),n([(0,c.initializable)(),i("design:type",String)],f.prototype,"controlFlowStorageKey",void 0),n([(0,c.initializable)(),i("design:type",String)],f.prototype,"controlFlowStorageName",void 0),n([(0,c.initializable)(),i("design:type",Array)],f.prototype,"expressionArguments",void 0),t.CallExpressionControlFlowStorageCallNode=f=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperFormatter)),a(2,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(3,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Function,Object,Object,Object])],f)},44441:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ReservedStringObfuscatingGuard=void 0;const o=r(71519),s=r(50275),c=r(32287),u=r(23615);let l=class{constructor(e){this.options=e}check(e){return this.options.reservedStrings.length&&u.NodeGuards.isLiteralNode(e)&&"string"==typeof e.value&&this.isReservedString(e.value)?s.ObfuscatingGuardResult.Ignore:s.ObfuscatingGuardResult.Transform}isReservedString(e){return this.options.reservedStrings.some(t=>null!==new RegExp(t,"g").exec(e))}};t.ReservedStringObfuscatingGuard=l,t.ReservedStringObfuscatingGuard=l=n([(0,o.injectable)(),a(0,(0,o.inject)(c.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object])],l)},44834:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.iso7064Check=function(e){for(var t=10,r=0;r=0;n--){if(r){var i=2*parseInt(e[n],10);t+=i>9?i.toString().split("").map(function(e){return parseInt(e,10)}).reduce(function(e,t){return e+t},0):i}else t+=parseInt(e[n],10);r=!r}return t%10==0},t.reverseMultiplyAndSum=function(e,t){for(var r=0,n=0;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.propertyEventDecorator=function(e,t){return function(){return function(r,i){var a=new n.Metadata(e,i);if(Reflect.hasOwnMetadata(e,r.constructor))throw new Error(t);Reflect.defineMetadata(e,a,r.constructor)}}};var n=r(14425)},45408:e=>{e.exports=function(e,t){if("function"!=typeof e)throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let r,n=0;return function(...i){clearTimeout(r);const a=Date.now(),o=t-(a-n);o<=0?(n=a,e.apply(this,i)):r=setTimeout(()=>{n=Date.now(),e.apply(this,i)},o)}}},45467:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){(0,i.default)(e);var r=!1,n=!0;"object"!==a(t)?arguments.length>=2&&(n=arguments[1]):(r=void 0!==t.allowSpaces?t.allowSpaces:r,n=void 0!==t.includePercentValues?t.includePercentValues:n);if(r){if(!l.test(e))return!1;e=e.replace(/\s/g,"")}if(!n)return o.test(e)||s.test(e);return o.test(e)||s.test(e)||c.test(e)||u.test(e)};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}var o=/^rgb\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){2}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\)$/,s=/^rgba\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){3}(0?\.\d\d?|1(\.0)?|0(\.0)?)\)$/,c=/^rgb\((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%)\)$/,u=/^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0?\.\d\d?|1(\.0)?|0(\.0)?)\)$/,l=/^rgba?/;e.exports=t.default,e.exports.default=t.default},45772:(e,t)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){"object"===r(e)&&null!==e?e="function"==typeof e.toString?e.toString():"[object Object]":(null==e||isNaN(e)&&!e.length)&&(e="");return String(e)},e.exports=t.default,e.exports.default=t.default},45777:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isFreightContainerID=void 0,t.isISO6346=s;var n,i=(n=r(83399))&&n.__esModule?n:{default:n};var a=/^[A-Z]{3}(U[0-9]{7})|([J,Z][0-9]{6,7})$/,o=/^[0-9]$/;function s(e){if((0,i.default)(e),e=e.toUpperCase(),!a.test(e))return!1;if(11===e.length){for(var t=0,r=0;r=11&&n<=20?12+n%11:n>=21&&n<=30?23+n%21:34+n%31)*Math.pow(2,r)}var s=t%11;return 10===s&&(s=0),Number(e[e.length-1])===s}return!0}t.isFreightContainerID=s},45906:(e,t,r)=>{"use strict";var n=r(65606);function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=r(88308),o=i(r(87206)),s=r(43663),c=new Promise(e=>{try{const t=new Uint8Array([104,101,108,108,111]);new Blob([t]).text().then(t=>{e("hello"===t)}).catch(()=>{e(!1)})}catch(t){e(!1)}});async function u(e){if(e instanceof ReadableStream)return e;if(e instanceof Blob)return e.stream();if(l(e))return s.Readable.toWeb(e);let t;var r;return e instanceof ArrayBuffer?t=new Uint8Array(e):!function(e){return o.default.call(void 0,e)}(e)?(r=e,t=(new TextEncoder).encode(r)):t=e,await c?new Blob([t]).stream():new ReadableStream({start(e){e.enqueue(t),e.close()}})}function l(e){return"object"==typeof e&&"function"==typeof e.pipe&&e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState}var d=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i,f={b:1,kb:1024,mb:1<<20,gb:1<<30,tb:1024**4,pb:1024**5};function p(e){if("number"==typeof e&&!Number.isNaN(e))return e;if("string"!=typeof e)return null;const t=d.exec(e);let r,n="b";if(t){const[,e,,,i]=t;if(!e)return null;r=parseFloat(e),i&&(n=i.toLowerCase())}else r=parseInt(e,10);return Number.isNaN(r)?null:Math.floor(f[n]*r)}function h(e){if(null==e?void 0:e.token)return e.token;if(n.env.BLOB_READ_WRITE_TOKEN)return n.env.BLOB_READ_WRITE_TOKEN;throw new m("No token found. Either configure the `BLOB_READ_WRITE_TOKEN` environment variable, or pass a `token` option to your calls.")}var m=class extends Error{constructor(e){super(`Vercel Blob: ${e}`)}};function g(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}var b=["//"],y=(()=>{if(a.isNodeProcess.call(void 0))return!0;if(S().startsWith("http://localhost"))return!1;let e=!1;const t=new Request(S(),{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})();function S(e=""){let t=null;try{t=n.env.VERCEL_BLOB_API_URL||n.env.NEXT_PUBLIC_VERCEL_BLOB_API_URL}catch(e){}return`${t||"https://vercel.com/api/blob"}${e}`}var v="function"==typeof TextEncoder?new TextEncoder:null;function _(e){return e?"string"==typeof e?v?v.encode(e).byteLength:new Blob([e]).size:"byteLength"in e&&"number"==typeof e.byteLength?e.byteLength:"size"in e&&"number"==typeof e.size?e.size:0:0}function C(e){return globalThis.ReadableStream&&e instanceof ReadableStream}var A,E,x,N=i(r(17336)),I=!1;try{((null==(A=n.env.DEBUG)?void 0:A.includes("blob"))||(null==(E=n.env.NEXT_PUBLIC_DEBUG)?void 0:E.includes("blob")))&&(I=!0)}catch(e){}function T(e,...t){I&&console.debug(`vercel-blob: ${e}`,...t)}var D=null!=(x=globalThis.DOMException)?x:(()=>{try{atob("~")}catch(e){return Object.getPrototypeOf(e).constructor}})(),O=Object.prototype.toString,M=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Load failed","Network request failed","fetch failed","terminated"]);function R(e){var t;return!(!e||(t=e,"[object Error]"!==O.call(t))||"TypeError"!==e.name||"string"!=typeof e.message)&&("Load failed"===e.message?void 0===e.stack:M.has(e.message))}var F=r(65903),P="function"==typeof F.fetch,w=P&&y,B=async({input:e,init:t,onUploadProgress:r})=>{let n;if(T("using fetch"),t.body)if(r){const e=await u(t.body);let i=0;const a=((e,t)=>{let r=new Uint8Array(0);return new TransformStream({transform(n,i){queueMicrotask(()=>{const a=new Uint8Array(r.length+n.byteLength);for(a.set(r),a.set(new Uint8Array(n),r.length),r=a;r.length>=e;){const n=r.slice(0,e);i.enqueue(n),null==t||t(n.byteLength),r=r.slice(e)}})},flush(e){queueMicrotask(()=>{r.length>0&&(e.enqueue(r),null==t||t(r.byteLength))})}})})(65536,e=>{i+=e,r(i)});n=e.pipeThrough(a)}else n=t.body;const i=y&&n&&(C(a=n)||l(a))?"half":void 0;var a;return F.fetch.call(void 0,e,{...t,...t.body?{body:n}:{},duplex:i})},k="undefined"!=typeof XMLHttpRequest,L=async({input:e,init:t,onUploadProgress:r})=>{T("using xhr");let n=null;return t.body&&(n=C(t.body)?await new Response(t.body).blob():t.body),new Promise((i,a)=>{const o=new XMLHttpRequest;if(o.open(t.method||"GET",e.toString(),!0),r&&o.upload.addEventListener("progress",e=>{e.lengthComputable&&r(e.loaded)}),o.onload=()=>{var e;if(null==(e=t.signal)?void 0:e.aborted)return void a(new DOMException("The user aborted the request.","AbortError"));const r=new Headers;o.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(e=>{const t=e.split(": "),n=t.shift(),i=t.join(": ");n&&r.set(n.toLowerCase(),i)});const n=new Response(o.response,{status:o.status,statusText:o.statusText,headers:r});i(n)},o.onerror=()=>{a(new TypeError("Network request failed"))},o.ontimeout=()=>{a(new TypeError("Network request timed out"))},o.onabort=()=>{a(new DOMException("The user aborted a request.","AbortError"))},t.headers){new Headers(t.headers).forEach((e,t)=>{o.setRequestHeader(t,e)})}t.signal&&(t.signal.addEventListener("abort",()=>{o.abort()}),t.signal.aborted)?o.abort():o.send(n)})},$=class extends m{constructor(){super("Access denied, please provide a valid token for this resource.")}},j=class extends m{constructor(e){super(`Content type mismatch, ${e}.`)}},G=class extends m{constructor(e){super(`Pathname mismatch, ${e}. Check the pathname used in upload() or put() matches the one from the client token.`)}},V=class extends m{constructor(){super("Client token has expired.")}},U=class extends m{constructor(e){super(`File is too large, ${e}.`)}},H=class extends m{constructor(){super("This store does not exist.")}},K=class extends m{constructor(){super("This store has been suspended.")}},W=class extends m{constructor(){super("Unknown error, please visit https://vercel.com/help.")}},z=class extends m{constructor(){super("The requested blob does not exist")}},X=class extends m{constructor(){super("The blob service is currently not available. Please try again.")}},Y=class extends m{constructor(e){super(`Too many requests please lower the number of concurrent requests ${e?` - try again in ${e} seconds`:""}.`),this.retryAfter=null!=e?e:0}},Z=class extends m{constructor(){super("The request was aborted.")}};function q(){try{const e=n.env.VERCEL_BLOB_RETRIES||"10";return parseInt(e,10)}catch(e){return 10}}async function J(e){var t,r,n;let i,a,o;try{const o=await e.json();i=null!=(r=null==(t=o.error)?void 0:t.code)?r:"unknown_error",a=null==(n=o.error)?void 0:n.message}catch(e){i="unknown_error"}switch((null==a?void 0:a.includes("contentType"))&&a.includes("is not allowed")&&(i="content_type_not_allowed"),(null==a?void 0:a.includes('"pathname"'))&&a.includes("does not match the token payload")&&(i="client_token_pathname_mismatch"),"Token expired"===a&&(i="client_token_expired"),(null==a?void 0:a.includes("the file length cannot be greater than"))&&(i="file_too_large"),i){case"store_suspended":o=new K;break;case"forbidden":o=new $;break;case"content_type_not_allowed":o=new j(a);break;case"client_token_pathname_mismatch":o=new G(a);break;case"client_token_expired":o=new V;break;case"file_too_large":o=new U(a);break;case"not_found":o=new z;break;case"store_not_found":o=new H;break;case"bad_request":o=new m(null!=a?a:"Bad request");break;case"service_unavailable":o=new X;break;case"rate_limited":o=function(e){const t=e.headers.get("retry-after");return new Y(t?parseInt(t,10):void 0)}(e);break;default:o=new W}return{code:i,error:o}}async function Q(e,t,r){const i=function(){let e=null;try{e=n.env.VERCEL_BLOB_API_VERSION_OVERRIDE||n.env.NEXT_PUBLIC_VERCEL_BLOB_API_VERSION_OVERRIDE}catch(e){}return`${null!=e?e:11}`}(),a=h(r),o=function(){const e={};try{"VERCEL_BLOB_PROXY_THROUGH_ALTERNATIVE_API"in n.env&&void 0!==n.env.VERCEL_BLOB_PROXY_THROUGH_ALTERNATIVE_API?e["x-proxy-through-alternative-api"]=n.env.VERCEL_BLOB_PROXY_THROUGH_ALTERNATIVE_API:"NEXT_PUBLIC_VERCEL_BLOB_PROXY_THROUGH_ALTERNATIVE_API"in n.env&&void 0!==n.env.NEXT_PUBLIC_VERCEL_BLOB_PROXY_THROUGH_ALTERNATIVE_API&&(e["x-proxy-through-alternative-api"]=n.env.NEXT_PUBLIC_VERCEL_BLOB_PROXY_THROUGH_ALTERNATIVE_API)}catch(e){}return e}(),[,,,s=""]=a.split("_"),c=`${s}:${Date.now()}:${Math.random().toString(16).slice(2)}`;let u=0,l=0,d=0;const f=(null==r?void 0:r.onUploadProgress)||function(){try{return"1"===n.env.VERCEL_BLOB_USE_X_CONTENT_LENGTH}catch(e){return!1}}();t.body&&f&&(l=_(t.body)),(null==r?void 0:r.onUploadProgress)&&r.onUploadProgress({loaded:0,total:l,percentage:0});const p=await N.default.call(void 0,async n=>{let s;try{s=await(async({input:e,init:t,onUploadProgress:r})=>{if(r){if(w)return B({input:e,init:t,onUploadProgress:r});if(k)return L({input:e,init:t,onUploadProgress:r})}if(P)return B({input:e,init:t});if(k)return L({input:e,init:t});throw new Error("No request implementation available")})({input:S(e),init:{...t,headers:{"x-api-blob-request-id":c,"x-api-blob-request-attempt":String(u),"x-api-version":i,...f?{"x-content-length":String(l)}:{},authorization:`Bearer ${a}`,...o,...t.headers}},onUploadProgress:(null==r?void 0:r.onUploadProgress)?e=>{var t;const n=0!==l?l:e;d=e;const i=l>0?Number((e/n*100).toFixed(2)):0;100===i&&l>0||null==(t=r.onUploadProgress)||t.call(r,{loaded:e,total:n,percentage:i})}:void 0})}catch(e){if(e instanceof D&&"AbortError"===e.name)return void n(new Z);if(R(e))throw e;if(e instanceof TypeError)return void n(e);throw e}if(s.ok)return s;const{code:p,error:h}=await J(s);if("unknown_error"===p||"service_unavailable"===p||"internal_server_error"===p)throw h;n(h)},{retries:q(),onRetry:t=>{t instanceof Error&&T(`retrying API request to ${e}`,t.message),u+=1}});if(!p)throw new W;return(null==r?void 0:r.onUploadProgress)&&r.onUploadProgress({loaded:d,total:d,percentage:100}),await p.json()}var ee="x-cache-control-max-age",te="x-add-random-suffix",re="x-allow-overwrite",ne="x-content-type";function ie(e,t){const r={};return e.includes("contentType")&&t.contentType&&(r[ne]=t.contentType),e.includes("addRandomSuffix")&&void 0!==t.addRandomSuffix&&(r[te]=t.addRandomSuffix?"1":"0"),e.includes("allowOverwrite")&&void 0!==t.allowOverwrite&&(r[re]=t.allowOverwrite?"1":"0"),e.includes("cacheControlMaxAge")&&void 0!==t.cacheControlMaxAge&&(r[ee]=t.cacheControlMaxAge.toString()),r}async function ae({pathname:e,options:t,extraChecks:r,getToken:n}){if(!e)throw new m("pathname is required");if(e.length>950)throw new m("pathname is too long, maximum length is 950");for(const t of b)if(e.includes(t))throw new m(`pathname cannot contain "${t}", please encode it if needed`);if(!t)throw new m("missing options, see usage");if("public"!==t.access)throw new m('access must be "public"');return r&&r(t),n&&(t.token=await n(e,t)),t}async function oe({uploadId:e,key:t,pathname:r,parts:n,headers:i,options:a}){const o=new URLSearchParams({pathname:r});try{const r=await Q(`/mpu?${o.toString()}`,{method:"POST",headers:{...i,"content-type":"application/json","x-mpu-action":"complete","x-mpu-upload-id":e,"x-mpu-key":encodeURIComponent(t)},body:JSON.stringify(n),signal:a.abortSignal},a);return T("mpu: complete",r),r}catch(e){throw e instanceof TypeError&&("Failed to fetch"===e.message||"fetch failed"===e.message)?new X:e}}async function se(e,t,r){T("mpu: create","pathname:",e);const n=new URLSearchParams({pathname:e});try{const e=await Q(`/mpu?${n.toString()}`,{method:"POST",headers:{...t,"x-mpu-action":"create"},signal:r.abortSignal},r);return T("mpu: create",e),e}catch(e){if(e instanceof TypeError&&("Failed to fetch"===e.message||"fetch failed"===e.message))throw new X;throw e}}var ce=i(r(45408));async function ue({uploadId:e,key:t,pathname:r,headers:n,options:i,internalAbortController:a=new AbortController,part:o}){var s,c,u;const l=Q(`/mpu?${new URLSearchParams({pathname:r}).toString()}`,{signal:a.signal,method:"POST",headers:{...n,"x-mpu-action":"upload","x-mpu-key":encodeURIComponent(t),"x-mpu-upload-id":e,"x-mpu-part-number":o.partNumber.toString()},body:o.blob},i);function d(){a.abort()}(null==(s=i.abortSignal)?void 0:s.aborted)?d():null==(c=i.abortSignal)||c.addEventListener("abort",d);const f=await l;return null==(u=i.abortSignal)||u.removeEventListener("abort",d),f}var le="undefined"!=typeof window?6:8,de=8388608,fe=le*de*2;async function pe(e,t,r,n){T("mpu: init","pathname:",e,"headers:",r);const i={...n,onUploadProgress:void 0},a=await se(e,r,i),o=_(t),s=await u(t),c=await function({uploadId:e,key:t,pathname:r,stream:n,headers:i,options:a,totalToLoad:o}){T("mpu: upload init","key:",t);const s=new AbortController;return new Promise((c,u)=>{const l=[],d=[],f=n.getReader();let h,m=0,g=!1,b=1,y=!1,S=0,v=!1,_=0,C=[],A=0;const E={};async function x(){for(T("mpu: upload read start","activeUploads:",m,"currentBytesInMemory:",`${p(S)}/${p(fe)}`,"bytesSent:",p(_)),g=!0;S0&&(l.push({partNumber:b++,blob:new Blob(C,{type:"application/octet-stream"})}),I()),void(g=!1);S+=e.byteLength;let r=0;for(;r{E[n.partNumber]=e.loaded,h&&h()}:void 0,u=await ue({uploadId:e,key:t,pathname:r,headers:i,options:{...a,onUploadProgress:o},internalAbortController:s,part:n});if(T("mpu: upload send part end","partNumber:",n.partNumber,"activeUploads",m,"currentBytesInMemory:",`${p(S)}/${p(fe)}`,"bytesSent:",p(_)),y)return;if(d.push({partNumber:n.partNumber,etag:u.etag}),S-=n.blob.size,m--,_+=n.blob.size,l.length>0&&I(),v)return void(0===m&&(f.releaseLock(),c(d)));g||x().catch(D)}catch(e){D(e)}}function I(){if(!y)for(T("send parts","activeUploads",m,"partsToUpload",l.length);m0;){const e=l.shift();e&&N(e)}}function D(e){y||(y=!0,s.abort(),f.releaseLock(),e instanceof TypeError&&("Failed to fetch"===e.message||"fetch failed"===e.message)?u(new X):u(e))}a.onUploadProgress&&(h=ce.default.call(void 0,()=>{var e;const t=Object.values(E).reduce((e,t)=>e+t,0),r=o||t,n=o>0?Number((100*(t/o||t)).toFixed(2)):0;null==(e=a.onUploadProgress)||e.call(a,{loaded:t,total:r,percentage:n})},150)),x().catch(D)})}({uploadId:a.uploadId,key:a.key,pathname:e,stream:s,headers:r,options:n,totalToLoad:o});return await oe({uploadId:a.uploadId,key:a.key,pathname:e,parts:c,headers:r,options:i})}t.getTokenFromOptionsOrEnv=h,t.BlobError=m,t.getDownloadUrl=function(e){const t=new URL(e);return t.searchParams.set("download","1"),t.toString()},t.disallowedPathnameCharacters=b,t.MAXIMUM_PATHNAME_LENGTH=950,t.BlobAccessError=$,t.BlobContentTypeNotAllowedError=j,t.BlobPathnameMismatchError=G,t.BlobClientTokenExpiredError=V,t.BlobFileTooLargeError=U,t.BlobStoreNotFoundError=H,t.BlobStoreSuspendedError=K,t.BlobUnknownError=W,t.BlobNotFoundError=z,t.BlobServiceNotAvailable=X,t.BlobServiceRateLimited=Y,t.BlobRequestAbortedError=Z,t.requestApi=Q,t.createCompleteMultipartUploadMethod=function({allowedOptions:e,getToken:t,extraChecks:r}){return async(n,i,a)=>{const o=await ae({pathname:n,options:a,extraChecks:r,getToken:t}),s=ie(e,o);return oe({uploadId:o.uploadId,key:o.key,pathname:n,headers:s,options:o,parts:i})}},t.createCreateMultipartUploadMethod=function({allowedOptions:e,getToken:t,extraChecks:r}){return async(n,i)=>{const a=await ae({pathname:n,options:i,extraChecks:r,getToken:t}),o=ie(e,a),s=await se(n,o,a);return{key:s.key,uploadId:s.uploadId}}},t.createUploadPartMethod=function({allowedOptions:e,getToken:t,extraChecks:r}){return async(n,i,a)=>{const o=await ae({pathname:n,options:a,extraChecks:r,getToken:t}),s=ie(e,o);if(g(i))throw new m("Body must be a string, buffer or stream. You sent a plain JavaScript object, double check what you're trying to upload.");return{etag:(await ue({uploadId:o.uploadId,key:o.key,pathname:n,part:{blob:i,partNumber:o.partNumber},headers:s,options:o})).etag,partNumber:o.partNumber}}},t.createCreateMultipartUploaderMethod=function({allowedOptions:e,getToken:t,extraChecks:r}){return async(n,i)=>{const a=await ae({pathname:n,options:i,extraChecks:r,getToken:t}),o=ie(e,a),s=await se(n,o,a);return{key:s.key,uploadId:s.uploadId,async uploadPart(e,t){if(g(t))throw new m("Body must be a string, buffer or stream. You sent a plain JavaScript object, double check what you're trying to upload.");return{etag:(await ue({uploadId:s.uploadId,key:s.key,pathname:n,part:{partNumber:e,blob:t},headers:o,options:a})).etag,partNumber:e}},complete:async e=>oe({uploadId:s.uploadId,key:s.key,pathname:n,parts:e,headers:o,options:a})}}},t.createPutMethod=function({allowedOptions:e,getToken:t,extraChecks:r}){return async function(n,i,a){if(!i)throw new m("body is required");if(g(i))throw new m("Body must be a string, buffer or stream. You sent a plain JavaScript object, double check what you're trying to upload.");const o=await ae({pathname:n,options:a,extraChecks:r,getToken:t}),s=ie(e,o);if(!0===o.multipart)return pe(n,i,s,o);const c=o.onUploadProgress?ce.default.call(void 0,o.onUploadProgress,100):void 0,u=new URLSearchParams({pathname:n}),l=await Q(`/?${u.toString()}`,{method:"PUT",body:i,headers:s,signal:o.abortSignal},{...o,onUploadProgress:c});return{url:l.url,downloadUrl:l.downloadUrl,pathname:l.pathname,contentType:l.contentType,contentDisposition:l.contentDisposition}}},t.createFolder=async function(e,t={}){const r=e.endsWith("/")?e:`${e}/`,n={};n[te]="0";const i=new URLSearchParams({pathname:r}),a=await Q(`/?${i.toString()}`,{method:"PUT",headers:n,signal:t.abortSignal},t);return{url:a.url,pathname:a.pathname}}},45926:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if((0,i.default)(e),(t=(0,n.default)(t,c)).locale in o.decimal)return!(0,a.default)(u,e.replace(/ /g,""))&&function(e){var t=new RegExp("^[-+]?([0-9]+)?(\\".concat(o.decimal[e.locale],"[0-9]{").concat(e.decimal_digits,"})").concat(e.force_decimal?"":"?","$"));return t}(t).test(e);throw new Error("Invalid locale '".concat(t.locale,"'"))};var n=s(r(93610)),i=s(r(83399)),a=s(r(78644)),o=r(13237);function s(e){return e&&e.__esModule?e:{default:e}}var c={force_decimal:!1,decimal_digits:"1,",locale:"en-US"},u=["","-","+"];e.exports=t.default,e.exports.default=t.default},46183:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.IfStatementSimplifyTransformer=void 0;const o=r(71519),s=r(32287),c=r(18436),u=r(21818),l=r(23615),d=r(91363),f=r(25120);let p=class extends u.AbstractStatementSimplifyTransformer{constructor(e,t){super(e,t)}getVisitor(e){return e===c.NodeTransformationStage.Simplifying?{leave:(e,t)=>{if(t&&l.NodeGuards.isIfStatementNode(e))return this.transformNode(e,t)}}:null}transformNode(e,t){const r=this.getStatementSimplifyData(e.consequent);if(!r)return e;let n;if(e.alternate){const t=this.getStatementSimplifyData(e.alternate);if(!t)return e;n=this.getConsequentAndAlternateNode(e,r,t)}else n=this.getConsequentNode(e,r);return f.NodeUtils.parentizeNode(n,t)}getConsequentNode(e,t){return t.leadingStatements.length||!t.trailingStatement?d.NodeFactory.ifStatementNode(e.test,this.getPartialStatement(t)):t.hasReturnStatement?d.NodeFactory.ifStatementNode(e.test,t.trailingStatement.statement):d.NodeFactory.expressionStatementNode(d.NodeFactory.logicalExpressionNode("&&",e.test,t.trailingStatement.expression))}getConsequentAndAlternateNode(e,t,r){return t.leadingStatements.length||r.leadingStatements.length||!t.trailingStatement||!r.trailingStatement?d.NodeFactory.ifStatementNode(e.test,this.getPartialStatement(t),this.getPartialStatement(r)):t.hasReturnStatement&&r.hasReturnStatement?d.NodeFactory.returnStatementNode(d.NodeFactory.conditionalExpressionNode(e.test,t.trailingStatement.expression,r.trailingStatement.expression)):t.hasReturnStatement||r.hasReturnStatement?d.NodeFactory.ifStatementNode(e.test,t.trailingStatement.statement,r.trailingStatement.statement):d.NodeFactory.expressionStatementNode(d.NodeFactory.conditionalExpressionNode(e.test,t.trailingStatement.expression,r.trailingStatement.expression))}getPartialStatement(e){const t=super.getPartialStatement(e);return l.NodeGuards.isBlockStatementNode(t)?1!==t.body.length||this.isProhibitedSingleStatementForIfStatementBranch(t.body[0])?t:t.body[0]:t}isProhibitedSingleStatementForIfStatementBranch(e){return l.NodeGuards.isFunctionDeclarationNode(e)||l.NodeGuards.isIfStatementNode(e)||l.NodeGuards.isNodeWithSingleStatementBody(e)||l.NodeGuards.isVariableDeclarationNode(e)&&"var"!==e.kind}};t.IfStatementSimplifyTransformer=p,t.IfStatementSimplifyTransformer=p=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object,Object])],p)},46255:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r,n;(0,i.default)(e),"object"===a(t)?(r=t.min||0,n=t.max):(r=arguments[1],n=arguments[2]);var o=encodeURI(e).split(/%..|./).length-1;return o>=r&&(void 0===n||o<=n)};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}e.exports=t.default,e.exports.default=t.default},46263:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectExpressionExtractor=void 0,function(e){e.BasePropertiesExtractor="BasePropertiesExtractor",e.ObjectExpressionToVariableDeclarationExtractor="ObjectExpressionToVariableDeclarationExtractor"}(r||(t.ObjectExpressionExtractor=r={}))},46404:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProApiObfuscationResult=void 0;t.ProApiObfuscationResult=class{constructor(e,t=""){this.obfuscatedCode=e,this.sourceMapValue=t}getObfuscatedCode(){return this.obfuscatedCode}getSourceMap(){return this.sourceMapValue}getIdentifierNamesCache(){return null}toString(){return this.obfuscatedCode}}},46438:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayScopeCallsWrapperVariableNode=void 0;const o=r(71519),s=r(32287),c=r(10548),u=r(35126),l=r(91363),d=r(25120);let f=class extends u.AbstractStringArrayCallNode{constructor(e,t,r,n,i,a,o){super(e,t,r,n,i,a,o)}initialize(e,t){this.stringArrayScopeCallsWrapperData=e,this.stringArrayCallsWrapperData=t}getNodeStructure(){const e=l.NodeFactory.variableDeclarationNode([l.NodeFactory.variableDeclaratorNode(l.NodeFactory.identifierNode(this.stringArrayScopeCallsWrapperData.name),l.NodeFactory.identifierNode(this.stringArrayCallsWrapperData.name))],"const");return d.NodeUtils.parentizeAst(e),[e]}};t.StringArrayScopeCallsWrapperVariableNode=f,n([(0,c.initializable)(),i("design:type",Object)],f.prototype,"stringArrayCallsWrapperData",void 0),n([(0,c.initializable)(),i("design:type",Object)],f.prototype,"stringArrayScopeCallsWrapperData",void 0),t.StringArrayScopeCallsWrapperVariableNode=f=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.Factory__IStringArrayIndexNode)),a(2,(0,o.inject)(s.ServiceIdentifiers.ICustomCodeHelperFormatter)),a(3,(0,o.inject)(s.ServiceIdentifiers.IStringArrayStorage)),a(4,(0,o.inject)(s.ServiceIdentifiers.IArrayUtils)),a(5,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(6,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Function,Function,Object,Object,Object,Object,Object])],f)},46459:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ForceTransformStringObfuscatingGuard=void 0;const o=r(71519),s=r(50275),c=r(32287),u=r(23615);let l=class{constructor(e){this.options=e}check(e){return this.options.forceTransformStrings.length&&u.NodeGuards.isLiteralNode(e)&&"string"==typeof e.value&&this.isForceTransformString(e.value)?s.ObfuscatingGuardResult.ForceTransform:s.ObfuscatingGuardResult.Transform}isForceTransformString(e){return this.options.forceTransformStrings.some(t=>null!==new RegExp(t,"g").exec(e))}};t.ForceTransformStringObfuscatingGuard=l,t.ForceTransformStringObfuscatingGuard=l=n([(0,o.injectable)(),a(0,(0,o.inject)(c.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object])],l)},46837:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},o=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayStorage=void 0;const s=r(71519),c=r(32287),u=r(70885),l=r(11440);let d=n=class extends l.MapStorage{constructor(e,t,r,i,a){super(r,i),this.rc4EncodedValuesSourcesCache=new Map,this.indexShiftAmount=0,this.rotationAmount=0,this.stringArrayStorageCallsWrapperNamesMap=new Map,this.identifierNamesGenerator=e(i),this.arrayUtils=t,this.cryptUtilsStringArray=a,this.rc4Keys=this.randomGenerator.getRandomGenerator().n(()=>this.randomGenerator.getRandomGenerator().string({length:n.rc4KeyLength}),n.rc4KeysCount)}initialize(){super.initialize(),this.indexShiftAmount=this.options.stringArrayIndexShift?this.randomGenerator.getRandomInteger(n.minimumIndexShiftAmount,n.maximumIndexShiftAmount):0,this.rotationAmount=this.options.stringArrayRotate?this.randomGenerator.getRandomInteger(n.minimumRotationAmount,n.maximumRotationAmount):0}get(e){return this.getOrSetIfDoesNotExist(e)}getIndexShiftAmount(){return this.indexShiftAmount}getRotationAmount(){return this.rotationAmount}getStorageName(){return this.getStorageId()}getStorageId(){return this.stringArrayStorageName||(this.stringArrayStorageName=this.identifierNamesGenerator.generateForGlobalScope(n.stringArrayFunctionNameLength)),this.stringArrayStorageName}getStorageCallsWrapperName(e){var t;const r=null!==(t=this.stringArrayStorageCallsWrapperNamesMap.get(e))&&void 0!==t?t:null;if(r)return r;const i=this.identifierNamesGenerator.generateForGlobalScope(n.stringArrayFunctionNameLength);return this.stringArrayStorageCallsWrapperNamesMap.set(e,i),i}rotateStorage(){this.getLength()&&(this.storage=new Map(this.arrayUtils.rotate(Array.from(this.storage.entries()),this.rotationAmount)))}shuffleStorage(){this.storage=new Map(this.arrayUtils.shuffle(Array.from(this.storage.entries())).map(([e,t],r)=>(t.index=r,[e,t])))}getOrSetIfDoesNotExist(e){const{encodedValue:t,encoding:r,decodeKey:n}=this.getEncodedValue(e),i=`${t}-${r}`,a=this.storage.get(i);if(a)return a;const o={encodedValue:t,encoding:r,decodeKey:n,value:e,index:this.getLength()};return this.storage.set(i,o),o}getEncodedValue(e){var t;const r=this.options.stringArrayEncoding.length?this.randomGenerator.getRandomGenerator().pickone(this.options.stringArrayEncoding):null;if(!r)throw new Error("`stringArrayEncoding` option array is empty");switch(r){case u.StringArrayEncoding.Rc4:{const n=50;for(let i=0;i{var n=r(90251),i=r(41163),a=r(80735).C,o=r(17092),s=r(43801).g;function c(e,t){var r=e;return"string"==typeof e&&(r=n.parseSourceMapInput(e)),null!=r.sections?new d(r,t):new u(r,t)}function u(e,t){var r=e;"string"==typeof e&&(r=n.parseSourceMapInput(e));var i=n.getArg(r,"version"),o=n.getArg(r,"sources"),s=n.getArg(r,"names",[]),c=n.getArg(r,"sourceRoot",null),u=n.getArg(r,"sourcesContent",null),l=n.getArg(r,"mappings"),d=n.getArg(r,"file",null);if(i!=this._version)throw new Error("Unsupported version: "+i);c&&(c=n.normalize(c)),o=o.map(String).map(n.normalize).map(function(e){return c&&n.isAbsolute(c)&&n.isAbsolute(e)?n.relative(c,e):e}),this._names=a.fromArray(s.map(String),!0),this._sources=a.fromArray(o,!0),this._absoluteSources=this._sources.toArray().map(function(e){return n.computeSourceURL(c,e,t)}),this.sourceRoot=c,this.sourcesContent=u,this._mappings=l,this._sourceMapURL=t,this.file=d}function l(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function d(e,t){var r=e;"string"==typeof e&&(r=n.parseSourceMapInput(e));var i=n.getArg(r,"version"),o=n.getArg(r,"sections");if(i!=this._version)throw new Error("Unsupported version: "+i);this._sources=new a,this._names=new a;var s={line:-1,column:0};this._sections=o.map(function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var r=n.getArg(e,"offset"),i=n.getArg(r,"line"),a=n.getArg(r,"column");if(i=0){var s=this._originalMappings[o];if(void 0===e.column)for(var c=s.originalLine;s&&s.originalLine===c;)a.push({line:n.getArg(s,"generatedLine",null),column:n.getArg(s,"generatedColumn",null),lastColumn:n.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++o];else for(var u=s.originalColumn;s&&s.originalLine===t&&s.originalColumn==u;)a.push({line:n.getArg(s,"generatedLine",null),column:n.getArg(s,"generatedColumn",null),lastColumn:n.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++o]}return a},u.prototype=Object.create(c.prototype),u.prototype.consumer=c,u.prototype._findSourceIndex=function(e){var t,r=e;if(null!=this.sourceRoot&&(r=n.relative(this.sourceRoot,r)),this._sources.has(r))return this._sources.indexOf(r);for(t=0;t1&&(r.source=m+a[1],m+=a[1],r.originalLine=p+a[2],p=r.originalLine,r.originalLine+=1,r.originalColumn=h+a[3],h=r.originalColumn,a.length>4&&(r.name=g+a[4],g+=a[4])),C.push(r),"number"==typeof r.originalLine&&_.push(r)}s(C,n.compareByGeneratedPositionsDeflated),this.__generatedMappings=C,s(_,n.compareByOriginalPositions),this.__originalMappings=_},u.prototype._findMapping=function(e,t,r,n,a,o){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[n]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[n]);return i.search(e,t,a,o)},u.prototype.computeColumnSpans=function(){for(var e=0;e=0){var i=this._generatedMappings[r];if(i.generatedLine===t.generatedLine){var a=n.getArg(i,"source",null);null!==a&&(a=this._sources.at(a),a=n.computeSourceURL(this.sourceRoot,a,this._sourceMapURL));var o=n.getArg(i,"name",null);return null!==o&&(o=this._names.at(o)),{source:a,line:n.getArg(i,"originalLine",null),column:n.getArg(i,"originalColumn",null),name:o}}}return{source:null,line:null,column:null,name:null}},u.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}))},u.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;var r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];var i,a=e;if(null!=this.sourceRoot&&(a=n.relative(this.sourceRoot,a)),null!=this.sourceRoot&&(i=n.urlParse(this.sourceRoot))){var o=a.replace(/^file:\/\//,"");if("file"==i.scheme&&this._sources.has(o))return this.sourcesContent[this._sources.indexOf(o)];if((!i.path||"/"==i.path)&&this._sources.has("/"+a))return this.sourcesContent[this._sources.indexOf("/"+a)]}if(t)return null;throw new Error('"'+a+'" is not in the SourceMap.')},u.prototype.generatedPositionFor=function(e){var t=n.getArg(e,"source");if((t=this._findSourceIndex(t))<0)return{line:null,column:null,lastColumn:null};var r={source:t,originalLine:n.getArg(e,"line"),originalColumn:n.getArg(e,"column")},i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",n.compareByOriginalPositions,n.getArg(e,"bias",c.GREATEST_LOWER_BOUND));if(i>=0){var a=this._originalMappings[i];if(a.source===r.source)return{line:n.getArg(a,"generatedLine",null),column:n.getArg(a,"generatedColumn",null),lastColumn:n.getArg(a,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},d.prototype=Object.create(c.prototype),d.prototype.constructor=c,d.prototype._version=3,Object.defineProperty(d.prototype,"sources",{get:function(){for(var e=[],t=0;t=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayHexadecimalNumberIndexNode=void 0;const o=r(71519),s=r(32287),c=r(79883),u=r(91363),l=r(57876);let d=class extends c.AbstractStringArrayIndexNode{constructor(e,t){super(e,t)}getNode(e){const t=l.NumberUtils.toHex(e);return u.NodeFactory.literalNode(e,t)}};t.StringArrayHexadecimalNumberIndexNode=d,t.StringArrayHexadecimalNumberIndexNode=d=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(1,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Object,Object])],d)},47926:function(e,t,r){"use strict";var n,i,a=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},c=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),i=0;i{if(b.NodeGuards.isProgramNode(e))return this.transformNode(e)}};case h.NodeTransformationStage.Finalizing:return{leave:e=>{if(b.NodeGuards.isProgramNode(e))return this.filterCommentsOnFinalizingTraverse(e)}};default:return null}}transformNode(e){var t;if(!(null===(t=(e=this.filterCommentsOnPrimaryTraverse(e)).comments)||void 0===t?void 0:t.length))return e;const r=e.comments.reverse();if(0===r.length)return e;if(!e.body.length)return e.leadingComments=r,e;let n=!0;return p.traverse(e,{enter:t=>{if(t===e)return;const i=r.findIndex(e=>e.range&&t.range&&e.range[0]=0&&((n?e:t).leadingComments=r.splice(i,r.length-i).reverse()),n=!1}}),r.length>0&&(e.trailingComments=r.reverse()),e}filterCommentsOnPrimaryTraverse(e){var t;return e.comments=null===(t=e.comments)||void 0===t?void 0:t.filter(e=>this.filterComment(e,!0)),e}filterCommentsOnFinalizingTraverse(e){return p.replace(e,{enter:e=>{var t,r;return e.leadingComments&&(e.leadingComments=null===(t=e.leadingComments)||void 0===t?void 0:t.filter(e=>this.filterComment(e,!1))),e.trailingComments&&(e.trailingComments=null===(r=e.trailingComments)||void 0===r?void 0:r.filter(e=>this.filterComment(e,!1))),e}}),e}filterComment(e,t){return!(!t||!g.ConditionalCommentObfuscatingGuard.isConditionalComment(e))||i.preservedWords.some(t=>e.value.includes(t))}};t.CommentsTransformer=y,y.preservedWords=["@license","@preserve"],t.CommentsTransformer=y=i=s([(0,d.injectable)(),l(0,(0,d.inject)(f.ServiceIdentifiers.IRandomGenerator)),l(1,(0,d.inject)(f.ServiceIdentifiers.IOptions)),u("design:paramtypes",[Object,Object])],y)},48007:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nodeModule=void 0;const n=r(71519),i=r(32287),a=r(19225);t.nodeModule=new n.ContainerModule(e=>{e(i.ServiceIdentifiers.IScopeIdentifiersTraverser).to(a.ScopeIdentifiersTraverser).inSingletonScope()})},48033:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)(e),a.has(e)};var n,i=(n=r(83399))&&n.__esModule?n:{default:n};var a=new Set(["aa","ab","ae","af","ak","am","an","ar","as","av","ay","az","az","ba","be","bg","bh","bi","bm","bn","bo","br","bs","ca","ce","ch","co","cr","cs","cu","cv","cy","da","de","dv","dz","ee","el","en","eo","es","et","eu","fa","ff","fi","fj","fo","fr","fy","ga","gd","gl","gn","gu","gv","ha","he","hi","ho","hr","ht","hu","hy","hz","ia","id","ie","ig","ii","ik","io","is","it","iu","ja","jv","ka","kg","ki","kj","kk","kl","km","kn","ko","kr","ks","ku","kv","kw","ky","la","lb","lg","li","ln","lo","lt","lu","lv","mg","mh","mi","mk","ml","mn","mr","ms","mt","my","na","nb","nd","ne","ng","nl","nn","no","nr","nv","ny","oc","oj","om","or","os","pa","pi","pl","ps","pt","qu","rm","rn","ro","ru","rw","sa","sc","sd","se","sg","si","sk","sl","sm","sn","so","sq","sr","ss","st","su","sv","sw","ta","te","tg","th","ti","tk","tl","tn","to","tr","ts","tt","tw","ty","ug","uk","ur","uz","ve","vi","vo","wa","wo","xh","yi","yo","za","zh","zu"]);e.exports=t.default,e.exports.default=t.default},48096:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SourceMapSourcesMode=void 0;const n=r(65063);t.SourceMapSourcesMode=n.Utils.makeEnum({Sources:"sources",SourcesContent:"sources-content"})},48211:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CryptUtilsStringArray=void 0;const o=r(71519),s=r(32287),c=r(10094),u=r(49081);let l=class extends u.CryptUtils{constructor(e){super(e),this.base64Alphabet=c.base64alphabetSwapped}btoa(e){return super.btoa(e).replace(/=+$/,"")}};t.CryptUtilsStringArray=l,t.CryptUtilsStringArray=l=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),i("design:paramtypes",[Object])],l)},48284:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.renameIdentifiersTransformersModule=void 0;const n=r(71519),i=r(32287),a=r(96390),o=r(30221),s=r(65284),c=r(19158),u=r(13662),l=r(74819),d=r(49808);t.renameIdentifiersTransformersModule=new n.ContainerModule(e=>{e(i.ServiceIdentifiers.INodeTransformer).to(o.DeadCodeInjectionIdentifiersTransformer).whenTargetNamed(a.NodeTransformer.DeadCodeInjectionIdentifiersTransformer),e(i.ServiceIdentifiers.INodeTransformer).to(c.LabeledStatementTransformer).whenTargetNamed(a.NodeTransformer.LabeledStatementTransformer),e(i.ServiceIdentifiers.INodeTransformer).to(u.ScopeIdentifiersTransformer).whenTargetNamed(a.NodeTransformer.ScopeIdentifiersTransformer),e(i.ServiceIdentifiers.INodeTransformer).to(l.ScopeThroughIdentifiersTransformer).whenTargetNamed(a.NodeTransformer.ScopeThroughIdentifiersTransformer),e(i.ServiceIdentifiers.IIdentifierReplacer).to(s.IdentifierReplacer).inSingletonScope(),e(i.ServiceIdentifiers.IThroughIdentifierReplacer).to(d.ThroughIdentifierReplacer).inSingletonScope()})},48427:function(e,t,r){"use strict";var n,i,a=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},c=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),i=0;i{if(y.NodeGuards.isLiteralNode(e)&&v.NodeLiteralUtils.isStringLiteralNode(e))return t=!0,p.VisitorOption.Break}}),t}getVisitor(e){return this.options.stringArrayRotate&&e===m.NodeTransformationStage.StringArray?{enter:e=>y.NodeGuards.isProgramNode(e)?i.isProgramNodeHasStringLiterals(e)?this.transformNode(e):p.VisitorOption.Break:e}:null}transformNode(e){const t=this.getStringArrayRotateFunctionNode(),r=S.NodeFactory.programNode([t]);A.NodeUtils.parentizeAst(r);const n=[m.NodeTransformationStage.Preparing,m.NodeTransformationStage.Converting,m.NodeTransformationStage.RenameIdentifiers,m.NodeTransformationStage.Finalizing];for(const e of n)this.transformersRunner.transform(r,i.stringArrayRotateFunctionTransformers,e);return p.traverse(r,{enter:e=>{y.NodeGuards.isLiteralNode(e)&&v.NodeLiteralUtils.isStringLiteralNode(e)&&(this.isComparisonExpressionStringLiteralNode(e)?this.stringArrayStorageAnalyzer.addItemDataForLiteralNode(e):_.NodeMetadata.set(e,{ignoredNode:!0}))}}),b.NodeAppender.prepend(e,[t]),e}getStringArrayRotateFunctionNode(){const e=this.getComparisonValue(),t=this.numberNumericalExpressionAnalyzer.analyze(e,i.comparisonExpressionAdditionalPartsCount);let r=1;const n=E.NumericalExpressionDataToNodeConverter.convertIntegerNumberData(t,(e,t)=>{const n=e*r,i=S.NodeFactory.literalNode(`${n}${this.randomGenerator.getRandomString(6)}`),a=S.NodeFactory.callExpressionNode(S.NodeFactory.identifierNode("parseInt"),[i]),o=S.NodeFactory.binaryExpressionNode("/",t?a:S.NodeFactory.unaryExpressionNode("-",a),S.NodeFactory.literalNode(r,r.toString()));return r++,o}),a=this.customCodeHelperFactory(h.CustomCodeHelper.StringArrayRotateFunction);return a.initialize(this.stringArrayStorage.getStorageName(),e,n),a.getNode()[0]}isComparisonExpressionStringLiteralNode(e){return/\d/.test(e.value)}getComparisonValue(){return this.randomGenerator.getRandomInteger(1e5,1e6)}};t.StringArrayRotateFunctionTransformer=x,x.stringArrayRotateFunctionTransformers=[C.NodeTransformer.BooleanLiteralTransformer,C.NodeTransformer.MemberExpressionTransformer,C.NodeTransformer.NumberLiteralTransformer,C.NodeTransformer.NumberToNumericalExpressionTransformer,C.NodeTransformer.ParentificationTransformer,C.NodeTransformer.ScopeIdentifiersTransformer],x.comparisonExpressionAdditionalPartsCount=7,t.StringArrayRotateFunctionTransformer=x=i=s([(0,d.injectable)(),l(0,(0,d.inject)(f.ServiceIdentifiers.IRandomGenerator)),l(1,(0,d.inject)(f.ServiceIdentifiers.IOptions)),l(2,(0,d.inject)(f.ServiceIdentifiers.INodeTransformersRunner)),l(3,(0,d.inject)(f.ServiceIdentifiers.IStringArrayStorage)),l(4,(0,d.inject)(f.ServiceIdentifiers.IStringArrayStorageAnalyzer)),l(5,(0,d.inject)(f.ServiceIdentifiers.Factory__ICustomCodeHelper)),l(6,(0,d.inject)(f.ServiceIdentifiers.INumberNumericalExpressionAnalyzer)),u("design:paramtypes",[Object,Object,Object,Object,Object,Function,Object])],x)},48498:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ConsoleOutputCodeHelperGroup=void 0;const o=r(71519),s=r(32287),c=r(10548),u=r(79011),l=r(18436),d=r(87415),f=r(30386),p=r(32504);let h=class extends d.AbstractCustomCodeHelperGroup{constructor(e,t,r,n){super(t,r,n),this.customCodeHelperFactory=e}appendOnPreparingStage(e,t){var r;if(!this.options.disableConsoleOutput)return;const n=this.getRandomCallsGraphIndex(t.length),i=t.length?f.NodeAppender.getOptimalBlockScope(t,n):e,a=t.length?f.NodeAppender.getOptimalBlockScope(t,n,1):e,o=null!==(r=p.NodeLexicalScopeUtils.getLexicalScope(i))&&void 0!==r?r:null,s=o?this.identifierNamesGenerator.generate(o):this.identifierNamesGenerator.generateNext(),c=o?this.identifierNamesGenerator.generate(o):this.identifierNamesGenerator.generateNext();this.appendCustomNodeIfExist(u.CustomCodeHelper.ConsoleOutputDisable,e=>{e.initialize(c,s),f.NodeAppender.prepend(i,e.getNode())}),this.appendCustomNodeIfExist(u.CustomCodeHelper.CallsControllerFunction,e=>{e.initialize(l.NodeTransformationStage.Preparing,c),f.NodeAppender.prepend(a,e.getNode())})}initialize(){if(this.customCodeHelpers=new Map,!this.options.disableConsoleOutput)return;const e=this.customCodeHelperFactory(u.CustomCodeHelper.ConsoleOutputDisable),t=this.customCodeHelperFactory(u.CustomCodeHelper.CallsControllerFunction);this.customCodeHelpers.set(u.CustomCodeHelper.ConsoleOutputDisable,e),this.customCodeHelpers.set(u.CustomCodeHelper.CallsControllerFunction,t)}};t.ConsoleOutputCodeHelperGroup=h,n([(0,c.initializable)(),i("design:type",Map)],h.prototype,"customCodeHelpers",void 0),t.ConsoleOutputCodeHelperGroup=h=n([(0,o.injectable)(),a(0,(0,o.inject)(s.ServiceIdentifiers.Factory__ICustomCodeHelper)),a(1,(0,o.inject)(s.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),a(2,(0,o.inject)(s.ServiceIdentifiers.IRandomGenerator)),a(3,(0,o.inject)(s.ServiceIdentifiers.IOptions)),i("design:paramtypes",[Function,Function,Object,Object])],h)},48630:function(e,t){!function(e){"use strict";var t=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],r=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],n="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",i="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ꟑꟑꟓꟕ-ꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",a={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},o="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",s={5:o,"5module":o+" export import",6:o+" const class extends export import super"},c=/^in(stanceof)?$/,u=new RegExp("["+i+"]"),l=new RegExp("["+i+n+"]");function d(e,t){for(var r=65536,n=0;ne)return!1;if((r+=t[n+1])>=e)return!0}return!1}function f(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&u.test(String.fromCharCode(e)):!1!==t&&d(e,r)))}function p(e,n){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&l.test(String.fromCharCode(e)):!1!==n&&(d(e,r)||d(e,t)))))}var h=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function m(e,t){return new h(e,{beforeExpr:!0,binop:t})}var g={beforeExpr:!0},b={startsExpr:!0},y={};function S(e,t){return void 0===t&&(t={}),t.keyword=e,y[e]=new h(e,t)}var v={num:new h("num",b),regexp:new h("regexp",b),string:new h("string",b),name:new h("name",b),privateId:new h("privateId",b),eof:new h("eof"),bracketL:new h("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new h("]"),braceL:new h("{",{beforeExpr:!0,startsExpr:!0}),braceR:new h("}"),parenL:new h("(",{beforeExpr:!0,startsExpr:!0}),parenR:new h(")"),comma:new h(",",g),semi:new h(";",g),colon:new h(":",g),dot:new h("."),question:new h("?",g),questionDot:new h("?."),arrow:new h("=>",g),template:new h("template"),invalidTemplate:new h("invalidTemplate"),ellipsis:new h("...",g),backQuote:new h("`",b),dollarBraceL:new h("${",{beforeExpr:!0,startsExpr:!0}),eq:new h("=",{beforeExpr:!0,isAssign:!0}),assign:new h("_=",{beforeExpr:!0,isAssign:!0}),incDec:new h("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new h("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:m("||",1),logicalAND:m("&&",2),bitwiseOR:m("|",3),bitwiseXOR:m("^",4),bitwiseAND:m("&",5),equality:m("==/!=/===/!==",6),relational:m(">/<=/>=",7),bitShift:m("<>>/>>>",8),plusMin:new h("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:m("%",10),star:m("*",10),slash:m("/",10),starstar:new h("**",{beforeExpr:!0}),coalesce:m("??",1),_break:S("break"),_case:S("case",g),_catch:S("catch"),_continue:S("continue"),_debugger:S("debugger"),_default:S("default",g),_do:S("do",{isLoop:!0,beforeExpr:!0}),_else:S("else",g),_finally:S("finally"),_for:S("for",{isLoop:!0}),_function:S("function",b),_if:S("if"),_return:S("return",g),_switch:S("switch"),_throw:S("throw",g),_try:S("try"),_var:S("var"),_const:S("const"),_while:S("while",{isLoop:!0}),_with:S("with"),_new:S("new",{beforeExpr:!0,startsExpr:!0}),_this:S("this",b),_super:S("super",b),_class:S("class",b),_extends:S("extends",g),_export:S("export"),_import:S("import",b),_null:S("null",b),_true:S("true",b),_false:S("false",b),_in:S("in",{beforeExpr:!0,binop:7}),_instanceof:S("instanceof",{beforeExpr:!0,binop:7}),_typeof:S("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:S("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:S("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},_=/\r\n?|\n|\u2028|\u2029/,C=new RegExp(_.source,"g");function A(e){return 10===e||13===e||8232===e||8233===e}function E(e,t,r){void 0===r&&(r=e.length);for(var n=t;n>10),56320+(1023&e)))}var w=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,B=function(e,t){this.line=e,this.column=t};B.prototype.offset=function(e){return new B(this.line,this.column+e)};var k=function(e,t,r){this.start=t,this.end=r,null!==e.sourceFile&&(this.source=e.sourceFile)};function L(e,t){for(var r=1,n=0;;){var i=E(e,n,t);if(i<0)return new B(r,t-n);++r,n=i}}var $={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},j=!1;function G(e){var t={};for(var r in $)t[r]=e&&O(e,r)?e[r]:$[r];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!j&&"object"==typeof console&&console.warn&&(j=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),null==t.allowReserved&&(t.allowReserved=t.ecmaVersion<5),e&&null!=e.allowHashBang||(t.allowHashBang=t.ecmaVersion>=14),M(t.onToken)){var n=t.onToken;t.onToken=function(e){return n.push(e)}}return M(t.onComment)&&(t.onComment=V(t,t.onComment)),t}function V(e,t){return function(r,n,i,a,o,s){var c={type:r?"Block":"Line",value:n,start:i,end:a};e.locations&&(c.loc=new k(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}var U=1,H=2,K=4,W=8,z=16,X=32,Y=64,Z=128,q=256,J=512,Q=U|H|q;function ee(e,t){return H|(e?K:0)|(t?W:0)}var te=0,re=1,ne=2,ie=3,ae=4,oe=5,se=function(e,t,r){this.options=e=G(e),this.sourceFile=e.sourceFile,this.keywords=F(s[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var n="";!0!==e.allowReserved&&(n=a[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(n+=" await")),this.reservedWords=F(n);var i=(n?n+" ":"")+a.strict;this.reservedWordsStrict=F(i),this.reservedWordsStrictBind=F(i+" "+a.strictBind),this.input=String(t),this.containsEsc=!1,r?(this.pos=r,this.lineStart=this.input.lastIndexOf("\n",r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(_).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=v.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(U),this.regexpState=null,this.privateNameStack=[]},ce={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};se.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},ce.inFunction.get=function(){return(this.currentVarScope().flags&H)>0},ce.inGenerator.get=function(){return(this.currentVarScope().flags&W)>0},ce.inAsync.get=function(){return(this.currentVarScope().flags&K)>0},ce.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(q|J))return!1;if(t&H)return(t&K)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},ce.allowSuper.get=function(){return(this.currentThisScope().flags&Y)>0||this.options.allowSuperOutsideMethod},ce.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Z)>0},ce.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},ce.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(q|J)||t&H&&!(t&z))return!0}return!1},ce.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&q)>0},se.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var r=this,n=0;n=,?^&]/.test(i)||"!"===i&&"="===this.input.charAt(n+1))}e+=t[0].length,N.lastIndex=e,e+=N.exec(this.input)[0].length,";"===this.input[e]&&e++}},ue.eat=function(e){return this.type===e&&(this.next(),!0)},ue.isContextual=function(e){return this.type===v.name&&this.value===e&&!this.containsEsc},ue.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},ue.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},ue.canInsertSemicolon=function(){return this.type===v.eof||this.type===v.braceR||_.test(this.input.slice(this.lastTokEnd,this.start))},ue.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},ue.semicolon=function(){this.eat(v.semi)||this.insertSemicolon()||this.unexpected()},ue.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},ue.expect=function(e){this.eat(e)||this.unexpected()},ue.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")};var de=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};ue.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var r=t?e.parenthesizedAssign:e.parenthesizedBind;r>-1&&this.raiseRecoverable(r,t?"Assigning to rvalue":"Parenthesized pattern")}},ue.checkExpressionErrors=function(e,t){if(!e)return!1;var r=e.shorthandAssign,n=e.doubleProto;if(!t)return r>=0||n>=0;r>=0&&this.raise(r,"Shorthand property assignments are valid only in destructuring patterns"),n>=0&&this.raiseRecoverable(n,"Redefinition of __proto__ property")},ue.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos55295&&n<56320)return!0;if(f(n,!0)){for(var i=r+1;p(n=this.input.charCodeAt(i),!0);)++i;if(92===n||n>55295&&n<56320)return!0;var a=this.input.slice(r,i);if(!c.test(a))return!0}return!1},fe.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;N.lastIndex=this.pos;var e,t=N.exec(this.input),r=this.pos+t[0].length;return!(_.test(this.input.slice(this.pos,r))||"function"!==this.input.slice(r,r+8)||r+8!==this.input.length&&(p(e=this.input.charCodeAt(r+8))||e>55295&&e<56320))},fe.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return!1;N.lastIndex=this.pos;var r=N.exec(this.input),n=this.pos+r[0].length;if(_.test(this.input.slice(this.pos,n)))return!1;if(e){var i,a=n+5;if("using"!==this.input.slice(n,a)||a===this.input.length||p(i=this.input.charCodeAt(a))||i>55295&&i<56320)return!1;N.lastIndex=a;var o=N.exec(this.input);if(o&&_.test(this.input.slice(a,a+o[0].length)))return!1}if(t){var s,c=n+2;if(!("of"!==this.input.slice(n,c)||c!==this.input.length&&(p(s=this.input.charCodeAt(c))||s>55295&&s<56320)))return!1}var u=this.input.charCodeAt(n);return f(u,!0)||92===u},fe.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},fe.isUsing=function(e){return this.isUsingKeyword(!1,e)},fe.parseStatement=function(e,t,r){var n,i=this.type,a=this.startNode();switch(this.isLet(e)&&(i=v._var,n="let"),i){case v._break:case v._continue:return this.parseBreakContinueStatement(a,i.keyword);case v._debugger:return this.parseDebuggerStatement(a);case v._do:return this.parseDoStatement(a);case v._for:return this.parseForStatement(a);case v._function:return e&&(this.strict||"if"!==e&&"label"!==e)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(a,!1,!e);case v._class:return e&&this.unexpected(),this.parseClass(a,!0);case v._if:return this.parseIfStatement(a);case v._return:return this.parseReturnStatement(a);case v._switch:return this.parseSwitchStatement(a);case v._throw:return this.parseThrowStatement(a);case v._try:return this.parseTryStatement(a);case v._const:case v._var:return n=n||this.value,e&&"var"!==n&&this.unexpected(),this.parseVarStatement(a,n);case v._while:return this.parseWhileStatement(a);case v._with:return this.parseWithStatement(a);case v.braceL:return this.parseBlock(!0,a);case v.semi:return this.parseEmptyStatement(a);case v._export:case v._import:if(this.options.ecmaVersion>10&&i===v._import){N.lastIndex=this.pos;var o=N.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(40===c||46===c)return this.parseExpressionStatement(a,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===v._import?this.parseImport(a):this.parseExport(a,r);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(a,!0,!e);var u=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(u)return t&&"script"===this.options.sourceType&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),"await using"===u&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(a,!1,u),this.semicolon(),this.finishNode(a,"VariableDeclaration");var l=this.value,d=this.parseExpression();return i===v.name&&"Identifier"===d.type&&this.eat(v.colon)?this.parseLabeledStatement(a,l,d,e):this.parseExpressionStatement(a,d)}},fe.parseBreakContinueStatement=function(e,t){var r="break"===t;this.next(),this.eat(v.semi)||this.insertSemicolon()?e.label=null:this.type!==v.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var n=0;n=6?this.eat(v.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},fe.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(pe),this.enterScope(0),this.expect(v.parenL),this.type===v.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var r=this.isLet();if(this.type===v._var||this.type===v._const||r){var n=this.startNode(),i=r?"let":this.value;return this.next(),this.parseVar(n,!0,i),this.finishNode(n,"VariableDeclaration"),this.parseForAfterInit(e,n,t)}var a=this.isContextual("let"),o=!1,s=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(s){var c=this.startNode();return this.next(),"await using"===s&&this.next(),this.parseVar(c,!0,s),this.finishNode(c,"VariableDeclaration"),this.parseForAfterInit(e,c,t)}var u=this.containsEsc,l=new de,d=this.start,f=t>-1?this.parseExprSubscripts(l,"await"):this.parseExpression(!0,l);return this.type===v._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===v._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(f.start!==d||u||"Identifier"!==f.type||"async"!==f.name?this.options.ecmaVersion>=9&&(e.await=!1):this.unexpected()),a&&o&&this.raise(f.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(f,!1,l),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(l,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))},fe.parseForAfterInit=function(e,t,r){return(this.type===v._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===t.declarations.length?(this.options.ecmaVersion>=9&&(this.type===v._in?r>-1&&this.unexpected(r):e.await=r>-1),this.parseForIn(e,t)):(r>-1&&this.unexpected(r),this.parseFor(e,t))},fe.parseFunctionStatement=function(e,t,r){return this.next(),this.parseFunction(e,ge|(r?0:be),!1,t)},fe.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(v._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},fe.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(v.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},fe.parseSwitchStatement=function(e){var t;this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(v.braceL),this.labels.push(he),this.enterScope(0);for(var r=!1;this.type!==v.braceR;)if(this.type===v._case||this.type===v._default){var n=this.type===v._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),n?t.test=this.parseExpression():(r&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),r=!0,t.test=null),this.expect(v.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},fe.parseThrowStatement=function(e){return this.next(),_.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var me=[];fe.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t="Identifier"===e.type;return this.enterScope(t?X:0),this.checkLValPattern(e,t?ae:ne),this.expect(v.parenR),e},fe.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===v._catch){var t=this.startNode();this.next(),this.eat(v.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(v._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},fe.parseVarStatement=function(e,t,r){return this.next(),this.parseVar(e,!1,t,r),this.semicolon(),this.finishNode(e,"VariableDeclaration")},fe.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(pe),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},fe.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")},fe.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},fe.parseLabeledStatement=function(e,t,r,n){for(var i=0,a=this.labels;i=0;s--){var c=this.labels[s];if(c.statementStart!==e.start)break;c.statementStart=this.start,c.kind=o}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(n?-1===n.indexOf("label")?n+"label":n:"label"),this.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")},fe.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},fe.parseBlock=function(e,t,r){for(void 0===e&&(e=!0),void 0===t&&(t=this.startNode()),t.body=[],this.expect(v.braceL),e&&this.enterScope(0);this.type!==v.braceR;){var n=this.parseStatement(null);t.body.push(n)}return r&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},fe.parseFor=function(e,t){return e.init=t,this.expect(v.semi),e.test=this.type===v.semi?null:this.parseExpression(),this.expect(v.semi),e.update=this.type===v.parenR?null:this.parseExpression(),this.expect(v.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},fe.parseForIn=function(e,t){var r=this.type===v._in;return this.next(),"VariableDeclaration"===t.type&&null!=t.declarations[0].init&&(!r||this.options.ecmaVersion<8||this.strict||"var"!==t.kind||"Identifier"!==t.declarations[0].id.type)&&this.raise(t.start,(r?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=r?this.parseExpression():this.parseMaybeAssign(),this.expect(v.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,r?"ForInStatement":"ForOfStatement")},fe.parseVar=function(e,t,r,n){for(e.declarations=[],e.kind=r;;){var i=this.startNode();if(this.parseVarId(i,r),this.eat(v.eq)?i.init=this.parseMaybeAssign(t):n||"const"!==r||this.type===v._in||this.options.ecmaVersion>=6&&this.isContextual("of")?n||"using"!==r&&"await using"!==r||!(this.options.ecmaVersion>=17)||this.type===v._in||this.isContextual("of")?n||"Identifier"===i.id.type||t&&(this.type===v._in||this.isContextual("of"))?i.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.raise(this.lastTokEnd,"Missing initializer in "+r+" declaration"):this.unexpected(),e.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat(v.comma))break}return e},fe.parseVarId=function(e,t){e.id="using"===t||"await using"===t?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,"var"===t?re:ne,!1)};var ge=1,be=2,ye=4;function Se(e,t){var r=t.key.name,n=e[r],i="true";return"MethodDefinition"!==t.type||"get"!==t.kind&&"set"!==t.kind||(i=(t.static?"s":"i")+t.kind),"iget"===n&&"iset"===i||"iset"===n&&"iget"===i||"sget"===n&&"sset"===i||"sset"===n&&"sget"===i?(e[r]="true",!1):!!n||(e[r]=i,!1)}function ve(e,t){var r=e.computed,n=e.key;return!r&&("Identifier"===n.type&&n.name===t||"Literal"===n.type&&n.value===t)}fe.parseFunction=function(e,t,r,n,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!n)&&(this.type===v.star&&t&be&&this.unexpected(),e.generator=this.eat(v.star)),this.options.ecmaVersion>=8&&(e.async=!!n),t&ge&&(e.id=t&ye&&this.type!==v.name?null:this.parseIdent(),!e.id||t&be||this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?re:ne:ie));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(ee(e.async,e.generator)),t&ge||(e.id=this.type===v.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,r,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&ge?"FunctionDeclaration":"FunctionExpression")},fe.parseFunctionParams=function(e){this.expect(v.parenL),e.params=this.parseBindingList(v.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},fe.parseClass=function(e,t){this.next();var r=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var n=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(v.braceL);this.type!==v.braceR;){var o=this.parseClassElement(null!==e.superClass);o&&(i.body.push(o),"MethodDefinition"===o.type&&"constructor"===o.kind?(a&&this.raiseRecoverable(o.start,"Duplicate constructor in the same class"),a=!0):o.key&&"PrivateIdentifier"===o.key.type&&Se(n,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=r,this.next(),e.body=this.finishNode(i,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},fe.parseClassElement=function(e){if(this.eat(v.semi))return null;var t=this.options.ecmaVersion,r=this.startNode(),n="",i=!1,a=!1,o="method",s=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(v.braceL))return this.parseClassStaticBlock(r),r;this.isClassElementNameStart()||this.type===v.star?s=!0:n="static"}if(r.static=s,!n&&t>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==v.star||this.canInsertSemicolon()?n="async":a=!0),!n&&(t>=9||!a)&&this.eat(v.star)&&(i=!0),!n&&!a&&!i){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?o=c:n=c)}if(n?(r.computed=!1,r.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),r.key.name=n,this.finishNode(r.key,"Identifier")):this.parseClassElementName(r),t<13||this.type===v.parenL||"method"!==o||i||a){var u=!r.static&&ve(r,"constructor"),l=u&&e;u&&"method"!==o&&this.raise(r.key.start,"Constructor can't have get/set modifier"),r.kind=u?"constructor":o,this.parseClassMethod(r,i,a,l)}else this.parseClassField(r);return r},fe.isClassElementNameStart=function(){return this.type===v.name||this.type===v.privateId||this.type===v.num||this.type===v.string||this.type===v.bracketL||this.type.keyword},fe.parseClassElementName=function(e){this.type===v.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},fe.parseClassMethod=function(e,t,r,n){var i=e.key;"constructor"===e.kind?(t&&this.raise(i.start,"Constructor can't be a generator"),r&&this.raise(i.start,"Constructor can't be an async method")):e.static&&ve(e,"prototype")&&this.raise(i.start,"Classes may not have a static property named prototype");var a=e.value=this.parseMethod(t,r,n);return"get"===e.kind&&0!==a.params.length&&this.raiseRecoverable(a.start,"getter should have no params"),"set"===e.kind&&1!==a.params.length&&this.raiseRecoverable(a.start,"setter should have exactly one param"),"set"===e.kind&&"RestElement"===a.params[0].type&&this.raiseRecoverable(a.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},fe.parseClassField=function(e){return ve(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&ve(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(v.eq)?(this.enterScope(J|Y),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")},fe.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(q|Y);this.type!==v.braceR;){var r=this.parseStatement(null);e.body.push(r)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},fe.parseClassId=function(e,t){this.type===v.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,ne,!1)):(!0===t&&this.unexpected(),e.id=null)},fe.parseClassSuper=function(e){e.superClass=this.eat(v._extends)?this.parseExprSubscripts(null,!1):null},fe.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},fe.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,r=e.used;if(this.options.checkPrivateFields)for(var n=this.privateNameStack.length,i=0===n?null:this.privateNameStack[n-1],a=0;a=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==v.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},fe.parseExport=function(e,t){if(this.next(),this.eat(v.star))return this.parseExportAllDeclaration(e,t);if(this.eat(v._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),"VariableDeclaration"===e.declaration.type?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==v.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var r=0,n=e.specifiers;r=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},fe.parseExportDeclaration=function(e){return this.parseStatement(null)},fe.parseExportDefaultDeclaration=function(){var e;if(this.type===v._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,ge|ye,!1,e)}if(this.type===v._class){var r=this.startNode();return this.parseClass(r,"nullableID")}var n=this.parseMaybeAssign();return this.semicolon(),n},fe.checkExport=function(e,t,r){e&&("string"!=typeof t&&(t="Identifier"===t.type?t.name:t.value),O(e,t)&&this.raiseRecoverable(r,"Duplicate export '"+t+"'"),e[t]=!0)},fe.checkPatternExport=function(e,t){var r=t.type;if("Identifier"===r)this.checkExport(e,t,t.start);else if("ObjectPattern"===r)for(var n=0,i=t.properties;n=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},fe.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,ne),this.finishNode(e,"ImportSpecifier")},fe.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,ne),this.finishNode(e,"ImportDefaultSpecifier")},fe.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,ne),this.finishNode(e,"ImportNamespaceSpecifier")},fe.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===v.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(v.comma)))return e;if(this.type===v.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(v.braceL);!this.eat(v.braceR);){if(t)t=!1;else if(this.expect(v.comma),this.afterTrailingComma(v.braceR))break;e.push(this.parseImportSpecifier())}return e},fe.parseWithClause=function(){var e=[];if(!this.eat(v._with))return e;this.expect(v.braceL);for(var t={},r=!0;!this.eat(v.braceR);){if(r)r=!1;else if(this.expect(v.comma),this.afterTrailingComma(v.braceR))break;var n=this.parseImportAttribute(),i="Identifier"===n.key.type?n.key.name:n.key.value;O(t,i)&&this.raiseRecoverable(n.key.start,"Duplicate attribute key '"+i+"'"),t[i]=!0,e.push(n)}return e},fe.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===v.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(v.colon),this.type!==v.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},fe.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===v.string){var e=this.parseLiteral(this.value);return w.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},fe.adaptDirectivePrologue=function(e){for(var t=0;t=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"string"==typeof e.expression.value&&('"'===this.input[e.start]||"'"===this.input[e.start])};var _e=se.prototype;_e.toAssignable=function(e,t,r){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&"await"===e.name&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",r&&this.checkPatternErrors(r,!0);for(var n=0,i=e.properties;n=6)switch(this.type){case v.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(v.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case v.braceL:return this.parseObj(!0)}return this.parseIdent()},_e.parseBindingList=function(e,t,r,n){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(v.comma),t&&this.type===v.comma)i.push(null);else{if(r&&this.afterTrailingComma(e))break;if(this.type===v.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===v.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}i.push(this.parseAssignableListItem(n))}return i},_e.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},_e.parseBindingListItem=function(e){return e},_e.parseMaybeDefault=function(e,t,r){if(r=r||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(v.eq))return r;var n=this.startNodeAt(e,t);return n.left=r,n.right=this.parseMaybeAssign(),this.finishNode(n,"AssignmentPattern")},_e.checkLValSimple=function(e,t,r){void 0===t&&(t=te);var n=t!==te;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(n?"Binding ":"Assigning to ")+e.name+" in strict mode"),n&&(t===ne&&"let"===e.name&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),r&&(O(r,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),r[e.name]=!0),t!==oe&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":n&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return n&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,r);default:this.raise(e.start,(n?"Binding":"Assigning to")+" rvalue")}},_e.checkLValPattern=function(e,t,r){switch(void 0===t&&(t=te),e.type){case"ObjectPattern":for(var n=0,i=e.properties;n=1;e--){var t=this.context[e];if("function"===t.token)return t.generator}return!1},Ee.updateContext=function(e){var t,r=this.type;r.keyword&&e===v.dot?this.exprAllowed=!1:(t=r.updateContext)?t.call(this,e):this.exprAllowed=r.beforeExpr},Ee.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},v.parenR.updateContext=v.braceR.updateContext=function(){if(1!==this.context.length){var e=this.context.pop();e===Ae.b_stat&&"function"===this.curContext().token&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},v.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?Ae.b_stat:Ae.b_expr),this.exprAllowed=!0},v.dollarBraceL.updateContext=function(){this.context.push(Ae.b_tmpl),this.exprAllowed=!0},v.parenL.updateContext=function(e){var t=e===v._if||e===v._for||e===v._with||e===v._while;this.context.push(t?Ae.p_stat:Ae.p_expr),this.exprAllowed=!0},v.incDec.updateContext=function(){},v._function.updateContext=v._class.updateContext=function(e){!e.beforeExpr||e===v._else||e===v.semi&&this.curContext()!==Ae.p_stat||e===v._return&&_.test(this.input.slice(this.lastTokEnd,this.start))||(e===v.colon||e===v.braceL)&&this.curContext()===Ae.b_stat?this.context.push(Ae.f_stat):this.context.push(Ae.f_expr),this.exprAllowed=!1},v.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},v.backQuote.updateContext=function(){this.curContext()===Ae.q_tmpl?this.context.pop():this.context.push(Ae.q_tmpl),this.exprAllowed=!1},v.star.updateContext=function(e){if(e===v._function){var t=this.context.length-1;this.context[t]===Ae.f_expr?this.context[t]=Ae.f_expr_gen:this.context[t]=Ae.f_gen}this.exprAllowed=!0},v.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==v.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var xe=se.prototype;function Ne(e){return"Identifier"===e.type||"ParenthesizedExpression"===e.type&&Ne(e.expression)}function Ie(e){return"MemberExpression"===e.type&&"PrivateIdentifier"===e.property.type||"ChainExpression"===e.type&&Ie(e.expression)||"ParenthesizedExpression"===e.type&&Ie(e.expression)}xe.checkPropClash=function(e,t,r){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===e.type||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var n,i=e.key;switch(i.type){case"Identifier":n=i.name;break;case"Literal":n=String(i.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6)"__proto__"===n&&"init"===a&&(t.proto&&(r?r.doubleProto<0&&(r.doubleProto=i.start):this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),t.proto=!0);else{var o=t[n="$"+n];o?("init"===a?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(i.start,"Redefinition of property"):o=t[n]={init:!1,get:!1,set:!1},o[a]=!0}}},xe.parseExpression=function(e,t){var r=this.start,n=this.startLoc,i=this.parseMaybeAssign(e,t);if(this.type===v.comma){var a=this.startNodeAt(r,n);for(a.expressions=[i];this.eat(v.comma);)a.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(a,"SequenceExpression")}return i},xe.parseMaybeAssign=function(e,t,r){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var n=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new de,n=!0);var s=this.start,c=this.startLoc;this.type!==v.parenL&&this.type!==v.name||(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===e);var u=this.parseMaybeConditional(e,t);if(r&&(u=r.call(this,u,s,c)),this.type.isAssign){var l=this.startNodeAt(s,c);return l.operator=this.value,this.type===v.eq&&(u=this.toAssignable(u,!1,t)),n||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=u.start&&(t.shorthandAssign=-1),this.type===v.eq?this.checkLValPattern(u):this.checkLValSimple(u),l.left=u,this.next(),l.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(l,"AssignmentExpression")}return n&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),u},xe.parseMaybeConditional=function(e,t){var r=this.start,n=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(v.question)){var a=this.startNodeAt(r,n);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(v.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,"ConditionalExpression")}return i},xe.parseExprOps=function(e,t){var r=this.start,n=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===r&&"ArrowFunctionExpression"===i.type?i:this.parseExprOp(i,r,n,-1,e)},xe.parseExprOp=function(e,t,r,n,i){var a=this.type.binop;if(null!=a&&(!i||this.type!==v._in)&&a>n){var o=this.type===v.logicalOR||this.type===v.logicalAND,s=this.type===v.coalesce;s&&(a=v.logicalAND.binop);var c=this.value;this.next();var u=this.start,l=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),u,l,a,i),f=this.buildBinary(t,r,e,d,c,o||s);return(o&&this.type===v.coalesce||s&&(this.type===v.logicalOR||this.type===v.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(f,t,r,n,i)}return e},xe.buildBinary=function(e,t,r,n,i,a){"PrivateIdentifier"===n.type&&this.raise(n.start,"Private identifier can only be left side of binary expression");var o=this.startNodeAt(e,t);return o.left=r,o.operator=i,o.right=n,this.finishNode(o,a?"LogicalExpression":"BinaryExpression")},xe.parseMaybeUnary=function(e,t,r,n){var i,a=this.start,o=this.startLoc;if(this.isContextual("await")&&this.canAwait)i=this.parseAwait(n),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===v.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,n),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&"delete"===s.operator&&Ne(s.argument)?this.raiseRecoverable(s.start,"Deleting local variable in strict mode"):"delete"===s.operator&&Ie(s.argument)?this.raiseRecoverable(s.start,"Private fields can not be deleted"):t=!0,i=this.finishNode(s,c?"UpdateExpression":"UnaryExpression")}else if(t||this.type!==v.privateId){if(i=this.parseExprSubscripts(e,n),this.checkExpressionErrors(e))return i;for(;this.type.postfix&&!this.canInsertSemicolon();){var u=this.startNodeAt(a,o);u.operator=this.value,u.prefix=!1,u.argument=i,this.checkLValSimple(i),this.next(),i=this.finishNode(u,"UpdateExpression")}}else(n||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),i=this.parsePrivateIdent(),this.type!==v._in&&this.unexpected();return r||!this.eat(v.starstar)?i:t?void this.unexpected(this.lastTokStart):this.buildBinary(a,o,i,this.parseMaybeUnary(null,!1,!1,n),"**",!1)},xe.parseExprSubscripts=function(e,t){var r=this.start,n=this.startLoc,i=this.parseExprAtom(e,t);if("ArrowFunctionExpression"===i.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return i;var a=this.parseSubscripts(i,r,n,!1,t);return e&&"MemberExpression"===a.type&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},xe.parseSubscripts=function(e,t,r,n,i){for(var a=this.options.ecmaVersion>=8&&"Identifier"===e.type&&"async"===e.name&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,r,n,a,o,i);if(s.optional&&(o=!0),s===e||"ArrowFunctionExpression"===s.type){if(o){var c=this.startNodeAt(t,r);c.expression=s,s=this.finishNode(c,"ChainExpression")}return s}e=s}},xe.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(v.arrow)},xe.parseSubscriptAsyncArrow=function(e,t,r,n){return this.parseArrowExpression(this.startNodeAt(e,t),r,!0,n)},xe.parseSubscript=function(e,t,r,n,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(v.questionDot);n&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var u=this.eat(v.bracketL);if(u||c&&this.type!==v.parenL&&this.type!==v.backQuote||this.eat(v.dot)){var l=this.startNodeAt(t,r);l.object=e,u?(l.property=this.parseExpression(),this.expect(v.bracketR)):this.type===v.privateId&&"Super"!==e.type?l.property=this.parsePrivateIdent():l.property=this.parseIdent("never"!==this.options.allowReserved),l.computed=!!u,s&&(l.optional=c),e=this.finishNode(l,"MemberExpression")}else if(!n&&this.eat(v.parenL)){var d=new de,f=this.yieldPos,p=this.awaitPos,h=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var m=this.parseExprList(v.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=f,this.awaitPos=p,this.awaitIdentPos=h,this.parseSubscriptAsyncArrow(t,r,m,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=h||this.awaitIdentPos;var g=this.startNodeAt(t,r);g.callee=e,g.arguments=m,s&&(g.optional=c),e=this.finishNode(g,"CallExpression")}else if(this.type===v.backQuote){(c||a)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var b=this.startNodeAt(t,r);b.tag=e,b.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(b,"TaggedTemplateExpression")}return e},xe.parseExprAtom=function(e,t,r){this.type===v.slash&&this.readRegexp();var n,i=this.potentialArrowAt===this.start;switch(this.type){case v._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),n=this.startNode(),this.next(),this.type!==v.parenL||this.allowDirectSuper||this.raise(n.start,"super() call outside constructor of a subclass"),this.type!==v.dot&&this.type!==v.bracketL&&this.type!==v.parenL&&this.unexpected(),this.finishNode(n,"Super");case v._this:return n=this.startNode(),this.next(),this.finishNode(n,"ThisExpression");case v.name:var a=this.start,o=this.startLoc,s=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!s&&"async"===c.name&&!this.canInsertSemicolon()&&this.eat(v._function))return this.overrideContext(Ae.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(v.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&"async"===c.name&&this.type===v.name&&!s&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return c=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat(v.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case v.regexp:var u=this.value;return(n=this.parseLiteral(u.value)).regex={pattern:u.pattern,flags:u.flags},n;case v.num:case v.string:return this.parseLiteral(this.value);case v._null:case v._true:case v._false:return(n=this.startNode()).value=this.type===v._null?null:this.type===v._true,n.raw=this.type.keyword,this.next(),this.finishNode(n,"Literal");case v.parenL:var l=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=l),e.parenthesizedBind<0&&(e.parenthesizedBind=l)),d;case v.bracketL:return n=this.startNode(),this.next(),n.elements=this.parseExprList(v.bracketR,!0,!0,e),this.finishNode(n,"ArrayExpression");case v.braceL:return this.overrideContext(Ae.b_expr),this.parseObj(!1,e);case v._function:return n=this.startNode(),this.next(),this.parseFunction(n,0);case v._class:return this.parseClass(this.startNode(),!1);case v._new:return this.parseNew();case v.backQuote:return this.parseTemplate();case v._import:return this.options.ecmaVersion>=11?this.parseExprImport(r):this.unexpected();default:return this.parseExprAtomDefault()}},xe.parseExprAtomDefault=function(){this.unexpected()},xe.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===v.parenL&&!e)return this.parseDynamicImport(t);if(this.type===v.dot){var r=this.startNodeAt(t.start,t.loc&&t.loc.start);return r.name="import",t.meta=this.finishNode(r,"Identifier"),this.parseImportMeta(t)}this.unexpected()},xe.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(v.parenR)?e.options=null:(this.expect(v.comma),this.afterTrailingComma(v.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(v.parenR)||(this.expect(v.comma),this.afterTrailingComma(v.parenR)||this.unexpected())));else if(!this.eat(v.parenR)){var t=this.start;this.eat(v.comma)&&this.eat(v.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},xe.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),"meta"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),"module"===this.options.sourceType||this.options.allowImportExportEverywhere||this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")},xe.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),110===t.raw.charCodeAt(t.raw.length-1)&&(t.bigint=null!=t.value?t.value.toString():t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")},xe.parseParenExpression=function(){this.expect(v.parenL);var e=this.parseExpression();return this.expect(v.parenR),e},xe.shouldParseArrow=function(e){return!this.canInsertSemicolon()},xe.parseParenAndDistinguishExpression=function(e,t){var r,n=this.start,i=this.startLoc,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o,s=this.start,c=this.startLoc,u=[],l=!0,d=!1,f=new de,p=this.yieldPos,h=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==v.parenR;){if(l?l=!1:this.expect(v.comma),a&&this.afterTrailingComma(v.parenR,!0)){d=!0;break}if(this.type===v.ellipsis){o=this.start,u.push(this.parseParenItem(this.parseRestBinding())),this.type===v.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}u.push(this.parseMaybeAssign(!1,f,this.parseParenItem))}var m=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(v.parenR),e&&this.shouldParseArrow(u)&&this.eat(v.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=p,this.awaitPos=h,this.parseParenArrowList(n,i,u,t);u.length&&!d||this.unexpected(this.lastTokStart),o&&this.unexpected(o),this.checkExpressionErrors(f,!0),this.yieldPos=p||this.yieldPos,this.awaitPos=h||this.awaitPos,u.length>1?((r=this.startNodeAt(s,c)).expressions=u,this.finishNodeAt(r,"SequenceExpression",m,g)):r=u[0]}else r=this.parseParenExpression();if(this.options.preserveParens){var b=this.startNodeAt(n,i);return b.expression=r,this.finishNode(b,"ParenthesizedExpression")}return r},xe.parseParenItem=function(e){return e},xe.parseParenArrowList=function(e,t,r,n){return this.parseArrowExpression(this.startNodeAt(e,t),r,!1,n)};var Te=[];xe.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===v.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var r=this.containsEsc;return e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),r&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var n=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),n,i,!0,!1),this.eat(v.parenL)?e.arguments=this.parseExprList(v.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Te,this.finishNode(e,"NewExpression")},xe.parseTemplateElement=function(e){var t=e.isTagged,r=this.startNode();return this.type===v.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),r.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):r.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),r.tail=this.type===v.backQuote,this.finishNode(r,"TemplateElement")},xe.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var r=this.startNode();this.next(),r.expressions=[];var n=this.parseTemplateElement({isTagged:t});for(r.quasis=[n];!n.tail;)this.type===v.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(v.dollarBraceL),r.expressions.push(this.parseExpression()),this.expect(v.braceR),r.quasis.push(n=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(r,"TemplateLiteral")},xe.isAsyncProp=function(e){return!e.computed&&"Identifier"===e.key.type&&"async"===e.key.name&&(this.type===v.name||this.type===v.num||this.type===v.string||this.type===v.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===v.star)&&!_.test(this.input.slice(this.lastTokEnd,this.start))},xe.parseObj=function(e,t){var r=this.startNode(),n=!0,i={};for(r.properties=[],this.next();!this.eat(v.braceR);){if(n)n=!1;else if(this.expect(v.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(v.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),r.properties.push(a)}return this.finishNode(r,e?"ObjectPattern":"ObjectExpression")},xe.parseProperty=function(e,t){var r,n,i,a,o=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(v.ellipsis))return e?(o.argument=this.parseIdent(!1),this.type===v.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(o,"RestElement")):(o.argument=this.parseMaybeAssign(!1,t),this.type===v.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(o,"SpreadElement"));this.options.ecmaVersion>=6&&(o.method=!1,o.shorthand=!1,(e||t)&&(i=this.start,a=this.startLoc),e||(r=this.eat(v.star)));var s=this.containsEsc;return this.parsePropertyName(o),!e&&!s&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(o)?(n=!0,r=this.options.ecmaVersion>=9&&this.eat(v.star),this.parsePropertyName(o)):n=!1,this.parsePropertyValue(o,e,r,n,i,a,t,s),this.finishNode(o,"Property")},xe.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var r="get"===e.kind?0:1;if(e.value.params.length!==r){var n=e.value.start;"get"===e.kind?this.raiseRecoverable(n,"getter should have no params"):this.raiseRecoverable(n,"setter should have exactly one param")}else"set"===e.kind&&"RestElement"===e.value.params[0].type&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")},xe.parsePropertyValue=function(e,t,r,n,i,a,o,s){(r||n)&&this.type===v.colon&&this.unexpected(),this.eat(v.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind="init"):this.options.ecmaVersion>=6&&this.type===v.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(r,n),e.kind="init"):t||s||!(this.options.ecmaVersion>=5)||e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.type===v.comma||this.type===v.braceR||this.type===v.eq?this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?((r||n)&&this.unexpected(),this.checkUnreserved(e.key),"await"!==e.key.name||this.awaitIdentPos||(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===v.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=!0):this.unexpected():((r||n)&&this.unexpected(),this.parseGetterSetter(e))},xe.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(v.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(v.bracketR),e.key;e.computed=!1}return e.key=this.type===v.num||this.type===v.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},xe.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},xe.parseMethod=function(e,t,r){var n=this.startNode(),i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=e),this.options.ecmaVersion>=8&&(n.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(ee(t,n.generator)|Y|(r?Z:0)),this.expect(v.parenL),n.params=this.parseBindingList(v.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(n,"FunctionExpression")},xe.parseArrowExpression=function(e,t,r,n){var i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(ee(r,!1)|z),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!r),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,n),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,"ArrowFunctionExpression")},xe.parseFunctionBody=function(e,t,r,n){var i=t&&this.type!==v.braceL,a=this.strict,o=!1;if(i)e.body=this.parseMaybeAssign(n),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);a&&!s||(o=this.strictDirective(this.end))&&s&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list");var c=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!r&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,oe),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},xe.isSimpleParamList=function(e){for(var t=0,r=e;t-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&U&&delete this.undefinedExports[e]}else if(t===ae)this.currentScope().lexical.push(e);else if(t===ie){var a=this.currentScope();n=this.treatFunctionsAsVar?a.lexical.indexOf(e)>-1:a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var s=this.scopeStack[o];if(s.lexical.indexOf(e)>-1&&!(s.flags&X&&s.lexical[0]===e)||!this.treatFunctionsAsVarInScope(s)&&s.functions.indexOf(e)>-1){n=!0;break}if(s.var.push(e),this.inModule&&s.flags&U&&delete this.undefinedExports[e],s.flags&Q)break}n&&this.raiseRecoverable(r,"Identifier '"+e+"' has already been declared")},Oe.checkLocalExport=function(e){-1===this.scopeStack[0].lexical.indexOf(e.name)&&-1===this.scopeStack[0].var.indexOf(e.name)&&(this.undefinedExports[e.name]=e)},Oe.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Oe.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Q|J|q))return t}},Oe.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Q|J|q)&&!(t.flags&z))return t}};var Re=function(e,t,r){this.type="",this.start=t,this.end=0,e.options.locations&&(this.loc=new k(e,r)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},Fe=se.prototype;function Pe(e,t,r,n){return e.type=t,e.end=r,this.options.locations&&(e.loc.end=n),this.options.ranges&&(e.range[1]=r),e}Fe.startNode=function(){return new Re(this,this.start,this.startLoc)},Fe.startNodeAt=function(e,t){return new Re(this,e,t)},Fe.finishNode=function(e,t){return Pe.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},Fe.finishNodeAt=function(e,t,r,n){return Pe.call(this,e,t,r,n)},Fe.copyNode=function(e){var t=new Re(this,e.start,this.startLoc);for(var r in e)t[r]=e[r];return t};var we="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Be=we+" Extended_Pictographic",ke=Be+" EBase EComp EMod EPres ExtPict",Le={9:we,10:Be,11:Be,12:ke,13:ke,14:ke},$e={9:"",10:"",11:"",12:"",13:"",14:"Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"},je="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Ge="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Ve=Ge+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Ue=Ve+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",He=Ue+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Ke=He+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",We={9:Ge,10:Ve,11:Ue,12:He,13:Ke,14:Ke+" Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz"},ze={};function Xe(e){var t=ze[e]={binary:F(Le[e]+" "+je),binaryOfStrings:F($e[e]),nonBinary:{General_Category:F(je),Script:F(We[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var Ye=0,Ze=[9,10,11,12,13,14];Ye=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=ze[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function et(e){for(var t in e)return!0;return!1}function tt(e){return 105===e||109===e||115===e}function rt(e){return 36===e||e>=40&&e<=43||46===e||63===e||e>=91&&e<=94||e>=123&&e<=125}function nt(e){return f(e,!0)||36===e||95===e}function it(e){return p(e,!0)||36===e||95===e||8204===e||8205===e}function at(e){return e>=65&&e<=90||e>=97&&e<=122}function ot(e){return e>=0&&e<=1114111}Qe.prototype.reset=function(e,t,r){var n=-1!==r.indexOf("v"),i=-1!==r.indexOf("u");this.start=0|e,this.source=t+"",this.flags=r,n&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},Qe.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)},Qe.prototype.at=function(e,t){void 0===t&&(t=!1);var r=this.source,n=r.length;if(e>=n)return-1;var i=r.charCodeAt(e);if(!t&&!this.switchU||i<=55295||i>=57344||e+1>=n)return i;var a=r.charCodeAt(e+1);return a>=56320&&a<=57343?(i<<10)+a-56613888:i},Qe.prototype.nextIndex=function(e,t){void 0===t&&(t=!1);var r=this.source,n=r.length;if(e>=n)return n;var i,a=r.charCodeAt(e);return!t&&!this.switchU||a<=55295||a>=57344||e+1>=n||(i=r.charCodeAt(e+1))<56320||i>57343?e+1:e+2},Qe.prototype.current=function(e){return void 0===e&&(e=!1),this.at(this.pos,e)},Qe.prototype.lookahead=function(e){return void 0===e&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},Qe.prototype.advance=function(e){void 0===e&&(e=!1),this.pos=this.nextIndex(this.pos,e)},Qe.prototype.eat=function(e,t){return void 0===t&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},Qe.prototype.eatChars=function(e,t){void 0===t&&(t=!1);for(var r=this.pos,n=0,i=e;n-1&&this.raise(e.start,"Duplicate regular expression flag"),"u"===o&&(n=!0),"v"===o&&(i=!0)}this.options.ecmaVersion>=15&&n&&i&&this.raise(e.start,"Invalid regular expression flag")},qe.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&et(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},qe.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,r=e.backReferenceNames;t