From ef29ba6e82cff6e568c3f9c6709000917d82cbdf Mon Sep 17 00:00:00 2001 From: Tim Saunders Date: Fri, 9 Jan 2026 10:37:54 +0000 Subject: [PATCH 01/29] First pass of removing auth0-extension-tools --- package-lock.json | 1527 +---------------- package.json | 6 +- server/index.js | 17 +- server/lib/apiaccess.js | 2 +- server/lib/auth0/SessionManager.js | 211 +++ server/lib/auth0/managementApi.js | 175 ++ server/lib/auth0/validateHookToken.js | 18 + server/lib/config.js | 27 +- server/lib/errors/ArgumentError.js | 11 + server/lib/errors/ForbiddenError.js | 11 + server/lib/errors/HookTokenError.js | 12 + server/lib/errors/ManagementApiError.js | 12 + server/lib/errors/NotFoundError.js | 11 + server/lib/errors/UnauthorizedError.js | 11 + server/lib/errors/ValidationError.js | 11 + server/lib/errors/index.js | 27 + server/lib/multipartRequest.js | 14 +- .../storage/contexts/BlobRecordProvider.js | 217 +++ .../storage/contexts/FileStorageContext.js | 92 + .../storage/contexts/WebtaskStorageContext.js | 67 + server/lib/storage/contexts/seriesQueue.js | 26 + server/lib/storage/database.js | 2 +- server/lib/storage/providers.js | 16 +- server/lib/tools/s3-storage-context.js | 2 +- server/lib/tools/server.js | 15 +- server/plugins/handlers.js | 23 +- server/plugins/local-mgmt-client.js | 9 +- server/plugins/session.js | 33 +- tests/unit/mocks/fetch-mock.js | 64 + tests/unit/runner.js | 8 + .../unit/server/groups-members-route.tests.js | 3 +- tests/unit/server/s3-storage-context.tests.js | 2 +- 32 files changed, 1139 insertions(+), 1543 deletions(-) create mode 100644 server/lib/auth0/SessionManager.js create mode 100644 server/lib/auth0/managementApi.js create mode 100644 server/lib/auth0/validateHookToken.js create mode 100644 server/lib/errors/ArgumentError.js create mode 100644 server/lib/errors/ForbiddenError.js create mode 100644 server/lib/errors/HookTokenError.js create mode 100644 server/lib/errors/ManagementApiError.js create mode 100644 server/lib/errors/NotFoundError.js create mode 100644 server/lib/errors/UnauthorizedError.js create mode 100644 server/lib/errors/ValidationError.js create mode 100644 server/lib/errors/index.js create mode 100644 server/lib/storage/contexts/BlobRecordProvider.js create mode 100644 server/lib/storage/contexts/FileStorageContext.js create mode 100644 server/lib/storage/contexts/WebtaskStorageContext.js create mode 100644 server/lib/storage/contexts/seriesQueue.js create mode 100644 tests/unit/mocks/fetch-mock.js diff --git a/package-lock.json b/package-lock.json index 50518eaa..b1f7bff3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,6 @@ "@hapi/inert": "7.1.0", "async": "2.6.4", "auth0": "4.9.0", - "auth0-extension-tools": "1.5.2", "auth0-extension-ui": "1.1.7", "auth0-extension-ui-redux": "git+https://github.com/auth0-extensions/auth0-extension-ui-redux", "axios": "^1.12.2", @@ -33,6 +32,7 @@ "moment": "^2.29.4", "nconf": "^0.12.0", "node-uuid": "^1.4.8", + "promise-retry": "^1.1.1", "superagent": "^10.2.3", "winston": "^3.10.0" }, @@ -985,7 +985,6 @@ "integrity": "sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.26.0", @@ -4394,30 +4393,6 @@ "node": ">=18.0.0" } }, - "node_modules/@tootallnate/once": { - "version": "1.1.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/@tootallnate/once/-/once-1.1.2.tgz", - "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, - "node_modules/@types/babel-types": { - "version": "7.0.16", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/@types/babel-types/-/babel-types-7.0.16.tgz", - "integrity": "sha512-5QXs9GBFTNTmilLlWBhnsprqpjfrotyrnzUdwDrywEL/DA4LuCWQT300BTOXA3Y9ngT9F2uvmCoIxI6z8DlJEA==", - "license": "MIT" - }, - "node_modules/@types/babylon": { - "version": "6.16.9", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/@types/babylon/-/babylon-6.16.9.tgz", - "integrity": "sha512-sEKyxMVEowhcr8WLfN0jJYe4gS4Z9KC2DGz0vqfC7+MXFbmvOF7jSjALC77thvAO2TLgFUPa9vDeOak+AcUrZA==", - "license": "MIT", - "dependencies": { - "@types/babel-types": "*" - } - }, "node_modules/@types/body-parser": { "version": "1.19.5", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/@types/body-parser/-/body-parser-1.19.5.tgz", @@ -4499,16 +4474,6 @@ "@types/serve-static": "*" } }, - "node_modules/@types/express-jwt": { - "version": "0.0.34", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/@types/express-jwt/-/express-jwt-0.0.34.tgz", - "integrity": "sha512-WR7a8Y7JZqod8lsu7imvLScJHafBhtc01BJc0vVuPVepeCHW9E6tWViqu8kdusU4L2oLpWoxXFwC8DPtdDycuQ==", - "license": "MIT", - "dependencies": { - "@types/express": "*", - "@types/express-unless": "*" - } - }, "node_modules/@types/express-serve-static-core": { "version": "4.19.6", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/@types/express-serve-static-core/-/express-serve-static-core-4.19.6.tgz", @@ -4521,15 +4486,6 @@ "@types/send": "*" } }, - "node_modules/@types/express-unless": { - "version": "0.5.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/@types/express-unless/-/express-unless-0.5.3.tgz", - "integrity": "sha512-TyPLQaF6w8UlWdv4gj8i46B+INBVzURBNRahCozCSXfsK2VTlL1wNyTlMKw817VHygBtlcl5jfnPadlydr06Yw==", - "license": "MIT", - "dependencies": { - "@types/express": "*" - } - }, "node_modules/@types/glob": { "version": "7.2.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/@types/glob/-/glob-7.2.0.tgz", @@ -5274,8 +5230,8 @@ "version": "6.12.6", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -5363,6 +5319,7 @@ "version": "0.1.4", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/align-text/-/align-text-0.1.4.tgz", "integrity": "sha512-GrTZLRpmp6wIC2ztrWW9MjjTgSKccffgFagbNDOX95/dcjEcYZibYTeaOntySQLcdw1ztBoFkviiUvTMbb9MYg==", + "dev": true, "license": "MIT", "dependencies": { "kind-of": "^3.0.2", @@ -5377,6 +5334,7 @@ "version": "3.2.2", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==", + "dev": true, "license": "MIT", "dependencies": { "is-buffer": "^1.1.5" @@ -5909,15 +5867,6 @@ "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", "license": "MIT" }, - "node_modules/asn1": { - "version": "0.2.6", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/asn1/-/asn1-0.2.6.tgz", - "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", - "license": "MIT", - "dependencies": { - "safer-buffer": "~2.1.0" - } - }, "node_modules/asn1.js": { "version": "4.10.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/asn1.js/-/asn1.js-4.10.1.tgz", @@ -5948,15 +5897,6 @@ "util": "^0.10.4" } }, - "node_modules/assert-plus": { - "version": "1.0.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", - "license": "MIT", - "engines": { - "node": ">=0.8" - } - }, "node_modules/assert/node_modules/inherits": { "version": "2.0.3", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/inherits/-/inherits-2.0.3.tgz", @@ -6083,356 +6023,6 @@ "node": ">=18" } }, - "node_modules/auth0-extension-tools": { - "version": "1.5.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/auth0-extension-tools/-/auth0-extension-tools-1.5.2.tgz", - "integrity": "sha1-IcREygWV9IiSJ2xpz20cv8RK2M8=", - "license": "MIT", - "dependencies": { - "async": "2.1.2", - "auth0": "^2.23.0", - "bluebird": "^3.4.1", - "jsonwebtoken": "^8.3.0", - "jwks-rsa": "1.2.0", - "lodash": "4.17.20", - "lru-memoizer": "1.11.2", - "ms": "2.0.0", - "node-uuid": "^1.4.7", - "promise-retry": "^1.1.1", - "superagent": "3.8.1", - "webtask-tools": "^3.4.1" - } - }, - "node_modules/auth0-extension-tools/node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "license": "MIT", - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/auth0-extension-tools/node_modules/async": { - "version": "2.1.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/async/-/async-2.1.2.tgz", - "integrity": "sha512-i0Jx7SEZNG5i+F9hrUILpfDkuVJxf+UqmsS6LVn3UdUegQryKplU5t5opYYkDPW0eKBeJUSiiuphgkUZagx5ZQ==", - "license": "MIT", - "dependencies": { - "lodash": "^4.14.0" - } - }, - "node_modules/auth0-extension-tools/node_modules/auth0": { - "version": "2.44.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/auth0/-/auth0-2.44.1.tgz", - "integrity": "sha512-+/lloZ2YGa8Epf2e1TRhyeXNEN1xHd4mw7arhYvD0ZY83ZOZxsHtaVyaOXuSL+rp0uqXHjyNjAbkGeyYxTUe7Q==", - "license": "MIT", - "dependencies": { - "axios": "^0.27.2", - "form-data": "^3.0.1", - "jsonwebtoken": "^8.5.1", - "jwks-rsa": "^1.12.1", - "lru-memoizer": "^2.1.4", - "rest-facade": "^1.16.3", - "retry": "^0.13.1" - }, - "engines": { - "node": ">=8.3.0" - } - }, - "node_modules/auth0-extension-tools/node_modules/auth0/node_modules/@types/express-jwt": { - "version": "0.0.42", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/@types/express-jwt/-/express-jwt-0.0.42.tgz", - "integrity": "sha512-WszgUddvM1t5dPpJ3LhWNH8kfNN8GPIBrAGxgIYXVCEGx6Bx4A036aAuf/r5WH9DIEdlmp7gHOYvSM6U87B0ag==", - "license": "MIT", - "dependencies": { - "@types/express": "*", - "@types/express-unless": "*" - } - }, - "node_modules/auth0-extension-tools/node_modules/auth0/node_modules/jwks-rsa": { - "version": "1.12.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/jwks-rsa/-/jwks-rsa-1.12.3.tgz", - "integrity": "sha512-cFipFDeYYaO9FhhYJcZWX/IyZgc0+g316rcHnDpT2dNRNIE/lMOmWKKqp09TkJoYlNFzrEVODsR4GgXJMgWhnA==", - "license": "MIT", - "dependencies": { - "@types/express-jwt": "0.0.42", - "axios": "^0.21.1", - "debug": "^4.1.0", - "http-proxy-agent": "^4.0.1", - "https-proxy-agent": "^5.0.0", - "jsonwebtoken": "^8.5.1", - "limiter": "^1.1.5", - "lru-memoizer": "^2.1.2", - "ms": "^2.1.2", - "proxy-from-env": "^1.1.0" - } - }, - "node_modules/auth0-extension-tools/node_modules/auth0/node_modules/jwks-rsa/node_modules/axios": { - "version": "0.21.4", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "license": "MIT", - "dependencies": { - "follow-redirects": "^1.14.0" - } - }, - "node_modules/auth0-extension-tools/node_modules/auth0/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/auth0-extension-tools/node_modules/auth0/node_modules/lru-memoizer": { - "version": "2.3.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/lru-memoizer/-/lru-memoizer-2.3.0.tgz", - "integrity": "sha512-GXn7gyHAMhO13WSKrIiNfztwxodVsP8IoZ3XfrJV4yH2x0/OeTO/FIaAHTY5YekdGgW94njfuKmyyt1E0mR6Ug==", - "license": "MIT", - "dependencies": { - "lodash.clonedeep": "^4.5.0", - "lru-cache": "6.0.0" - } - }, - "node_modules/auth0-extension-tools/node_modules/auth0/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/auth0-extension-tools/node_modules/auth0/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "license": "ISC" - }, - "node_modules/auth0-extension-tools/node_modules/axios": { - "version": "0.27.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", - "license": "MIT", - "dependencies": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" - } - }, - "node_modules/auth0-extension-tools/node_modules/axios/node_modules/form-data": { - "version": "4.0.4", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/form-data/-/form-data-4.0.4.tgz", - "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "es-set-tostringtag": "^2.1.0", - "hasown": "^2.0.2", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/auth0-extension-tools/node_modules/formidable": { - "version": "1.2.6", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/formidable/-/formidable-1.2.6.tgz", - "integrity": "sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ==", - "deprecated": "Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau", - "license": "MIT", - "funding": { - "url": "https://ko-fi.com/tunnckoCore/commissions" - } - }, - "node_modules/auth0-extension-tools/node_modules/http-proxy-agent": { - "version": "4.0.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", - "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", - "license": "MIT", - "dependencies": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/auth0-extension-tools/node_modules/https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "license": "MIT", - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/auth0-extension-tools/node_modules/jsonwebtoken": { - "version": "8.5.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", - "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", - "license": "MIT", - "dependencies": { - "jws": "^3.2.2", - "lodash.includes": "^4.3.0", - "lodash.isboolean": "^3.0.3", - "lodash.isinteger": "^4.0.4", - "lodash.isnumber": "^3.0.3", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.once": "^4.0.0", - "ms": "^2.1.1", - "semver": "^5.6.0" - }, - "engines": { - "node": ">=4", - "npm": ">=1.4.28" - } - }, - "node_modules/auth0-extension-tools/node_modules/jsonwebtoken/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/auth0-extension-tools/node_modules/jwks-rsa": { - "version": "1.2.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/jwks-rsa/-/jwks-rsa-1.2.0.tgz", - "integrity": "sha512-nd0L/D9Ejc4lc8LWTyM3UuGVlf+VgCBcCgltfFpsE4E3ua+n4/WBQvnZUu3soP3BNcz1hGI+ROWjcW4vvItpsg==", - "license": "MIT", - "dependencies": { - "@types/express-jwt": "0.0.34", - "debug": "^2.2.0", - "limiter": "^1.1.0", - "lru-memoizer": "^1.6.0", - "ms": "^2.0.0", - "request": "^2.73.0" - } - }, - "node_modules/auth0-extension-tools/node_modules/jwks-rsa/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/auth0-extension-tools/node_modules/lodash": { - "version": "4.17.20", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", - "license": "MIT" - }, - "node_modules/auth0-extension-tools/node_modules/lru-cache": { - "version": "4.0.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/lru-cache/-/lru-cache-4.0.2.tgz", - "integrity": "sha512-uQw9OqphAGiZhkuPlpFGmdTU2tEuhxTourM/19qGJrxBPHAr/f8BT1a0i/lOclESnGatdJG/UCkP9kZB/Lh1iw==", - "license": "ISC", - "dependencies": { - "pseudomap": "^1.0.1", - "yallist": "^2.0.0" - } - }, - "node_modules/auth0-extension-tools/node_modules/lru-memoizer": { - "version": "1.11.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/lru-memoizer/-/lru-memoizer-1.11.2.tgz", - "integrity": "sha512-idcNeXwB6qWSWt7P7ynI64b9gT1Vvp2tfmbnZD41apz3F+QsDdJf8KfV0GfPAjmCvwNmA+IaxcHPnWeD5Xjo+Q==", - "dependencies": { - "lock": "~0.1.2", - "lodash": "^4.17.4", - "lru-cache": "~4.0.0", - "very-fast-args": "^1.1.0" - } - }, - "node_modules/auth0-extension-tools/node_modules/mime": { - "version": "1.6.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "license": "MIT", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/auth0-extension-tools/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/auth0-extension-tools/node_modules/superagent": { - "version": "3.8.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/superagent/-/superagent-3.8.1.tgz", - "integrity": "sha512-VMBFLYgFuRdfeNQSMLbxGSLfmXL/xc+OO+BZp41Za/NRDBet/BNbkRJrYzCUu0u4GU0i/ml2dtT8b9qgkw9z6Q==", - "deprecated": "Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net", - "license": "MIT", - "dependencies": { - "component-emitter": "^1.2.0", - "cookiejar": "^2.1.0", - "debug": "^3.1.0", - "extend": "^3.0.0", - "form-data": "^2.3.1", - "formidable": "^1.1.1", - "methods": "^1.1.1", - "mime": "^1.4.1", - "qs": "^6.5.1", - "readable-stream": "^2.0.5" - }, - "engines": { - "node": ">= 4.0" - } - }, - "node_modules/auth0-extension-tools/node_modules/superagent/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/auth0-extension-tools/node_modules/superagent/node_modules/form-data": { - "version": "2.5.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/form-data/-/form-data-2.5.2.tgz", - "integrity": "sha512-GgwY0PS7DbXqajuGf4OYlsrIu3zgxD6Vvql43IBhm6MahqA5SK/7mwhtNj2AdH2z35YR34ujJ7BN+3fFC3jP5Q==", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12", - "safe-buffer": "^5.2.1" - }, - "engines": { - "node": ">= 0.12" - } - }, - "node_modules/auth0-extension-tools/node_modules/superagent/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/auth0-extension-tools/node_modules/yallist": { - "version": "2.1.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==", - "license": "ISC" - }, "node_modules/auth0-extension-ui": { "version": "1.1.7", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/auth0-extension-ui/-/auth0-extension-ui-1.1.7.tgz", @@ -8587,7 +8177,6 @@ "integrity": "sha512-td7fYwgLSrky3fI1EuU5cneU4+pbH6GgOfuKNS1tNPcfdGinGELAqsb/BP4nnvZyKSG2i/xFGU7+n2PvZA8HJQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@webassemblyjs/ast": "1.9.0", "@webassemblyjs/helper-module-context": "1.9.0", @@ -9460,21 +9049,6 @@ "tslib": "^2.1.0" } }, - "node_modules/aws-sign2": { - "version": "0.7.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, - "node_modules/aws4": { - "version": "1.13.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/aws4/-/aws4-1.13.2.tgz", - "integrity": "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw==", - "license": "MIT" - }, "node_modules/axios": { "version": "1.12.2", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/axios/-/axios-1.12.2.tgz", @@ -10728,7 +10302,6 @@ "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/@babel/runtime-corejs3/-/runtime-corejs3-7.26.0.tgz", "integrity": "sha512-YXHu5lN8kJCb1LOb9PgV6pvak43X2h4HvRApcN5SdWeaItQOzfn1hgP6jasD6KWQyJDBxrVmA9o9OivlnNJK/w==", "license": "MIT", - "peer": true, "dependencies": { "core-js-pure": "^3.30.2", "regenerator-runtime": "^0.14.0" @@ -10793,6 +10366,7 @@ "version": "6.26.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/babel-types/-/babel-types-6.26.0.tgz", "integrity": "sha512-zhe3V/26rCWsEZK8kZN+HaQj5yQ1CilTObixFzKW1UWjqG7618Twz6YEsCnjfg5gBcJh02DrpCkS9h98ZqDY+g==", + "dev": true, "license": "MIT", "dependencies": { "babel-runtime": "^6.26.0", @@ -10805,6 +10379,7 @@ "version": "6.18.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/babylon/-/babylon-6.18.0.tgz", "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true, "license": "MIT", "bin": { "babylon": "bin/babylon.js" @@ -10904,15 +10479,6 @@ "dev": true, "license": "MIT" }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", - "license": "BSD-3-Clause", - "dependencies": { - "tweetnacl": "^0.14.3" - } - }, "node_modules/bfj-node4": { "version": "5.3.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/bfj-node4/-/bfj-node4-5.3.1.tgz", @@ -11029,12 +10595,6 @@ "node": ">=8" } }, - "node_modules/bluebird": { - "version": "3.4.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/bluebird/-/bluebird-3.4.1.tgz", - "integrity": "sha512-m+8bsbdWs6YPVFuONHh0La8No75auC+i7tfhUcuLA+nUCxsXZwxYgwsoCy+IHhI/fuodNh9D70VUwcjcKcGh1A==", - "license": "MIT" - }, "node_modules/bn.js": { "version": "5.2.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/bn.js/-/bn.js-5.2.1.tgz", @@ -11171,16 +10731,6 @@ "dev": true, "license": "ISC" }, - "node_modules/boom": { - "version": "7.3.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/boom/-/boom-7.3.0.tgz", - "integrity": "sha512-Swpoyi2t5+GhOEGw8rEsKvTxFLIDiiKoUc2gsoV6Lyr43LHBIzch3k2MvYUs8RTROrIkVJ3Al0TkaOGjnb+B6A==", - "deprecated": "This module has moved and is now available at @hapi/boom. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.", - "license": "BSD-3-Clause", - "dependencies": { - "hoek": "6.x.x" - } - }, "node_modules/bowser": { "version": "2.11.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/bowser/-/bowser-2.11.0.tgz", @@ -11429,7 +10979,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "caniuse-lite": "^1.0.30001688", "electron-to-chromium": "^1.5.73", @@ -11703,16 +11252,6 @@ "node": ">=0.10.0" } }, - "node_modules/camel-case": { - "version": "1.2.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/camel-case/-/camel-case-1.2.2.tgz", - "integrity": "sha512-rUug78lL8mqStaLehmH2F0LxMJ2TM9fnPFxb+gFkgyUjUM/1o2wKTQtalypHnkb2cFwH/DENBw7YEAOYLgSMxQ==", - "license": "MIT", - "dependencies": { - "sentence-case": "^1.1.1", - "upper-case": "^1.1.1" - } - }, "node_modules/camelcase": { "version": "5.3.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/camelcase/-/camelcase-5.3.1.tgz", @@ -11870,16 +11409,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/caseless": { - "version": "0.12.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", - "license": "Apache-2.0" - }, "node_modules/center-align": { "version": "0.1.3", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/center-align/-/center-align-0.1.3.tgz", "integrity": "sha512-Baz3aNe2gd2LP2qk5U+sDk/m4oSuwSDcBfayTCTBoWpfIGO5XFxPmjILQII4NGiZjD6DoDI6kf7gKaxkf7s3VQ==", + "dev": true, "license": "MIT", "dependencies": { "align-text": "^0.1.3", @@ -11938,39 +11472,6 @@ "node": ">=0.10.0" } }, - "node_modules/change-case": { - "version": "2.3.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/change-case/-/change-case-2.3.1.tgz", - "integrity": "sha512-3HE5jrTqqn9jeKzD0+yWi7FU4OMicLbwB57ph4bpwEn5jGi3hZug5WjZjnBD2RY7YyTKAAck86ACfShXUWJKLg==", - "license": "MIT", - "dependencies": { - "camel-case": "^1.1.1", - "constant-case": "^1.1.0", - "dot-case": "^1.1.0", - "is-lower-case": "^1.1.0", - "is-upper-case": "^1.1.0", - "lower-case": "^1.1.1", - "lower-case-first": "^1.0.0", - "param-case": "^1.1.0", - "pascal-case": "^1.1.0", - "path-case": "^1.1.0", - "sentence-case": "^1.1.1", - "snake-case": "^1.1.0", - "swap-case": "^1.1.0", - "title-case": "^1.1.0", - "upper-case": "^1.1.1", - "upper-case-first": "^1.1.0" - } - }, - "node_modules/character-parser": { - "version": "2.2.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/character-parser/-/character-parser-2.2.0.tgz", - "integrity": "sha512-+UqJQjFEFaTAs3bNsF2j2kEN1baG/zghZbdqoYEDxGZtJo9LBzl1A+m0D4n3qKx8N2FNv8/Xp6yV9mQmBuptaw==", - "license": "MIT", - "dependencies": { - "is-regex": "^1.0.3" - } - }, "node_modules/check-error": { "version": "1.0.3", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/check-error/-/check-error-1.0.3.tgz", @@ -12124,27 +11625,6 @@ "dev": true, "license": "MIT" }, - "node_modules/clean-css": { - "version": "4.2.4", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/clean-css/-/clean-css-4.2.4.tgz", - "integrity": "sha512-EJUDT7nDVFDvaQgAo2G/PJvxmp1o/c6iXLbswsBbUFXi1Nr+AjA2cKmfbKDMjMvzEe75g3P6JkaDDAKk96A85A==", - "license": "MIT", - "dependencies": { - "source-map": "~0.6.0" - }, - "engines": { - "node": ">= 4.0" - } - }, - "node_modules/clean-css/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/clean-stack": { "version": "2.2.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/clean-stack/-/clean-stack-2.2.0.tgz", @@ -12808,28 +12288,6 @@ "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==", "dev": true }, - "node_modules/constant-case": { - "version": "1.1.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/constant-case/-/constant-case-1.1.2.tgz", - "integrity": "sha512-FQ/HuOuSnX6nIF8OnofRWj+KnOpGAHXQpOKHmsL1sAnuLwu6r5mHGK+mJc0SkHkbmNfcU/SauqXLTEOL1JQfJA==", - "license": "MIT", - "dependencies": { - "snake-case": "^1.1.0", - "upper-case": "^1.1.1" - } - }, - "node_modules/constantinople": { - "version": "3.1.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/constantinople/-/constantinople-3.1.2.tgz", - "integrity": "sha512-yePcBqEFhLOqSBtwYOGGS1exHo/s1xjekXiinh4itpNQGCu4KA1euPh1fg07N2wMITZXQkBz75Ntdt1ctGZouw==", - "license": "MIT", - "dependencies": { - "@types/babel-types": "^7.0.0", - "@types/babylon": "^6.16.2", - "babel-types": "^6.26.0", - "babylon": "^6.18.0" - } - }, "node_modules/constants-browserify": { "version": "1.0.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/constants-browserify/-/constants-browserify-1.0.0.tgz", @@ -13007,6 +12465,7 @@ "version": "1.0.3", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/core-util-is/-/core-util-is-1.0.3.tgz", "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true, "license": "MIT" }, "node_modules/cosmiconfig": { @@ -13274,7 +12733,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "nanoid": "^3.3.7", "picocolors": "^1.1.1", @@ -13586,18 +13044,6 @@ "dev": true, "license": "BSD-2-Clause" }, - "node_modules/dashdash": { - "version": "1.14.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0" - }, - "engines": { - "node": ">=0.10" - } - }, "node_modules/data-urls": { "version": "5.0.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/data-urls/-/data-urls-5.0.0.tgz", @@ -13806,15 +13252,6 @@ "dev": true, "license": "MIT" }, - "node_modules/deepmerge": { - "version": "3.3.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/deepmerge/-/deepmerge-3.3.0.tgz", - "integrity": "sha512-GRQOafGHwMHpjPx9iCvTgpu9NojZ49q794EEL94JVEw6VaeA8XTUyBKvAkOOjBX9oJNiV6G3P+T+tihFjo2TqA==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/default-compare": { "version": "1.0.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/default-compare/-/default-compare-1.0.0.tgz", @@ -14209,12 +13646,6 @@ "node": ">=0.10.0" } }, - "node_modules/doctypes": { - "version": "1.1.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/doctypes/-/doctypes-1.1.0.tgz", - "integrity": "sha512-LLBi6pEqS6Do3EKQ3J0NqHWV5hhb78Pi8vvESYwyOy2c31ZEZVdtitdzsQsKb7878PEERhzUk0ftqGhG6Mz+pQ==", - "license": "MIT" - }, "node_modules/dom-helpers": { "version": "3.4.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/dom-helpers/-/dom-helpers-3.4.0.tgz", @@ -14242,15 +13673,6 @@ "npm": ">=1.2" } }, - "node_modules/dot-case": { - "version": "1.1.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/dot-case/-/dot-case-1.1.2.tgz", - "integrity": "sha512-NzEIt12UjECXi6JZ/R/nBey6EE1qCN0yUTEFaPIaKW0AcOEwlKqujtcJVbtSfLNnj3CDoXLQyli79vAaqohyvw==", - "license": "MIT", - "dependencies": { - "sentence-case": "^1.1.2" - } - }, "node_modules/dot-prop": { "version": "4.2.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/dot-prop/-/dot-prop-4.2.1.tgz", @@ -14348,22 +13770,6 @@ "wcwidth": "^1.0.1" } }, - "node_modules/ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", - "license": "MIT", - "dependencies": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "node_modules/ecc-jsbn/node_modules/jsbn": { - "version": "0.1.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", - "license": "MIT" - }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -15086,7 +14492,6 @@ "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "babel-code-frame": "^6.16.0", "chalk": "^1.1.3", @@ -15239,7 +14644,6 @@ "integrity": "sha512-69zk4fLTFIV4nUaZQfdXyDjSIuymcc4y7ZMywQSnmySpy6MlvDCduug7+G0e6FJMOvEvNC/1N5xDbZvZQphm1g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "builtin-modules": "^1.1.1", "contains-path": "^0.1.0", @@ -15291,7 +14695,6 @@ "integrity": "sha512-OS+axp7UzxE7fmiTHiv9GEavlCfYFIXLQvyEZLMOAJB1/wALDVfWi2KPlj9TKbP97cof/7ZSVwaG6lpUKq8Tog==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "damerau-levenshtein": "^1.0.0", "jsx-ast-utils": "^1.0.0", @@ -15310,7 +14713,6 @@ "integrity": "sha512-vFfMSxJynKlgOhIVjhlZyibVUg442Aiv3482XPkgdYV90T8nD2QvxGXILZGwZHYMQ/l+A/De14O9D0qjDelSrg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "array.prototype.find": "^2.0.1", "doctrine": "^1.2.2", @@ -15818,6 +15220,7 @@ "version": "3.0.2", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true, "license": "MIT" }, "node_modules/extend-shallow": { @@ -15878,15 +15281,6 @@ "node": ">=0.10.0" } }, - "node_modules/extsprintf": { - "version": "1.3.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", - "engines": [ - "node >=0.6.0" - ], - "license": "MIT" - }, "node_modules/eyes": { "version": "0.1.8", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/eyes/-/eyes-0.1.8.tgz", @@ -15916,6 +15310,7 @@ "version": "3.1.3", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, "license": "MIT" }, "node_modules/fast-glob": { @@ -16015,6 +15410,7 @@ "version": "2.1.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, "license": "MIT" }, "node_modules/fast-levenshtein": { @@ -16546,33 +15942,11 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/forever-agent": { - "version": "0.6.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, - "node_modules/form-data": { - "version": "3.0.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/form-data/-/form-data-3.0.2.tgz", - "integrity": "sha512-sJe+TQb2vIaIyO783qN6BlMYWMw3WBOHA1Ay2qxsnjuafEOQFJ2JakedOQirT6D5XPRxDvS7AHYyem9fTpb4LQ==", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/formidable": { "version": "2.1.2", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/formidable/-/formidable-2.1.2.tgz", "integrity": "sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==", + "dev": true, "license": "MIT", "dependencies": { "dezalgo": "^1.0.4", @@ -16890,15 +16264,6 @@ "node": ">=0.10.0" } }, - "node_modules/getpass": { - "version": "0.1.7", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0" - } - }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/glob/-/glob-7.2.3.tgz", @@ -17364,29 +16729,6 @@ "node": ">=18.0.0" } }, - "node_modules/har-schema": { - "version": "2.0.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", - "license": "ISC", - "engines": { - "node": ">=4" - } - }, - "node_modules/har-validator": { - "version": "5.1.5", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "deprecated": "this library is no longer supported", - "license": "MIT", - "dependencies": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/has": { "version": "1.0.4", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/has/-/has-1.0.4.tgz", @@ -17612,6 +16954,7 @@ "version": "1.0.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/hexoid/-/hexoid-1.0.0.tgz", "integrity": "sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -17641,13 +16984,6 @@ "minimalistic-crypto-utils": "^1.0.1" } }, - "node_modules/hoek": { - "version": "6.1.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/hoek/-/hoek-6.1.3.tgz", - "integrity": "sha512-YXXAAhmF9zpQbC7LEcREFtXfGq5K1fmd+4PHkBq8NUqmzW3G+Dq10bI/i0KucLRwss3YYFQ0fSfoxBZYiGUqtQ==", - "deprecated": "This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.", - "license": "BSD-3-Clause" - }, "node_modules/hoist-non-react-statics": { "version": "1.2.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz", @@ -17956,21 +17292,6 @@ "node": ">=8.0" } }, - "node_modules/http-signature": { - "version": "1.2.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - }, - "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" - } - }, "node_modules/https-browserify": { "version": "1.0.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/https-browserify/-/https-browserify-1.0.0.tgz", @@ -18715,6 +18036,7 @@ "version": "1.1.6", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/is-buffer/-/is-buffer-1.1.6.tgz", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true, "license": "MIT" }, "node_modules/is-callable": { @@ -18754,6 +18076,7 @@ "version": "2.16.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/is-core-module/-/is-core-module-2.16.1.tgz", "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, "license": "MIT", "dependencies": { "hasown": "^2.0.2" @@ -18853,28 +18176,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-expression": { - "version": "3.0.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/is-expression/-/is-expression-3.0.0.tgz", - "integrity": "sha512-vyMeQMq+AiH5uUnoBfMTwf18tO3bM6k1QXBE9D6ueAAquEfCZe3AJPtud9g6qS0+4X8xA7ndpZiDyeb2l2qOBw==", - "license": "MIT", - "dependencies": { - "acorn": "~4.0.2", - "object-assign": "^4.0.1" - } - }, - "node_modules/is-expression/node_modules/acorn": { - "version": "4.0.13", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/acorn/-/acorn-4.0.13.tgz", - "integrity": "sha512-fu2ygVGuMmlzG8ZeRJ0bvR41nsAkxxhbyk8bZ1SS521Z7vmgJFTQQlfz/Mp/nJexGBz+v8sC9bM6+lNgskt4Ug==", - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/is-extendable": { "version": "0.1.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/is-extendable/-/is-extendable-0.1.1.tgz", @@ -18996,15 +18297,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-lower-case": { - "version": "1.1.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/is-lower-case/-/is-lower-case-1.1.3.tgz", - "integrity": "sha512-+5A1e/WJpLLXZEDlgz4G//WYSHyQBD32qa4Jd3Lw06qQlv3fJHnp3YIHjTQSGzHMgzmVKz2ZP3rBxTHkPw/lxA==", - "license": "MIT", - "dependencies": { - "lower-case": "^1.1.0" - } - }, "node_modules/is-map": { "version": "2.0.3", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/is-map/-/is-map-2.0.3.tgz", @@ -19202,6 +18494,7 @@ "version": "2.2.2", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/is-promise/-/is-promise-2.2.2.tgz", "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==", + "dev": true, "license": "MIT" }, "node_modules/is-property": { @@ -19225,6 +18518,7 @@ "version": "1.2.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/is-regex/-/is-regex-1.2.1.tgz", "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dev": true, "license": "MIT", "dependencies": { "call-bound": "^1.0.2", @@ -19384,6 +18678,7 @@ "version": "1.0.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", + "dev": true, "license": "MIT" }, "node_modules/is-unc-path": { @@ -19412,15 +18707,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-upper-case": { - "version": "1.1.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/is-upper-case/-/is-upper-case-1.1.2.tgz", - "integrity": "sha512-GQYSJMgfeAmVwh9ixyk888l7OIhNAGKtY6QA+IrWlu9MDTCaXmeozOZ2S9Knj7bQwBO/H6J2kb+pbyTUiMNbsw==", - "license": "MIT", - "dependencies": { - "upper-case": "^1.1.0" - } - }, "node_modules/is-utf8": { "version": "0.2.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/is-utf8/-/is-utf8-0.2.1.tgz", @@ -19508,6 +18794,7 @@ "version": "1.0.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/isarray/-/isarray-1.0.0.tgz", "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true, "license": "MIT" }, "node_modules/isexe": { @@ -19550,6 +18837,7 @@ "version": "0.1.2", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/isstream/-/isstream-0.1.2.tgz", "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", + "dev": true, "license": "MIT" }, "node_modules/istanbul-lib-coverage": { @@ -20343,12 +19631,6 @@ "dev": true, "license": "MIT" }, - "node_modules/js-stringify": { - "version": "1.0.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/js-stringify/-/js-stringify-1.0.2.tgz", - "integrity": "sha512-rtS5ATOo2Q5k1G+DADISilDA6lv79zIiwFd6CcjuIxGKLFm5C+RLImRscVap9k55i+MOZwgliw+NejvkLuGD5g==", - "license": "MIT" - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/js-tokens/-/js-tokens-4.0.0.tgz", @@ -20494,16 +19776,11 @@ "dev": true, "license": "MIT" }, - "node_modules/json-schema": { - "version": "0.4.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/json-schema/-/json-schema-0.4.0.tgz", - "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", - "license": "(AFL-2.1 OR BSD-3-Clause)" - }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, "license": "MIT" }, "node_modules/json-stable-stringify": { @@ -20619,31 +19896,6 @@ "node": ">=10" } }, - "node_modules/jsprim": { - "version": "1.4.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/jsprim/-/jsprim-1.4.2.tgz", - "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", - "license": "MIT", - "dependencies": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.4.0", - "verror": "1.10.0" - }, - "engines": { - "node": ">=0.6.0" - } - }, - "node_modules/jstransformer": { - "version": "1.0.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/jstransformer/-/jstransformer-1.0.0.tgz", - "integrity": "sha512-C9YK3Rf8q6VAPDCCU9fnqo3mAfOH6vUGnMcP4AQAYIEpWtfGLpwOTmZ+igtdK5y+VvI2n3CyYSzy4Qh34eq24A==", - "license": "MIT", - "dependencies": { - "is-promise": "^2.0.0", - "promise": "^7.0.1" - } - }, "node_modules/jsx-ast-utils": { "version": "1.4.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz", @@ -20900,6 +20152,7 @@ "version": "1.0.4", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/lazy-cache/-/lazy-cache-1.0.4.tgz", "integrity": "sha512-RE2g0b5VGZsOCFOCgP7omTRYFqydmZkBwl5oNnQ1lDYC57uyO9KqNnNVxT7COSHTxrRCWVcAVOcbjk+tvh/rgQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -21037,12 +20290,6 @@ "node": ">=8" } }, - "node_modules/lock": { - "version": "0.1.4", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/lock/-/lock-0.1.4.tgz", - "integrity": "sha512-IcEe2R+NA7WgM622ppgmJFCFZl20f2owsA1YiJg7qpvO0wdOgOuZdfhQMxCYXdESVX+QIF/eikE4hB5ZPM2ipA==", - "license": "MIT" - }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/lodash/-/lodash-4.17.21.tgz", @@ -21174,6 +20421,7 @@ "version": "4.4.2", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/lodash.get/-/lodash.get-4.4.2.tgz", "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", + "dev": true, "license": "MIT" }, "node_modules/lodash.includes": { @@ -21335,6 +20583,7 @@ "version": "1.0.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/longest/-/longest-1.0.1.tgz", "integrity": "sha512-k+yt5n3l48JU4k8ftnKG6V7u32wyH2NfKzeMto9F/QRE0amxy/LayxwlvjjkZEIzqR+19IrtFO8p5kB9QaYUFg==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -21383,21 +20632,6 @@ "get-func-name": "^2.0.1" } }, - "node_modules/lower-case": { - "version": "1.1.4", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/lower-case/-/lower-case-1.1.4.tgz", - "integrity": "sha512-2Fgx1Ycm599x+WGpIYwJOvsjmXFzTSc34IwDWALRA/8AopUKAVPwfJ+h5+f85BCp0PWmmJcWzEpxOpoXycMpdA==", - "license": "MIT" - }, - "node_modules/lower-case-first": { - "version": "1.0.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/lower-case-first/-/lower-case-first-1.0.2.tgz", - "integrity": "sha512-UuxaYakO7XeONbKrZf5FEgkantPf5DUqDayzP5VXZrtRPdH86s4kN47I8B3TW10S4QKiE3ziHNf3kRN//okHjA==", - "license": "MIT", - "dependencies": { - "lower-case": "^1.1.2" - } - }, "node_modules/lowercase-keys": { "version": "1.0.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/lowercase-keys/-/lowercase-keys-1.0.1.tgz", @@ -22066,7 +21300,6 @@ "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -24550,15 +23783,6 @@ "node": ">=6" } }, - "node_modules/oauth-sign": { - "version": "0.9.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/object-assign/-/object-assign-4.1.1.tgz", @@ -25129,15 +24353,6 @@ "readable-stream": "^2.1.5" } }, - "node_modules/param-case": { - "version": "1.1.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/param-case/-/param-case-1.1.2.tgz", - "integrity": "sha512-gksk6zeZQxwBm1AHsKh+XDFsTGf1LvdZSkkpSIkfDtzW+EQj/P2PBgNb3Cs0Y9Xxqmbciv2JZe3fWU6Xbher+Q==", - "license": "MIT", - "dependencies": { - "sentence-case": "^1.1.2" - } - }, "node_modules/parse-asn1": { "version": "5.1.7", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/parse-asn1/-/parse-asn1-5.1.7.tgz", @@ -25234,16 +24449,6 @@ "node": ">= 0.8" } }, - "node_modules/pascal-case": { - "version": "1.1.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/pascal-case/-/pascal-case-1.1.2.tgz", - "integrity": "sha512-QWlbdQHdKWlcyTEuv/M0noJtlCa7qTmg5QFAqhx5X9xjAfCU1kXucL+rcOmd2HliESuRLIOz8521RAW/yhuQog==", - "license": "MIT", - "dependencies": { - "camel-case": "^1.1.1", - "upper-case-first": "^1.1.0" - } - }, "node_modules/pascalcase": { "version": "0.1.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/pascalcase/-/pascalcase-0.1.1.tgz", @@ -25271,15 +24476,6 @@ "dev": true, "license": "MIT" }, - "node_modules/path-case": { - "version": "1.1.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/path-case/-/path-case-1.1.2.tgz", - "integrity": "sha512-2snAGA6xVRqTuTPa40bn0iEpYtVK6gEqeyS/63dqpm5pGlesOv6EmRcnB9Rr6eAnAC2Wqlbz0tqgJZryttxhxg==", - "license": "MIT", - "dependencies": { - "sentence-case": "^1.1.2" - } - }, "node_modules/path-dirname": { "version": "1.0.2", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/path-dirname/-/path-dirname-1.0.2.tgz", @@ -25327,6 +24523,7 @@ "version": "1.0.7", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, "license": "MIT" }, "node_modules/path-root": { @@ -25444,6 +24641,7 @@ "version": "2.1.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", + "dev": true, "license": "MIT" }, "node_modules/picocolors": { @@ -26564,6 +25762,7 @@ "version": "2.0.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true, "license": "MIT" }, "node_modules/process-on-spawn": { @@ -26752,18 +25951,6 @@ "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==", "license": "ISC" }, - "node_modules/psl": { - "version": "1.15.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/psl/-/psl-1.15.0.tgz", - "integrity": "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==", - "license": "MIT", - "dependencies": { - "punycode": "^2.3.1" - }, - "funding": { - "url": "https://github.com/sponsors/lupomontero" - } - }, "node_modules/pstree.remy": { "version": "1.1.8", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/pstree.remy/-/pstree.remy-1.1.8.tgz", @@ -26793,183 +25980,6 @@ "dev": true, "license": "MIT" }, - "node_modules/pug": { - "version": "2.0.4", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/pug/-/pug-2.0.4.tgz", - "integrity": "sha512-XhoaDlvi6NIzL49nu094R2NA6P37ijtgMDuWE+ofekDChvfKnzFal60bhSdiy8y2PBO6fmz3oMEIcfpBVRUdvw==", - "license": "MIT", - "dependencies": { - "pug-code-gen": "^2.0.2", - "pug-filters": "^3.1.1", - "pug-lexer": "^4.1.0", - "pug-linker": "^3.0.6", - "pug-load": "^2.0.12", - "pug-parser": "^5.0.1", - "pug-runtime": "^2.0.5", - "pug-strip-comments": "^1.0.4" - } - }, - "node_modules/pug-attrs": { - "version": "2.0.4", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/pug-attrs/-/pug-attrs-2.0.4.tgz", - "integrity": "sha512-TaZ4Z2TWUPDJcV3wjU3RtUXMrd3kM4Wzjbe3EWnSsZPsJ3LDI0F3yCnf2/W7PPFF+edUFQ0HgDL1IoxSz5K8EQ==", - "license": "MIT", - "dependencies": { - "constantinople": "^3.0.1", - "js-stringify": "^1.0.1", - "pug-runtime": "^2.0.5" - } - }, - "node_modules/pug-code-gen": { - "version": "2.0.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/pug-code-gen/-/pug-code-gen-2.0.3.tgz", - "integrity": "sha512-r9sezXdDuZJfW9J91TN/2LFbiqDhmltTFmGpHTsGdrNGp3p4SxAjjXEfnuK2e4ywYsRIVP0NeLbSAMHUcaX1EA==", - "license": "MIT", - "dependencies": { - "constantinople": "^3.1.2", - "doctypes": "^1.1.0", - "js-stringify": "^1.0.1", - "pug-attrs": "^2.0.4", - "pug-error": "^1.3.3", - "pug-runtime": "^2.0.5", - "void-elements": "^2.0.1", - "with": "^5.0.0" - } - }, - "node_modules/pug-error": { - "version": "1.3.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/pug-error/-/pug-error-1.3.3.tgz", - "integrity": "sha512-qE3YhESP2mRAWMFJgKdtT5D7ckThRScXRwkfo+Erqga7dyJdY3ZquspprMCj/9sJ2ijm5hXFWQE/A3l4poMWiQ==", - "license": "MIT" - }, - "node_modules/pug-filters": { - "version": "3.1.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/pug-filters/-/pug-filters-3.1.1.tgz", - "integrity": "sha512-lFfjNyGEyVWC4BwX0WyvkoWLapI5xHSM3xZJFUhx4JM4XyyRdO8Aucc6pCygnqV2uSgJFaJWW3Ft1wCWSoQkQg==", - "license": "MIT", - "dependencies": { - "clean-css": "^4.1.11", - "constantinople": "^3.0.1", - "jstransformer": "1.0.0", - "pug-error": "^1.3.3", - "pug-walk": "^1.1.8", - "resolve": "^1.1.6", - "uglify-js": "^2.6.1" - } - }, - "node_modules/pug-filters/node_modules/camelcase": { - "version": "1.2.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha512-wzLkDa4K/mzI1OSITC+DUyjgIl/ETNHE9QvYgy6J6Jvqyyz4C0Xfd+lQhb19sX2jMpZV4IssUn0VDVmglV+s4g==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pug-filters/node_modules/cliui": { - "version": "2.1.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/cliui/-/cliui-2.1.0.tgz", - "integrity": "sha512-GIOYRizG+TGoc7Wgc1LiOTLare95R3mzKgoln+Q/lE4ceiYH19gUpl0l0Ffq4lJDEf3FxujMe6IBfOCs7pfqNA==", - "license": "ISC", - "dependencies": { - "center-align": "^0.1.1", - "right-align": "^0.1.1", - "wordwrap": "0.0.2" - } - }, - "node_modules/pug-filters/node_modules/uglify-js": { - "version": "2.8.29", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/uglify-js/-/uglify-js-2.8.29.tgz", - "integrity": "sha512-qLq/4y2pjcU3vhlhseXGGJ7VbFO4pBANu0kwl8VCa9KEI0V8VfZIx2Fy3w01iSTA/pGwKZSmu/+I4etLNDdt5w==", - "license": "BSD-2-Clause", - "dependencies": { - "source-map": "~0.5.1", - "yargs": "~3.10.0" - }, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - }, - "optionalDependencies": { - "uglify-to-browserify": "~1.0.0" - } - }, - "node_modules/pug-filters/node_modules/yargs": { - "version": "3.10.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/yargs/-/yargs-3.10.0.tgz", - "integrity": "sha512-QFzUah88GAGy9lyDKGBqZdkYApt63rCXYBGYnEP4xDJPXNqXXnBDACnbrXnViV6jRSqAePwrATi2i8mfYm4L1A==", - "license": "MIT", - "dependencies": { - "camelcase": "^1.0.2", - "cliui": "^2.1.0", - "decamelize": "^1.0.0", - "window-size": "0.1.0" - } - }, - "node_modules/pug-lexer": { - "version": "4.1.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/pug-lexer/-/pug-lexer-4.1.0.tgz", - "integrity": "sha512-i55yzEBtjm0mlplW4LoANq7k3S8gDdfC6+LThGEvsK4FuobcKfDAwt6V4jKPH9RtiE3a2Akfg5UpafZ1OksaPA==", - "license": "MIT", - "dependencies": { - "character-parser": "^2.1.1", - "is-expression": "^3.0.0", - "pug-error": "^1.3.3" - } - }, - "node_modules/pug-linker": { - "version": "3.0.6", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/pug-linker/-/pug-linker-3.0.6.tgz", - "integrity": "sha512-bagfuHttfQOpANGy1Y6NJ+0mNb7dD2MswFG2ZKj22s8g0wVsojpRlqveEQHmgXXcfROB2RT6oqbPYr9EN2ZWzg==", - "license": "MIT", - "dependencies": { - "pug-error": "^1.3.3", - "pug-walk": "^1.1.8" - } - }, - "node_modules/pug-load": { - "version": "2.0.12", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/pug-load/-/pug-load-2.0.12.tgz", - "integrity": "sha512-UqpgGpyyXRYgJs/X60sE6SIf8UBsmcHYKNaOccyVLEuT6OPBIMo6xMPhoJnqtB3Q3BbO4Z3Bjz5qDsUWh4rXsg==", - "license": "MIT", - "dependencies": { - "object-assign": "^4.1.0", - "pug-walk": "^1.1.8" - } - }, - "node_modules/pug-parser": { - "version": "5.0.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/pug-parser/-/pug-parser-5.0.1.tgz", - "integrity": "sha512-nGHqK+w07p5/PsPIyzkTQfzlYfuqoiGjaoqHv1LjOv2ZLXmGX1O+4Vcvps+P4LhxZ3drYSljjq4b+Naid126wA==", - "license": "MIT", - "dependencies": { - "pug-error": "^1.3.3", - "token-stream": "0.0.1" - } - }, - "node_modules/pug-runtime": { - "version": "2.0.5", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/pug-runtime/-/pug-runtime-2.0.5.tgz", - "integrity": "sha512-P+rXKn9un4fQY77wtpcuFyvFaBww7/91f3jHa154qU26qFAnOe6SW1CbIDcxiG5lLK9HazYrMCCuDvNgDQNptw==", - "license": "MIT" - }, - "node_modules/pug-strip-comments": { - "version": "1.0.4", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/pug-strip-comments/-/pug-strip-comments-1.0.4.tgz", - "integrity": "sha512-i5j/9CS4yFhSxHp5iKPHwigaig/VV9g+FgReLJWWHEHbvKsbqL0oP/K5ubuLco6Wu3Kan5p7u7qk8A4oLLh6vw==", - "license": "MIT", - "dependencies": { - "pug-error": "^1.3.3" - } - }, - "node_modules/pug-walk": { - "version": "1.1.8", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/pug-walk/-/pug-walk-1.1.8.tgz", - "integrity": "sha512-GMu3M5nUL3fju4/egXwZO0XLi6fW/K3T3VTgFQ14GxNi8btlxgT5qZL//JwZFm/2Fa64J/PNS8AZeys3wiMkVA==", - "license": "MIT" - }, "node_modules/pump": { "version": "3.0.2", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/pump/-/pump-3.0.2.tgz", @@ -26995,6 +26005,7 @@ "version": "2.3.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -27219,7 +26230,6 @@ "integrity": "sha512-5/MMRYmpmM0sMTHGLossnJCrmXQIiJilD6y3YN3TzAwGFj6zdnMtFv6xmi65PHKRV+pehIHpT7oy67Sr6s9AHA==", "deprecated": "false", "license": "MIT", - "peer": true, "dependencies": { "create-react-class": "^15.6.0", "fbjs": "^0.8.9", @@ -27306,7 +26316,6 @@ "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/react-dom/-/react-dom-15.6.2.tgz", "integrity": "sha512-qxrSETbovswZ0xXs1o5+1o9NfNYbLnQWUqhef36tDWb+tGrbsHjEel5DZuncWMbO0rWd5e4AvCoJBOWm3x6p3A==", "license": "MIT", - "peer": true, "dependencies": { "fbjs": "^0.8.9", "loose-envify": "^1.1.0", @@ -27450,7 +26459,6 @@ "integrity": "sha512-XNguUSFvjBcti5d1vWvLURETiSLPZW1+ugveIa38SgD3aczVqwENNjjC2jtBRMBOziJZDsnmneCLB+I+pkLNTg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "hoist-non-react-statics": "^1.0.3", "invariant": "^2.0.0", @@ -27468,7 +26476,6 @@ "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/react-router/-/react-router-3.0.2.tgz", "integrity": "sha512-RmdTKs9p6uZRoPEIglKsf8Y6LFbW2vLAgN8hmqlxmBqNx0kQUh2/ufBSHLbanHicwGeHZusxzxECLfdBjh2Lkw==", "license": "MIT", - "peer": true, "dependencies": { "history": "^3.0.0", "hoist-non-react-statics": "^1.2.0", @@ -27509,7 +26516,6 @@ "integrity": "sha512-jflbohN8XxJJ91ItKcAFy7B3GE9aLdyifV6w4qcsRcLpWTmVEAZ33h5MmfHPKhGli6FoPZM5VC1/Xnu1TPCqSw==", "dev": true, "license": "BSD-3-Clause", - "peer": true, "dependencies": { "fbjs": "^0.8.9", "object-assign": "^4.1.0" @@ -27673,6 +26679,7 @@ "version": "2.3.8", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/readable-stream/-/readable-stream-2.3.8.tgz", "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, "license": "MIT", "dependencies": { "core-util-is": "~1.0.0", @@ -27688,6 +26695,7 @@ "version": "5.1.2", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, "license": "MIT" }, "node_modules/readdirp": { @@ -27825,7 +26833,6 @@ "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/redux/-/redux-3.7.2.tgz", "integrity": "sha512-pNqnf9q1hI5HHZRBkj3bAngGZW/JMCmexDlOxw4XagXY2o1327nHH54LoTjiPJ0gizoqPDRqWyX/00g0hD6w+A==", "license": "MIT", - "peer": true, "dependencies": { "lodash": "^4.2.1", "lodash-es": "^4.2.1", @@ -27840,7 +26847,6 @@ "deprecated": "Package moved to @redux-devtools/core.", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "lodash": "^4.2.0", "prop-types": "^15.5.7", @@ -28246,6 +27252,7 @@ "version": "1.6.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/repeat-string/-/repeat-string-1.6.1.tgz", "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10" @@ -28289,71 +27296,6 @@ "node": ">= 0.10" } }, - "node_modules/request": { - "version": "2.88.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", - "license": "Apache-2.0", - "dependencies": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/request/node_modules/form-data": { - "version": "2.3.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, - "node_modules/request/node_modules/qs": { - "version": "6.5.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/qs/-/qs-6.5.3.tgz", - "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/request/node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", - "license": "MIT", - "bin": { - "uuid": "bin/uuid" - } - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/require-directory/-/require-directory-2.1.1.tgz", @@ -28422,6 +27364,7 @@ "version": "1.22.10", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/resolve/-/resolve-1.22.10.tgz", "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "dev": true, "license": "MIT", "dependencies": { "is-core-module": "^2.16.0", @@ -28559,89 +27502,6 @@ "deprecated": "https://github.com/lydell/resolve-url#deprecated", "license": "MIT" }, - "node_modules/rest-facade": { - "version": "1.16.4", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/rest-facade/-/rest-facade-1.16.4.tgz", - "integrity": "sha512-EeQm4TMYFAvEw/6wV0OyjerdR8V2cThnmXuPCmRWSrwG6p2fZw9ZkzMIYy33OpdnvHCoGHggKOly7J6Nu3nsAQ==", - "license": "MIT", - "dependencies": { - "change-case": "^2.3.0", - "deepmerge": "^3.2.0", - "lodash.get": "^4.4.2", - "superagent": "^7.1.3" - }, - "peerDependencies": { - "superagent-proxy": "^3.0.0" - }, - "peerDependenciesMeta": { - "superagent-proxy": { - "optional": true - } - } - }, - "node_modules/rest-facade/node_modules/form-data": { - "version": "4.0.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/form-data/-/form-data-4.0.1.tgz", - "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/rest-facade/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/rest-facade/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/rest-facade/node_modules/superagent": { - "version": "7.1.6", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/superagent/-/superagent-7.1.6.tgz", - "integrity": "sha512-gZkVCQR1gy/oUXr+kxJMLDjla434KmSOKbx5iGD30Ql+AkJQ/YlPKECJy2nhqOsHLjGHzoDTXNSjhnvWhzKk7g==", - "deprecated": "Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net", - "license": "MIT", - "dependencies": { - "component-emitter": "^1.3.0", - "cookiejar": "^2.1.3", - "debug": "^4.3.4", - "fast-safe-stringify": "^2.1.1", - "form-data": "^4.0.0", - "formidable": "^2.0.1", - "methods": "^1.1.2", - "mime": "2.6.0", - "qs": "^6.10.3", - "readable-stream": "^3.6.0", - "semver": "^7.3.7" - }, - "engines": { - "node": ">=6.4.0 <13 || >=14" - } - }, "node_modules/restore-cursor": { "version": "1.0.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/restore-cursor/-/restore-cursor-1.0.1.tgz", @@ -28670,6 +27530,7 @@ "version": "0.13.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/retry/-/retry-0.13.1.tgz", "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "dev": true, "license": "MIT", "engines": { "node": ">= 4" @@ -28690,6 +27551,7 @@ "version": "0.1.3", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/right-align/-/right-align-0.1.3.tgz", "integrity": "sha512-yqINtL/G7vs2v+dFIZmFUDbnVyFUJFKd6gK22Kgo6R4jfJGFtisKyncWDDULgjfqf4ASQuIQyjJ7XZ+3aWpsAg==", + "dev": true, "license": "MIT", "dependencies": { "align-text": "^0.1.1" @@ -29124,15 +27986,6 @@ "dev": true, "license": "MIT" }, - "node_modules/sentence-case": { - "version": "1.1.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/sentence-case/-/sentence-case-1.1.3.tgz", - "integrity": "sha512-laa/UDTPXsrQnoN/Kc8ZO7gTeEjMsuPiDgUCk9N0iINRZvqAMCTXjGl8+tD27op1eF/JHbdUlEUmovDh6AX7sA==", - "license": "MIT", - "dependencies": { - "lower-case": "^1.1.1" - } - }, "node_modules/serialize-javascript": { "version": "6.0.2", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/serialize-javascript/-/serialize-javascript-6.0.2.tgz", @@ -29603,15 +28456,6 @@ "node": ">=0.10.0" } }, - "node_modules/snake-case": { - "version": "1.1.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/snake-case/-/snake-case-1.1.2.tgz", - "integrity": "sha512-oapUKC+qulnUIN+/O7Tbl2msi9PQvJeivGN9RNbygxzI2EOY0gA96i8BJLYnGUWSLGcYtyW4YYqnGTZEySU/gg==", - "license": "MIT", - "dependencies": { - "sentence-case": "^1.1.2" - } - }, "node_modules/snapdragon": { "version": "0.8.2", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/snapdragon/-/snapdragon-0.8.2.tgz", @@ -30113,37 +28957,6 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "license": "BSD-3-Clause" }, - "node_modules/sshpk": { - "version": "1.18.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/sshpk/-/sshpk-1.18.0.tgz", - "integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==", - "license": "MIT", - "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - }, - "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sshpk/node_modules/jsbn": { - "version": "0.1.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", - "license": "MIT" - }, "node_modules/stack-trace": { "version": "0.0.10", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/stack-trace/-/stack-trace-0.0.10.tgz", @@ -30600,7 +29413,6 @@ "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/stylus/-/stylus-0.54.8.tgz", "integrity": "sha512-vr54Or4BZ7pJafo2mpf0ZcwA74rpuYCZbxrHBsH8kbcXOwSfvBFwsRfpGO5OD5fhG5HDCFW737PKaawI7OqEAg==", "license": "MIT", - "peer": true, "dependencies": { "css-parse": "~2.0.0", "debug": "~3.1.0", @@ -30751,6 +29563,7 @@ "version": "1.0.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -30827,16 +29640,6 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/swap-case": { - "version": "1.1.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/swap-case/-/swap-case-1.1.2.tgz", - "integrity": "sha512-BAmWG6/bx8syfc6qXPprof3Mn5vQgf5dwdUNJhsNqU9WdPt5P+ES/wQ5bxfijy8zwZgZZHslC3iAsxsuQMCzJQ==", - "license": "MIT", - "dependencies": { - "lower-case": "^1.1.1", - "upper-case": "^1.1.1" - } - }, "node_modules/symbol-observable": { "version": "1.2.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/symbol-observable/-/symbol-observable-1.2.0.tgz", @@ -30881,7 +29684,6 @@ "integrity": "sha512-I/bSHSNEcFFqXLf91nchoNB9D1Kie3QKcWdchYUaoIg1+1bdWDkdfdlvdIOJbi9U8xR0y+MWc5D+won9v95WlQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "co": "^4.6.0", "json-stable-stringify": "^1.0.1" @@ -31240,7 +30042,6 @@ "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -31452,16 +30253,6 @@ "node": ">=0.6.0" } }, - "node_modules/title-case": { - "version": "1.1.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/title-case/-/title-case-1.1.2.tgz", - "integrity": "sha512-xYbo5Um5MBgn24xJSK+x5hZ8ehuGXTVhgx32KJCThHRHwpyIb1lmABi1DH5VvN9E7rNEquPjz//rF/tZQd7mjQ==", - "license": "MIT", - "dependencies": { - "sentence-case": "^1.1.1", - "upper-case": "^1.0.3" - } - }, "node_modules/tldts": { "version": "6.1.70", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/tldts/-/tldts-6.1.70.tgz", @@ -31520,6 +30311,7 @@ "version": "1.0.3", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/to-fast-properties/-/to-fast-properties-1.0.3.tgz", "integrity": "sha512-lxrWP8ejsq+7E3nNjwYmUBMAgjMTZoTI+sdBOpvNyijeDLa29LUn9QaoXAHv4+Z578hbmHHJKZknzxVtvo77og==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -31631,12 +30423,6 @@ "node": ">=0.6" } }, - "node_modules/token-stream": { - "version": "0.0.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/token-stream/-/token-stream-0.0.1.tgz", - "integrity": "sha512-nfjOAu/zAWmX9tgwi5NRp7O7zTDUD1miHiB40klUnAh9qnL1iXdgzcz/i5dMaL5jahcBAaSfmNOBBJBLJW8TEg==", - "license": "MIT" - }, "node_modules/totalist": { "version": "3.0.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/totalist/-/totalist-3.0.1.tgz", @@ -31657,19 +30443,6 @@ "nodetouch": "bin/nodetouch.js" } }, - "node_modules/tough-cookie": { - "version": "2.5.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "license": "BSD-3-Clause", - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, "node_modules/tr46": { "version": "5.0.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/tr46/-/tr46-5.0.0.tgz", @@ -31741,24 +30514,6 @@ "dev": true, "license": "MIT" }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", - "license": "Apache-2.0", - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } - }, - "node_modules/tweetnacl": { - "version": "0.14.5", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", - "license": "Unlicense" - }, "node_modules/type": { "version": "2.7.3", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/type/-/type-2.7.3.tgz", @@ -31986,6 +30741,7 @@ "version": "1.0.2", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", "integrity": "sha512-vb2s1lYx2xBtUgy+ta+b2J/GLVUR+wmpINwHePmPRhOsIVCG2wDzKJ0n14GslH1BifsqVzSOwQhRaCAsZ/nI4Q==", + "dev": true, "license": "MIT", "optional": true }, @@ -32373,25 +31129,11 @@ "node": ">=4" } }, - "node_modules/upper-case": { - "version": "1.1.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/upper-case/-/upper-case-1.1.3.tgz", - "integrity": "sha512-WRbjgmYzgXkCV7zNVpy5YgrHgbBv126rMALQQMrmzOVC4GM2waQ9x7xtm8VU+1yF2kWyPzI9zbZ48n4vSxwfSA==", - "license": "MIT" - }, - "node_modules/upper-case-first": { - "version": "1.1.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/upper-case-first/-/upper-case-first-1.1.2.tgz", - "integrity": "sha512-wINKYvI3Db8dtjikdAqoBbZoP6Q+PZUyfMR7pmwHzjC2quzSkUq5DmPrTtPEqHaz8AGtmsB4TqwapMTM1QAQOQ==", - "license": "MIT", - "dependencies": { - "upper-case": "^1.1.1" - } - }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "punycode": "^2.1.0" @@ -32614,31 +31356,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/verror": { - "version": "1.10.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/verror/-/verror-1.10.0.tgz", - "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", - "engines": [ - "node >=0.6.0" - ], - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "node_modules/verror/node_modules/core-util-is": { - "version": "1.0.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", - "license": "MIT" - }, - "node_modules/very-fast-args": { - "version": "1.1.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/very-fast-args/-/very-fast-args-1.1.0.tgz", - "integrity": "sha512-yLTU+/TMf4gaHnbfcV0DQJRQuhp6dh0Jsl1g26sXNV93wLswly6/azFwvZrtm/QBMD8r82/N3+5YpsiQ+jcdkA==" - }, "node_modules/vinyl": { "version": "2.2.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/vinyl/-/vinyl-2.2.1.tgz", @@ -32768,15 +31485,6 @@ "dev": true, "license": "MIT" }, - "node_modules/void-elements": { - "version": "2.0.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/void-elements/-/void-elements-2.0.1.tgz", - "integrity": "sha512-qZKX4RnBzH2ugr8Lxa7x+0V6XD9Sb/ouARtiasEQCHB1EVU4NXtmHsDDrx1dO4ne5fc3J6EW05BP1Dl0z0iung==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/w3c-xmlserializer": { "version": "5.0.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", @@ -32860,7 +31568,6 @@ "integrity": "sha512-EksG6gFY3L1eFMROS/7Wzgrii5mBAFe4rIr3r2BTfo7bcc+DWwFZ4OJ/miOuHJO/A85HwyI4eQ0F6IKXesO7Fg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.6", @@ -32993,7 +31700,6 @@ "integrity": "sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@discoveryjs/json-ext": "^0.5.0", "@webpack-cli/configtest": "^2.1.1", @@ -33104,7 +31810,6 @@ "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -33239,7 +31944,6 @@ "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -33744,7 +32448,6 @@ "integrity": "sha512-I/bSHSNEcFFqXLf91nchoNB9D1Kie3QKcWdchYUaoIg1+1bdWDkdfdlvdIOJbi9U8xR0y+MWc5D+won9v95WlQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "co": "^4.6.0", "json-stable-stringify": "^1.0.1" @@ -34455,7 +33158,6 @@ "integrity": "sha512-MjAA0ZqO1ba7ZQJRnoCdbM56mmFpipOPUv/vQpwwfSI42p5PVDdoiuK2AL2FwFUVgT859Jr43bFZXRg/LNsqvg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "acorn": "^5.0.0", "acorn-dynamic-import": "^2.0.0", @@ -34637,113 +33339,6 @@ "ajv-errors": "^1.0.0" } }, - "node_modules/webtask-tools": { - "version": "3.4.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/webtask-tools/-/webtask-tools-3.4.1.tgz", - "integrity": "sha512-NqjvLZVA3AUsRLWBIEcNH7jEoBZERjb1w3JANg/KjxUkEcmS+c8bcBPAGIy+awhgVax2E52qs6bZhiPg842aCw==", - "license": "MIT", - "dependencies": { - "boom": "^7.2.0", - "jsonwebtoken": "^5.7.0", - "pug": "^2.0.3", - "safe-buffer": "^5.0.1", - "superagent": "^3.8.3" - } - }, - "node_modules/webtask-tools/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/webtask-tools/node_modules/debug/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/webtask-tools/node_modules/form-data": { - "version": "2.5.2", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/form-data/-/form-data-2.5.2.tgz", - "integrity": "sha512-GgwY0PS7DbXqajuGf4OYlsrIu3zgxD6Vvql43IBhm6MahqA5SK/7mwhtNj2AdH2z35YR34ujJ7BN+3fFC3jP5Q==", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12", - "safe-buffer": "^5.2.1" - }, - "engines": { - "node": ">= 0.12" - } - }, - "node_modules/webtask-tools/node_modules/formidable": { - "version": "1.2.6", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/formidable/-/formidable-1.2.6.tgz", - "integrity": "sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ==", - "deprecated": "Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau", - "license": "MIT", - "funding": { - "url": "https://ko-fi.com/tunnckoCore/commissions" - } - }, - "node_modules/webtask-tools/node_modules/jsonwebtoken": { - "version": "5.7.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/jsonwebtoken/-/jsonwebtoken-5.7.0.tgz", - "integrity": "sha512-VP2HXX7tJ73v5ZGGTFdgILhOBwGSDlPP4qArdrq6YbDVJ9YJflcNE/fbuGHPlefPkbM1+7rFzz1eTq1xICsJxA==", - "license": "MIT", - "dependencies": { - "jws": "^3.0.0", - "ms": "^0.7.1", - "xtend": "^4.0.1" - }, - "engines": { - "npm": ">=1.4.28" - } - }, - "node_modules/webtask-tools/node_modules/mime": { - "version": "1.6.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "license": "MIT", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/webtask-tools/node_modules/ms": { - "version": "0.7.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/ms/-/ms-0.7.3.tgz", - "integrity": "sha512-lrKNzMWqQZgwJahtrtrM+9NgOoDUveDrVmm5aGXrf3BdtL0mq7X6IVzoZaw+TfNti29eHd1/8GI+h45K5cQ6/w==", - "license": "MIT" - }, - "node_modules/webtask-tools/node_modules/superagent": { - "version": "3.8.3", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/superagent/-/superagent-3.8.3.tgz", - "integrity": "sha512-GLQtLMCoEIK4eDv6OGtkOoSMt3D+oq0y3dsxMuYuDvaNUvuT8eFBuLmfR0iYYzHC1e8hpzC6ZsxbuP6DIalMFA==", - "deprecated": "Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net", - "license": "MIT", - "dependencies": { - "component-emitter": "^1.2.0", - "cookiejar": "^2.1.0", - "debug": "^3.1.0", - "extend": "^3.0.0", - "form-data": "^2.3.1", - "formidable": "^1.2.0", - "methods": "^1.1.1", - "mime": "^1.4.1", - "qs": "^6.5.1", - "readable-stream": "^2.3.5" - }, - "engines": { - "node": ">= 4.0" - } - }, "node_modules/whatwg-encoding": { "version": "3.1.1", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", @@ -34950,6 +33545,7 @@ "version": "0.1.0", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/window-size/-/window-size-0.1.0.tgz", "integrity": "sha512-1pTPQDKTdd61ozlKGNCjhNRd+KPmgLSGa3mZTHoOliaGcESD8G1PXhh7c1fgiPjVbNVfgy2Faw4BI8/m0cC8Mg==", + "dev": true, "engines": { "node": ">= 0.8.0" } @@ -35024,49 +33620,6 @@ "node": ">= 6" } }, - "node_modules/with": { - "version": "5.1.1", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/with/-/with-5.1.1.tgz", - "integrity": "sha512-uAnSsFGfSpF6DNhBXStvlZILfHJfJu4eUkfbRGk94kGO1Ta7bg6FwfvoOhhyHAJuFbCw+0xk4uJ3u57jLvlCJg==", - "license": "MIT", - "dependencies": { - "acorn": "^3.1.0", - "acorn-globals": "^3.0.0" - } - }, - "node_modules/with/node_modules/acorn": { - "version": "3.3.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/acorn/-/acorn-3.3.0.tgz", - "integrity": "sha512-OLUyIIZ7mF5oaAUT1w0TFqQS81q3saT46x8t7ukpPjMNk+nbs4ZHhs7ToV8EWnLYLepjETXd4XaCE4uxkMeqUw==", - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/with/node_modules/acorn-globals": { - "version": "3.1.0", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/acorn-globals/-/acorn-globals-3.1.0.tgz", - "integrity": "sha512-uWttZCk96+7itPxK8xCzY86PnxKTMrReKDqrHzv42VQY0K30PUO8WY13WMOuI+cOdX4EIdzdvQ8k6jkuGRFMYw==", - "license": "MIT", - "dependencies": { - "acorn": "^4.0.4" - } - }, - "node_modules/with/node_modules/acorn-globals/node_modules/acorn": { - "version": "4.0.13", - "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/acorn/-/acorn-4.0.13.tgz", - "integrity": "sha512-fu2ygVGuMmlzG8ZeRJ0bvR41nsAkxxhbyk8bZ1SS521Z7vmgJFTQQlfz/Mp/nJexGBz+v8sC9bM6+lNgskt4Ug==", - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/wolfy87-eventemitter": { "version": "5.2.9", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/wolfy87-eventemitter/-/wolfy87-eventemitter-5.2.9.tgz", @@ -35088,6 +33641,7 @@ "version": "0.0.2", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/wordwrap/-/wordwrap-0.0.2.tgz", "integrity": "sha512-xSBsCeh+g+dinoBv3GAOWM4LcVVO68wLXRanibtBSdUvkGWQRGeE9P7IwU9EmDDi4jA6L44lz15CGMwdw9N5+Q==", + "dev": true, "license": "MIT/X11", "engines": { "node": ">=0.4.0" @@ -35292,6 +33846,7 @@ "version": "4.0.2", "resolved": "https://a0us.jfrog.io/artifactory/api/npm/npm/xtend/-/xtend-4.0.2.tgz", "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.4" diff --git a/package.json b/package.json index 569dface..410d0910 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "@hapi/good-console@9.0.1", "@hapi/hapi@21.3.3", "async@2.6.4", - "auth0-extension-tools@1.5.2", "axios@1.12.2", "blipp@4.0.2", "ejs@3.1.9", @@ -66,7 +65,6 @@ "@hapi/inert": "7.1.0", "async": "2.6.4", "auth0": "4.9.0", - "auth0-extension-tools": "1.5.2", "auth0-extension-ui": "1.1.7", "auth0-extension-ui-redux": "git+https://github.com/auth0-extensions/auth0-extension-ui-redux", "axios": "^1.12.2", @@ -82,6 +80,7 @@ "moment": "^2.29.4", "nconf": "^0.12.0", "node-uuid": "^1.4.8", + "promise-retry": "^1.1.1", "superagent": "^10.2.3", "winston": "^3.10.0" }, @@ -183,9 +182,6 @@ "webtask-bundle": "3.0.1" }, "overrides": { - "auth0-extension-tools": { - "async": "2.6.4" - }, "react-router": "3.0.2", "@hapi/hoek": "^9.3.0", "@hapi/validate": "1.1.3", diff --git a/server/index.js b/server/index.js index 4765fe3d..51c699e3 100644 --- a/server/index.js +++ b/server/index.js @@ -72,9 +72,24 @@ export default async () => { // otherwise 500s are returned regardless of the thrown error if (statusCode >= 400) { request.response.output.statusCode = statusCode; + + // Map status codes to standard HTTP error names + let errorName = request.response.name; + if (statusCode === 400) { + errorName = "Bad Request"; + } else if (statusCode === 401) { + errorName = "Unauthorized"; + } else if (statusCode === 403) { + errorName = "Forbidden"; + } else if (statusCode === 404) { + errorName = "Not Found"; + } else if (statusCode === 429) { + errorName = "Too Many Requests"; + } + request.response.output.payload = { statusCode: statusCode, - error: request.response.name === "APIError" ? "Bad Request" : request.response.name, + error: errorName, message: request.response.message }; } diff --git a/server/lib/apiaccess.js b/server/lib/apiaccess.js index aafa11e9..ae5648d7 100644 --- a/server/lib/apiaccess.js +++ b/server/lib/apiaccess.js @@ -1,5 +1,5 @@ import request from 'superagent'; -import { managementApi } from 'auth0-extension-tools'; +import managementApi from './auth0/managementApi'; import config from './config'; const apiIdentifier = 'urn:auth0-authz-api'; diff --git a/server/lib/auth0/SessionManager.js b/server/lib/auth0/SessionManager.js new file mode 100644 index 00000000..12425a53 --- /dev/null +++ b/server/lib/auth0/SessionManager.js @@ -0,0 +1,211 @@ +const jwt = require('jsonwebtoken'); +const jwksClient = require('jwks-rsa'); +const crypto = require('crypto'); + +const ArgumentError = require('../errors').ArgumentError; +const UnauthorizedError = require('../errors').UnauthorizedError; +const ValidationError = require('../errors').ValidationError; + +function SessionManager(rta, domain, clientId) { + if (rta === null || rta === undefined) { + throw new ArgumentError('Must provide a valid domain'); + } + + if (typeof rta !== 'string' || rta.length === 0) { + throw new ArgumentError('The provided rta is invalid: ' + rta); + } + + if (rta.indexOf('https://') === 0) { + rta = rta.replace('https://', ''); + } + + if (domain === null || domain === undefined) { + throw new ArgumentError('Must provide a valid domain'); + } + + if (typeof domain !== 'string' || domain.length === 0) { + throw new ArgumentError('The provided domain is invalid: ' + domain); + } + + if (clientId === null || clientId === undefined) { + throw new ArgumentError('Must provide a valid clientId'); + } + + if (typeof clientId !== 'string' || clientId.length === 0) { + throw new ArgumentError('The provided clientId is invalid: ' + clientId); + } + + this.options = { + rta: rta, + domain: domain, + clientId: clientId + }; + + this.jwksClient = jwksClient({ + cache: true, + rateLimit: true, + jwksRequestsPerMinute: 10, + jwksUri: 'https://' + rta + '/.well-known/jwks.json' + }); + this.managementApiAudience = 'https://' + domain + '/api/v2/'; +} + +SessionManager.prototype.createAuthorizeUrl = function(options) { + if (options === null || options === undefined) { + throw new ArgumentError('Must provide the options'); + } + + if (options.redirectUri === null || options.redirectUri === undefined) { + throw new ArgumentError('Must provide the redirectUri'); + } + + if (options.nonce === null || options.nonce === undefined) { + // TODO: throw new ArgumentError('Must provide the nonce'); + options.nonce = crypto.randomBytes(16).toString('hex'); + } else if (typeof options.nonce !== 'string' || options.nonce.length === 0) { + throw new ArgumentError('The provided nonce is invalid: ' + options.nonce); + } + + if (typeof options.redirectUri !== 'string' || options.redirectUri.length === 0) { + throw new ArgumentError('The provided redirectUri is invalid: ' + options.redirectUri); + } + + if (options.state !== undefined && (typeof options.state !== 'string' || options.state.length === 0)) { + throw new ArgumentError('The provided state is invalid: ' + options.state); + } + + var scopes = 'openid name email'; + if (options.scopes && options.scopes.length) { + scopes += ' ' + options.scopes; + } + + var urlOptions = [ + 'https://' + this.options.rta + '/authorize', + '?client_id=' + encodeURIComponent(this.options.clientId), + '&response_type=token id_token', + '&response_mode=form_post', + '&scope=' + encodeURIComponent(scopes), + '&expiration=' + (options.expiration || 36000), + '&redirect_uri=' + encodeURIComponent(options.redirectUri), + '&audience=' + encodeURIComponent(this.managementApiAudience), + '&nonce=' + encodeURIComponent(options.nonce) + ]; + if (options.state) urlOptions.push('&state=' + encodeURIComponent(options.state)); + return urlOptions.join(''); +}; + +SessionManager.prototype.validateToken = function(client, audience, token) { + const self = this; + return new Promise(function(resolve, reject) { + const decoded = jwt.decode(token, { complete: true }); + if (decoded == null) { + return reject(new ValidationError('Unable to decoded the token.')); + } + + return self.jwksClient.getSigningKey(decoded.header.kid, function(signingKeyError, key) { + if (signingKeyError) { + return reject(signingKeyError); + } + + const signingKey = key.publicKey || key.rsaPublicKey; + return jwt.verify(token, signingKey, { algorithms: ['RS256'] }, function(err, payload) { + if (err) { + return reject(err); + } + + if (payload.iss !== 'https://' + self.options.rta + '/') { + return reject(new UnauthorizedError('Invalid issuer: ' + payload.iss)); + } + + if (!(payload && (payload.aud === audience + || (Array.isArray(payload.aud) && payload.aud.indexOf(audience) > -1)))) { + return reject(new UnauthorizedError('Audience mismatch for: ' + audience)); + } + + return resolve(payload); + }); + }); + }); +}; + +/** + * Create a new session. + */ +SessionManager.prototype.create = function(idToken, accessToken, options) { + if (idToken === null || idToken === undefined) { + return Promise.reject(new ArgumentError('Must provide an id_token')); + } + + if (typeof idToken !== 'string' || idToken.length === 0) { + return Promise.reject(new ArgumentError('The provided id_token is invalid: ' + idToken)); + } + + if (accessToken === null || accessToken === undefined) { + return Promise.reject(new ArgumentError('Must provide an access_token')); + } + + if (typeof accessToken !== 'string' || accessToken.length === 0) { + return Promise.reject(new ArgumentError('The provided access_token is invalid: ' + accessToken)); + } + + if (options === null || options === undefined) { + return Promise.reject(new ArgumentError('Must provide the options')); + } + + if (options.secret === null || options.secret === undefined) { + return Promise.reject(new ArgumentError('Must provide the secret')); + } + + if (typeof options.secret !== 'string' || options.secret.length === 0) { + return Promise.reject(new ArgumentError('The provided secret is invalid: ' + options.secret)); + } + + if (options.audience === null || options.audience === undefined) { + return Promise.reject(new ArgumentError('Must provide the audience')); + } + + if (typeof options.audience !== 'string' || options.audience.length === 0) { + return Promise.reject(new ArgumentError('The provided audience is invalid: ' + options.audience)); + } + + if (options.issuer === null || options.issuer === undefined) { + return Promise.reject(new ArgumentError('Must provide the issuer')); + } + + if (typeof options.issuer !== 'string' || options.issuer.length === 0) { + return Promise.reject(new ArgumentError('The provided issuer is invalid: ' + options.issuer)); + } + + const self = this; + return Promise.all([ + self.validateToken(self.options.clientId, self.options.clientId, idToken), + self.validateToken(self.options.clientId, self.managementApiAudience, accessToken) + ]) + .then(function(tokens) { + if (tokens[1].azp !== self.options.clientId) { + return Promise.reject(new UnauthorizedError('The access_token\'s azp does not match the id_token')); + } + + if (tokens[0].sub !== tokens[1].sub) { + return Promise.reject(new UnauthorizedError('Subjects don\'t match')); + } + + const payload = { + sub: tokens[0].sub, + email: tokens[0].email, + exp: tokens[0].exp + }; + + if (!options.noAccessToken) { + payload.access_token = accessToken; + } + + return jwt.sign(payload, options.secret, { + algorithm: 'HS256', + issuer: options.issuer, + audience: options.audience + }); + }); +}; + +module.exports = SessionManager; diff --git a/server/lib/auth0/managementApi.js b/server/lib/auth0/managementApi.js new file mode 100644 index 00000000..7afcb0ff --- /dev/null +++ b/server/lib/auth0/managementApi.js @@ -0,0 +1,175 @@ +const jwt = require('jsonwebtoken'); +const auth0 = require('auth0'); +const memoizer = require('lru-memoizer'); +const request = require('superagent'); + +const ArgumentError = require('../errors').ArgumentError; +const ManagementApiError = require('../errors').ManagementApiError; + +const getAccessToken = function(domain, clientId, clientSecret) { + return new Promise(function(resolve, reject) { + request + .post('https://' + domain + '/oauth/token') + .send({ + audience: 'https://' + domain + '/api/v2/', + client_id: clientId, + client_secret: clientSecret, + grant_type: 'client_credentials' + }) + .set('Accept', 'application/json') + .end(function(err, res) { + if (err && err.status === 401) { + return reject(new ManagementApiError('unauthorized', 'Invalid credentials for ' + clientId, err.status)); + } else if (err && res && res.body && res.body.error) { + return reject(new ManagementApiError(res.body.error, res.body.error_description || res.body.error, err.status)); + } else if (err) { + return reject(err); + } + + if (!res.ok || !res.body.access_token) { + return reject(new ManagementApiError('unknown_error', 'Unknown error from Management Api or no access token was provided: ' + (res.text || res.status))); + } + + return resolve(res.body.access_token); + }); + }); +}; + +// Promisify the memoizer using standard Promise +const getAccessTokenCached = function(domain, clientId, clientSecret) { + return new Promise(function(resolve, reject) { + memoizedGetToken(domain, clientId, clientSecret, function(err, token) { + if (err) { + return reject(err); + } + return resolve(token); + }); + }); +}; + +const memoizedGetToken = memoizer({ + load: function(domain, clientId, clientSecret, callback) { + getAccessToken(domain, clientId, clientSecret) + .then(function(accessToken) { + return callback(null, accessToken); + }) + .catch(function(err) { + return callback(err); + }); + }, + hash: function(domain, clientId, clientSecret) { + return domain + '-' + clientId + '-' + clientSecret; + }, + itemMaxAge: function(domain, clientId, clientSecret, accessToken) { + try { + const decodedToken = jwt.decode(accessToken); + const expiresIn = new Date(0); + expiresIn.setUTCSeconds(decodedToken.exp); + const now = new Date().valueOf(); + return (expiresIn.valueOf() - now) - 10000; + } catch (e) { + return 1000; + } + }, + max: 100, + maxAge: 3600000 // 1 hour in milliseconds +}); + +// Helper function to wrap all methods in a resource using Proxy +function wrapResource(resource) { + return new Proxy(resource, { + get(target, prop) { + const value = target[prop]; + + // If it's a function, wrap it to unwrap JSONApiResponse + if (typeof value === 'function') { + return function(...args) { + const result = value.apply(target, args); + + // If the result is a promise, unwrap the .data property + if (result && typeof result.then === 'function') { + return result.then(function(response) { + // auth0 SDK v4 returns JSONApiResponse with .data property + // Unwrap it to maintain compatibility with v3 SDK behavior + if (response && response.data !== undefined) { + return response.data; + } + return response; + }); + } + + return result; + }; + } + + return value; + } + }); +} + +// Helper function to wrap all resources in the management client using Proxy +function wrapManagementClient(client) { + return new Proxy(client, { + get(target, prop) { + const value = target[prop]; + + // If it's an object (likely a resource like clients, users, etc.), wrap it + if (value && typeof value === 'object' && prop !== 'options') { + return wrapResource(value); + } + + return value; + } + }); +} + +const getClient = function(options) { + if (options === null || options === undefined) { + throw new ArgumentError('An options object must be provided'); + } + + if (options.domain === null || options.domain === undefined) { + throw new ArgumentError('An options object must contain the domain'); + } + + if (typeof options.domain !== 'string' || options.domain.length === 0) { + throw new ArgumentError('The provided domain is invalid: ' + options.domain); + } + + if (options.accessToken) { + if (typeof options.accessToken !== 'string' || options.accessToken.length === 0) { + throw new ArgumentError('The provided accessToken is invalid'); + } + + const client = new auth0.ManagementClient({ domain: options.domain, token: options.accessToken, headers: options.headers }); + return Promise.resolve(wrapManagementClient(client)); + } + + if (options.clientId === null || options.clientId === undefined) { + throw new ArgumentError('An options object must contain the clientId'); + } + + if (typeof options.clientId !== 'string' || options.clientId.length === 0) { + throw new ArgumentError('The provided clientId is invalid: ' + options.clientId); + } + + if (options.clientSecret === null || options.clientSecret === undefined) { + throw new ArgumentError('An options object must contain the clientSecret'); + } + + if (typeof options.clientSecret !== 'string' || options.clientSecret.length === 0) { + throw new ArgumentError('The provided clientSecret is invalid'); + } + + return getAccessTokenCached(options.domain, options.clientId, options.clientSecret) + .then(function(token) { + const client = new auth0.ManagementClient({ domain: options.domain, token: token, headers: options.headers }); + return wrapManagementClient(client); + }); +}; + +module.exports = { + getAccessToken: getAccessToken, + getAccessTokenCached: getAccessTokenCached, + getClient: getClient +}; diff --git a/server/lib/auth0/validateHookToken.js b/server/lib/auth0/validateHookToken.js new file mode 100644 index 00000000..c023a278 --- /dev/null +++ b/server/lib/auth0/validateHookToken.js @@ -0,0 +1,18 @@ +const jwt = require('jsonwebtoken'); +const HookTokenError = require('../errors').HookTokenError; + +module.exports = function validateHookToken(domain, webtaskUrl, hookPath, extensionSecret, hookToken) { + if (!hookToken) { + throw new HookTokenError('Hook token missing'); + } + + try { + jwt.verify(hookToken, extensionSecret, { + audience: webtaskUrl + hookPath, + issuer: 'https://' + domain + }); + return true; + } catch (e) { + throw new HookTokenError('Invalid hook token', e); + } +}; diff --git a/server/lib/config.js b/server/lib/config.js index 714d0a6f..a53116a7 100644 --- a/server/lib/config.js +++ b/server/lib/config.js @@ -1,6 +1,27 @@ -const tools = require('auth0-extension-tools'); +// Simple configuration factory - replaces auth0-extension-tools config +module.exports = function() { + const settings = {}; + let currentProvider = null; -const config = tools.config(); + const config = function getConfig(key) { + if (settings && settings[key]) { + return settings[key]; + } -module.exports = config; + if (!currentProvider) { + throw new Error('A configuration provider has not been set'); + } + return currentProvider(key); + }; + + config.setProvider = function setProvider(providerFunction) { + currentProvider = providerFunction; + }; + + config.setValue = function setValue(key, value) { + settings[key] = value; + }; + + return config; +}(); diff --git a/server/lib/errors/ArgumentError.js b/server/lib/errors/ArgumentError.js new file mode 100644 index 00000000..85d308b6 --- /dev/null +++ b/server/lib/errors/ArgumentError.js @@ -0,0 +1,11 @@ +class ArgumentError extends Error { + constructor(message) { + super(message); + this.name = 'ArgumentError'; + this.status = 400; + this.statusCode = 400; + Error.captureStackTrace(this, this.constructor); + } +} + +module.exports = ArgumentError; diff --git a/server/lib/errors/ForbiddenError.js b/server/lib/errors/ForbiddenError.js new file mode 100644 index 00000000..b917c185 --- /dev/null +++ b/server/lib/errors/ForbiddenError.js @@ -0,0 +1,11 @@ +class ForbiddenError extends Error { + constructor(message) { + super(message); + this.name = 'ForbiddenError'; + this.status = 403; + this.statusCode = 403; + Error.captureStackTrace(this, this.constructor); + } +} + +module.exports = ForbiddenError; diff --git a/server/lib/errors/HookTokenError.js b/server/lib/errors/HookTokenError.js new file mode 100644 index 00000000..6deb6c3a --- /dev/null +++ b/server/lib/errors/HookTokenError.js @@ -0,0 +1,12 @@ +class HookTokenError extends Error { + constructor(message, innerError) { + super(message); + this.name = 'HookTokenError'; + this.status = 401; + this.statusCode = 401; + this.innerError = innerError; + Error.captureStackTrace(this, this.constructor); + } +} + +module.exports = HookTokenError; diff --git a/server/lib/errors/ManagementApiError.js b/server/lib/errors/ManagementApiError.js new file mode 100644 index 00000000..5ba11b08 --- /dev/null +++ b/server/lib/errors/ManagementApiError.js @@ -0,0 +1,12 @@ +class ManagementApiError extends Error { + constructor(code, message, statusCode) { + super(message); + this.name = 'ManagementApiError'; + this.code = code; + this.status = statusCode || 500; + this.statusCode = statusCode || 500; + Error.captureStackTrace(this, this.constructor); + } +} + +module.exports = ManagementApiError; diff --git a/server/lib/errors/NotFoundError.js b/server/lib/errors/NotFoundError.js new file mode 100644 index 00000000..20940e7e --- /dev/null +++ b/server/lib/errors/NotFoundError.js @@ -0,0 +1,11 @@ +class NotFoundError extends Error { + constructor(message) { + super(message); + this.name = 'NotFoundError'; + this.status = 404; + this.statusCode = 404; + Error.captureStackTrace(this, this.constructor); + } +} + +module.exports = NotFoundError; diff --git a/server/lib/errors/UnauthorizedError.js b/server/lib/errors/UnauthorizedError.js new file mode 100644 index 00000000..4e368f17 --- /dev/null +++ b/server/lib/errors/UnauthorizedError.js @@ -0,0 +1,11 @@ +class UnauthorizedError extends Error { + constructor(message) { + super(message); + this.name = 'UnauthorizedError'; + this.status = 401; + this.statusCode = 401; + Error.captureStackTrace(this, this.constructor); + } +} + +module.exports = UnauthorizedError; diff --git a/server/lib/errors/ValidationError.js b/server/lib/errors/ValidationError.js new file mode 100644 index 00000000..7af3f7b3 --- /dev/null +++ b/server/lib/errors/ValidationError.js @@ -0,0 +1,11 @@ +class ValidationError extends Error { + constructor(message) { + super(message); + this.name = 'ValidationError'; + this.status = 400; + this.statusCode = 400; + Error.captureStackTrace(this, this.constructor); + } +} + +module.exports = ValidationError; diff --git a/server/lib/errors/index.js b/server/lib/errors/index.js new file mode 100644 index 00000000..17627c11 --- /dev/null +++ b/server/lib/errors/index.js @@ -0,0 +1,27 @@ +const ArgumentError = require('./ArgumentError'); +const ValidationError = require('./ValidationError'); +const HookTokenError = require('./HookTokenError'); +const NotFoundError = require('./NotFoundError'); +const ManagementApiError = require('./ManagementApiError'); +const UnauthorizedError = require('./UnauthorizedError'); +const ForbiddenError = require('./ForbiddenError'); + +// CommonJS exports +module.exports = { + ArgumentError, + ValidationError, + HookTokenError, + NotFoundError, + ManagementApiError, + UnauthorizedError, + ForbiddenError +}; + +// ES6 named exports for compatibility +module.exports.ArgumentError = ArgumentError; +module.exports.ValidationError = ValidationError; +module.exports.HookTokenError = HookTokenError; +module.exports.NotFoundError = NotFoundError; +module.exports.ManagementApiError = ManagementApiError; +module.exports.UnauthorizedError = UnauthorizedError; +module.exports.ForbiddenError = ForbiddenError; diff --git a/server/lib/multipartRequest.js b/server/lib/multipartRequest.js index 920902b8..27194001 100644 --- a/server/lib/multipartRequest.js +++ b/server/lib/multipartRequest.js @@ -1,4 +1,4 @@ -import { ArgumentError } from 'auth0-extension-tools'; +import { ArgumentError } from './errors/index.js'; import { promiseMap } from '../lib/utils'; @@ -30,15 +30,21 @@ export default async function( Object.assign({}, options, { include_totals: true, page: 0 }) ]); - total = response.total || 0; + // auth0 SDK v4 returns JSONApiResponse with .data property + const responseData = response.data || response; + total = responseData.total || 0; pageCount = Math.ceil(total / perPage); - const data = response[entity] || response || []; + const data = responseData[entity] || responseData || []; data.forEach((item) => result.push(item)); return null; }; const getPage = async (page) => { - const data = await apiCall(client[entity], getter, [ Object.assign({}, options, { page: page }) ]); + const response = await apiCall(client[entity], getter, [ + Object.assign({}, options, { page: page }) + ]); + // auth0 SDK v4 returns JSONApiResponse with .data property + const data = response.data || response || []; data.forEach((item) => result.push(item)); return null; }; diff --git a/server/lib/storage/contexts/BlobRecordProvider.js b/server/lib/storage/contexts/BlobRecordProvider.js new file mode 100644 index 00000000..7821a8a9 --- /dev/null +++ b/server/lib/storage/contexts/BlobRecordProvider.js @@ -0,0 +1,217 @@ +const uuid = require('node-uuid'); +const promiseRetry = require('promise-retry'); + +const seriesQueue = require('./seriesQueue'); +const ArgumentError = require('../../errors').ArgumentError; +const NotFoundError = require('../../errors').NotFoundError; +const ValidationError = require('../../errors').ValidationError; + +const getDataForCollection = function(storageContext, collectionName) { + return storageContext.read() + .then(function(data) { + data[collectionName] = data[collectionName] || []; + return data; + }); +}; + +const withRetry = function(storageContext, action) { + const retryOptions = { + retries: 10, + factor: 2, + minTimeout: 100, + maxTimeout: Infinity, + randomize: false + }; + + return function() { + return promiseRetry(function(retry) { + return action() + .catch(function(err) { + const writeRetryCondition = + storageContext.writeRetryCondition || + function() { return false; }; + if (writeRetryCondition(err)) { + return retry(err); + } + + throw err; + }); + }, retryOptions); + }; +}; + +/** + * Create a new BlobRecordProvider. + * @param {Object} storageContext The storage context. + * @param {Object} options Options object. + * @constructor + */ +function BlobRecordProvider(storageContext, options) { + if (storageContext === null || storageContext === undefined) { + throw new ArgumentError('Must provide a storage context'); + } + + this.storageContext = storageContext; + this.queue = seriesQueue(); + this.options = options || { + concurrentWrites: true + }; +} + +/** + * Write to the underlying storage layer + * @param {Object} storageContext Storage context + * @param {Function} action Action to execute. + * @return {Promise} + */ +BlobRecordProvider.prototype.write = function(storageContext, action) { + const actionWithRetry = withRetry(storageContext, action); + + // Concurrent writes are allowed. + if (this.options.concurrentWrites) { + return actionWithRetry(); + } + + // Concurrent writes are not allowed, process them sequentially. + const queue = this.queue; + return new Promise(function(resolve, reject) { + queue(actionWithRetry, function(err, res) { + if (err) { + return reject(err); + } + + return resolve(res); + }); + }); +}; + +/** + * Get all records for a collection. + * @param {string} collectionName The name of the collection. + * @return {Promise} The records. + */ +BlobRecordProvider.prototype.getAll = function(collectionName) { + return getDataForCollection(this.storageContext, collectionName) + .then(function(data) { + return data[collectionName]; + }); +}; + +/** + * Get a single record from a collection. + * @param {string} collectionName The name of the collection. + * @param {string} identifier The identifier of the record. + * @return {Promise} The record. + */ +BlobRecordProvider.prototype.get = function(collectionName, identifier) { + return this.getAll(collectionName) + .then(function(records) { + const record = records.find(function(r) { return r._id === identifier; }); + if (!record) { + return Promise.reject( + new NotFoundError('The record ' + identifier + ' in ' + collectionName + ' does not exist.') + ); + } + + return record; + }); +}; + +/** + * Create a record in a collection. + * @param {string} collectionName The name of the collection. + * @param {Object} record The record. + * @return {Promise} The record. + */ +BlobRecordProvider.prototype.create = function(collectionName, record) { + const storageContext = this.storageContext; + return this.write(storageContext, function() { + return getDataForCollection(storageContext, collectionName) + .then(function(data) { + if (!record._id) { + record._id = uuid.v4(); + } + + const index = data[collectionName].findIndex(function(r) { return r._id === record._id; }); + if (index > -1) { + return Promise.reject( + new ValidationError('The record ' + record._id + ' in ' + collectionName + ' already exists.') + ); + } + + // Add to dataset. + data[collectionName].push(record); + + // Save. + return storageContext.write(data) + .then(function() { + return record; + }); + }); + }); +}; + +/** + * Update a record in a collection. + * @param {string} collectionName The name of the collection. + * @param {string} identifier The identifier of the record to update. + * @param {Object} record The record. + * @param {boolean} upsert Flag allowing to upsert if the record does not exist. + * @return {Promise} The record. + */ +BlobRecordProvider.prototype.update = function(collectionName, identifier, record, upsert) { + const storageContext = this.storageContext; + return this.write(storageContext, function() { + return getDataForCollection(storageContext, collectionName) + .then(function(data) { + const index = data[collectionName].findIndex(function(r) { return r._id === identifier; }); + if (index < 0 && !upsert) { + throw new NotFoundError('The record ' + identifier + ' in ' + collectionName + ' does not exist.'); + } + + // Update record. + const updatedRecord = Object.assign({ _id: identifier }, index < 0 ? {} : data[collectionName][index], record); + if (index < 0) { + data[collectionName].push(updatedRecord); + } else { + data[collectionName][index] = updatedRecord; + } + + // Save. + return storageContext.write(data) + .then(function() { + return updatedRecord; + }); + }); + }); +}; + +/** + * Delete a record in a collection. + * @param {string} collectionName The name of the collection. + * @param {string} identifier The identifier of the record to update. + * @return {Promise} + */ +BlobRecordProvider.prototype.delete = function(collectionName, identifier) { + const storageContext = this.storageContext; + return this.write(storageContext, function() { + return getDataForCollection(storageContext, collectionName) + .then(function(data) { + const index = data[collectionName].findIndex(function(r) { return r._id === identifier; }); + if (index < 0) { + return false; + } + + // Remove the record. + data[collectionName].splice(index, 1); + + // Save. + return storageContext.write(data) + .then(function() { + return true; + }); + }); + }); +}; + +module.exports = BlobRecordProvider; diff --git a/server/lib/storage/contexts/FileStorageContext.js b/server/lib/storage/contexts/FileStorageContext.js new file mode 100644 index 00000000..e11418ab --- /dev/null +++ b/server/lib/storage/contexts/FileStorageContext.js @@ -0,0 +1,92 @@ +const fs = require('fs'); +const ArgumentError = require('../../errors').ArgumentError; + +/** + * Create a new FileStorageContext. + * @param {string} path The full path to the file. + * @param {Object} options The options object. + * @param {boolean} options.mergeWrites Merge the data from the local file with the new payload when writing a file. + * (defaults to `true` if options is not defined). + * @param {Object} options.defaultData The default data to use when the file does not exist or is empty. + * @constructor + */ +function FileStorageContext(path, options) { + if (path === null || path === undefined) { + throw new ArgumentError('Must provide the path to the file'); + } + + if (typeof path !== 'string' || path.length === 0) { + throw new ArgumentError('The provided path is invalid: ' + path); + } + + options = options || { mergeWrites: true }; + + this.path = path; + this.mergeWrites = options.mergeWrites; + this.defaultData = options.defaultData || {}; +} + +/** + * Read payload from the file. + * @return {Promise} The object parsed from the file. + */ +FileStorageContext.prototype.read = function() { + const ctx = this; + return new Promise(function readFileStorageContext(resolve, reject) { + fs.readFile(ctx.path, 'utf8', function(err, data) { + if (err) { + if (err.code === 'ENOENT') { + return resolve(ctx.defaultData); + } + + return reject(err); + } + try { + if (data && data.length) { + return resolve(JSON.parse(data)); + } + + return resolve(ctx.defaultData); + } catch (e) { + return reject(e); + } + }); + }); +}; + +/** + * Write payload to the file. + * @param {object} payload The object to write. + * @return {Promise} + */ +FileStorageContext.prototype.write = function(payload) { + const ctx = this; + let writePromise = Promise.resolve(payload); + + if (ctx.mergeWrites) { + writePromise = writePromise.then(function(data) { + return ctx.read() + .then(function(originalData) { + return Object.assign({}, originalData, data); + }); + }); + } + + return writePromise.then(function(data) { + return new Promise(function(resolve, reject) { + try { + return fs.writeFile(ctx.path, JSON.stringify(data, null, 2), 'utf8', function(err) { + if (err) { + return reject(err); + } + + return resolve(); + }); + } catch (e) { + return reject(e); + } + }); + }); +}; + +module.exports = FileStorageContext; diff --git a/server/lib/storage/contexts/WebtaskStorageContext.js b/server/lib/storage/contexts/WebtaskStorageContext.js new file mode 100644 index 00000000..a39f27dd --- /dev/null +++ b/server/lib/storage/contexts/WebtaskStorageContext.js @@ -0,0 +1,67 @@ +const ArgumentError = require('../../errors').ArgumentError; + +/** + * Create a new WebtaskStorageContext. + * @param {Object} storage The Webtask storage object. + * @param {Object} options The options object. + * @param {int} options.force Disregard the possibility of a conflict. + * @param {Object} options.defaultData The default data to use when the file does not exist or is empty. + * @constructor + */ +function WebtaskStorageContext(storage, options) { + if (storage === null || storage === undefined) { + throw new ArgumentError('Must provide the Webtask storage object'); + } + + options = options || { force: 1 }; + + this.storage = storage; + this.options = options; + this.defaultData = options.defaultData || {}; +} + +/** + * Read payload from Webtask storage. + * @return {Promise} The object parsed from Webtask storage. + */ +WebtaskStorageContext.prototype.read = function() { + const ctx = this; + return new Promise(function readWebtaskStorageContext(resolve, reject) { + ctx.storage.get(function(err, data) { + if (err) { + return reject(err); + } + + return resolve(data || ctx.defaultData); + }); + }); +}; + +/** + * Write data to Webtask storage. + * @param {object} data The object to write. + * @return {Promise} + */ +WebtaskStorageContext.prototype.write = function(data) { + const ctx = this; + return new Promise(function(resolve, reject) { + ctx.storage.set(data, ctx.options, function(err) { + if (err) { + return reject(err); + } + + return resolve(); + }); + }); +}; + +/** + * Perform retries on write if a webtask storage conflict is detected. + * @param {object} err The write error to examine. + * @return {boolean} + */ +WebtaskStorageContext.prototype.writeRetryCondition = function(err) { + return err.code === 409; +}; + +module.exports = WebtaskStorageContext; diff --git a/server/lib/storage/contexts/seriesQueue.js b/server/lib/storage/contexts/seriesQueue.js new file mode 100644 index 00000000..231a105b --- /dev/null +++ b/server/lib/storage/contexts/seriesQueue.js @@ -0,0 +1,26 @@ +// Helper for sequential task execution +module.exports = function seriesQueue() { + const queue = []; + let running = false; + + const next = function() { + if (queue.length === 0) { + running = false; + return; + } + + running = true; + const task = queue.shift(); + task.action(function(err, res) { + task.callback(err, res); + next(); + }); + }; + + return function(action, callback) { + queue.push({ action: action, callback: callback }); + if (!running) { + next(); + } + }; +}; diff --git a/server/lib/storage/database.js b/server/lib/storage/database.js index 379b0471..316d1471 100644 --- a/server/lib/storage/database.js +++ b/server/lib/storage/database.js @@ -1,5 +1,5 @@ import _ from 'lodash'; -import { ArgumentError, ValidationError } from 'auth0-extension-tools'; +import { ArgumentError, ValidationError } from '../errors/index.js'; import config from '../config'; const checkUnique = ( diff --git a/server/lib/storage/providers.js b/server/lib/storage/providers.js index fb2e7c5a..ab3ca46c 100644 --- a/server/lib/storage/providers.js +++ b/server/lib/storage/providers.js @@ -1,11 +1,13 @@ -import path from 'path'; -import { FileStorageContext, WebtaskStorageContext, BlobRecordProvider } from 'auth0-extension-tools'; -import { S3StorageContext } from '../tools/s3-storage-context'; +const path = require('path'); +const FileStorageContext = require('./contexts/FileStorageContext'); +const WebtaskStorageContext = require('./contexts/WebtaskStorageContext'); +const BlobRecordProvider = require('./contexts/BlobRecordProvider'); +const { S3StorageContext } = require('../tools/s3-storage-context'); -import config from '../config'; -import logger from '../logger'; +const config = require('../config'); +const logger = require('../logger'); -export function createProvider(storageContext) { +function createProvider(storageContext) { switch (config('STORAGE_TYPE')) { case 's3': { logger.info('Initializing the S3 Storage Context.'); @@ -30,3 +32,5 @@ export function createProvider(storageContext) { } } } + +module.exports = { createProvider }; diff --git a/server/lib/tools/s3-storage-context.js b/server/lib/tools/s3-storage-context.js index 1585003b..52feb94d 100644 --- a/server/lib/tools/s3-storage-context.js +++ b/server/lib/tools/s3-storage-context.js @@ -4,7 +4,7 @@ import { PutObjectCommand } from '@aws-sdk/client-s3'; -import Errors from 'auth0-extension-tools'; +import * as Errors from '../errors/index.js'; const logger = require('../logger'); diff --git a/server/lib/tools/server.js b/server/lib/tools/server.js index dd0caa6d..b5545192 100644 --- a/server/lib/tools/server.js +++ b/server/lib/tools/server.js @@ -2,12 +2,23 @@ const Boom = require('@hapi/boom'); const request = require('superagent'); -const tools = require('auth0-extension-tools'); module.exports.createServer = function(cb) { - return fromHapi(tools.createServer(cb)); + return fromHapi(createServerFactory(cb)); }; +// Create a server factory function +function createServerFactory(cb) { + return function(ctx) { + return cb( + function getConfig(key) { + return ctx && ctx.secrets ? ctx.secrets[key] : null; + }, + ctx && ctx.storage ? ctx.storage : null + ); + }; +} + const SANITIZE_RX = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g; function fromHapi(serverFactory) { diff --git a/server/plugins/handlers.js b/server/plugins/handlers.js index e934fde1..de3a1654 100644 --- a/server/plugins/handlers.js +++ b/server/plugins/handlers.js @@ -1,42 +1,43 @@ -import * as tools from 'auth0-extension-tools'; +import { ArgumentError, HookTokenError } from '../lib/errors/index.js'; import Boom from '@hapi/boom'; import config from '../lib/config'; import logger from '../lib/logger'; import mgmtCLient from './local-mgmt-client'; +import validateHookTokenFn from '../lib/auth0/validateHookToken'; const validateHookToken = (domain, webtaskUrl, extensionSecret) => { if (domain === null || domain === undefined) { - throw new tools.ArgumentError('Must provide the domain'); + throw new ArgumentError('Must provide the domain'); } if (typeof domain !== 'string' || domain.length === 0) { - throw new tools.ArgumentError(`The provided domain is invalid: ${domain}`); + throw new ArgumentError(`The provided domain is invalid: ${domain}`); } if (webtaskUrl === null || webtaskUrl === undefined) { - throw new tools.ArgumentError('Must provide the webtaskUrl'); + throw new ArgumentError('Must provide the webtaskUrl'); } if (typeof webtaskUrl !== 'string' || webtaskUrl.length === 0) { - throw new tools.ArgumentError(`The provided webtaskUrl is invalid: ${webtaskUrl}`); + throw new ArgumentError(`The provided webtaskUrl is invalid: ${webtaskUrl}`); } if (extensionSecret === null || extensionSecret === undefined) { - throw new tools.ArgumentError('Must provide the extensionSecret'); + throw new ArgumentError('Must provide the extensionSecret'); } if (typeof extensionSecret !== 'string' || extensionSecret.length === 0) { - throw new tools.ArgumentError(`The provided extensionSecret is invalid: ${extensionSecret}`); + throw new ArgumentError(`The provided extensionSecret is invalid: ${extensionSecret}`); } return hookPath => { if (hookPath === null || hookPath === undefined) { - throw new tools.ArgumentError('Must provide the hookPath'); + throw new ArgumentError('Must provide the hookPath'); } if (typeof hookPath !== 'string' || hookPath.length === 0) { - throw new tools.ArgumentError(`The provided hookPath is invalid: ${hookPath}`); + throw new ArgumentError(`The provided hookPath is invalid: ${hookPath}`); } return { @@ -46,7 +47,7 @@ const validateHookToken = (domain, webtaskUrl, extensionSecret) => { try { logger.info(`Validating hook token with signature: ${extensionSecret.substring(0, 4)}...`); - if (tools.validateHookToken(domain, webtaskUrl, hookPath, extensionSecret, token)) { + if (validateHookTokenFn(domain, webtaskUrl, hookPath, extensionSecret, token)) { return h.continue; } } catch (e) { @@ -55,7 +56,7 @@ const validateHookToken = (domain, webtaskUrl, extensionSecret) => { } } - const err = new tools.HookTokenError(`Hook token missing for the call to: ${hookPath}`); + const err = new HookTokenError(`Hook token missing for the call to: ${hookPath}`); throw Boom.unauthorized(err, 401, err.message); } }; diff --git a/server/plugins/local-mgmt-client.js b/server/plugins/local-mgmt-client.js index 1338dec9..4eef650c 100644 --- a/server/plugins/local-mgmt-client.js +++ b/server/plugins/local-mgmt-client.js @@ -1,12 +1,13 @@ -const tools = require('auth0-extension-tools'); +const { ArgumentError } = require('../lib/errors'); +const managementApi = require('../lib/auth0/managementApi'); export default function(handlerOptions) { if (!handlerOptions || typeof handlerOptions !== 'object') { - throw new tools.ArgumentError('Must provide the options'); + throw new ArgumentError('Must provide the options'); } if (typeof handlerOptions.domain !== 'string' || handlerOptions.domain.length === 0) { - throw new tools.ArgumentError('The provided domain is invalid: ' + handlerOptions.domain); + throw new ArgumentError('The provided domain is invalid: ' + handlerOptions.domain); } return { @@ -17,7 +18,7 @@ export default function(handlerOptions) { accessToken: req.auth.credentials.access_token }; - const auth0 = await tools.managementApi.getClient(options); + const auth0 = await managementApi.getClient(options); return auth0; }, assign: 'auth0' diff --git a/server/plugins/session.js b/server/plugins/session.js index 82d25d50..9239fc01 100644 --- a/server/plugins/session.js +++ b/server/plugins/session.js @@ -6,7 +6,8 @@ const Boom = require('@hapi/boom'); const path = require('path'); const crypto = require('crypto'); const jwt = require('jsonwebtoken'); -const tools = require('auth0-extension-tools'); +const { ArgumentError } = require('../lib/errors'); +const SessionManager = require('../lib/auth0/SessionManager'); const jwksRsa = require('jwks-rsa'); const { getBasePath, getBaseUrl } = require('../lib/tools/auth0-extension-hapi-tools-url-helpers'); @@ -27,66 +28,66 @@ const findCookie = function(cookie, value) { const register = async function(server, options) { if (!options || typeof options !== 'object') { - return new tools.ArgumentError('Must provide the options'); + return new ArgumentError('Must provide the options'); } if (options.onLoginSuccess === null || options.onLoginSuccess === undefined) { - return new tools.ArgumentError('Must provide a valid login callback'); + return new ArgumentError('Must provide a valid login callback'); } if (options.secret === null || options.secret === undefined) { - return new tools.ArgumentError('Must provide a valid secret'); + return new ArgumentError('Must provide a valid secret'); } if (typeof options.secret !== 'string' || options.secret.length === 0) { - return new tools.ArgumentError('The provided secret is invalid: ' + options.secret); + return new ArgumentError('The provided secret is invalid: ' + options.secret); } if (options.audience === null || options.audience === undefined) { - return new tools.ArgumentError('Must provide a valid audience'); + return new ArgumentError('Must provide a valid audience'); } if (typeof options.audience !== 'string' || options.audience.length === 0) { - return new tools.ArgumentError('The provided audience is invalid: ' + options.audience); + return new ArgumentError('The provided audience is invalid: ' + options.audience); } if (options.rta === null || options.rta === undefined) { - return new tools.ArgumentError('Must provide a valid rta'); + return new ArgumentError('Must provide a valid rta'); } if (typeof options.rta !== 'string' || options.rta.length === 0) { - return new tools.ArgumentError('The provided rta is invalid: ' + options.rta); + return new ArgumentError('The provided rta is invalid: ' + options.rta); } if (options.domain === null || options.domain === undefined) { - return new tools.ArgumentError('Must provide a valid domain'); + return new ArgumentError('Must provide a valid domain'); } if (typeof options.domain !== 'string' || options.domain.length === 0) { - return new tools.ArgumentError('The provided domain is invalid: ' + options.domain); + return new ArgumentError('The provided domain is invalid: ' + options.domain); } if (options.baseUrl === null || options.baseUrl === undefined) { - return new tools.ArgumentError('Must provide a valid base URL'); + return new ArgumentError('Must provide a valid base URL'); } if (typeof options.baseUrl !== 'string' || options.baseUrl.length === 0) { - return new tools.ArgumentError('The provided base URL is invalid: ' + options.baseUrl); + return new ArgumentError('The provided base URL is invalid: ' + options.baseUrl); } if (options.clientName === null || options.clientName === undefined) { - return new tools.ArgumentError('Must provide a valid client name'); + return new ArgumentError('Must provide a valid client name'); } if (typeof options.clientName !== 'string' || options.clientName.length === 0) { - return new tools.ArgumentError('The provided client name is invalid: ' + options.clientName); + return new ArgumentError('The provided client name is invalid: ' + options.clientName); } const stateKey = options.stateKey || 'state'; const nonceKey = options.nonceKey || 'nonce'; const urlPrefix = options.urlPrefix || ''; const sessionStorageKey = options.sessionStorageKey || 'apiToken'; - const sessionManager = options.sessionManager || new tools.SessionManager(options.rta, options.domain, options.baseUrl); + const sessionManager = options.sessionManager || new SessionManager(options.rta, options.domain, options.baseUrl); const basicCookieAttr = { isHttpOnly: true }; diff --git a/tests/unit/mocks/fetch-mock.js b/tests/unit/mocks/fetch-mock.js new file mode 100644 index 00000000..6e8cd3ac --- /dev/null +++ b/tests/unit/mocks/fetch-mock.js @@ -0,0 +1,64 @@ +// Mock fetch to work with nock +// This wraps the native fetch to work through nock's HTTP interceptors +const nock = require('nock'); + +// Store original fetch +const originalFetch = global.fetch; + +// Create a custom fetch that works with nock +global.fetch = async function(url, options = {}) { + // Convert fetch request to a format nock can intercept + const urlObj = new URL(url); + + // Check if nock has an interceptor for this request + const method = (options.method || 'GET').toUpperCase(); + const path = urlObj.pathname + urlObj.search; + + // Try to use nock's HTTP adapter instead + const http = require('http'); + const https = require('https'); + + return new Promise((resolve, reject) => { + const protocol = urlObj.protocol === 'https:' ? https : http; + const req = protocol.request({ + hostname: urlObj.hostname, + port: urlObj.port, + path: path, + method: method, + headers: options.headers || {} + }, (res) => { + let data = ''; + res.on('data', chunk => data += chunk); + res.on('end', () => { + // Convert HTTP response to fetch Response + resolve({ + ok: res.statusCode >= 200 && res.statusCode < 300, + status: res.statusCode, + statusCode: res.statusCode, + statusText: res.statusMessage, + headers: new Headers(res.headers), + json: async () => { + try { + return data ? JSON.parse(data) : null; + } catch (e) { + console.error('Failed to parse JSON:', data); + throw e; + } + }, + text: async () => data, + body: data + }); + }); + }); + + req.on('error', reject); + + if (options.body) { + req.write(typeof options.body === 'string' ? options.body : JSON.stringify(options.body)); + } + + req.end(); + }); +}; + +module.exports = global.fetch; diff --git a/tests/unit/runner.js b/tests/unit/runner.js index dd5bb965..ca89b53e 100644 --- a/tests/unit/runner.js +++ b/tests/unit/runner.js @@ -1,6 +1,14 @@ import nconf from 'nconf'; +import nock from 'nock'; import config from '../../server/lib/config'; +// Mock fetch to work with nock +require('./mocks/fetch-mock'); + +// Disable all network connections except localhost (for test server) +nock.disableNetConnect(); +nock.enableNetConnect('127.0.0.1'); + import { wellKnownEndpoint } from './mocks/tokens'; import { auth0Client } from './mocks/auth0'; diff --git a/tests/unit/server/groups-members-route.tests.js b/tests/unit/server/groups-members-route.tests.js index fb2ba721..cc3e94b5 100644 --- a/tests/unit/server/groups-members-route.tests.js +++ b/tests/unit/server/groups-members-route.tests.js @@ -81,7 +81,8 @@ describe('groups-members-route', async () => { expect(response.result.users).to.be.a('array'); expect(response.result.users[0].user_id).to.be.equal(uid); expect(response.result.users[1].user_id).to.be.equal('undefined'); - expect(response.result.users[1].name).to.be.equal(''); + // auth0 SDK v4 throws FetchError instead of APIError when user not found + expect(response.result.users[1].name).to.be.equal(''); expect(response.result.total).to.be.equal(2); }); diff --git a/tests/unit/server/s3-storage-context.tests.js b/tests/unit/server/s3-storage-context.tests.js index f527b960..8755f82c 100644 --- a/tests/unit/server/s3-storage-context.tests.js +++ b/tests/unit/server/s3-storage-context.tests.js @@ -5,7 +5,7 @@ import { sdkStreamMixin } from '@smithy/util-stream'; import { Readable } from 'stream'; import { expect } from 'chai'; -import { ArgumentError } from 'auth0-extension-tools'; +import { ArgumentError } from '../../../server/lib/errors/index.js'; import { S3StorageContext } from '../../../server/lib/tools/s3-storage-context'; From 3f67b4b663bfe43e193a88be658a6deb45c4cfb4 Mon Sep 17 00:00:00 2001 From: Tim Saunders Date: Fri, 9 Jan 2026 11:19:27 +0000 Subject: [PATCH 02/29] Build extension backend --- dist/auth0-authz.extension.2.13.2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/auth0-authz.extension.2.13.2.js b/dist/auth0-authz.extension.2.13.2.js index a5af4ace..992b242a 100644 --- a/dist/auth0-authz.extension.2.13.2.js +++ b/dist/auth0-authz.extension.2.13.2.js @@ -1,2 +1,2 @@ /*! For license information please see auth0-authz.extension.2.13.2.js.LICENSE.txt */ -"use strict";var __webpack_modules__=[(e,t,r)=>{const s=r(1),n=r(5),a=r(6),{getWebtaskUrl:i}=r(8),o=(e,t)=>{a.info("Starting Authorization Extension - Version:","2.13.2"),a.info(" > WT_URL:",e("WT_URL")),a.info(" > PUBLIC_WT_URL:",e("PUBLIC_WT_URL"));return(0,r(10).default)(e,t)};e.exports=(e,t,r)=>{((e,t,r)=>{setImmediate((()=>{t.x_wt&&t.x_wt.ectx&&t.x_wt.ectx.PUBLIC_WT_URL||n.setValue("PUBLIC_WT_URL",i(t)),s.createServer(o)(e,t,r)}))})(e,t,r)}},(e,t,r)=>{const s=r(2),n=r(3),a=r(4);e.exports.createServer=function(e){return t=a.createServer(e),async function(e,a,p){if(u=function(e){return e.read=e.secrets.EXT_STORAGE_URL?r:t,e.write=e.secrets.EXT_STORAGE_URL?i:a,e;function t(e,t,r){"function"==typeof t&&(r=t,t={}),r(s.preconditionFailed("Storage is not available in this context"))}function r(t,r,a){"function"==typeof r&&(a=r,r={}),n.get(e.secrets.EXT_STORAGE_URL).set(r.headers||{}).query({path:t}).then((e=>404===e.statusCode&&Object.hasOwnProperty.call(r,"defaultValue")?a(null,r.defaultValue):e.statusCode>=400?a(s.create(e.statusCode,e.body&&e.body.message)):a(null,e.body))).catch((e=>a(s.boomify(e,502))))}function a(e,t,r,n){"function"==typeof r&&(n=r,r={}),n(s.preconditionFailed("Storage is not available in this context"))}function i(t,r,a,i){"function"==typeof a&&(i=a,a={}),n.put(e.secrets.EXT_STORAGE_URL).set(a.headers||{}).query({path:t}).send(r).then((e=>e.statusCode>=400?i(s.create(e.statusCode,e.body&&e.body.message)):i(null))).catch((e=>i(s.boomify(e,502))))}}(e),null==r){if(!(r=await t(u)))throw new Error("Server factory did not return a server instance");r.ext("onRequest",(function(e,t){const r=function(e){if(!e.container)return null;const t=e.container.replace(i,"\\$&"),r=e.jtn?e.jtn.replace(i,"\\$&"):"";if(e.url_format===c)return new RegExp("^/api/run/"+t+"/(?:"+r+"/?)?");if(e.url_format===l)return new RegExp("^/"+t+"/(?:"+r+"/?)?");if(e.url_format===o)return new RegExp("^/(?:"+r+"/?)?");throw new Error("Unsupported webtask URL format.")}(e.raw.req.x_wt);return r&&(e.originalUrl=e.path,e.setUrl(`${e.path}${e.url.search}`.replace(r,"/"))),e.headers["x-forwarded-proto"]&&(e.headers["x-forwarded-proto"]=e.headers["x-forwarded-proto"].split(",").shift()),e.webtaskContext=u,t.continue}))}r.listener.emit("request",a,p)};var t,r,u};const i=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;const o=3,l=2,c=1},e=>{e.exports=require("@hapi/boom@10.0.1")},e=>{e.exports=require("superagent@10.2.3")},e=>{e.exports=require("auth0-extension-tools@1.5.2")},(e,t,r)=>{const s=r(4).config();e.exports=s},(e,t,r)=>{const s=r(7),n=new s.createLogger({format:s.format.json(),transports:[new s.transports.Console({level:"debug",json:!1})],exitOnError:!1});e.exports=n},e=>{e.exports=require("winston@3.10.0")},(e,t,r)=>{const s=r(9);e.exports.getBasePath=function(e){return t=e.originalUrl||"",r=e.path,(n=(n=s.parse(t).pathname||"").replace(r,"").replace(/^\/|\/$/g,"")).startsWith("/")||(n="/"+n),n.endsWith("/")||(n+="/"),n;var t,r,n},e.exports.getBaseUrl=function(e,t){const r=s.parse(e.originalUrl||"").pathname||"";return s.format({protocol:t||"https",host:e.headers.host,pathname:r.replace(e.path,"").replace(/\/$/g,"")})};const n=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports.getWebtaskUrl=function(e){const t=function(e){if(!e.container)return null;const t=e.container.replace(n,"\\$&"),r=e.jtn?e.jtn.replace(n,"\\$&"):"";if(1===e.url_format)return new RegExp("^/api/run/"+t+"/(?:"+r+"/?)?");if(2===e.url_format)return new RegExp("^/"+t+"/(?:"+r+"/?)?");if(3===e.url_format)return new RegExp("^/(?:"+r+"/?)?");throw new Error("Unsupported webtask URL format.")}(e.x_wt),r=e.url,a=e.url.replace(t,"/"),i=s.parse(a||"").pathname,o=s.parse(r||"").pathname||"";var l=s.format({protocol:"https",host:e.headers.host,pathname:o.replace(i,"").replace(/\/$/g,"")});if(e.x_wt){const t=".it.auth0.com/api/run/"+e.x_wt.container+"/",r=function(e,t){if(!e)return null;const r=e.indexOf("sandbox8")>=0?"8":"";return"https://"+t+"."+(e.split(".it.auth0.com")[0].split("-")[1]||"us")+r+".webtask.io/"}(l,e.x_wt.container);l.indexOf(t)>=0&&(l=l.replace("https://"+e.headers.host+"/api/run/"+e.x_wt.container+"/",r))}return l}},e=>{e.exports=require("url")},(e,t,r)=>{r.r(t),r.d(t,{default:()=>h});var s=r(11),n=r(5),a=r.n(n),i=r(12),o=r(17),l=r(18),c=r(22),u=r(6),p=r.n(u);const h=(e,t,r)=>{null==r&&(r=e=>{if(e){p().error("Hapi initialization failed.");const{stack:t,details:r,message:s}=e;p().error({stack:t,details:r,message:s}),p().error(e)}else p().info("Hapi initialization completed.")}),a().setProvider((t=>e(t)||{WARN_DB_SIZE:409600,MAX_MULTISELECT_USERS:5,MULTISELECT_DEBOUNCE_MS:250,PER_PAGE:10,NODE_ENV:"production",CLIENT_VERSION:"2.13.2"}[t]));const n=a()("PUBLIC_WT_URL"),u="auth0c.com"===new s.URL(n).hostname.split(".").slice(-2).join(".");return a().setValue("IS_LAYER0_TEST_SPACE",u),(0,o.init)(new i.default({provider:(0,l.createProvider)(t)})),(0,c.default)(r)}},e=>{e.exports=require("node:url")},(e,t,r)=>{r.r(t),r.d(t,{default:()=>u});var s=r(13),n=r.n(s),a=r(4),i=r(5),o=r.n(i),l=r(14).Buffer;const c=(e=[],t="Record with that identifier is already exists.",r)=>0===e.length||r&&1===e.length&&e[0]._id===r?null:Promise.reject(new a.ValidationError(t));class u{constructor(e={}){if(!e.provider)throw new a.ArgumentError("The 'provider' has to be set when initializing the database.");this.provider=e.provider}getStatus(){return o()("STORAGE_TYPE")&&"webtask"!==o()("STORAGE_TYPE")?Promise.resolve({size:null,type:o()("STORAGE_TYPE")}):this.provider.storageContext.read().then((e=>({size:l.byteLength(JSON.stringify(e),"utf8"),type:"default"})))}canChange(e,t,r){return this.provider.getAll(e).then((e=>n().filter(e,(e=>e[t]&&n().includes(e[t],r))))).then((r=>{if(r.length){const s=r.map((e=>e.name)).join(", "),n=`Unable to touch ${t} while used in ${e}: ${s}`;return Promise.reject(new a.ValidationError(n))}return Promise.resolve()}))}getApiKey(){return this.provider.getAll("configuration").then((e=>e.length?e[0].apikey:null))}updateApiKey(e){return this.provider.getAll("configuration").then((e=>e.length?e[0]:{})).then((t=>this.provider.update("configuration","v1",{...t,apikey:e},!0)))}getConfiguration(){return this.provider.getAll("configuration").then((e=>e.length?e[0]:null))}updateConfiguration(e){return this.provider.update("configuration","v1",e,!0)}getRules(){return this.provider.getAll("rules")}createRule(e){return this.provider.create("rules",e)}getPermissions(){return this.provider.getAll("permissions")}getPermission(e){return this.provider.get("permissions",e)}createPermission(e){return this.getPermissions().then((t=>c(t.filter((t=>t.name.toLowerCase()===e.name.toLowerCase()&&t.applicationId===e.applicationId)),`Permission with name "${e.name}" already exists for this application`))).then((()=>this.provider.create("permissions",e)))}updatePermission(e,t){return this.getPermissions().then((r=>c(r.filter((e=>e.name.toLowerCase()===t.name.toLowerCase()&&e.applicationId===t.applicationId)),`Permission with name "${t.name}" already exists for this application`,e))).then((()=>this.canChange("roles","permissions",e))).then((()=>this.canChange("groups","permissions",e))).then((()=>this.provider.update("permissions",e,t)))}deletePermission(e){return this.canChange("roles","permissions",e).then((()=>this.provider.delete("permissions",e)))}getRoles(){return this.provider.getAll("roles")}getRole(e){return this.provider.get("roles",e)}createRole(e){return this.getRoles().then((t=>c(t.filter((t=>t.name.toLowerCase()===e.name.toLowerCase()&&t.applicationId===e.applicationId)),`Role with name "${e.name}" already exists for this application`))).then((()=>this.provider.create("roles",e)))}updateRole(e,t){return this.getRoles().then((r=>c(r.filter((e=>e.name.toLowerCase()===t.name.toLowerCase()&&e.applicationId===t.applicationId)),`Role with name "${t.name}" already exists for this application`,e))).then((()=>this.provider.update("roles",e,t)))}deleteRole(e){return this.canChange("groups","roles",e).then((()=>this.provider.delete("roles",e)))}getGroups(){return this.provider.getAll("groups")}getGroup(e){return this.provider.get("groups",e)}createGroup(e){return this.getGroups().then((t=>c(t.filter((t=>t.name.toLowerCase()===e.name.toLowerCase())),`Group with name "${e.name}" already exists`))).then((()=>this.provider.create("groups",e)))}updateGroup(e,t){return this.getGroups().then((r=>c(r.filter((e=>e.name.toLowerCase()===t.name.toLowerCase())),`Group with name "${t.name}" already exists`,e))).then((()=>this.provider.update("groups",e,t)))}deleteGroup(e){return this.canChange("groups","nested",e).then((()=>this.provider.delete("groups",e)))}getApplications(){return this.provider.getAll("applications")}getApplication(e){return this.provider.get("applications",e)}updateApplication(e,t){return this.provider.update("applications",e,t,!0)}}},e=>{e.exports=require("lodash@4.17.21")},(e,t,r)=>{var s=r(15),n=r(16),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},t.INSPECT_MAX_BYTES=50;var i=2147483647;function o(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return p(e)}return c(e,t,r)}function c(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|m(e,t),s=o(r),n=s.write(e,t);n!==r&&(s=s.slice(0,n));return s}(e,t);if(ArrayBuffer.isView(e))return function(e){if(G(e,Uint8Array)){var t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(G(e,ArrayBuffer)||e&&G(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(G(e,SharedArrayBuffer)||e&&G(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var s=e.valueOf&&e.valueOf();if(null!=s&&s!==e)return l.from(s,t,r);var n=function(e){if(l.isBuffer(e)){var t=0|f(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||F(e.length)?o(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function p(e){return u(e),o(e<0?0:0|f(e))}function h(e){for(var t=e.length<0?0:0|f(e.length),r=o(t),s=0;s=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function m(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||G(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,s=arguments.length>2&&!0===arguments[2];if(!s&&0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return P(e).length;default:if(n)return s?-1:U(e).length;t=(""+t).toLowerCase(),n=!0}}function g(e,t,r){var s=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,r);case"utf8":case"utf-8":return $(this,t,r);case"ascii":return O(this,t,r);case"latin1":case"binary":return I(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(s)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0}}function y(e,t,r){var s=e[t];e[t]=e[r],e[r]=s}function b(e,t,r,s,n){if(0===e.length)return-1;if("string"==typeof r?(s=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),F(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=l.from(t,s)),l.isBuffer(t))return 0===t.length?-1:v(e,t,r,s,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,s,n);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,s,n){var a,i=1,o=e.length,l=t.length;if(void 0!==s&&("ucs2"===(s=String(s).toLowerCase())||"ucs-2"===s||"utf16le"===s||"utf-16le"===s)){if(e.length<2||t.length<2)return-1;i=2,o/=2,l/=2,r/=2}function c(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(n){var u=-1;for(a=r;ao&&(r=o-l),a=r;a>=0;a--){for(var p=!0,h=0;hn&&(s=n):s=n;var a=t.length;s>a/2&&(s=a/2);for(var i=0;i>8,n=r%256,a.push(n),a.push(s);return a}(t,e.length-r),e,r,s)}function S(e,t,r){return 0===t&&r===e.length?s.fromByteArray(e):s.fromByteArray(e.slice(t,r))}function $(e,t,r){r=Math.min(e.length,r);for(var s=[],n=t;n239?4:c>223?3:c>191?2:1;if(n+p<=r)switch(p){case 1:c<128&&(u=c);break;case 2:128==(192&(a=e[n+1]))&&(l=(31&c)<<6|63&a)>127&&(u=l);break;case 3:a=e[n+1],i=e[n+2],128==(192&a)&&128==(192&i)&&(l=(15&c)<<12|(63&a)<<6|63&i)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:a=e[n+1],i=e[n+2],o=e[n+3],128==(192&a)&&128==(192&i)&&128==(192&o)&&(l=(15&c)<<18|(63&a)<<12|(63&i)<<6|63&o)>65535&&l<1114112&&(u=l)}null===u?(u=65533,p=1):u>65535&&(u-=65536,s.push(u>>>10&1023|55296),u=56320|1023&u),s.push(u),n+=p}return function(e){var t=e.length;if(t<=x)return String.fromCharCode.apply(String,e);var r="",s=0;for(;ss.length?l.from(a).copy(s,n):Uint8Array.prototype.set.call(s,a,n);else{if(!l.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(s,n)}n+=a.length}return s},l.byteLength=m,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},a&&(l.prototype[a]=l.prototype.inspect),l.prototype.compare=function(e,t,r,s,n){if(G(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===s&&(s=0),void 0===n&&(n=this.length),t<0||r>e.length||s<0||n>this.length)throw new RangeError("out of range index");if(s>=n&&t>=r)return 0;if(s>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(n>>>=0)-(s>>>=0),i=(r>>>=0)-(t>>>=0),o=Math.min(a,i),c=this.slice(s,n),u=e.slice(t,r),p=0;p>>=0,isFinite(r)?(r>>>=0,void 0===s&&(s="utf8")):(s=r,r=void 0)}var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");s||(s="utf8");for(var a=!1;;)switch(s){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return A(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+s);s=(""+s).toLowerCase(),a=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var x=4096;function O(e,t,r){var s="";r=Math.min(e.length,r);for(var n=t;ns)&&(r=s);for(var n="",a=t;ar)throw new RangeError("Trying to access beyond buffer length")}function k(e,t,r,s,n,a){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function j(e,t,r,s,n,a){if(r+s>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,s,a){return t=+t,r>>>=0,a||j(e,0,r,4),n.write(e,t,r,s,23,4),r+4}function M(e,t,r,s,a){return t=+t,r>>>=0,a||j(e,0,r,8),n.write(e,t,r,s,52,8),r+8}l.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||N(e,t,this.length);for(var s=this[e],n=1,a=0;++a>>=0,t>>>=0,r||N(e,t,this.length);for(var s=this[e+--t],n=1;t>0&&(n*=256);)s+=this[e+--t]*n;return s},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);for(var s=this[e],n=1,a=0;++a=(n*=128)&&(s-=Math.pow(2,8*t)),s},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);for(var s=t,n=1,a=this[e+--s];s>0&&(n*=256);)a+=this[e+--s]*n;return a>=(n*=128)&&(a-=Math.pow(2,8*t)),a},l.prototype.readInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||N(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||N(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return e>>>=0,t||N(e,4,this.length),n.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||N(e,4,this.length),n.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||N(e,8,this.length),n.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||N(e,8,this.length),n.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,r,s){(e=+e,t>>>=0,r>>>=0,s)||k(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,a=0;for(this[t]=255&e;++a>>=0,r>>>=0,s)||k(this,e,t,r,Math.pow(2,8*r)-1,0);var n=r-1,a=1;for(this[t+n]=255&e;--n>=0&&(a*=256);)this[t+n]=e/a&255;return t+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||k(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||k(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||k(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||k(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||k(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeIntLE=function(e,t,r,s){if(e=+e,t>>>=0,!s){var n=Math.pow(2,8*r-1);k(this,e,t,r,n-1,-n)}var a=0,i=1,o=0;for(this[t]=255&e;++a>0)-o&255;return t+r},l.prototype.writeIntBE=function(e,t,r,s){if(e=+e,t>>>=0,!s){var n=Math.pow(2,8*r-1);k(this,e,t,r,n-1,-n)}var a=r-1,i=1,o=0;for(this[t+a]=255&e;--a>=0&&(i*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/i>>0)-o&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||k(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||k(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||k(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||k(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||k(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return M(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return M(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,s){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),s||0===s||(s=this.length),t>=e.length&&(t=e.length),t||(t=0),s>0&&s=this.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("sourceEnd out of bounds");s>this.length&&(s=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(i+1===s){(t-=3)>-1&&a.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&a.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function P(e){return s.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function B(e,t,r,s){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function G(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function F(e){return e!=e}var q=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var s=16*r,n=0;n<16;++n)t[s+n]=e[r]+e[n];return t}()},(e,t)=>{t.byteLength=function(e){var t=o(e),r=t[0],s=t[1];return 3*(r+s)/4-s},t.toByteArray=function(e){var t,r,a=o(e),i=a[0],l=a[1],c=new n(function(e,t,r){return 3*(t+r)/4-r}(0,i,l)),u=0,p=l>0?i-4:i;for(r=0;r>16&255,c[u++]=t>>8&255,c[u++]=255&t;2===l&&(t=s[e.charCodeAt(r)]<<2|s[e.charCodeAt(r+1)]>>4,c[u++]=255&t);1===l&&(t=s[e.charCodeAt(r)]<<10|s[e.charCodeAt(r+1)]<<4|s[e.charCodeAt(r+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t);return c},t.fromByteArray=function(e){for(var t,s=e.length,n=s%3,a=[],i=16383,o=0,c=s-n;oc?c:o+i));1===n?(t=e[s-1],a.push(r[t>>2]+r[t<<4&63]+"==")):2===n&&(t=(e[s-2]<<8)+e[s-1],a.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return a.join("")};for(var r=[],s=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)r[i]=a[i],s[a.charCodeAt(i)]=i;function o(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,s){for(var n,a,i=[],o=t;o>18&63]+r[a>>12&63]+r[a>>6&63]+r[63&a]);return i.join("")}s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63},(e,t)=>{t.read=function(e,t,r,s,n){var a,i,o=8*n-s-1,l=(1<>1,u=-7,p=r?n-1:0,h=r?-1:1,d=e[t+p];for(p+=h,a=d&(1<<-u)-1,d>>=-u,u+=o;u>0;a=256*a+e[t+p],p+=h,u-=8);for(i=a&(1<<-u)-1,a>>=-u,u+=s;u>0;i=256*i+e[t+p],p+=h,u-=8);if(0===a)a=1-c;else{if(a===l)return i?NaN:1/0*(d?-1:1);i+=Math.pow(2,s),a-=c}return(d?-1:1)*i*Math.pow(2,a-s)},t.write=function(e,t,r,s,n,a){var i,o,l,c=8*a-n-1,u=(1<>1,h=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=s?0:a-1,f=s?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,i=u):(i=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-i))<1&&(i--,l*=2),(t+=i+p>=1?h/l:h*Math.pow(2,1-p))*l>=2&&(i++,l/=2),i+p>=u?(o=0,i=u):i+p>=1?(o=(t*l-1)*Math.pow(2,n),i+=p):(o=t*Math.pow(2,p-1)*Math.pow(2,n),i=0));n>=8;e[r+d]=255&o,d+=f,o/=256,n-=8);for(i=i<0;e[r+d]=255&i,d+=f,i/=256,c-=8);e[r+d-f]|=128*m}},e=>{let t=null;e.exports.init=e=>{t=e},e.exports.getDb=()=>{if(!t)throw new Error("The database has not been initialized.");return t}},(e,t,r)=>{r.r(t),r.d(t,{createProvider:()=>p});var s=r(19),n=r.n(s),a=r(4),i=r(20),o=r(5),l=r.n(o),c=r(6),u=r.n(c);function p(e){if("s3"===l()("STORAGE_TYPE")){u().info("Initializing the S3 Storage Context.");const e=new i.S3StorageContext({path:l()("S3_PATH"),bucket:l()("S3_BUCKET"),keyId:l()("S3_KEY"),keySecret:l()("S3_SECRET"),defaultData:{}});return new a.BlobRecordProvider(e,{concurrentWrites:!1})}{u().info("Initializing the Webtask Storage Context.");const t=e?new a.WebtaskStorageContext(e,{force:0}):new a.FileStorageContext(n().join(__dirname,"../../data.json"),{mergeWrites:!0});return new a.BlobRecordProvider(t,{concurrentWrites:!1})}}},e=>{e.exports=require("path")},(e,t,r)=>{r.r(t),r.d(t,{S3StorageContext:()=>o});var s=r(21),n=r(4),a=r.n(n);const i=r(6);class o{#e=["AuthorizationHeaderMalformed","BadRequest","PermanentRedirect",301];constructor(e){if(null==e)throw new(a().ArgumentError)("The 'options' object is required when configuring the S3StorageContext.");if(!e.path||0===e.path.length)throw new(a().ArgumentError)("The 'path' property is required when configuring the S3StorageContext.");if(!e.bucket||0===e.bucket.length)throw new(a().ArgumentError)("The 'bucket' property is required when configuring the S3StorageContext.");if(!e.keyId||0===e.keyId.length)throw new(a().ArgumentError)("The 'keyId' property is required when configuring the S3StorageContext.");if(!e.keySecret||0===e.keySecret.length)throw new(a().ArgumentError)("The 'keySecret' property is required when configuring the S3StorageContext.");this.options=e,this.defaultData=e.defaultData||{},this.#t()}async read(){return this.#r((async()=>{const e={Key:this.options.path,Bucket:this.options.bucket};try{const t=await this.s3Client.send(new s.GetObjectCommand(e)),r=await(t?.Body?.transformToString());return r?JSON.parse(r):this.defaultData}catch(e){if("NoSuchKey"===e.Code)return this.defaultData;throw e}}))}async write(e){return this.#r((async()=>{const t={Key:this.options.path,Bucket:this.options.bucket,Body:JSON.stringify(e,null,2),ContentType:"application/json"};await this.s3Client.send(new s.PutObjectCommand(t))}))}async#r(e){try{return await e()}catch(t){i.info("Trying to resolve s3 bucket region...");const r=t.$response?.headers["x-amz-bucket-region"]||null,s=await this.s3Client.config.region();if(-1!==this.#e.indexOf(t.Code)&&r&&r!==s)return i.info(`Resolved following s3 bucket region: ${r}.`),this.#t(r),await e();throw t}}#t(e="us-east-1"){this.s3Client=new s.S3Client({credentials:{accessKeyId:this.options.keyId,secretAccessKey:this.options.keySecret},region:e})}}},e=>{e.exports=require("@aws-sdk/client-s3@3.738.0")},(e,t,r)=>{r.r(t),r.d(t,{default:()=>_});var s=r(23),n=r.n(s),a=r(24),i=r(95),o=r.n(i),l=r(96),c=r.n(l),u=r(97),p=r.n(u),h=r(98),d=r.n(h),f=r(5),m=r.n(f),g=r(6),y=r.n(g),b=r(138),v=r.n(b);const _=async()=>{const e={plugin:{...r(231).plugin,name:"@hapi/good"},options:{ops:{interval:3e4},reporters:{console:[]}}};e.options.reporters.console.push(new(p())({color:!!m()("LOG_COLOR")})),e.options.reporters.console.push("stdout");const t=new(n().Server)({host:"localhost",port:3e3,routes:{cors:!0}});t.validator(d());const s=[e,{plugin:{...a,name:"inert"}},{plugin:{...o(),name:"blipp"}},{plugin:{...c(),name:"jwt"}}];return await t.register([...s,...v()]),y().debug=(...e)=>{t.log(["debug"],e.join(" "))},y().info=(...e)=>{t.log(["info"],e.join(" "))},y().error=(...e)=>{t.log(["error"],e.join(" "))},t.ext("onPreResponse",((e,r)=>{const s=e.response?.statusCode??e.response?.status;return s>=400&&(e.response.output.statusCode=s,e.response.output.payload={statusCode:s,error:"APIError"===e.response.name?"Bad Request":e.response.name,message:e.response.message}),e.response&&e.response.isBoom&&(t.log(["error"],`Request: ${e.method.toUpperCase()} ${e.path}`),t.log(["error"],`Response: ${JSON.stringify(e.response,null,2)}`)),r.continue})),t}},e=>{e.exports=require("@hapi/hapi@21.3.3")},(e,t,r)=>{const s=r(25),n=r(50),a=r(80),i=r(86),o=r(83),l={schema:n.object({etagsCacheMaxSize:n.number().integer().min(0).default(1e3)}).required(),fileMethod:function(e,t={}){return void 0!==t.confine&&!0!==t.confine||(t.confine="."),s.assert(void 0===t.end||+t.start<=+t.end,"options.start must be less than or equal to options.end"),this.response(o.response(e,t,this.request))}};t.plugin={pkg:r(94),once:!0,requirements:{hapi:">=20.0.0"},register(e,t){s.assert(0===Object.keys(t).length,"Inert does not support registration options");const r=n.attempt(e.settings.plugins?.inert??{},l.schema,'Invalid "inert" server options');e.expose("_etags",r.etagsCacheMaxSize>0?new i.Cache({max:r.etagsCacheMaxSize}):null),e.decorate("handler","file",o.handler),e.decorate("handler","directory",a.handler),e.decorate("toolkit","file",l.fileMethod)}}},(e,t,r)=>{t.applyToDefaults=r(26),t.assert=r(27),t.Bench=r(35),t.block=r(36),t.clone=r(30),t.contain=r(38),t.deepEqual=r(39),t.Error=r(28),t.escapeHeaderAttribute=r(41),t.escapeHtml=r(42),t.escapeJson=r(43),t.escapeRegex=r(40),t.flatten=r(44),t.ignore=r(37),t.intersect=r(45),t.isPromise=r(46),t.merge=r(34),t.once=r(47),t.reach=r(31),t.reachTemplate=r(48),t.stringify=r(29),t.wait=r(49)},(e,t,r)=>{const s=r(27),n=r(30),a=r(34),i=r(31),o={};e.exports=function(e,t,r={}){if(s(e&&"object"==typeof e,"Invalid defaults value: must be an object"),s(!t||!0===t||"object"==typeof t,"Invalid source value: must be true, falsy or an object"),s("object"==typeof r,"Invalid options: must be an object"),!t)return null;if(r.shallow)return o.applyToDefaultsWithShallow(e,t,r);const i=n(e);if(!0===t)return i;const l=void 0!==r.nullOverride&&r.nullOverride;return a(i,t,{nullOverride:l,mergeArrays:!1})},o.applyToDefaultsWithShallow=function(e,t,r){const l=r.shallow;s(Array.isArray(l),"Invalid keys");const c=new Map,u=!0===t?null:new Set;for(let r of l){r=Array.isArray(r)?r:r.split(".");const s=i(e,r);s&&"object"==typeof s?c.set(s,u&&i(t,r)||s):u&&u.add(r)}const p=n(e,{},c);if(!u)return p;for(const e of u)o.reachCopy(p,t,e);const h=void 0!==r.nullOverride&&r.nullOverride;return a(p,t,{nullOverride:h,mergeArrays:!1})},o.reachCopy=function(e,t,r){for(const e of r){if(!(e in t))return;const r=t[e];if("object"!=typeof r||null===r)return;t=r}const s=t;let n=e;for(let e=0;e{const s=r(28);e.exports=function(e,...t){if(!e){if(1===t.length&&t[0]instanceof Error)throw t[0];throw new s(t)}}},(e,t,r)=>{const s=r(29);e.exports=class extends Error{constructor(e){super(e.filter((e=>""!==e)).map((e=>"string"==typeof e?e:e instanceof Error?e.message:s(e))).join(" ")||"Unknown error"),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t.assert)}}},e=>{e.exports=function(...e){try{return JSON.stringify(...e)}catch(e){return"[Cannot display object: "+e.message+"]"}}},(e,t,r)=>{var s=r(14).Buffer;const n=r(31),a=r(32),i=r(33),o={needsProtoHack:new Set([a.set,a.map,a.weakSet,a.weakMap])};e.exports=o.clone=function(e,t={},r=null){if("object"!=typeof e||null===e)return e;let n=o.clone,l=r;if(t.shallow){if(!0!==t.shallow)return o.cloneWithShallow(e,t);n=e=>e}else if(l){const t=l.get(e);if(t)return t}else l=new Map;const c=a.getInternalProto(e);if(c===a.buffer)return s&&s.from(e);if(c===a.date)return new Date(e.getTime());if(c===a.regex)return new RegExp(e);const u=o.base(e,c,t);if(u===e)return e;if(l&&l.set(e,u),c===a.set)for(const r of e)u.add(n(r,t,l));else if(c===a.map)for(const[r,s]of e)u.set(r,n(s,t,l));const p=i.keys(e,t);for(const r of p){if("__proto__"===r)continue;if(c===a.array&&"length"===r){u.length=e.length;continue}const s=Object.getOwnPropertyDescriptor(e,r);s?s.get||s.set?Object.defineProperty(u,r,s):s.enumerable?u[r]=n(e[r],t,l):Object.defineProperty(u,r,{enumerable:!1,writable:!0,configurable:!0,value:n(e[r],t,l)}):Object.defineProperty(u,r,{enumerable:!0,writable:!0,configurable:!0,value:n(e[r],t,l)})}return u},o.cloneWithShallow=function(e,t){const r=t.shallow;(t=Object.assign({},t)).shallow=!1;const s=new Map;for(const t of r){const r=n(e,t);"object"!=typeof r&&"function"!=typeof r||s.set(r,r)}return o.clone(e,t,s)},o.base=function(e,t,r){if(!1===r.prototype)return o.needsProtoHack.has(t)?new t.constructor:t===a.array?[]:{};const s=Object.getPrototypeOf(e);if(s&&s.isImmutable)return e;if(t===a.array){const e=[];return s!==t&&Object.setPrototypeOf(e,s),e}if(o.needsProtoHack.has(t)){const e=new s.constructor;return s!==t&&Object.setPrototypeOf(e,s),e}return Object.create(s)}},(e,t,r)=>{const s=r(27),n={};e.exports=function(e,t,r){if(!1===t||null==t)return e;"string"==typeof(r=r||{})&&(r={separator:r});const a=Array.isArray(t);s(!a||!r.separator,"Separator option is not valid for array-based chain");const i=a?t:t.split(r.separator||".");let o=e;for(let e=0;e{var s=r(14).Buffer;const n={};t=e.exports={array:Array.prototype,buffer:s&&s.prototype,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},n.typeMap=new Map([["[object Error]",t.error],["[object Map]",t.map],["[object Promise]",t.promise],["[object Set]",t.set],["[object WeakMap]",t.weakMap],["[object WeakSet]",t.weakSet]]),t.getInternalProto=function(e){if(Array.isArray(e))return t.array;if(s&&e instanceof s)return t.buffer;if(e instanceof Date)return t.date;if(e instanceof RegExp)return t.regex;if(e instanceof Error)return t.error;const r=Object.prototype.toString.call(e);return n.typeMap.get(r)||t.generic}},(e,t)=>{t.keys=function(e,t={}){return!1!==t.symbols?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}},(e,t,r)=>{var s=r(14).Buffer;const n=r(27),a=r(30),i=r(33),o={};e.exports=o.merge=function(e,t,r){if(n(e&&"object"==typeof e,"Invalid target value: must be an object"),n(null==t||"object"==typeof t,"Invalid source value: must be null, undefined, or an object"),!t)return e;if(r=Object.assign({nullOverride:!0,mergeArrays:!0},r),Array.isArray(t)){n(Array.isArray(e),"Cannot merge array onto an object"),r.mergeArrays||(e.length=0);for(let s=0;s{const t={};e.exports=t.Bench=class{constructor(){this.ts=0,this.reset()}reset(){this.ts=t.Bench.now()}elapsed(){return t.Bench.now()-this.ts}static now(){const e=process.hrtime();return 1e3*e[0]+e[1]/1e6}}},(e,t,r)=>{const s=r(37);e.exports=function(){return new Promise(s)}},e=>{e.exports=function(){}},(e,t,r)=>{const s=r(27),n=r(39),a=r(40),i=r(33),o={};e.exports=function(e,t,r={}){return"object"!=typeof t&&(t=[t]),s(!Array.isArray(t)||t.length,"Values array cannot be empty"),"string"==typeof e?o.string(e,t,r):Array.isArray(e)?o.array(e,t,r):(s("object"==typeof e,"Reference must be string or an object"),o.object(e,t,r))},o.array=function(e,t,r){if(Array.isArray(t)||(t=[t]),!e.length)return!1;if(r.only&&r.once&&e.length!==t.length)return!1;let s;const n=new Map;for(const e of t)if(r.deep&&e&&"object"==typeof e){s=s||o.compare(r);let t=!1;for(const[r,a]of n.entries())if(s(r,e)){++a.allowed,t=!0;break}t||n.set(e,{allowed:1,hits:0})}else{const t=n.get(e);t?++t.allowed:n.set(e,{allowed:1,hits:0})}let a=0;for(const t of e){let e;if(r.deep&&t&&"object"==typeof t){s=s||o.compare(r);for(const[r,a]of n.entries())if(s(r,t)){e=a;break}}else e=n.get(t);if(e&&(++e.hits,++a,r.once&&e.hits>e.allowed))return!1}if(r.only&&a!==e.length)return!1;for(const e of n.values())if(e.hits!==e.allowed&&e.hitst.propertyIsEnumerable(e))),l=[...Object.keys(t),...a],c=o.compare(r),u=new Set(l);for(const s of n)if(u.has(s)){if(!c(t[s],e[s]))return!1;u.delete(s)}else if(r.only)return!1;return!u.size||!!r.part&&u.size""!==e));const n=new Map,i=[];for(const e of t)if(s("string"==typeof e,"Cannot compare string reference to non-string value"),e){const t=n.get(e);t?++t.allowed:(n.set(e,{allowed:1,hits:0}),i.push(a(e)))}else if(r.once||r.only)return!1;if(!i.length)return!0;const o=new RegExp(`(${i.join("|")})`,"g"),l=e.replace(o,((e,t)=>(++n.get(t).hits,"")));if(r.only&&l)return!1;let c=!1;for(const e of n.values())if(e.hits&&(c=!0),e.hits!==e.allowed){if(e.hitsn(e,t,s)},o.shallow=function(e,t){return e===t}},(e,t,r)=>{var s=r(14).Buffer;const n=r(32),a={mismatched:null};e.exports=function(e,t,r){return r=Object.assign({prototype:!0},r),!!a.isDeepEqual(e,t,r,[])},a.isDeepEqual=function(e,t,r,i){if(e===t)return 0!==e||1/e==1/t;const o=typeof e;if(o!==typeof t)return!1;if(null===e||null===t)return!1;if("function"===o){if(!r.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==o)return e!=e&&t!=t;const l=a.getSharedType(e,t,!!r.prototype);switch(l){case n.buffer:return s&&s.prototype.equals.call(e,t);case n.promise:return e===t;case n.regex:return e.toString()===t.toString();case a.mismatched:return!1}for(let r=i.length-1;r>=0;--r)if(i[r].isSame(e,t))return!0;i.push(new a.SeenEntry(e,t));try{return!!a.isDeepEqualObj(l,e,t,r,i)}finally{i.pop()}},a.getSharedType=function(e,t,r){if(r)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?a.mismatched:n.getInternalProto(e);const s=n.getInternalProto(e);return s!==n.getInternalProto(t)?a.mismatched:s},a.valueOf=function(e){const t=e.valueOf;if(void 0===t)return e;try{return t.call(e)}catch(e){return e}},a.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)},a.isSetSimpleEqual=function(e,t){for(const r of Set.prototype.values.call(e))if(!Set.prototype.has.call(t,r))return!1;return!0},a.isDeepEqualObj=function(e,t,r,s,i){const{isDeepEqual:o,valueOf:l,hasOwnEnumerableProperty:c}=a,{keys:u,getOwnPropertySymbols:p}=Object;if(e===n.array){if(!s.part){if(t.length!==r.length)return!1;for(let e=0;e{e.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},(e,t,r)=>{const s=r(27);e.exports=function(e){return s(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(e),"Bad attribute value ("+e+")"),e.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')}},e=>{const t={};e.exports=function(e){if(!e)return"";let r="";for(let s=0;s=256)return"&#"+e+";";return`&#x${e.toString(16).padStart(2,"0")};`},t.isSafe=function(e){return t.safeCharCodes.has(e)},t.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]),t.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&e.add(t);return e}()},e=>{const t={};e.exports=function(e){return e?e.replace(/[<>&\u2028\u2029]/g,t.escape):""},t.escape=function(e){return t.replacements.get(e)},t.replacements=new Map([["<","\\u003c"],[">","\\u003e"],["&","\\u0026"],["\u2028","\\u2028"],["\u2029","\\u2029"]])},e=>{const t={};e.exports=t.flatten=function(e,r){const s=r||[];for(const r of e)Array.isArray(r)?t.flatten(r,s):s.push(r);return s}},e=>{const t={};e.exports=function(e,r,s={}){if(!e||!r)return s.first?null:[];const n=[],a=Array.isArray(e)?new Set(e):e,i=new Set;for(const e of r)if(t.has(a,e)&&!i.has(e)){if(s.first)return e;n.push(e),i.add(e)}return s.first?null:n},t.has=function(e,t){return"function"==typeof e.has?e.has(t):void 0!==e[t]}},e=>{e.exports=function(e){return!!e&&"function"==typeof e.then}},e=>{const t=Symbol("wrapped");e.exports=function(e){if(e[t])return e;let r=!1;const s=function(...t){r||(r=!0,e(...t))};return s[t]=!0,s}},(e,t,r)=>{const s=r(31);e.exports=function(e,t,r){return t.replace(/{([^{}]+)}/g,((t,n)=>{const a=s(e,n,r);return null==a?"":a}))}},e=>{const t=2**31-1;e.exports=function(e,r,s){if("bigint"==typeof e&&(e=Number(e)),e>=Number.MAX_SAFE_INTEGER&&(e=1/0),"number"!=typeof e&&void 0!==e)throw new TypeError("Timeout must be a number or bigint");return new Promise((n=>{const a=s?s.setTimeout:setTimeout,i=()=>{const s=Math.min(e,t);e-=s,a((()=>e>0?i():n(r)),s)};e!==1/0&&i()}))}},(e,t,r)=>{var s=r(14).Buffer;const n=r(27),a=r(30),i=r(51),o=r(57),l=r(58),c=r(56),u={types:{alternatives:r(60),any:r(61),array:r(68),boolean:r(69),date:r(70),function:r(71),link:r(74),number:r(75),object:r(76),string:r(77),symbol:r(78)},aliases:{alt:"alternatives",bool:"boolean",func:"function"}};s&&(u.types.binary=r(79)),u.root=function(){const e={_types:new Set(Object.keys(u.types))};for(const t of e._types)e[t]=function(...e){return n(!e.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),u.generate(this,u.types[t],e)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(...e){return this.any()[t](...e)};Object.assign(e,u.methods);for(const t in u.aliases){const r=u.aliases[t];e[t]=e[r]}return e},u.methods={ValidationError:l.ValidationError,version:i.version,assert(e,t,...r){u.assert(e,t,!0,r)},attempt:(e,t,...r)=>u.assert(e,t,!1,r),checkPreferences(e){i.checkPreferences(e)},compile(e,t){return o.compile(this,e,t)},isError:l.ValidationError.isError,isRef:c.isRef,isSchema:i.isSchema,in:(...e)=>c.in(...e),override:i.symbols.override,ref:(...e)=>c.create(...e)},u.assert=function(e,t,r,s){const n=s[0]instanceof Error||"string"==typeof s[0]?s[0]:null,o=n?s[1]:s[0],c=t.validate(e,i.preferences({errors:{stack:!0}},o||{}));let u=c.error;if(!u)return c.value;if(n instanceof Error)throw n;const p=r&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof l.ValidationError==!1&&(u=a(u)),u.message=n?`${n} ${p}`:p,u},u.generate=function(e,t,r){return n(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&r.length?t._definition.args(t,...r):t},e.exports=u.root()},(e,t,r)=>{const s=r(27),n=r(28),a=r(52);let i,o;const l={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};t.version=a.version,t.defaults={abortEarly:!0,allowUnknown:!1,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1},t.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},t.assertOptions=function(e,t,r="Options"){s(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const n=Object.keys(e).filter((e=>!t.includes(e)));s(0===n.length,`${r} contain unknown keys: ${n}`)},t.checkPreferences=function(e){o=o||r(53);const t=o.preferences.validate(e);if(t.error)throw new n([t.error.details[0].message])},t.compare=function(e,t,r){switch(r){case"=":return e===t;case">":return e>t;case"<":return e=":return e>=t;case"<=":return e<=t}},t.default=function(e,t){return void 0===e?t:e},t.isIsoDate=function(e){return l.isoDate.test(e)},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.isResolvable=function(e){return!!e&&(e[t.symbols.ref]||e[t.symbols.template])},t.isSchema=function(e,r={}){return!(!e||!e[t.symbols.any])},t.limit=function(e){return Number.isSafeInteger(e)&&e>=0},t.preferences=function(e,s){i=i||r(54),e=e||{},s=s||{};const n=Object.assign({},e,s);return s.errors&&e.errors&&(n.errors=Object.assign({},e.errors,s.errors),n.errors.wrap=Object.assign({},e.errors.wrap,s.errors.wrap)),s.messages&&(n.messages=i.compile(s.messages,e.messages)),delete n[t.symbols.prefs],n},t.tryWithPath=function(e,t,r={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,r.append&&(e.message=`${e.message} (${e.path})`),e}},t.validateArg=function(e,r,{assert:s,message:n}){if(t.isSchema(s)){const t=s.validate(e);if(!t.error)return;return t.error.message}if(!s(e))return r?`${r} ${n}`:n},t.verifyFlat=function(e,t){for(const r of e)s(!Array.isArray(r),"Method no longer accepts array arguments:",t)}},e=>{e.exports=JSON.parse('{"name":"@hapi/validate","description":"Object schema validation","version":"1.1.3","repository":"git://github.com/hapijs/validate","main":"lib/index.js","files":["lib/**/*"],"dependencies":{"@hapi/hoek":"^9.0.0","@hapi/topo":"^5.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/lab":"24.x.x"},"scripts":{"test":"lab -t 100 -a @hapi/code -L","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause"}')},(e,t,r)=>{const s=r(50),n={};n.wrap=s.string().min(1).max(2).allow(!1),t.preferences=s.object({allowUnknown:s.boolean(),abortEarly:s.boolean(),context:s.object(),convert:s.boolean(),dateFormat:s.valid("date","iso","string","time","utc"),errors:{escapeHtml:s.boolean(),label:s.valid("path","key",!1),language:[s.string(),s.object().ref()],render:s.boolean(),stack:s.boolean(),wrap:{label:n.wrap,array:n.wrap}},messages:s.object(),noDefaults:s.boolean(),nonEnumerables:s.boolean(),presence:s.valid("required","optional","forbidden"),skipFunctions:s.boolean(),stripUnknown:s.object({arrays:s.boolean(),objects:s.boolean()}).or("arrays","objects").allow(!0,!1)}).strict()},(e,t,r)=>{const s=r(27),n=r(30),a=r(55);t.compile=function(e,t){if("string"==typeof e)return s(!t,"Cannot set single message string"),new a(e);if(a.isTemplate(e))return s(!t,"Cannot set single message template"),e;s("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?n(t):{};for(let r in e){const n=e[r];if("root"===r||a.isTemplate(n)){t[r]=n;continue}if("string"==typeof n){t[r]=new a(n);continue}s("object"==typeof n&&!Array.isArray(n),"Invalid message for",r);const i=r;for(r in t[i]=t[i]||{},n){const e=n[r];"root"===r||a.isTemplate(e)?t[i][r]=e:(s("string"==typeof e,"Invalid message for",r,"in",i),t[i][r]=new a(e))}}return t},t.merge=function(e,r){if(!e)return t.compile(r);if(!r)return e;if("string"==typeof r)return new a(r);if(a.isTemplate(r))return r;const i=n(e);for(let e in r){const t=r[e];if("root"===e||a.isTemplate(t)){i[e]=t;continue}if("string"==typeof t){i[e]=new a(t);continue}s("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const n=e;for(e in i[n]=i[n]||{},t){const r=t[e];"root"===e||a.isTemplate(r)?i[n][e]=r:(s("string"==typeof r,"Invalid message for",e,"in",n),i[n][e]=new a(r))}}return i}},(e,t,r)=>{const s=r(27),n=r(30),a=r(42),i=r(51),o=r(56),l={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};e.exports=l.Template=class{constructor(e,t){s("string"==typeof e,"Template source must be a string"),s(!e.includes("\0")&&!e.includes(""),"Template source cannot contain reserved control characters"),this.source=e,this.rendered=e,this._template=null,this._settings=n(t),this._parse()}_parse(){if(!this.source.includes("{"))return;const e=l.encode(this.source),t=l.split(e),r=[],s=t.shift();s&&r.push(s);for(const e of t){const t="{"!==e[0],s=t?"}":"}}",n=e.indexOf(s);let a=e.slice(t?0:1,n);const i=":"===a[0];i&&(a=a.slice(1));const o=this._ref(l.decode(a),{raw:t,wrapped:i});r.push(o);const c=e.slice(n+s.length);c&&r.push(l.decode(c))}this._template=r}static date(e,t){return l.dateFormat[t.dateFormat].call(e)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[i.symbols.template]}render(e,t,r,s,n={}){if(!this.isDynamic())return this.rendered;const i=[];for(const o of this._template)if("string"==typeof o)i.push(o);else{const c=o.ref.resolve(e,t,r,s,n),u=l.stringify(c,r,n.errors),p=o.raw||!1===(n.errors&&n.errors.escapeHtml)?u:a(u);i.push(l.wrap(p,o.wrapped&&r.errors.wrap.label))}return i.join("")}_ref(e,{raw:t,wrapped:r}){const s=o.create(e,this._settings);return{ref:s,raw:t,wrapped:r||"local"===s.type&&"label"===s.key}}toString(){return this.source}},l.Template.prototype[i.symbols.template]=!0,l.Template.prototype.isImmutable=!0,l.encode=function(e){return e.replace(/\\(\{+)/g,((e,t)=>l.opens.slice(0,t.length))).replace(/\\(\}+)/g,((e,t)=>l.closes.slice(0,t.length)))},l.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},l.split=function(e){const t=[];let r="";for(let s=0;s ${s.toString()}`);e=t}if(!Array.isArray(e))return e.toString();let n="";for(const s of e)n=n+(n.length?", ":"")+l.stringify(s,t,r);return l.wrap(n,t.errors.wrap.array)}},(e,t,r)=>{const s=r(27),n=r(30),a=r(31),i=r(51),o={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e,t={}){s("string"==typeof e,"Invalid reference key:",e),i.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","separator"]),s(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const r=Object.assign({},o.defaults,t);delete r.prefix;const n=r.separator,a=o.context(e,n,t.prefix);if(r.type=a.type,e=a.key,"value"===r.type)if(a.root&&(s(!n||e[0]!==n,"Cannot specify relative path with root prefix"),r.ancestor="root",e||(e=null)),n&&n===e)e=null,r.ancestor=0;else if(void 0!==r.ancestor)s(!n||!e||e[0]!==n,"Cannot combine prefix with ancestor option");else{const[t,s]=o.ancestor(e,n);s&&""===(e=e.slice(s))&&(e=null),r.ancestor=t}return r.path=n?null===e?[]:e.split(n):[e],new o.Ref(r)},t.in=function(e,r={}){return t.create(e,Object.assign({},r,{in:!0}))},t.isRef=function(e){return!!e&&!!e[i.symbols.ref]},o.Ref=class{constructor(e){s("object"==typeof e,"Invalid reference construction"),i.assertOptions(e,["adjust","ancestor","in","iterables","map","path","separator","type","depth","key","root","display"]),s([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),s(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),s(!e.map||Array.isArray(e.map),"options.map must be an array"),s(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,o.defaults,e),s("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,t,r,n,a={}){return s(!this.in||a.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(r.context,t,a):"local"===this.type?this._resolve(n,t,a):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,a):(s(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,a)):this._resolve(e,t,a)}_resolve(e,t,r){let s;if("value"===this.type&&t.mainstay.shadow&&!1!==r.shadow&&(s=t.mainstay.shadow.get(this.absolute(t))),void 0===s&&(s=a(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(s=this.adjust(s)),this.map){const e=this.map.get(s);void 0!==e&&(s=e)}return s}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new o.Ref(this)}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display=`ref:${this.type}:${e}`);if(!this.separator)return void(this.display=`ref:${e}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${e}`);if("root"===this.ancestor)return void(this.display=`ref:root:${e}`);if(1===this.ancestor)return void(this.display=`ref:${e||".."}`);const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${t}${e||""}`}},o.Ref.prototype[i.symbols.ref]=!0,o.context=function(e,t,r={}){if(e=e.trim(),r){const s=void 0===r.global?"$":r.global;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"global"};const n=void 0===r.local?"#":r.local;if(n!==t&&e.startsWith(n))return{key:e.slice(n.length),type:"local"};const a=void 0===r.root?"/":r.root;if(a!==t&&e.startsWith(a))return{key:e.slice(a.length),type:"value",root:!0}}return{key:e,type:"value"}},o.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let r=2;for(;e[r]===t;)++r;return[r-1,r]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,r){if(e)if(r=void 0===r?t.toParent:r,Array.isArray(e))for(const t of e)this.register(t,r);else if(i.isSchema(e))for(const t of e._refs.refs)t.ancestor-r>=0&&this.refs.push({ancestor:t.ancestor-r,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-r>=0&&this.refs.push({ancestor:e.ancestor-r,root:e.root})}clone(){const e=new t.Manager;return e.refs=n(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter((e=>!e.ancestor)).map((e=>e.root))}}},(e,t,r)=>{const s=r(27),n=r(51),a=r(56),i={};t.schema=function(e,t,r={}){n.assertOptions(r,["appendPath","override"]);try{return i.schema(e,t,r)}catch(e){throw r.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},i.schema=function(e,t,r){s(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(s(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const a=(t,...s)=>!1!==r.override?t.valid(e.override,...s):t.valid(...s);if(i.simple(t))return a(e,t);if("function"==typeof t)return e.custom(t);if(s("object"==typeof t,"Invalid schema content:",typeof t),n.isResolvable(t))return a(e,t);if(n.isSchema(t))return t;if(Array.isArray(t)){for(const r of t)if(!i.simple(r))return e.alternatives().try(...t);return a(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?a(e.date(),t):(s(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return a.isRef(e)?e:a.create(e,t)},t.compile=function(e,r){const a=r&&r[n.symbols.any];return a?(s(a.version===n.version,"Cannot mix different versions of joi schemas:",a.version,n.version),r):t.schema(e,r,{appendPath:!0})},i.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,r,o){if(void 0===o&&(s(r&&"object"==typeof r,"Missing options"),o=r,r=a.create(".")),Array.isArray(o)&&(o={switch:o}),n.assertOptions(o,["is","not","then","otherwise","switch","break"]),n.isSchema(r))return s(void 0===o.is,'"is" can not be used with a schema condition'),s(void 0===o.not,'"not" can not be used with a schema condition'),s(void 0===o.switch,'"switch" can not be used with a schema condition'),i.condition(e,{is:r,then:o.then,otherwise:o.otherwise,break:o.break});if(s(a.isRef(r)||"string"==typeof r,"Invalid condition:",r),s(void 0===o.not||void 0===o.is,'Cannot combine "is" with "not"'),void 0===o.switch){let l=o;void 0!==o.not&&(l={is:o.not,then:o.otherwise,otherwise:o.then,break:o.break});let c=void 0!==l.is?e.$_compile(l.is):e.$_root.invalid(null,!1,0,"").required();return s(void 0!==l.then||void 0!==l.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),s(void 0===l.break||void 0===l.then||void 0===l.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===o.is||a.isRef(o.is)||n.isSchema(o.is)||(c=c.required()),i.condition(e,{ref:t.ref(r),is:c,then:l.then,otherwise:l.otherwise,break:l.break})}s(Array.isArray(o.switch),'"switch" must be an array'),s(void 0===o.is,'Cannot combine "switch" with "is"'),s(void 0===o.not,'Cannot combine "switch" with "not"'),s(void 0===o.then,'Cannot combine "switch" with "then"');const l={ref:t.ref(r),switch:[],break:o.break};for(let t=0;t{const s=r(59),n=r(51),a=r(55);t.Report=class{constructor(e,r,s,n,a,i,o){if(this.code=e,this.flags=n,this.messages=a,this.path=i.path,this.prefs=o,this.state=i,this.value=r,this.message=null,this.local=s||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?`Error code "${e}" is not defined, your custom type is missing the correct messages definition`:(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(e){return t.template(this.value,e,this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const r of e)"object"!=typeof r&&("string"==typeof r?(t&&(t+="."),t+=r):t+=`[${r}]`);return t},t.template=function(e,t,r,s,i){if(a.isTemplate(t))return"root"!==r?t:null;let o=i.errors.language;return n.isResolvable(o)&&(o=o.resolve(e,s,i)),o&&t[o]&&void 0!==t[o][r]?t[o][r]:t[r]},t.label=function(e,r,s,n){if(!s.errors.label)return"";let a=r.path;"key"===s.errors.label&&r.path.length>1&&(a=r.path.slice(-1));const i=t.path(a);return i||(t.template(null,s.messages,"root",r,s)||t.template(null,n,"root",r,s)||"value")},t.process=function(e,r,s){if(!e)return null;const{override:n,message:a,details:i}=t.details(e);if(n)return n;if(s.errors.stack)return new t.ValidationError(a,i,r);const o=Error.stackTraceLimit;Error.stackTraceLimit=0;const l=new t.ValidationError(a,i,r);return Error.stackTraceLimit=o,l},t.details=function(e,t={}){let r=[];const s=[];for(const n of e){if(n instanceof Error){if(!1!==t.override)return{override:n};const e=n.toString();r.push(e),s.push({message:e,type:"override",context:{error:n}});continue}const e=n.toString();r.push(e),s.push({message:e,path:n.path.filter((e=>"object"!=typeof e)),type:n.code,context:n.local})}return r.length>1&&(r=[...new Set(r)]),{message:r.join(". "),details:s}},t.ValidationError=class extends Error{constructor(e,t,r){super(e),this._original=r,this.details=t}static isError(e){return e instanceof t.ValidationError}},t.ValidationError.prototype.isJoi=!0,t.ValidationError.prototype.name="ValidationError",t.ValidationError.prototype.annotate=s.error},(e,t,r)=>{const s=r(30),n=r(51),a={annotations:Symbol("annotations")};t.error=function(e){if(!this._original||"object"!=typeof this._original)return this.details[0].message;const t=e?"":"",r=e?"":"",i=e?"":"",o=s(this._original);for(let e=this.details.length-1;e>=0;--e){const t=e+1,r=this.details[e],s=r.path;let i=o;for(let e=0;;++e){const o=s[e];if(n.isSchema(i)&&(i=i.clone()),!(e+1`" ${t}[${r}]${i}`)).replace(c,((e,s,n)=>`${r}"${s}"${i}${t} [${n}]: -- missing --${i}`)).replace(u,((e,r,s)=>`\n${s} ${t}[${r}]${i}`)).replace(p,((e,t)=>t));h=`${h}\n${t}`;for(let e=0;et[0]===s?"[Circular ~]":"[Circular ~."+e.slice(0,t.indexOf(s)).join(".")+"]";return function(s,n){if(t.length>0){const a=t.indexOf(this);~a?(t.length=a+1,e.length=a+1,e[a]=s):(t.push(this),e.push(s)),~t.indexOf(n)&&(n=r.call(this,s,n))}else t.push(n);if(n){const e=n[a.annotations];if(e){if(Array.isArray(n)){const t=[];for(let r=0;r{const s=r(27),n=r(61),a=r(51),i=r(57),o=r(58),l=r(56),c={};e.exports=n._extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:l.toSibling}},args:(e,...t)=>1===t.length&&Array.isArray(t[0])?e.try(...t[0]):e.try(...t),validate(e,t){const{schema:r,error:s,state:n,prefs:a}=t;if(r._flags.match){let t,i=0;for(let s=0;s{a.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),c.errors=function(e,{error:t,state:r}){if(!e.length)return{errors:t("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const s=new Set,n=[];for(const{reports:a,schema:i}of e){if(a.length>1)return c.unmatched(e,t);const l=a[0];if(l instanceof o.Report==!1)return c.unmatched(e,t);if(l.state.path.length!==r.path.length){n.push({type:i.type,report:l});continue}if("any.only"===l.code){for(const e of l.local.valids)s.add(e);continue}const[u,p]=l.code.split(".");"base"===p?s.add(u):n.push({type:i.type,report:l})}return n.length?1===n.length?{errors:n[0].report}:c.unmatched(e,t):{errors:t("alternatives.types",{types:[...s]})}},c.unmatched=function(e,t){const r=[];for(const t of e)r.push(...t.reports);return{errors:t("alternatives.match",o.details(r,{override:!1}))}}},(e,t,r)=>{const s=r(27),n=r(62),a=r(51);e.exports=n._extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(e,t){return s("function"==typeof e,"Method must be a function"),s(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:e,description:t}})},validate(e,t,{method:r}){try{return r(e,t)}catch(e){return t.error("any.custom",{error:e})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(e){s(a.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const t=this.clone();return t.$_terms.shared=t.$_terms.shared||[],t.$_terms.shared.push(e),t.$_mutateRegister(e),t}}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":"{{#label}} must be one of {{#valids}}","any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},(e,t,r)=>{const s=r(27),n=r(30),a=r(39),i=r(34),o=r(51),l=r(57),c=r(58),u=r(63),p=r(54),h=r(64),d=r(56),f=r(65),m=r(67),g={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._ids=new h.Ids,this._preferences=null,this._refs=new d.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={whens:{}}}allow(...e){return o.verifyFlat(e,"allow"),this._values(e,"_valids")}cast(e){return s(!1===e||"string"==typeof e,"Invalid to value"),s(!1===e||this._definition.cast[e],"Type",this.type,"does not support casting to",e),this.$_setFlag("cast",!1===e?void 0:e)}default(e,t){return this._default("default",e,t)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(e){return s(e,"Missing error"),s(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(e){return e?(s("string"==typeof e,"id must be a non-empty string"),s(/^[^\.]+$/.test(e),"id cannot contain period character"),this.$_setFlag("id",e)):this.$_setFlag("id",void 0)}invalid(...e){return this._values(e,"_invalids")}only(e=!0){return s("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){s(e,"Missing preferences"),s(void 0===e.context,"Cannot override context"),o.checkPreferences(e);const t=this.clone();return t._preferences=o.preferences(t._preferences,e),t}presence(e){return s(["optional","required","forbidden"].includes(e),"Unknown presence mode",e),this.$_setFlag("presence",e)}raw(e=!0){return this.$_setFlag("result",e?"raw":void 0)}required(){return this.presence("required")}strict(e){const t=this.clone(),r=void 0!==e&&!e;return t._preferences=o.preferences(t._preferences,{convert:r}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}valid(...e){o.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(e,t){const r=this.clone();r.$_terms.whens||(r.$_terms.whens=[]);const n=l.when(r,e,t);if(!["any","link"].includes(r.type)){const e=n.is?[n]:n.switch;for(const t of e)s(!t.then||"any"===t.then.type||t.then.type===r.type,"Cannot combine",r.type,"with",t.then&&t.then.type),s(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===r.type,"Cannot combine",r.type,"with",t.otherwise&&t.otherwise.type)}return r.$_terms.whens.push(n),r.$_mutateRebuild()}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){s(o.isSchema(e),"Invalid schema object"),s("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type);let t=this.clone();if("any"===this.type&&"any"!==e.type){const r=e.clone();for(const e of Object.keys(t))"type"!==e&&(r[e]=t[e]);t=r}t._ids.concat(e._ids),t._refs.register(e,d.toSibling),t._preferences=t._preferences?o.preferences(t._preferences,e._preferences):e._preferences,t._valids=m.merge(t._valids,e._valids,e._invalids),t._invalids=m.merge(t._invalids,e._invalids,e._valids);for(const r of e._singleRules.keys())t._singleRules.has(r)&&(t._rules=t._rules.filter((e=>e.name!==r)),t._singleRules.delete(r));for(const r of e._rules)e._definition.rules[r.method].multi||t._singleRules.set(r.name,r),t._rules.push(r);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const r=Object.assign({},e._flags);delete r.empty,i(t._flags,r)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const r=Object.assign({},e._flags);delete r.empty,i(t._flags,r)}else i(t._flags,e._flags);for(const r in e.$_terms){const s=e.$_terms[r];s?t.$_terms[r]?t.$_terms[r]=t.$_terms[r].concat(s):t.$_terms[r]=s.slice():t.$_terms[r]||(t.$_terms[r]=s)}return t.$_mutateRebuild()}validate(e,t){return f.entry(e,this,t)}validateAsync(e,t){const r=this.validate(e,t);if(r.error)throw r.error;return r.value}$_addRule(e){"string"==typeof e&&(e={name:e}),s(e&&"object"==typeof e,"Invalid options"),s(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)s("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const r=this._definition.rules[t.method],n=t.args;s(r,"Unknown rule",t.method);const a=this.clone();if(n){s(1===Object.keys(n).length||Object.keys(n).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in n){let i=n[e];if(void 0!==i){if(r.argsByName){const l=r.argsByName.get(e);if(l.ref&&o.isResolvable(i))t._resolve.push(e),a.$_mutateRegister(i);else if(l.normalize&&(i=l.normalize(i),n[e]=i),l.assert){const t=o.validateArg(i,e,l);s(!t,t,"or reference")}}n[e]=i}else delete n[e]}}return r.multi||(a._ruleRemove(t.name),a._singleRules.set(t.name,t)),r.priority?a._rules.unshift(t):a._rules.push(t),a}$_compile(e,t){return l.schema(this.$_root,e,t)}$_createError(e,t,r,s,n,a={}){const i=!1!==a.flags?this._flags:{},o=a.messages?p.merge(this._definition.messages,a.messages):this._definition.messages;return new c.Report(e,t,r,i,o,s,n)}$_getRule(e){return this._singleRules.get(e)}$_match(e,t,r,s){(r=Object.assign({},r)).abortEarly=!0,r._externals=!1,t.snapshot();const n=!f.validate(e,this,t,r,s).errors;return t.restore(),n}$_modify(e){return o.assertOptions(e,["each","once","ref","schema"]),h.schema(this,e)||this}$_mutateRebuild(){this._refs.reset(),this._ids.reset();return this.$_modify({each:(e,{source:t,name:r,path:s,key:n})=>{const a=this._definition[t][r]&&this._definition[t][r].register;!1!==a&&this.$_mutateRegister(e,{family:a,key:n})}}),this._definition.rebuild&&this._definition.rebuild(this),this}$_mutateRegister(e,{family:t,key:r}={}){this._refs.register(e,t),this._ids.register(e,{key:r})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t,r={}){const s=this._definition.flags[e]||{};if(a(t,s.default)&&(t=void 0),a(t,this._flags[e]))return this;const n=!1!==r.clone?this.clone():this;return void 0!==t?(n._flags[e]=t,n.$_mutateRegister(t)):delete n._flags[e],n}$_parent(e,...t){return this[e][o.symbols.parent].call(this,...t)}$_validate(e,t,r){return f.validate(e,this,t,r)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=n(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_default(e,t,r={}){o.assertOptions(r,"literal"),s(void 0!==t,"Missing",e,"value"),s("function"==typeof t||!r.literal,"Only function value supports literal option"),"function"==typeof t&&r.literal&&(t={[o.symbols.literal]:!0,literal:t});return this.$_setFlag(e,t)}_extend(e){return s(!e.base,"Cannot extend type with another base"),u.type(this,e)}_generate(e,t,r){if(!this.$_terms.whens)return{schema:this};const s=[],n=[];for(let a=0;ac)break}const a=n.join(", ");if(!a)return{schema:this};if(this.$_temp.whens[a])return{schema:this.$_temp.whens[a],id:a};let i=this;this._definition.generate&&(i=this._definition.generate(this,e,t,r));for(const e of s)i=i.concat(e);return this.$_temp.whens[a]=i,{schema:i,id:a}}_ruleRemove(e){if(!this._singleRules.has(e))return this;this._singleRules.delete(e);const t=[];for(let r=0;r{const s=r(27),n=r(30),a=r(51),i=r(54);t.type=function(e,t){const r=Object.getPrototypeOf(e),o=n(r),l=e._assign(Object.create(o)),c=Object.assign({},t);delete c.base,o._definition=c;const u=r._definition||{};c.messages=i.merge(u.messages,c.messages),c.properties=Object.assign({},u.properties,c.properties),l.type=c.type,c.flags=Object.assign({},u.flags,c.flags);const p=Object.assign({},u.terms);if(c.terms)for(const e in c.terms){const t=c.terms[e];s(void 0===l.$_terms[e],"Invalid term override for",c.type,e),l.$_terms[e]=t.init,p[e]=t}c.terms=p,c.args||(c.args=u.args),c.coerce&&("function"==typeof c.coerce&&(c.coerce={method:c.coerce}),c.coerce.from&&!Array.isArray(c.coerce.from)&&(c.coerce={method:c.coerce.method,from:[].concat(c.coerce.from)})),c.coerce=c.coerce||u.coerce,c.validate=c.validate||u.validate;const h=Object.assign({},u.rules);if(c.rules)for(const e in c.rules){const t=c.rules[e];s("object"==typeof t,"Invalid rule definition for",c.type,e);const r=t.method;if(r&&(s(!o[e],"Rule conflict in",c.type,e),o[e]=r),s(!h[e],"Rule conflict in",c.type,e),h[e]=t,t.alias){const e=[].concat(t.alias);for(const r of e)o[r]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map((e=>("string"==typeof e&&(e={name:e}),s(!t.argsByName.has(e.name),"Duplicated argument name",e.name),t.argsByName.set(e.name,e),e))))}if(c.rules=h,c.overrides){o._super=r,l.$_super={};for(const e in c.overrides)s(r[e],"Cannot override missing",e),c.overrides[e][a.symbols.parent]=r[e],l.$_super[e]=r[e].bind(l);Object.assign(o,c.overrides)}return c.cast=Object.assign({},u.cast,c.cast),c.rebuild=c.rebuild||u.rebuild,l}},(e,t,r)=>{const s=r(27),n=r(51),a=r(56),i={};t.Ids=i.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new i.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,r]of e._byId.entries())s(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,r);for(const[t,r]of e._byKey.entries())s(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,r)}reach(e,t=[]){const r=e[0],n=this._get(r);s(n,"Schema does not contain path",[...t,...e].join("."));const a=e.slice(1);return a.length?n.schema._ids.reach(a,[...t,r]):n.schema}register(e,{key:t}={}){if(!e||!n.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const r=e._flags.id;if(r){const t=this._byId.get(r);s(!t||t.schema===e,"Cannot add different schemas with the same id:",r),s(!this._byKey.has(r),"Schema id conflicts with existing key:",r),this._byId.set(r,{schema:e,id:r})}t&&(s(!this._byKey.has(t),"Schema already contains key:",t),s(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,{schema:e,id:t}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_get(e){return this._byId.get(e)||this._byKey.get(e)}},t.schema=function(e,t){let r;for(const s in e._flags){if("_"===s[0])continue;const n=i.scan(e._flags[s],{source:"flags",name:s},t);void 0!==n&&(r=r||e.clone(),r._flags[s]=n)}for(let s=0;s{const s=r(27),n=r(30),a=r(51),i=r(58),o=r(66),l={result:Symbol("result")};t.entry=function(e,t,r){let s=a.defaults;r&&(s=a.preferences(a.defaults,r));const n=l.entry(e,t,s),i={value:n.value};return n.error&&(i.error=n.error),i},l.entry=function(e,r,s){const n={links:r._ids._schemaChain?new Map:null},a=r._ids._schemaChain?[{schema:r}]:null,l=new o([],[],{mainstay:n,schemas:a}),c=t.validate(e,r,l,s),u=i.process(c.errors,e,s);return{value:c.value,error:u,mainstay:n}},t.validate=function(e,t,r,s,n={}){t.$_terms.whens&&(t=t._generate(e,r,s).schema),t._preferences&&(s=l.prefs(t,s));const i={original:e,prefs:s,schema:t,state:r,error:(n,a,i)=>t.$_createError(n,e,a,i||r,s),errorsArray:l.errorsArray,message:(n,a)=>t.$_createError("custom",e,a,r,s,{messages:n})},o=t._definition;if(o.coerce&&void 0!==e&&s.convert&&(!o.coerce.from||o.coerce.from.includes(typeof e))){const t=o.coerce.method(e,i);if(t){if(t.errors)return l.finalize(t.value,[].concat(t.errors),i);e=t.value}}const c=t._flags.empty;c&&c.$_match(l.trim(e,t),r.nest(c),a.defaults)&&(e=void 0);const u=n.presence||t._flags.presence||(t._flags._endedSwitch?null:s.presence);if(void 0===e){if("forbidden"===u)return l.finalize(e,null,i);if("required"===u)return l.finalize(e,[t.$_createError("any.required",e,null,r,s)],i);if("optional"===u){if(t._flags.default!==a.symbols.deepDefault)return l.finalize(e,null,i);e={}}}else if("forbidden"===u)return l.finalize(e,[t.$_createError("any.unknown",e,null,r,s)],i);const p=[];if(t._valids){const n=t._valids.get(e,r,s,t._flags.insensitive);if(n)return s.convert&&(e=n.value),l.finalize(e,null,i);if(t._flags.only){const n=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},r,s);if(s.abortEarly)return l.finalize(e,[n],i);p.push(n)}}if(t._invalids){if(t._invalids.get(e,r,s,t._flags.insensitive)){const n=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,s);if(s.abortEarly)return l.finalize(e,[n],i);p.push(n)}}if(o.validate){const t=o.validate(e,i);if(t&&(e=t.value,t.errors)){if(!Array.isArray(t.errors))return p.push(t.errors),l.finalize(e,p,i);if(t.errors.length)return p.push(...t.errors),l.finalize(e,p,i)}}return t._rules.length?l.rules(e,p,i):l.finalize(e,p,i)},l.rules=function(e,t,r){const{schema:s,state:n,prefs:i}=r;for(const o of s._rules){const c=s._definition.rules[o.method];if(c.convert&&i.convert)continue;let u,p=o.args;if(o._resolve.length){p=Object.assign({},p);for(const t of o._resolve){const r=c.argsByName.get(t),o=p[t].resolve(e,n,i),l=r.normalize?r.normalize(o):o,h=a.validateArg(l,null,r);if(h){u=s.$_createError("any.ref",o,{arg:t,ref:p[t],reason:h},n,i);break}p[t]=l}}u=u||c.validate(e,r,p,o);const h=l.rule(u,o);if(h.errors){if(i.abortEarly)return l.finalize(e,h.errors,r);t.push(...h.errors)}else e=h.value}return l.finalize(e,t,r)},l.rule=function(e,t){return e instanceof i.Report?{errors:[e],value:null}:Array.isArray(e)&&e[a.symbols.errors]?{errors:e,value:null}:{errors:null,value:e}},l.finalize=function(e,t,r){t=t||[];const{schema:n,state:a}=r;if(t.length){const s=l.default("failover",void 0,t,r);void 0!==s&&(e=s,t=[])}if(t.length&&n._flags.error)if("function"==typeof n._flags.error){t=n._flags.error(t),Array.isArray(t)||(t=[t]);for(const e of t)s(e instanceof Error||e instanceof i.Report,"error() must return an Error object")}else t=[n._flags.error];if(void 0===e){e=l.default("default",e,t,r)}if(n._flags.cast&&void 0!==e){const t=n._definition.cast[n._flags.cast];if(t.from(e)){e=t.to(e,r)}}const o={value:e,errors:t.length?t:null};return n._flags.result&&(o.value="strip"===n._flags.result?void 0:r.original,a.shadow(e,n._flags.result)),o},l.prefs=function(e,t){const r=t===a.defaults;return r&&e._preferences[a.symbols.prefs]?e._preferences[a.symbols.prefs]:(t=a.preferences(t,e._preferences),r&&(e._preferences[a.symbols.prefs]=t),t)},l.default=function(e,t,r,s){const{schema:i,state:o,prefs:l}=s,c=i._flags[e];if(l.noDefaults||void 0===c)return t;if(!c)return c;if("function"==typeof c){const t=c.length?[n(o.ancestors[0]),s]:[];try{return c(...t)}catch(t){return void r.push(i.$_createError(`any.${e}`,null,{error:t},o,l))}}return"object"!=typeof c?c:c[a.symbols.literal]?c.literal:a.isResolvable(c)?c.resolve(t,o,l):n(c)},l.trim=function(e,t){if("string"!=typeof e)return e;const r=t.$_getRule("trim");return r&&r.args.enabled?e.trim():e},l.errorsArray=function(){const e=[];return e[a.symbols.errors]=!0,e}},(e,t,r)=>{const s=r(30),n=r(31),a=r(51),i={value:Symbol("value")};e.exports=i.State=class{constructor(e,t,r){this.path=e,this.ancestors=t,this.mainstay=r.mainstay,this.schemas=r.schemas}localize(e,t=null,r=null){const s=new i.State(e,t,this);return r&&s.schemas&&(s.schemas=[i.schemas(r),...s.schemas]),s}nest(e){const t=new i.State(this.path,this.ancestors,this);return t.schemas=t.schemas&&[i.schemas(e),...t.schemas],t}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new i.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=s(this.mainstay.shadow.node(this.path)))}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0)}},i.schemas=function(e){return a.isSchema(e)?{schema:e}:e},i.Shadow=class{constructor(){this._values=null}set(e,t,r){if(!e.length)return;if("strip"===r&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let s=this._values;for(let t=0;t{const s=r(27),n=r(39),a=r(51),i={};e.exports=i.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=i.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){a.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,r){if(e=e||new i.Values,t){if(t._override)return t.clone();for(const r of[...t._values,...t._refs])e.add(r)}if(r)for(const t of[...r._values,...r._refs])e.remove(t);return e.length?e:null}remove(e){a.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,r,s){return!!this.get(e,t,r,s)}get(e,t,r,s){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&s){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const t of this._values)if(n(t,e))return{value:t};if(t)for(const a of this._refs){const i=a.resolve(e,t,r,null,{in:!0});if(void 0===i)continue;const o=a.in&&"object"==typeof i?Array.isArray(i)?i:Object.keys(i):[i];for(const t of o)if(typeof t==typeof e)if(s&&e&&"string"==typeof e){if(t.toLowerCase()===e.toLowerCase())return{value:t,ref:a}}else if(n(t,e))return{value:t,ref:a}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new i.Values(this._values,this._refs);return e._override=this._override,e}concat(e){s(!e._override,"Cannot concat override set of values");const t=new i.Values([...this._values,...e._values],[...this._refs,...e._refs]);return t._override=this._override,t}},i.Values.prototype[a.symbols.values]=!0,i.Values.prototype.slice=i.Values.prototype.clone,i.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t}},(e,t,r)=>{const s=r(27),n=r(39),a=r(31),i=r(61),o=r(51),l=r(57),c={};e.exports=i._extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[]},ordered:{init:[]},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,{schema:t,state:r,prefs:s}){if(!Array.isArray(e))return;const n=t.$_getRule("sort");return n?c.sort(t,e,n.args.options,r,s):void 0}},validate(e,{schema:t,error:r}){if(!Array.isArray(e)){if(t._flags.single){const t=[e];return t[o.symbols.arraySingle]=!0,{value:t}}return{errors:r("array.base")}}if(t.$_getRule("items"))return{value:e.slice()}},rules:{has:{method(e){e=this.$_compile(e,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:e}});return t.$_mutateRegister(e),t},validate(e,{state:t,prefs:r,error:s},{schema:n}){const a=[e,...t.ancestors];for(let s=0;sthis.$_compile(e[r])),r,{append:!0});t.$_terms.items.push(s)}return t.$_mutateRebuild()},validate(e,{schema:t,error:r,state:s,prefs:n,errorsArray:a}){const i=t.$_terms._requireds.slice(),l=t.$_terms.ordered.slice(),u=[...t.$_terms._inclusions,...i],p=!e[o.symbols.arraySingle];delete e[o.symbols.arraySingle];const h=a();let d=e.length;for(let a=0;a="})}},ordered:{method(...e){o.verifyFlat(e,"ordered");const t=this.$_addRule("items");for(let r=0;rthis.$_compile(e[r])),r,{append:!0});c.validateSingle(s,t),t.$_mutateRegister(s),t.$_terms.ordered.push(s)}return t.$_mutateRebuild()}},single:{method(e){const t=void 0===e||!!e;return s(!t||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",t)}},sort:{method(e={}){o.assertOptions(e,["by","order"]);const t={order:e.order||"ascending"};return e.by&&(t.by=l.ref(e.by,{ancestor:0}),s(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(e,{error:t,state:r,prefs:s,schema:n},{options:a}){const{value:i,errors:o}=c.sort(n,e,a,r,s);if(o)return o;for(let r=0;rnew Set(e)}},rebuild(e){e.$_terms._inclusions=[],e.$_terms._exclusions=[],e.$_terms._requireds=[];for(const t of e.$_terms.items)c.validateSingle(t,e),"required"===t._flags.presence?e.$_terms._requireds.push(t):"forbidden"===t._flags.presence?e.$_terms._exclusions.push(t):e.$_terms._inclusions.push(t);for(const t of e.$_terms.ordered)c.validateSingle(t,e)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),c.fillMissedErrors=function(e,t,r,s,n,a){let i=0;for(let e=0;e{let p=c.compare(l,u,i,o);if(null!==p)return p;if(r.by&&(l=r.by.resolve(l,s,n),u=r.by.resolve(u,s,n)),p=c.compare(l,u,i,o),null!==p)return p;const h=typeof l;if(h!==typeof u)throw e.$_createError("array.sort.mismatching",t,null,s,n);if("number"!==h&&"string"!==h)throw e.$_createError("array.sort.unsupported",t,{type:h},s,n);return"number"===h?(l-u)*a:l{const s=r(27),n=r(61),a=r(51),i=r(67),o={isBool:function(e){return"boolean"==typeof e}};e.exports=n._extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null},truthy:{init:null}},coerce(e,{schema:t}){if("boolean"!=typeof e){if("string"==typeof e){const r=t._flags.sensitive?e:e.toLowerCase();e="true"===r||"false"!==r&&e}return"boolean"!=typeof e&&(e=t.$_terms.truthy&&t.$_terms.truthy.has(e,null,null,!t._flags.sensitive)||(!t.$_terms.falsy||!t.$_terms.falsy.has(e,null,null,!t._flags.sensitive))&&e),{value:e}}},validate(e,{error:t}){if("boolean"!=typeof e)return{value:e,errors:t("boolean.base")}},rules:{truthy:{method(...e){a.verifyFlat(e,"truthy");const t=this.clone();t.$_terms.truthy=t.$_terms.truthy||new i;for(let r=0;re?1:0},string:{from:o.isBool,to:(e,t)=>e?"true":"false"}},messages:{"boolean.base":"{{#label}} must be a boolean"}})},(e,t,r)=>{const s=r(27),n=r(61),a=r(51),i=r(55),o={isDate:function(e){return e instanceof Date}};e.exports=n._extend({type:"date",coerce:{from:["number","string"],method:(e,{schema:t})=>({value:o.parse(e,t._flags.format)||e})},validate(e,{schema:t,error:r,prefs:s}){if(e instanceof Date&&!isNaN(e.getTime()))return;const n=t._flags.format;return s.convert&&n&&"string"==typeof e?{value:e,errors:r("date.format",{format:n})}:{value:e,errors:r("date.base")}},rules:{compare:{method:!1,validate(e,t,{date:r},{name:s,operator:n,args:i}){const o="now"===r?Date.now():r.getTime();return a.compare(e.getTime(),o,n)?e:t.error("date."+s,{limit:i.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:o.parse(e),assert:e=>null!==e,message:"must have a valid date format"}]},format:{method(e){return s(["iso","javascript","unix"].includes(e),"Unknown date format",e),this.$_setFlag("format",e)}},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{date:e},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{date:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{date:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{date:e},operator:">="})}},timestamp:{method(e="javascript"){return s(["javascript","unix"].includes(e),'"type" must be one of "javascript, unix"'),this.format(e)}}},cast:{number:{from:o.isDate,to:(e,t)=>e.getTime()},string:{from:o.isDate,to:(e,{prefs:t})=>i.date(e,t)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":"{{#label}} must be in {{#format}} format","date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}"}}),o.parse=function(e,t){if(e instanceof Date)return e;if("string"!=typeof e&&(isNaN(e)||!isFinite(e)))return null;if(/^\s*$/.test(e))return null;if("iso"===t)return a.isIsoDate(e)?o.date(e.toString()):null;const r=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return o.date(1*e);if("unix"===t)return o.date(1e3*e);if("string"==typeof r)return null}return o.date(e)},o.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t}},(e,t,r)=>{const s=r(27),n=r(72);e.exports=n._extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(e){return s(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:e}})},validate:(e,t,{n:r})=>e.length===r?e:t.error("function.arity",{n:r})},class:{method(){return this.$_addRule("class")},validate:(e,t)=>/^\s*class\s/.test(e.toString())?e:t.error("function.class",{value:e})},minArity:{method(e){return s(Number.isSafeInteger(e)&&e>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:e}})},validate:(e,t,{n:r})=>e.length>=r?e:t.error("function.minArity",{n:r})},maxArity:{method(e){return s(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:e}})},validate:(e,t,{n:r})=>e.length<=r?e:t.error("function.maxArity",{n:r})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},(e,t,r)=>{const s=r(26),n=r(27),a=r(30),i=r(73),o=r(61),l=r(51),c=r(57),u=r(58),p=r(56),h={renameDefaults:{alias:!1,multiple:!1,override:!1}};e.exports=o._extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:!1}},terms:{dependencies:{init:null},keys:{init:null},patterns:{init:null},renames:{init:null}},args:(e,t)=>e.keys(t),validate(e,{schema:t,error:r,state:s,prefs:n}){if(!e||typeof e!==t.$_property("typeof")||Array.isArray(e))return{value:e,errors:r("object.base",{type:t.$_property("typeof")})};if(!(t.$_terms.renames||t.$_terms.dependencies||t.$_terms.keys||t.$_terms.patterns))return;e=h.clone(e,n);const a=[];if(t.$_terms.renames&&!h.rename(t,e,s,n,a))return{value:e,errors:a};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:a};const i=new Set(Object.keys(e));if(t.$_terms.keys){const r=[e,...s.ancestors];for(const o of t.$_terms.keys){const t=o.key,l=e[t];i.delete(t);const c=s.localize([...s.path,t],r,o),u=o.schema.$_validate(l,c,n);if(u.errors){if(n.abortEarly)return{value:e,errors:u.errors};a.push(...u.errors)}else"strip"===o.schema._flags.result||void 0===u.value&&void 0!==l?delete e[t]:void 0!==u.value&&(e[t]=u.value)}}if(i.size||t._flags._hasPatternMatch){const r=h.unknown(t,e,i,a,s,n);if(r)return r}if(t.$_terms.dependencies)for(const r of t.$_terms.dependencies){if(r.key&&void 0===r.key.resolve(e,s,n,null,{shadow:!1}))continue;const i=h.dependencies[r.rel](t,r,e,s,n);if(i){const r=t.$_createError(i.code,e,i.context,s,n);if(n.abortEarly)return{value:e,errors:r};a.push(r)}}return{value:e,errors:a}},rules:{and:{method(...e){return l.verifyFlat(e,"and"),h.dependency(this,"and",null,e)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,t,r){e=c.ref(e),n(void 0===r||"string"==typeof r,"Message must be a string"),t=this.$_compile(t,{appendPath:!0});const s=this.$_addRule({name:"assert",args:{subject:e,schema:t,message:r}});return s.$_mutateRegister(e),s.$_mutateRegister(t),s},validate(e,{error:t,prefs:r,state:s},{subject:n,schema:a,message:i}){const o=n.resolve(e,s,r),l=n.absolute(s);return a.$_match(o,s.localize(l,[e,...s.ancestors],a),r)?e:t("object.assert",{subject:n,message:i})},args:["subject","schema","message"],multi:!0},instance:{method(e,t){return n("function"==typeof e,"constructor must be a function"),t=t||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:t}})},validate:(e,t,{constructor:r,name:s})=>e instanceof r?e:t.error("object.instance",{type:s,value:e}),args:["constructor","name"]},keys:{method(e){n(void 0===e||"object"==typeof e,"Object schema must be a valid object"),n(!l.isSchema(e),"Object schema cannot be a joi schema");const t=this.clone();if(e)if(Object.keys(e).length){t.$_terms.keys=t.$_terms.keys?t.$_terms.keys.filter((t=>!e.hasOwnProperty(t.key))):new h.Keys;for(const r in e)l.tryWithPath((()=>t.$_terms.keys.push({key:r,schema:this.$_compile(e[r])})),r)}else t.$_terms.keys=new h.Keys;else t.$_terms.keys=null;return t.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:s,operator:n,args:a})=>l.compare(Object.keys(e).length,r,n)?e:t.error("object."+s,{limit:a.limit,value:e}),args:[{name:"limit",ref:!0,assert:l.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},nand:{method(...e){return l.verifyFlat(e,"nand"),h.dependency(this,"nand",null,e)}},or:{method(...e){return l.verifyFlat(e,"or"),h.dependency(this,"or",null,e)}},oxor:{method(...e){return h.dependency(this,"oxor",null,e)}},pattern:{method(e,t,r={}){const s=e instanceof RegExp;s||(e=this.$_compile(e,{appendPath:!0})),n(void 0!==t,"Invalid rule"),l.assertOptions(r,["fallthrough","matches"]),s&&n(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),t=this.$_compile(t,{appendPath:!0});const a=this.clone();a.$_terms.patterns=a.$_terms.patterns||[];const i={[s?"regex":"schema"]:e,rule:t};return r.matches&&(i.matches=this.$_compile(r.matches),"array"!==i.matches.type&&(i.matches=i.matches.$_root.array().items(i.matches)),a.$_mutateRegister(i.matches),a.$_setFlag("_hasPatternMatch",!0,{clone:!1})),r.fallthrough&&(i.fallthrough=!0),a.$_terms.patterns.push(i),a.$_mutateRegister(t),a}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>p.isRef(e)?e:t.error("object.refType",{value:e})},regex:{method(){return this.$_addRule("regex")},validate:(e,t)=>e instanceof RegExp?e:t.error("object.regex",{value:e})},rename:{method(e,t,r={}){n("string"==typeof e||e instanceof RegExp,"Rename missing the from argument"),n("string"==typeof t,"Invalid rename to argument"),n(t!==e,"Cannot rename key to same name:",e),l.assertOptions(r,["alias","ignoreUndefined","override","multiple"]);const a=this.clone();a.$_terms.renames=a.$_terms.renames||[];for(const t of a.$_terms.renames)n(t.from!==e,"Cannot rename the same key multiple times");return a.$_terms.renames.push({from:e,to:t,options:s(h.renameDefaults,r)}),a}},schema:{method(e="any"){return this.$_addRule({name:"schema",args:{type:e}})},validate:(e,t,{type:r})=>!l.isSchema(e)||"any"!==r&&e.type!==r?t.error("object.schema",{type:r}):e},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t,r={}){return h.dependency(this,"with",e,t,r)}},without:{method(e,t,r={}){return h.dependency(this,"without",e,t,r)}},xor:{method(...e){return l.verifyFlat(e,"xor"),h.dependency(this,"xor",null,e)}}},overrides:{default(e,t){return void 0===e&&(e=l.symbols.deepDefault),this.$_parent("default",e,t)}},rebuild(e){if(e.$_terms.keys){const t=new i.Sorter;for(const r of e.$_terms.keys)l.tryWithPath((()=>t.add(r,{after:r.schema.$_rootReferences(),group:r.key})),r.key);e.$_terms.keys=new h.Keys(...t.nodes)}},messages:{"object.and":"{{#label}} contains {{#present}} without its required peers {{#missing}}","object.assert":"{{#label}} is invalid because it failed to pass the assertion test","object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":"{{#label}} must have {{#limit}} keys","object.max":"{{#label}} must have less than or equal to {{#limit}} keys","object.min":"{{#label}} must have at least {{#limit}} keys","object.missing":"{{#label}} must contain at least one of {{#peers}}","object.nand":"{{:#main}} must not exist simultaneously with {{#peers}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peers}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#main}} missing required peer {{:#peer}}","object.without":"{{:#main}} conflict with forbidden peer {{:#peer}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peers}}"}}),h.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return a(e,{shallow:!0});const r=Object.create(Object.getPrototypeOf(e));return Object.assign(r,e),r}const r=function(...t){return e.apply(this,t)};return r.prototype=a(e.prototype),Object.defineProperty(r,"name",{value:e.name,writable:!1}),Object.defineProperty(r,"length",{value:e.length,writable:!1}),Object.assign(r,e),r},h.dependency=function(e,t,r,s,a){n(null===r||"string"==typeof r,t,"key must be a strings"),a||(a=s.length>1&&"object"==typeof s[s.length-1]?s.pop():{}),l.assertOptions(a,["separator"]),s=[].concat(s);const i=l.default(a.separator,"."),o=[];for(const e of s)n("string"==typeof e,t,"peers must be a string or a reference"),o.push(c.ref(e,{separator:i,ancestor:0,prefix:!1}));null!==r&&(r=c.ref(r,{separator:i,ancestor:0,prefix:!1}));const u=e.clone();return u.$_terms.dependencies=u.$_terms.dependencies||[],u.$_terms.dependencies.push(new h.Dependency(t,r,o,s)),u},h.dependencies={and(e,t,r,s,n){const a=[],i=[],o=t.peers.length;for(const e of t.peers)void 0===e.resolve(r,s,n,null,{shadow:!1})?a.push(e.key):i.push(e.key);if(a.length!==o&&i.length!==o)return{code:"object.and",context:{present:i,missing:a}}},nand(e,t,r,s,n){const a=[];for(const e of t.peers)void 0!==e.resolve(r,s,n,null,{shadow:!1})&&a.push(e.key);if(a.length!==t.peers.length)return;return{code:"object.nand",context:{main:t.paths[0],peers:t.paths.slice(1)}}},or(e,t,r,s,n){for(const e of t.peers)if(void 0!==e.resolve(r,s,n,null,{shadow:!1}))return;return{code:"object.missing",context:{peers:t.paths}}},oxor(e,t,r,s,n){const a=[];for(const e of t.peers)void 0!==e.resolve(r,s,n,null,{shadow:!1})&&a.push(e.key);if(!a.length||1===a.length)return;const i={peers:t.paths};return i.present=a,{code:"object.oxor",context:i}},with(e,t,r,s,n){for(const e of t.peers)if(void 0===e.resolve(r,s,n,null,{shadow:!1}))return{code:"object.with",context:{main:t.key.key,peer:e.key}}},without(e,t,r,s,n){for(const e of t.peers)if(void 0!==e.resolve(r,s,n,null,{shadow:!1}))return{code:"object.without",context:{main:t.key.key,peer:e.key}}},xor(e,t,r,s,n){const a=[];for(const e of t.peers)void 0!==e.resolve(r,s,n,null,{shadow:!1})&&a.push(e.key);if(1===a.length)return;const i={peers:t.paths};return 0===a.length?{code:"object.missing",context:i}:(i.present=a,{code:"object.xor",context:i})}},h.rename=function(e,t,r,s,n){const a={};for(const i of e.$_terms.renames){const o=[],l="string"!=typeof i.from;if(l)for(const e in t){if(void 0===t[e]&&i.options.ignoreUndefined)continue;if(e===i.to)continue;const r=i.from.exec(e);r&&o.push({from:e,to:i.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,i.from)||void 0===t[i.from]&&i.options.ignoreUndefined||o.push(i);for(const c of o){const o=c.from,u=c.to;if(!i.options.multiple&&a[u]&&(n.push(e.$_createError("object.rename.multiple",t,{from:o,to:u,pattern:l},r,s)),s.abortEarly))return!1;if(Object.prototype.hasOwnProperty.call(t,u)&&!i.options.override&&!a[u]&&(n.push(e.$_createError("object.rename.override",t,{from:o,to:u,pattern:l},r,s)),s.abortEarly))return!1;void 0===t[o]?delete t[u]:t[u]=t[o],a[u]=!0,i.options.alias||delete t[o]}}return!0},h.unknown=function(e,t,r,s,n,a){if(e.$_terms.patterns){let i=!1;const o=e.$_terms.patterns.map((e=>{if(e.matches)return i=!0,[]})),l=[t,...n.ancestors];for(const i of r){const c=t[i],u=[...n.path,i];for(let p=0;p{const{assert:s}=r(25),n={};t.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(e,t){const r=[].concat((t=t??{}).before??[]),n=[].concat(t.after??[]),a=t.group??"?",i=t.sort??0;s(!r.includes(a),`Item cannot come before itself: ${a}`),s(!r.includes("?"),"Item cannot come before unassociated items"),s(!n.includes(a),`Item cannot come after itself: ${a}`),s(!n.includes("?"),"Item cannot come after unassociated items"),Array.isArray(e)||(e=[e]);for(const t of e){const e={seq:this._items.length,sort:i,before:r,after:n,group:a,node:t};this._items.push(e)}if(!t.manual){const e=this._sort();s(e,"item","?"!==a?`added into group ${a}`:"","created a dependencies error")}return this.nodes}merge(e){Array.isArray(e)||(e=[e]);for(const t of e)if(t)for(const e of t._items)this._items.push(Object.assign({},e));this._items.sort(n.mergeSort);for(let e=0;ee.sort===t.sort?0:e.sort{const s=r(27),n=r(61),a=r(51),i=r(57),o=r(58),l={};e.exports=n._extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,register:!1}},args:(e,t)=>e.ref(t),validate(e,{schema:t,state:r,prefs:n}){s(t.$_terms.link,"Uninitialized link schema");const a=l.generate(t,e,r,n),i=t.$_terms.link[0].ref;return a.$_validate(e,r.nest(a,`link:${i.display}:${a.type}`),n)},generate:(e,t,r,s)=>l.generate(e,t,r,s),rules:{ref:{method(e){s(!this.$_terms.link,"Cannot reinitialize schema"),e=i.ref(e),s("value"===e.type||"local"===e.type,"Invalid reference type:",e.type),s("local"===e.type||"root"===e.ancestor||e.ancestor>0,"Link cannot reference itself");const t=this.clone();return t.$_terms.link=[{ref:e}],t}},relative:{method(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(e){s(this.$_terms.link,"Uninitialized link schema"),s(a.isSchema(e),"Invalid schema object"),s("link"!==e.type,"Cannot merge type link with another link");const t=this.clone();return t.$_terms.whens||(t.$_terms.whens=[]),t.$_terms.whens.push({concat:e}),t.$_mutateRebuild()}}}),l.generate=function(e,t,r,s){let n=r.mainstay.links.get(e);if(n)return n._generate(t,r,s).schema;const a=e.$_terms.link[0].ref,{perspective:i,path:o}=l.perspective(a,r);l.assert(i,"which is outside of schema boundaries",a,e,r,s);try{n=o.length?i.$_reach(o):i}catch(t){l.assert(!1,"to non-existing schema",a,e,r,s)}return l.assert("link"!==n.type,"which is another link",a,e,r,s),e._flags.relative||r.mainstay.links.set(e,n),n._generate(t,r,s).schema},l.perspective=function(e,t){if("local"===e.type){for(const{schema:r,key:s}of t.schemas){if((r._flags.id||s)===e.path[0])return{perspective:r,path:e.path.slice(1)};if(r.$_terms.shared)for(const t of r.$_terms.shared)if(t._flags.id===e.path[0])return{perspective:t,path:e.path.slice(1)}}return{perspective:null,path:null}}return"root"===e.ancestor?{perspective:t.schemas[t.schemas.length-1].schema,path:e.path}:{perspective:t.schemas[e.ancestor]&&t.schemas[e.ancestor].schema,path:e.path}},l.assert=function(e,t,r,n,a,i){e||s(!1,`"${o.label(n._flags,a,i)}" contains link reference "${r.display}" ${t}`)}},(e,t,r)=>{const s=r(27),n=r(61),a=r(51),i={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/};e.exports=n._extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:r}){const s=e.match(i.numberRx);if(!s)return;e=e.trim();const n={value:parseFloat(e)};if(0===n.value&&(n.value=0),!t._flags.unsafe)if(e.match(/e/i)){if(i.normalizeExponent(`${n.value/Math.pow(10,s[1])}e${s[1]}`)!==i.normalizeExponent(e))return n.errors=r("number.unsafe"),n}else{const t=n.value.toString();if(t.match(/e/i))return n;if(t!==i.normalizeDecimal(e))return n.errors=r("number.unsafe"),n}return n}},validate(e,{schema:t,error:r,prefs:s}){if(e===1/0||e===-1/0)return{value:e,errors:r("number.infinity")};if(!a.isNumber(e))return{value:e,errors:r("number.base")};const n={value:e};if(s.convert){const e=t.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);n.value=Math.round(n.value*t)/t}}return 0===n.value&&(n.value=0),!t._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||ea.compare(e,r,n)?e:t.error("number."+s,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:a.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){return this.$_addRule({name:"multiple",args:{base:e}})},validate:(e,t,{base:r},s)=>e%r==0?e:t.error("number.multiple",{multiple:s.args.base,value:e}),args:[{name:"base",ref:!0,assert:e=>"number"==typeof e&&isFinite(e)&&e>0,message:"must be a positive number"}],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,t)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:t.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(e){return s(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,t,{limit:r}){const s=e.toString().match(i.precisionRx);return Math.max((s[1]?s[1].length:0)-(s[2]?parseInt(s[2],10):0),0)<=r?e:t.error("number.precision",{limit:r,value:e})},convert:!0},sign:{method(e){return s(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate:(e,t,{sign:r})=>"negative"===r&&e<0||"positive"===r&&e>0?e:t.error(`number.${r}`)},unsafe:{method(e=!0){return s("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("unsafe",e)}}},cast:{string:{from:e=>"number"==typeof e,to:(e,t)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),i.normalizeExponent=function(e){return e.replace(/E/,"e").replace(/\.(\d*[1-9])?0+e/,".$1e").replace(/\.e/,"e").replace(/e\+/,"e").replace(/^\+/,"").replace(/^(-?)0+([1-9])/,"$1$2")},i.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0+$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([1-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e}},(e,t,r)=>{const s=r(72);e.exports=s._extend({type:"object",cast:{map:{from:e=>e&&"object"==typeof e,to:(e,t)=>new Map(Object.entries(e))}}})},(e,t,r)=>{var s=r(14).Buffer;const n=r(9),a=r(27),i=r(40),o=r(61),l=r(51),c={base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:/^[a-f0-9]+$/i,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"],domainControlRx:/[\x00-\x20@\:\/]/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,finalSegmentAdditionalRx:/[^0-9]/};e.exports=o._extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,{schema:t,state:r,prefs:s}){const n=t.$_getRule("normalize");n&&(e=e.normalize(n.args.form));const a=t.$_getRule("case");a&&(e="upper"===a.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const i=t.$_getRule("trim");if(i&&i.args.enabled&&(e=e.trim()),t.$_terms.replacements)for(const r of t.$_terms.replacements)e=e.replace(r.pattern,r.replacement);const o=t.$_getRule("hex");if(o&&o.args.options.byteAligned&&e.length%2!=0&&(e=`0${e}`),t.$_getRule("isoDate")){const t=c.isoDate(e);t&&(e=t)}if(t._flags.truncate){const n=t.$_getRule("max");if(n){let a=n.args.limit;if(l.isResolvable(a)&&(a=a.resolve(e,r,s),!l.limit(a)))return{value:e,errors:t.$_createError("any.ref",a,{ref:n.args.limit,arg:"limit",reason:"must be a positive integer"},r,s)};e=e.slice(0,a)}}return{value:e}}},validate:(e,{error:t})=>"string"!=typeof e?{value:e,errors:t("string.base")}:""===e?{value:e,errors:t("string.empty")}:void 0,rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(e,t)=>/^[a-zA-Z0-9]+$/.test(e)?e:t.error("string.alphanum")},base64:{method(e={}){return l.assertOptions(e,["paddingRequired","urlSafe"]),e={urlSafe:!1,paddingRequired:!0,...e},a("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),a("boolean"==typeof e.urlSafe,"urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:e}})},validate:(e,t,{options:r})=>c.base64Regex[r.paddingRequired][r.urlSafe].test(e)?e:t.error("string.base64")},case:{method(e){return a(["lower","upper"].includes(e),"Invalid case:",e),this.$_addRule({name:"case",args:{direction:e}})},validate:(e,t,{direction:r})=>"lower"===r&&e===e.toLocaleLowerCase()||"upper"===r&&e===e.toLocaleUpperCase()?e:t.error(`string.${r}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let r=e.length,s=0,n=1;for(;r--;){const t=e.charAt(r)*n;s+=t-9*(t>9),n^=3}return s>0&&s%10==0?e:t.error("string.creditCard")}},dataUri:{method(e={}){return l.assertOptions(e,["paddingRequired"]),e={paddingRequired:!0,...e},a("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:e}})},validate(e,t,{options:r}){const s=e.match(c.dataUriRegex);if(s){if(!s[2])return e;if("base64"!==s[2])return e;if(c.base64Regex[r.paddingRequired].false.test(s[3]))return e}return t.error("string.dataUri")}},guid:{alias:"uuid",method(e={}){l.assertOptions(e,["version","separator"]);let t="";if(e.version){const r=[].concat(e.version);a(r.length>=1,"version must have at least 1 valid version specified");const s=new Set;for(let e=0;ec.hexRegex.test(e)?r.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(e,t)=>c.isDomainValid(e)||c.ipRegex.test(e)?e:t.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},isoDate:{method(){return this.$_addRule("isoDate")},validate:(e,{error:t})=>c.isoDate(e)?e:t("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>c.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return c.length(this,"length",e,"=",t)},validate(e,t,{limit:r,encoding:n},{name:a,operator:i,args:o}){const c=n?s&&s.byteLength(e,n):e.length;return l.compare(c,r,i)?e:t.error("string."+a,{limit:o.limit,value:e,encoding:n})},args:[{name:"limit",ref:!0,assert:l.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return c.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return c.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(e="NFC"){return a(c.normalizationForms.includes(e),"normalization form must be one of "+c.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:e}})},validate:(e,{error:t},{form:r})=>e===e.normalize(r)?e:t("string.normalize",{value:e,form:r}),convert:!0},pattern:{alias:"regex",method(e,t={}){a(e instanceof RegExp,"regex must be a RegExp"),a(!e.flags.includes("g")&&!e.flags.includes("y"),"regex should not use global or sticky mode"),"string"==typeof t&&(t={name:t}),l.assertOptions(t,["invert","name"]);const r=["string.pattern",t.invert?".invert":"",t.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:e,options:t},errorCode:r})},validate:(e,t,{regex:r,options:s},{errorCode:n})=>r.test(e)^s.invert?e:t.error(n,{name:s.name,regex:r,value:e}),args:["regex","options"],multi:!0},replace:{method(e,t){"string"==typeof e&&(e=new RegExp(i(e),"g")),a(e instanceof RegExp,"pattern must be a RegExp"),a("string"==typeof t,"replacement must be a String");const r=this.clone();return r.$_terms.replacements||(r.$_terms.replacements=[]),r.$_terms.replacements.push({pattern:e,replacement:t}),r}},token:{method(){return this.$_addRule("token")},validate:(e,t)=>/^\w+$/.test(e)?e:t.error("string.token")},trim:{method(e=!0){return a("boolean"==typeof e,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:e}})},validate:(e,t,{enabled:r})=>r&&e!==e.trim()?t.error("string.trim"):e,convert:!0},truncate:{method(e=!0){return a("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("truncate",e)}},uppercase:{method(){return this.case("upper")}}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:.} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:.} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:.} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:.} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uppercase":"{{#label}} must only contain uppercase characters"}}),c.isoDate=function(e){if(!l.isIsoDate(e))return null;const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},c.length=function(e,t,r,n,i){return a(!i||s&&s.isEncoding(i),"Invalid encoding:",i),e.$_addRule({name:t,method:"length",args:{limit:r,encoding:i},operator:n})},c.rfc3986=function(){const e={},t="[\\dA-Fa-f]",r="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4="(?:"+r+"\\.){3}"+r;const s=t+"{1,4}",n="(?:"+s+":"+s+"|"+e.ipv4+")",a="(?:"+s+":){6}"+n,i="::(?:"+s+":){5}"+n,o="(?:"+s+")?::(?:"+s+":){4}"+n,l="(?:(?:"+s+":){0,1}"+s+")?::(?:"+s+":){3}"+n,c="(?:(?:"+s+":){0,2}"+s+")?::(?:"+s+":){2}"+n,u="(?:(?:"+s+":){0,3}"+s+")?::"+s+":"+n,p="(?:(?:"+s+":){0,4}"+s+")?::"+n,h="(?:(?:"+s+":){0,5}"+s+")?::"+s,d="(?:(?:"+s+":){0,6}"+s+")?::";return e.v4Cidr="(?:\\d|[1-2]\\d|3[0-2])",e.v6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",e.ipv6="(?:"+a+"|"+i+"|"+o+"|"+l+"|"+c+"|"+u+"|"+p+"|"+h+"|"+d+")",e.ipvfuture="v"+t+"+\\.[\\w-\\.~!\\$&'\\(\\)\\*\\+,;=:]+",e},c.ipRegex=function(){const e=c.rfc3986(),t=`(?:${["ipv4","ipv6","ipvfuture"].map((t=>{const r=`\\/${"ipv4"===t?e.v4Cidr:e.v6Cidr}`;return`${e[t]}(?:${r})?`})).join("|")})`;return new RegExp(`^${t}$`)}(),c.isDomainValid=function(e){if(e.length>256)return!1;if(e=e.normalize("NFC"),c.domainControlRx.test(e))return!1;const t=(e=c.punycode(e)).split(".");for(let e=0;e63)return!1;if(!c.domainSegmentRx.test(r))return!1;if(e===t.length-1&&!c.finalSegmentAdditionalRx.test(r))return!1}return!0},c.punycode=function(e){try{return new n.URL(`http://${e}`).host}catch(t){return e}}},(e,t,r)=>{const s=r(27),n=r(61),a={};a.Map=class extends Map{slice(){return new a.Map(this)}},e.exports=n._extend({type:"symbol",terms:{map:{init:new a.Map}},coerce:{method(e,{schema:t,error:r}){const s=t.$_terms.map.get(e);return s&&(e=s),t._flags.only&&"symbol"!=typeof e?{value:e,errors:r("symbol.map",{map:t.$_terms.map})}:{value:e}}},validate(e,{error:t}){if("symbol"!=typeof e)return{value:e,errors:t("symbol.base")}},rules:{map:{method(e){e&&!e[Symbol.iterator]&&"object"==typeof e&&(e=Object.entries(e)),s(e&&e[Symbol.iterator],"Iterable must be an iterable or object");const t=this.clone(),r=[];for(const n of e){s(n&&n[Symbol.iterator],"Entry must be an iterable");const[e,a]=n;s("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),s("symbol"==typeof a,"Value must be a Symbol"),t.$_terms.map.set(e,a),r.push(a)}return t.valid(...r)}}},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},(e,t,r)=>{var s=r(14).Buffer;const n=r(27),a=r(61),i=r(51);e.exports=a._extend({type:"binary",coerce:{from:"string",method(e,{schema:t}){try{return{value:s.from(e,t._flags.encoding)}}catch(e){}}},validate(e,{error:t}){if(!s.isBuffer(e))return{value:e,errors:t("binary.base")}},rules:{encoding:{method(e){return n(s.isEncoding(e),"Invalid encoding:",e),this.$_setFlag("encoding",e)}},length:{method(e){return this.$_addRule({name:"length",method:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:s,operator:n,args:a})=>i.compare(e.length,r,n)?e:t.error("binary."+s,{limit:a.limit,value:e}),args:[{name:"limit",ref:!0,assert:i.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}}},cast:{string:{from:e=>s.isBuffer(e),to:(e,t)=>e.toString()}},messages:{"binary.base":"{{#label}} must be a buffer or a string","binary.length":"{{#label}} must be {{#limit}} bytes","binary.max":"{{#label}} must be less than or equal to {{#limit}} bytes","binary.min":"{{#label}} must be at least {{#limit}} bytes"}})},(e,t,r)=>{const s=r(19),n=r(2),a=r(81),i=r(25),o=r(50),l=r(83),c=r(92),u={};u.schema=o.object({path:o.alternatives(o.array().items(o.string()).single(),o.func()).required(),index:o.alternatives(o.boolean(),o.array().items(o.string()).single()).default(!0),listing:o.boolean(),showHidden:o.boolean(),redirectToSlash:o.boolean(),lookupCompressed:o.boolean(),lookupMap:o.object().min(1).pattern(/.+/,o.string()),etagMethod:o.string().valid("hash","simple").allow(!1),defaultExtension:o.string().alphanum()}),u.resolvePathOption=function(e){if(e instanceof Error)throw e;if("string"==typeof e)return[e];if(Array.isArray(e))return e;throw n.internal("Invalid path function")},t.handler=function(e,t){const r=o.attempt(t,u.schema,"Invalid directory handler options ("+e.path+")");i.assert("}"===e.path[e.path.length-1],"The route path for a directory handler must end with a parameter:",e.path);const c=/\w+/.exec(e.path.slice(e.path.lastIndexOf("{")))[0],p=e.settings.files.relativeTo,h=Array.isArray(r.path)?r.path:null,d=!0===r.index?["index.html"]:r.index||[];return async(e,t)=>{const i=h??u.resolvePathOption(r.path.call(null,e)),o=e.params[c]??"";if(s.isAbsolute(o))throw n.notFound(null,{});if(o&&!r.showHidden&&u.isFileHidden(o))throw n.notFound(null,{});o||!e.server.settings.router.stripTrailingSlash&&e.path.endsWith("/")||(e.path+="/");const f=e.path,m=f.endsWith("/"),g={confine:null,lookupCompressed:r.lookupCompressed,lookupMap:r.lookupMap,etagMethod:r.etagMethod},y=async i=>{g.confine=i;let c,h=o;try{return await l.load(h,e,g)}catch(e){a.ignore(e,"boom"),c=e}if(u.isNotFound(c)){if(!r.defaultExtension)throw c;return m&&(h=h.slice(0,-1)),await l.load(h+"."+r.defaultExtension,e,g)}if(u.isDirectory(c)){if(!1!==r.redirectToSlash&&!e.server.settings.router.stripTrailingSlash&&!m)return t.redirect(f+"/");for(const t of d){const r=s.join(h,t);try{return await l.load(r,e,g)}catch(e){if(a.ignore(e,"boom"),!u.isNotFound(e))throw n.internal(t+" is a directory",e)}}if(r.listing)return u.generateListing(s.join(p,i,h),f,o,m,r,e)}throw c};for(let e=0;e

Directory: "+h+"

    ";if(r){const e=t.substring(0,t.lastIndexOf("/",t.length-(s?2:1)))+"/";d=d+'
  • Parent Directory
  • '}for(const e of p)!o.showHidden&&u.isFileHidden(e)||(d=d+'
  • '+i.escapeHtml(e)+"
  • ");return d+="
",l.generateResponse(d)},u.isFileHidden=function(e){return/(^|[\\\/])\.([^.\\\/]|\.[^\\\/])/.test(e)},u.pathEncode=function(e){return encodeURIComponent(e).replace(/%2F/g,"/").replace(/%5C/g,"\\")},u.isNotFound=function(e){return 404===e.output.statusCode},u.isDirectory=function(e){return 403===e.output.statusCode&&"EISDIR"===e.data.code}},(e,t,r)=>{const s=r(82),n=r(2),a=r(25),i={system:[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,s.AssertionError,a.Error]};t.rethrow=function(e,t,r={}){return i.catch(e,t,r,!0)},t.ignore=function(e,t,r={}){return i.catch(e,t,r,!1)},i.catch=function(e,t,r,s){if(i.match(e,t)===s){if(r.override&&(e=r.override),r.decorate&&Object.assign(e,r.decorate),r.return)return e;throw e}},t.background=async function(e,r="rethrow",s="system",n={}){try{"function"==typeof e?await e():await e}catch(e){t[r](e,s,n)}},t.isBoom=function(e){return n.isBoom(e)},t.isError=function(e){return e instanceof Error},t.isSystem=function(e){if(!e)return!1;if(e.isBoom)return!1;for(const t of i.system)if(e instanceof t)return!0;return!1},i.rules={system:t.isSystem,boom:t.isBoom},i.match=function(e,t){if(!t)return!0;t=Array.isArray(t)?t:[t];for(const r of t)if("string"==typeof r){if(i.rules[r](e))return!0}else if("object"==typeof r){if(a.contain(e,r,{deep:!0,part:!0}))return!0}else if(e instanceof r)return!0;return!1}},e=>{e.exports=require("assert")},(e,t,r)=>{const s=r(19),n=r(84),a=r(2),i=r(81),o=r(25),l=r(50),c=r(86),u=r(92),p={defaultMap:{gzip:".gz"}};p.schema=l.alternatives([l.string(),l.func(),l.object({path:l.alternatives(l.string(),l.func()).required(),confine:l.alternatives(l.string(),l.boolean()).default(!0),filename:l.string(),mode:l.string().valid("attachment","inline").allow(!1),lookupCompressed:l.boolean(),lookupMap:l.object().min(1).pattern(/.+/,l.string()),etagMethod:l.string().valid("hash","simple").allow(!1),start:l.number().integer().min(0).default(0),end:l.number().integer().min(l.ref("start"))}).with("filename","mode")]),t.handler=function(e,r){let s=l.attempt(r,p.schema,"Invalid file handler options ("+e.path+")");s="object"!=typeof r?{path:r,confine:"."}:s,s.confine=!0===s.confine?".":s.confine,o.assert("string"!=typeof s.path||"/"!==s.path[s.path.length-1],"File path cannot end with a '/':",e.path);return e=>{const r="function"==typeof s.path?s.path(e):s.path;return t.response(r,s,e)}},t.load=function(e,r,s){const n=t.response(e,s,r,!0);return p.prepare(n)},t.response=function(e,t,r,n){if(o.assert(!t.mode||-1!==["attachment","inline"].indexOf(t.mode),"options.mode must be either false, attachment, or inline"),t.confine){const n=s.resolve(r.route.settings.files.relativeTo,t.confine);0!==(e=s.isAbsolute(e)?s.normalize(e):s.join(n,e)).lastIndexOf(n,0)&&(e=null)}else e=s.isAbsolute(e)?s.normalize(e):s.join(r.route.settings.files.relativeTo,e);const a={path:e,settings:t,stat:null,file:null},i=n?null:p.prepare;return r.generateResponse(a,{variety:"file",marshal:p.marshal,prepare:i,close:p.close})},p.prepare=async function(e){const{request:t,source:r}=e,{settings:n,path:i}=r;if(null===i)throw a.forbidden(null,{code:"EACCES"});const o=r.file=new u.File(i);try{const r=await o.openStat("r"),a=n.start??0;if(void 0!==n.end?e.bytes(n.end-a+1):e.bytes(r.size-a),e.headers["content-type"]||e.type(t.server.mime.path(i).type??"application/octet-stream"),e.header("last-modified",r.mtime.toUTCString()),n.mode){const t=n.filename??s.basename(i);e.header("content-disposition",n.mode+"; filename="+encodeURIComponent(t))}return await c.apply(e,r),e}catch(t){throw p.close(e),t}},p.marshal=async function(e){const{request:t,source:r}=e,{settings:s}=r;if(s.lookupCompressed&&!s.start&&void 0===s.end&&!1!==t.server.settings.compression){const a=s.lookupMap??p.defaultMap,o=t.info.acceptEncoding,l=a.hasOwnProperty(o)?a[o]:null;if(l){const t=new u.File(`${r.path}${l}`);try{var n=await t.openStat("r")}catch(e){t.close(),i.ignore(e,"boom")}n&&(r.file.close(),r.file=t,e.bytes(n.size),e.header("content-encoding",o),e.vary("accept-encoding"))}}return p.createStream(e)},p.addContentRange=function(e){const{request:t}=e;let r=null;if(t.route.settings.response.ranges){const s=e.headers["content-length"];if(t.headers.range&&s&&(!t.headers["if-range"]||t.headers["if-range"]===e.headers.etag)){const i=t.server.mime.type(e.headers["content-type"]||"application/octet-stream"),o=t.server.settings.compression&&i.compressible&&!e.headers["content-encoding"]?t.info.acceptEncoding:null;if("identity"===o||!o){const i=n.header(t.headers.range,s);if(!i){const e=a.rangeNotSatisfiable();throw e.output.headers["content-range"]="bytes */"+s,e}1===i.length&&(r=i[0],e.code(206),e.bytes(r.to-r.from+1),e.header("content-range","bytes "+r.from+"-"+r.to+"/"+s))}}e.header("accept-ranges","bytes")}return r},p.createStream=function(e){const{settings:t,file:r}=e.source;o.assert(null!==r);const s=p.addContentRange(e),n={start:t.start??0,end:t.end};return s&&(n.end=s.to+n.start,n.start=s.from+n.start),r.createReadStream(n)},p.close=function(e){const{source:t}=e;null!==t.file&&(t.file.close(),t.file=null)}},(e,t,r)=>{const s=r(85),n=r(25),a={headerRx:/^bytes=[\s,]*((?:(?:\d+\-\d*)|(?:\-\d+))(?:\s*,\s*(?:(?:\d+\-\d*)|(?:\-\d+)))*)$/i};t.header=function(e,t){const r=a.headerRx.exec(e);if(!r)return null;const s=t-1,n=[],i=r[1].match(/\d*\-\d*/g);for(let e of i){let r,i;if(e=e.split("-"),e[0]&&(r=parseInt(e[0],10)),e[1]?(i=parseInt(e[1],10),void 0!==r?i>s&&(i=s):(r=t-i,i=s)):i=s,r>i)return null;n.push(new a.Range(r,i))}if(1===n.length)return n;n.sort(((e,t)=>e.from-t.from));const o=[];for(let e=n.length-1;e>0;--e){const t=n[e],r=n[e-1];t.from<=r.to+1?r.to=t.to:o.unshift(t)}return o.unshift(n[0]),o},a.Range=class{constructor(e,t){this.from=e,this.to=t}},t.Clip=class extends s.Transform{constructor(e){if(!(e instanceof a.Range)){n.assert("object"==typeof e,'Expected "range" object');const t=e.from??0;n.assert("number"==typeof t,'"range.from" must be a number'),n.assert(t===parseInt(t,10)&&t>=0,'"range.from" must be a positive integer');const r=e.to??0;n.assert("number"==typeof r,'"range.to" must be a number'),n.assert(r===parseInt(r,10)&&r>=0,'"range.to" must be a positive integer'),n.assert(r>=t,'"range.to" must be greater than or equal to "range.from"'),e=new a.Range(t,r)}super(),this._range=e,this._next=0,this._pipes=new Set,this.on("pipe",(e=>this._pipes.add(e))),this.on("unpipe",(e=>this._pipes.delete(e)))}_transform(e,t,r){try{a.processChunk(this,e)}catch(e){return r(e)}return r()}_flush(e){this._pipes.clear(),e()}},a.processChunk=function(e,t){const r=e._next;if(e._next=e._next+t.length,e._next<=e._range.from)return;if(r>e._range.to){for(const t of e._pipes)t.unpipe(e);return e._pipes.clear(),void e.end()}const s=Math.max(0,e._range.from-r),n=Math.min(t.length,e._range.to-r+1);e.push(t.slice(s,n))}},e=>{e.exports=require("stream")},(e,t,r)=>{const s=r(87),n=r(85),a=r(88),i=r(2),o=r(81),l=r(89),c={pendings:new Map,streamEnd:a.promisify(n.finished),computeHashed:async function(e,t){const r=e.request.server.plugins.inert._etags;if(!r)return null;const s=[e.source.path,t.ino,t.size,t.mtime.getTime()].join("-"),n=r.get(s);if(n)return n;let a=c.pendings.get(s);if(a)return await a;return c.pendings.set(s,a=(async()=>{try{const t=await c.hashFile(e);return r.set(s,t),t}finally{c.pendings.delete(s)}})()),await a},hashFile:async function(e){const t=s.createHash("sha1");t.setEncoding("hex");const r=e.source.file.createReadStream({autoClose:!1});r.pipe(t);try{return await c.streamEnd(r),t.read()}catch(t){throw o.rethrow(t,"system"),i.boomify(t,{message:"Failed to hash file",data:{path:e.source.path}})}},computeSimple:function(e,t){return t.size.toString(16)+"-"+t.mtime.getTime().toString(16)}};t.apply=async function(e,t){const r=e.source.settings.etagMethod;if(!1===r)return;let s;s="simple"===r?c.computeSimple(e,t):await c.computeHashed(e,t),null!==s&&e.etag(s,{vary:!0})},t.Cache=l},e=>{e.exports=require("crypto")},e=>{e.exports=require("util")},(e,t,r)=>{const s=r(90),n=Symbol("max"),a=Symbol("length"),i=Symbol("lengthCalculator"),o=Symbol("allowStale"),l=Symbol("maxAge"),c=Symbol("dispose"),u=Symbol("noDisposeOnSet"),p=Symbol("lruList"),h=Symbol("cache"),d=Symbol("updateAgeOnGet"),f=()=>1;const m=(e,t,r)=>{const s=e[h].get(t);if(s){const t=s.value;if(g(e,t)){if(b(e,s),!e[o])return}else r&&(e[d]&&(s.value.now=Date.now()),e[p].unshiftNode(s));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[l])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[l]&&r>e[l]},y=e=>{if(e[a]>e[n])for(let t=e[p].tail;e[a]>e[n]&&null!==t;){const r=t.prev;b(e,t),t=r}},b=(e,t)=>{if(t){const r=t.value;e[c]&&e[c](r.key,r.value),e[a]-=r.length,e[h].delete(r.key),e[p].removeNode(t)}};class v{constructor(e,t,r,s,n){this.key=e,this.value=t,this.length=r,this.now=s,this.maxAge=n||0}}const _=(e,t,r,s)=>{let n=r.value;g(e,n)&&(b(e,r),e[o]||(n=void 0)),n&&t.call(s,n.value,n.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[n]=e.max||1/0;const t=e.length||f;if(this[i]="function"!=typeof t?f:t,this[o]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[l]=e.maxAge||0,this[c]=e.dispose,this[u]=e.noDisposeOnSet||!1,this[d]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[n]=e||1/0,y(this)}get max(){return this[n]}set allowStale(e){this[o]=!!e}get allowStale(){return this[o]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[l]=e,y(this)}get maxAge(){return this[l]}set lengthCalculator(e){"function"!=typeof e&&(e=f),e!==this[i]&&(this[i]=e,this[a]=0,this[p].forEach((e=>{e.length=this[i](e.value,e.key),this[a]+=e.length}))),y(this)}get lengthCalculator(){return this[i]}get length(){return this[a]}get itemCount(){return this[p].length}rforEach(e,t){t=t||this;for(let r=this[p].tail;null!==r;){const s=r.prev;_(this,e,r,t),r=s}}forEach(e,t){t=t||this;for(let r=this[p].head;null!==r;){const s=r.next;_(this,e,r,t),r=s}}keys(){return this[p].toArray().map((e=>e.key))}values(){return this[p].toArray().map((e=>e.value))}reset(){this[c]&&this[p]&&this[p].length&&this[p].forEach((e=>this[c](e.key,e.value))),this[h]=new Map,this[p]=new s,this[a]=0}dump(){return this[p].map((e=>!g(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[p]}set(e,t,r){if((r=r||this[l])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const s=r?Date.now():0,o=this[i](t,e);if(this[h].has(e)){if(o>this[n])return b(this,this[h].get(e)),!1;const i=this[h].get(e).value;return this[c]&&(this[u]||this[c](e,i.value)),i.now=s,i.maxAge=r,i.value=t,this[a]+=o-i.length,i.length=o,this.get(e),y(this),!0}const d=new v(e,t,o,s,r);return d.length>this[n]?(this[c]&&this[c](e,t),!1):(this[a]+=d.length,this[p].unshift(d),this[h].set(e,this[p].head),y(this),!0)}has(e){if(!this[h].has(e))return!1;const t=this[h].get(e).value;return!g(this,t)}get(e){return m(this,e,!0)}peek(e){return m(this,e,!1)}pop(){const e=this[p].tail;return e?(b(this,e),e.value):null}del(e){b(this,this[h].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const s=e[r],n=s.e||0;if(0===n)this.set(s.k,s.v);else{const e=n-t;e>0&&this.set(s.k,s.v,e)}}}prune(){this[h].forEach(((e,t)=>m(this,t,!1)))}}},(e,t,r)=>{function s(e){var t=this;if(t instanceof s||(t=new s),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var r=0,n=arguments.length;r1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");s=this.head.next,r=this.head.value}for(var n=0;null!==s;n++)r=e(r,s.value,n),s=s.next;return r},s.prototype.reduceReverse=function(e,t){var r,s=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");s=this.tail.prev,r=this.tail.value}for(var n=this.length-1;null!==s;n--)r=e(r,s.value,n),s=s.prev;return r},s.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},s.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},s.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new s;if(tthis.length&&(t=this.length);for(var n=0,a=this.head;null!==a&&nthis.length&&(t=this.length);for(var n=this.length,a=this.tail;null!==a&&n>t;n--)a=a.prev;for(;null!==a&&n>e;n--,a=a.prev)r.push(a.value);return r},s.prototype.splice=function(e,t){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var r=0,s=this.head;null!==s&&r{e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},(e,t,r)=>{const s=r(93),n=r(88),a=r(2),i=r(81),o=r(25),l={methods:{promised:["open","close","fstat","readdir"],raw:["createReadStream"]},notFound:new Set(["ENOENT","ENOTDIR"])};t.File=class{constructor(e){this.path=e,this.fd=null}async open(e){o.assert(null===this.fd);try{this.fd=await t.open(this.path,e)}catch(e){const t={path:this.path};if(-1!==this.path.indexOf("\0")||l.notFound.has(e.code))throw a.notFound(null,t);if("EACCES"===e.code||"EPERM"===e.code)throw t.code=e.code,a.forbidden(null,t);throw a.boomify(e,{message:"Failed to open file",data:t})}}close(){null!==this.fd&&(i.background(t.close(this.fd)),this.fd=null)}async stat(){o.assert(null!==this.fd);try{const e=await t.fstat(this.fd);if(e.isDirectory())throw a.forbidden(null,{code:"EISDIR",path:this.path});return e}catch(e){throw this.close(this.fd),i.rethrow(e,["boom","system"]),a.boomify(e,{message:"Failed to stat file",data:{path:this.path}})}}async openStat(e){return await this.open(e),this.stat()}createReadStream(e){o.assert(null!==this.fd),e=Object.assign({fd:this.fd,start:0},e);const r=t.createReadStream(this.path,e);return!1!==e.autoClose&&(this.fd=null),r}};for(const e of l.methods.raw)t[e]=s[e].bind(s);for(const e of l.methods.promised)t[e]=n.promisify(s[e])},e=>{e.exports=require("fs")},e=>{e.exports=JSON.parse('{"name":"@hapi/inert","description":"Static file and directory handlers plugin for hapi.js","version":"7.1.0","repository":"https://github.com/hapijs/inert.git","main":"lib/index.js","types":"lib/index.d.ts","files":["lib"],"keywords":["file","directory","handler","hapi","plugin"],"eslintConfig":{"extends":["plugin:@hapi/module"]},"dependencies":{"@hapi/ammo":"^6.0.1","@hapi/boom":"^10.0.1","@hapi/bounce":"^3.0.1","@hapi/hoek":"^11.0.2","@hapi/validate":"^2.0.1","lru-cache":"^7.14.1"},"devDependencies":{"@hapi/code":"^9.0.3","@hapi/eslint-plugin":"*","@hapi/file":"^3.0.0","@hapi/hapi":"^21.3.0","@hapi/lab":"^25.1.2","@types/node":"^14.18.37","joi":"^17.8.3","typescript":"^4.9.5"},"scripts":{"test":"lab -f -a @hapi/code -t 100 -L -Y","test-cov-html":"lab -f -a @hapi/code -r html -o coverage.html"},"license":"BSD-3-Clause"}')},e=>{e.exports=require("blipp@4.0.2")},e=>{e.exports=require("hapi-auth-jwt2@10.5.1")},e=>{e.exports=require("@hapi/good-console@9.0.1")},(e,t,r)=>{var s=r(14).Buffer;const n=r(27),a=r(30),i=r(99),o=r(100),l=r(109),c=r(106),u=r(110),p=r(111),h=r(108),d=r(104),f=r(112);let m;const g={types:{alternatives:r(114),any:r(115),array:r(121),boolean:r(122),date:r(123),function:r(124),link:r(126),number:r(127),object:r(128),string:r(129),symbol:r(136)},aliases:{alt:"alternatives",bool:"boolean",func:"function"}};s&&(g.types.binary=r(137)),g.root=function(){const e={_types:new Set(Object.keys(g.types))};for(const t of e._types)e[t]=function(...e){return n(!e.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),g.generate(this,g.types[t],e)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(...e){return this.any()[t](...e)};Object.assign(e,g.methods);for(const t in g.aliases){const r=g.aliases[t];e[t]=e[r]}return e.x=e.expression,f.setup&&f.setup(e),e},g.methods={ValidationError:c.ValidationError,version:o.version,cache:i.provider,assert(e,t,...r){g.assert(e,t,!0,r)},attempt:(e,t,...r)=>g.assert(e,t,!1,r),build(e){return n("function"==typeof p.build,"Manifest functionality disabled"),p.build(this,e)},checkPreferences(e){o.checkPreferences(e)},compile(e,t){return l.compile(this,e,t)},defaults(e){n("function"==typeof e,"modifier must be a function");const t=Object.assign({},this);for(const r of t._types){const s=e(t[r]());n(o.isSchema(s),"modifier must return a valid schema object"),t[r]=function(...e){return g.generate(this,s,e)}}return t},expression:(...e)=>new d(...e),extend(...e){o.verifyFlat(e,"extend"),m=m||r(102),n(e.length,"You need to provide at least one extension"),this.assert(e,m.extensions);const t=Object.assign({},this);t._types=new Set(t._types);for(let r of e){"function"==typeof r&&(r=r(t)),this.assert(r,m.extension);const e=g.expandExtension(r,t);for(const r of e){n(void 0===t[r.type]||t._types.has(r.type),"Cannot override name",r.type);const e=r.base||this.any(),s=u.type(e,r);t._types.add(r.type),t[r.type]=function(...e){return g.generate(this,s,e)}}}return t},isError:c.ValidationError.isError,isExpression:d.isTemplate,isRef:h.isRef,isSchema:o.isSchema,in:(...e)=>h.in(...e),override:o.symbols.override,ref:(...e)=>h.create(...e),types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in g.aliases)e[t]=this[t]();return e}},g.assert=function(e,t,r,s){const n=s[0]instanceof Error||"string"==typeof s[0]?s[0]:null,i=null!==n?s[1]:s[0],l=t.validate(e,o.preferences({errors:{stack:!0}},i||{}));let u=l.error;if(!u)return l.value;if(n instanceof Error)throw n;const p=r&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof c.ValidationError==!1&&(u=a(u)),u.message=n?`${n} ${p}`:p,u},g.generate=function(e,t,r){return n(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&r.length?t._definition.args(t,...r):t},g.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const r=[];for(const s of t._types)if(e.type.test(s)){const n=Object.assign({},e);n.type=s,n.base=t[s](),r.push(n)}return r},e.exports=g.root()},(e,t,r)=>{const s=r(27),n=r(30),a=r(100),i={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new i.Cache(e)},i.Cache=class{constructor(e={}){a.assertOptions(e,["max"]),s(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||i.max,this._map=new Map,this._list=new i.List}get length(){return this._map.size}set(e,t){if(null!==e&&!i.supported.has(typeof e))return;let r=this._map.get(e);if(r)return r.value=t,void this._list.first(r);r=this._list.unshift({key:e,value:t}),this._map.set(e,r),this._compact()}get(e){const t=this._map.get(e);if(t)return this._list.first(t),n(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},i.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:t,prev:r}=e;return t.prev=r,r&&(r.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}}},(e,t,r)=>{const s=r(27),n=r(28),a=r(101);let i,o;const l={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};t.version=a.version,t.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},t.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},t.assertOptions=function(e,t,r="Options"){s(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const n=Object.keys(e).filter((e=>!t.includes(e)));s(0===n.length,`${r} contain unknown keys: ${n}`)},t.checkPreferences=function(e){o=o||r(102);const t=o.preferences.validate(e);if(t.error)throw new n([t.error.details[0].message])},t.compare=function(e,t,r){switch(r){case"=":return e===t;case">":return e>t;case"<":return e=":return e>=t;case"<=":return e<=t}},t.default=function(e,t){return void 0===e?t:e},t.isIsoDate=function(e){return l.isoDate.test(e)},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.isResolvable=function(e){return!!e&&(e[t.symbols.ref]||e[t.symbols.template])},t.isSchema=function(e,r={}){const n=e&&e[t.symbols.any];return!!n&&(s(r.legacy||n.version===t.version,"Cannot mix different versions of joi schemas"),!0)},t.isValues=function(e){return e[t.symbols.values]},t.limit=function(e){return Number.isSafeInteger(e)&&e>=0},t.preferences=function(e,s){i=i||r(103),e=e||{},s=s||{};const n=Object.assign({},e,s);return s.errors&&e.errors&&(n.errors=Object.assign({},e.errors,s.errors),n.errors.wrap=Object.assign({},e.errors.wrap,s.errors.wrap)),s.messages&&(n.messages=i.compile(s.messages,e.messages)),delete n[t.symbols.prefs],n},t.tryWithPath=function(e,t,r={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,r.append&&(e.message=`${e.message} (${e.path})`),e}},t.validateArg=function(e,r,{assert:s,message:n}){if(t.isSchema(s)){const t=s.validate(e);if(!t.error)return;return t.error.message}if(!s(e))return r?`${r} ${n}`:n},t.verifyFlat=function(e,t){for(const r of e)s(!Array.isArray(r),"Method no longer accepts array arguments:",t)}},e=>{e.exports=JSON.parse('{"name":"joi","description":"Object schema validation","version":"17.12.2","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause"}')},(e,t,r)=>{const s=r(98),n={};n.wrap=s.string().min(1).max(2).allow(!1),t.preferences=s.object({allowUnknown:s.boolean(),abortEarly:s.boolean(),artifacts:s.boolean(),cache:s.boolean(),context:s.object(),convert:s.boolean(),dateFormat:s.valid("date","iso","string","time","utc"),debug:s.boolean(),errors:{escapeHtml:s.boolean(),label:s.valid("path","key",!1),language:[s.string(),s.object().ref()],render:s.boolean(),stack:s.boolean(),wrap:{label:n.wrap,array:n.wrap,string:n.wrap}},externals:s.boolean(),messages:s.object(),noDefaults:s.boolean(),nonEnumerables:s.boolean(),presence:s.valid("required","optional","forbidden"),skipFunctions:s.boolean(),stripUnknown:s.object({arrays:s.boolean(),objects:s.boolean()}).or("arrays","objects").allow(!0,!1),warnings:s.boolean()}).strict(),n.nameRx=/^[a-zA-Z0-9]\w*$/,n.rule=s.object({alias:s.array().items(s.string().pattern(n.nameRx)).single(),args:s.array().items(s.string(),s.object({name:s.string().pattern(n.nameRx).required(),ref:s.boolean(),assert:s.alternatives([s.function(),s.object().schema()]).conditional("ref",{is:!0,then:s.required()}),normalize:s.function(),message:s.string().when("assert",{is:s.function(),then:s.required()})})),convert:s.boolean(),manifest:s.boolean(),method:s.function().allow(!1),multi:s.boolean(),validate:s.function()}),t.extension=s.object({type:s.alternatives([s.string(),s.object().regex()]).required(),args:s.function(),cast:s.object().pattern(n.nameRx,s.object({from:s.function().maxArity(1).required(),to:s.function().minArity(1).maxArity(2).required()})),base:s.object().schema().when("type",{is:s.object().regex(),then:s.forbidden()}),coerce:[s.function().maxArity(3),s.object({method:s.function().maxArity(3).required(),from:s.array().items(s.string()).single()})],flags:s.object().pattern(n.nameRx,s.object({setter:s.string(),default:s.any()})),manifest:{build:s.function().arity(2)},messages:[s.object(),s.string()],modifiers:s.object().pattern(n.nameRx,s.function().minArity(1).maxArity(2)),overrides:s.object().pattern(n.nameRx,s.function()),prepare:s.function().maxArity(3),rebuild:s.function().arity(1),rules:s.object().pattern(n.nameRx,n.rule),terms:s.object().pattern(n.nameRx,s.object({init:s.array().allow(null).required(),manifest:s.object().pattern(/.+/,[s.valid("schema","single"),s.object({mapped:s.object({from:s.string().required(),to:s.string().required()}).required()})])})),validate:s.function().maxArity(3)}).strict(),t.extensions=s.array().items(s.object(),s.function().arity(1)).strict(),n.desc={buffer:s.object({buffer:s.string()}),func:s.object({function:s.function().required(),options:{literal:!0}}),override:s.object({override:!0}),ref:s.object({ref:s.object({type:s.valid("value","global","local"),path:s.array().required(),separator:s.string().length(1).allow(!1),ancestor:s.number().min(0).integer().allow("root"),map:s.array().items(s.array().length(2)).min(1),adjust:s.function(),iterables:s.boolean(),in:s.boolean(),render:s.boolean()}).required()}),regex:s.object({regex:s.string().min(3)}),special:s.object({special:s.valid("deep").required()}),template:s.object({template:s.string().required(),options:s.object()}),value:s.object({value:s.alternatives([s.object(),s.array()]).required()})},n.desc.entity=s.alternatives([s.array().items(s.link("...")),s.boolean(),s.function(),s.number(),s.string(),n.desc.buffer,n.desc.func,n.desc.ref,n.desc.regex,n.desc.special,n.desc.template,n.desc.value,s.link("/")]),n.desc.values=s.array().items(null,s.boolean(),s.function(),s.number().allow(1/0,-1/0),s.string().allow(""),s.symbol(),n.desc.buffer,n.desc.func,n.desc.override,n.desc.ref,n.desc.regex,n.desc.template,n.desc.value),n.desc.messages=s.object().pattern(/.+/,[s.string(),n.desc.template,s.object().pattern(/.+/,[s.string(),n.desc.template])]),t.description=s.object({type:s.string().required(),flags:s.object({cast:s.string(),default:s.any(),description:s.string(),empty:s.link("/"),failover:n.desc.entity,id:s.string(),label:s.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:s.boolean(),unit:s.string()}).unknown(),preferences:{allowUnknown:s.boolean(),abortEarly:s.boolean(),artifacts:s.boolean(),cache:s.boolean(),convert:s.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:s.boolean(),label:["path","key"],language:[s.string(),n.desc.ref],wrap:{label:n.wrap,array:n.wrap}},externals:s.boolean(),messages:n.desc.messages,noDefaults:s.boolean(),nonEnumerables:s.boolean(),presence:["required","optional","forbidden"],skipFunctions:s.boolean(),stripUnknown:s.object({arrays:s.boolean(),objects:s.boolean()}).or("arrays","objects").allow(!0,!1),warnings:s.boolean()},allow:n.desc.values,invalid:n.desc.values,rules:s.array().min(1).items({name:s.string().required(),args:s.object().min(1),keep:s.boolean(),message:[s.string(),n.desc.messages],warn:s.boolean()}),keys:s.object().pattern(/.*/,s.link("/")),link:n.desc.ref}).pattern(/^[a-z]\w*$/,s.any())},(e,t,r)=>{const s=r(27),n=r(30),a=r(104);t.compile=function(e,t){if("string"==typeof e)return s(!t,"Cannot set single message string"),new a(e);if(a.isTemplate(e))return s(!t,"Cannot set single message template"),e;s("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?n(t):{};for(let r in e){const n=e[r];if("root"===r||a.isTemplate(n)){t[r]=n;continue}if("string"==typeof n){t[r]=new a(n);continue}s("object"==typeof n&&!Array.isArray(n),"Invalid message for",r);const i=r;for(r in t[i]=t[i]||{},n){const e=n[r];"root"===r||a.isTemplate(e)?t[i][r]=e:(s("string"==typeof e,"Invalid message for",r,"in",i),t[i][r]=new a(e))}}return t},t.decompile=function(e){const t={};for(let r in e){const s=e[r];if("root"===r){t.root=s;continue}if(a.isTemplate(s)){t[r]=s.describe({compact:!0});continue}const n=r;for(r in t[n]={},s){const e=s[r];"root"!==r?t[n][r]=e.describe({compact:!0}):t[n].root=e}}return t},t.merge=function(e,r){if(!e)return t.compile(r);if(!r)return e;if("string"==typeof r)return new a(r);if(a.isTemplate(r))return r;const i=n(e);for(let e in r){const t=r[e];if("root"===e||a.isTemplate(t)){i[e]=t;continue}if("string"==typeof t){i[e]=new a(t);continue}s("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const n=e;for(e in i[n]=i[n]||{},t){const r=t[e];"root"===e||a.isTemplate(r)?i[n][e]=r:(s("string"==typeof r,"Invalid message for",e,"in",n),i[n][e]=new a(r))}}return i}},(e,t,r)=>{const s=r(27),n=r(30),a=r(42),i=r(105),o=r(100),l=r(106),c=r(108),u={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};e.exports=u.Template=class{constructor(e,t){if(s("string"==typeof e,"Template source must be a string"),s(!e.includes("\0")&&!e.includes(""),"Template source cannot contain reserved control characters"),this.source=e,this.rendered=e,this._template=null,t){const{functions:e,...r}=t;this._settings=Object.keys(r).length?n(r):void 0,this._functions=e,this._functions&&(s(Object.keys(this._functions).every((e=>"string"==typeof e)),"Functions keys must be strings"),s(Object.values(this._functions).every((e=>"function"==typeof e)),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const e=u.encode(this.source),t=u.split(e);let r=!1;const s=[],n=t.shift();n&&s.push(n);for(const e of t){const t="{"!==e[0],n=t?"}":"}}",a=e.indexOf(n);if(-1===a||"{"===e[1]){s.push(`{${u.decode(e)}`);continue}let i=e.slice(t?0:1,a);const o=":"===i[0];o&&(i=i.slice(1));const l=this._ref(u.decode(i),{raw:t,wrapped:o});s.push(l),"string"!=typeof l&&(r=!0);const c=e.slice(a+n.length);c&&s.push(u.decode(c))}r?this._template=s:this.rendered=s.join("")}static date(e,t){return u.dateFormat[t.dateFormat].call(e)}describe(e={}){if(!this._settings&&e.compact)return this.source;const t={template:this.source};return this._settings&&(t.options=this._settings),this._functions&&(t.functions=this._functions),t}static build(e){return new u.Template(e.template,e.options||e.functions?{...e.options,functions:e.functions}:void 0)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[o.symbols.template]}refs(){if(!this._template)return;const e=[];for(const t of this._template)"string"!=typeof t&&e.push(...t.refs);return e}resolve(e,t,r,s){return this._template&&1===this._template.length?this._part(this._template[0],e,t,r,s,{}):this.render(e,t,r,s)}_part(e,...t){return e.ref?e.ref.resolve(...t):e.formula.evaluate(t)}render(e,t,r,s,n={}){if(!this.isDynamic())return this.rendered;const i=[];for(const o of this._template)if("string"==typeof o)i.push(o);else{const l=this._part(o,e,t,r,s,n),c=u.stringify(l,e,t,r,s,n);if(void 0!==c){const e=o.raw||!1===(n.errors&&n.errors.escapeHtml)?c:a(c);i.push(u.wrap(e,o.wrapped&&r.errors.wrap.label))}}return i.join("")}_ref(e,{raw:t,wrapped:r}){const s=[],n=e=>{const t=c.create(e,this._settings);return s.push(t),e=>{const r=t.resolve(...e);return void 0!==r?r:null}};try{const t=this._functions?{...u.functions,...this._functions}:u.functions;var a=new i.Parser(e,{reference:n,functions:t,constants:u.constants})}catch(t){throw t.message=`Invalid template variable "${e}" fails due to: ${t.message}`,t}if(a.single){if("reference"===a.single.type){const e=s[0];return{ref:e,raw:t,refs:s,wrapped:r||"local"===e.type&&"label"===e.key}}return u.stringify(a.single.value)}return{formula:a,raw:t,refs:s}}toString(){return this.source}},u.Template.prototype[o.symbols.template]=!0,u.Template.prototype.isImmutable=!0,u.encode=function(e){return e.replace(/\\(\{+)/g,((e,t)=>u.opens.slice(0,t.length))).replace(/\\(\}+)/g,((e,t)=>u.closes.slice(0,t.length)))},u.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},u.split=function(e){const t=[];let r="";for(let s=0;s ${s.toString()}`);e=t}if(!Array.isArray(e))return e.toString();const p=[];for(const i of e)p.push(u.stringify(i,t,r,s,n,{arrayItems:!0,...a}));return u.wrap(p.join(", "),!l&&o.array)},u.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},u.functions={if:(e,t,r)=>e?t:r,length:e=>"string"==typeof e?e.length:e&&"object"==typeof e?Array.isArray(e)?e.length:Object.keys(e).length:null,msg(e){const[t,r,s,n,a]=this,i=a.messages;if(!i)return"";const o=l.template(t,i[0],e,r,s)||l.template(t,i[1],e,r,s);return o?o.render(t,r,s,n,a):""},number:e=>"number"==typeof e?e:"string"==typeof e?parseFloat(e):"boolean"==typeof e?e?1:0:e instanceof Date?e.getTime():null}},(e,t)=>{const r={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};t.Parser=class{constructor(e,t={}){if(!t[r.settings]&&t.constants)for(const e in t.constants){const r=t.constants[e];if(null!==r&&!["boolean","number","string"].includes(typeof r))throw new Error(`Formula constant ${e} contains invalid ${typeof r} value type`)}this.settings=t[r.settings]?t:Object.assign({[r.settings]:!0,constants:{},functions:{}},t),this.single=null,this._parts=null,this._parse(e)}_parse(e){let s=[],n="",a=0,i=!1;const o=e=>{if(a)throw new Error("Formula missing closing parenthesis");const o=s.length?s[s.length-1]:null;if(i||n||e){if(o&&"reference"===o.type&&")"===e)return o.type="function",o.value=this._subFormula(n,o.value),void(n="");if(")"===e){const e=new t.Parser(n,this.settings);s.push({type:"segment",value:e})}else if(i){if("]"===i)return s.push({type:"reference",value:n}),void(n="");s.push({type:"literal",value:n})}else if(r.operatorCharacters.includes(n))o&&"operator"===o.type&&r.operators.includes(o.value+n)?o.value+=n:s.push({type:"operator",value:n});else if(n.match(r.numberRx))s.push({type:"constant",value:parseFloat(n)});else if(void 0!==this.settings.constants[n])s.push({type:"constant",value:this.settings.constants[n]});else{if(!n.match(r.tokenRx))throw new Error(`Formula contains invalid token: ${n}`);s.push({type:"reference",value:n})}n=""}};for(const t of e)i?t===i?(o(),i=!1):n+=t:a?"("===t?(n+=t,++a):")"===t?(--a,a?n+=t:o(t)):n+=t:t in r.literals?i=r.literals[t]:"("===t?(o(),++a):r.operatorCharacters.includes(t)?(o(),n=t,o()):" "!==t?n+=t:o();o(),s=s.map(((e,t)=>"operator"!==e.type||"-"!==e.value||t&&"operator"!==s[t-1].type?e:{type:"operator",value:"n"}));let l=!1;for(const e of s){if("operator"===e.type){if(r.operatorsPrefix.includes(e.value))continue;if(!l)throw new Error("Formula contains an operator in invalid position");if(!r.operators.includes(e.value))throw new Error(`Formula contains an unknown operator ${e.value}`)}else if(l)throw new Error("Formula missing expected operator");l=!l}if(!l)throw new Error("Formula contains invalid trailing operator");1===s.length&&["reference","literal","constant"].includes(s[0].type)&&(this.single={type:"reference"===s[0].type?"reference":"value",value:s[0].value}),this._parts=s.map((e=>{if("operator"===e.type)return r.operatorsPrefix.includes(e.value)?e:e.value;if("reference"!==e.type)return e.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(e.value))throw new Error(`Formula contains invalid reference ${e.value}`);return this.settings.reference?this.settings.reference(e.value):r.reference(e.value)}))}_subFormula(e,s){const n=this.settings.functions[s];if("function"!=typeof n)throw new Error(`Formula contains unknown function ${s}`);let a=[];if(e){let t="",n=0,i=!1;const o=()=>{if(!t)throw new Error(`Formula contains function ${s} with invalid arguments ${e}`);a.push(t),t=""};for(let s=0;snew t.Parser(e,this.settings))),function(e){const t=[];for(const r of a)t.push(r.evaluate(e));return n.call(e,...t)}}evaluate(e){const t=this._parts.slice();for(let s=t.length-2;s>=0;--s){const n=t[s];if(n&&"operator"===n.type){const a=t[s+1];t.splice(s+1,1);const i=r.evaluate(a,e);t[s]=r.single(n.value,i)}}return r.operatorsOrder.forEach((s=>{for(let n=1;n":return t>s;case">=":return t>=s;case"==":return t===s;case"!=":return t!==s;case"&&":return t&&s;case"||":return t||s}return null},r.exists=function(e){return null!=e}},(e,t,r)=>{const s=r(107),n=r(100),a=r(104);t.Report=class{constructor(e,r,s,n,a,i,o){if(this.code=e,this.flags=n,this.messages=a,this.path=i.path,this.prefs=o,this.state=i,this.value=r,this.message=null,this.template=null,this.local=s||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}_setTemplate(e){if(this.template=e,!this.flags.label&&0===this.path.length){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?`Error code "${e}" is not defined, your custom type is missing the correct messages definition`:(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(e,r){return t.template(this.value,e,r||this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const r of e)"object"!=typeof r&&("string"==typeof r?(t&&(t+="."),t+=r):t+=`[${r}]`);return t},t.template=function(e,t,r,s,i){if(!t)return;if(a.isTemplate(t))return"root"!==r?t:null;let o=i.errors.language;if(n.isResolvable(o)&&(o=o.resolve(e,s,i)),o&&t[o]){if(void 0!==t[o][r])return t[o][r];if(void 0!==t[o]["*"])return t[o]["*"]}return t[r]?t[r]:t["*"]},t.label=function(e,r,s,n){if(e.label)return e.label;if(!s.errors.label)return"";let a=r.path;"key"===s.errors.label&&r.path.length>1&&(a=r.path.slice(-1));const i=t.path(a);return i||(t.template(null,s.messages,"root",r,s)||n&&t.template(null,n,"root",r,s)||"value")},t.process=function(e,r,s){if(!e)return null;const{override:n,message:a,details:i}=t.details(e);if(n)return n;if(s.errors.stack)return new t.ValidationError(a,i,r);const o=Error.stackTraceLimit;Error.stackTraceLimit=0;const l=new t.ValidationError(a,i,r);return Error.stackTraceLimit=o,l},t.details=function(e,t={}){let r=[];const s=[];for(const n of e){if(n instanceof Error){if(!1!==t.override)return{override:n};const e=n.toString();r.push(e),s.push({message:e,type:"override",context:{error:n}});continue}const e=n.toString();r.push(e),s.push({message:e,path:n.path.filter((e=>"object"!=typeof e)),type:n.code,context:n.local})}return r.length>1&&(r=[...new Set(r)]),{message:r.join(". "),details:s}},t.ValidationError=class extends Error{constructor(e,t,r){super(e),this._original=r,this.details=t}static isError(e){return e instanceof t.ValidationError}},t.ValidationError.prototype.isJoi=!0,t.ValidationError.prototype.name="ValidationError",t.ValidationError.prototype.annotate=s.error},(e,t,r)=>{const s=r(30),n=r(100),a={annotations:Symbol("annotations")};t.error=function(e){if(!this._original||"object"!=typeof this._original)return this.details[0].message;const t=e?"":"",r=e?"":"",i=e?"":"",o=s(this._original);for(let e=this.details.length-1;e>=0;--e){const t=e+1,r=this.details[e],s=r.path;let i=o;for(let e=0;;++e){const o=s[e];if(n.isSchema(i)&&(i=i.clone()),!(e+1`" ${t}[${r}]${i}`)).replace(c,((e,s,n)=>`${r}"${s}"${i}${t} [${n}]: -- missing --${i}`)).replace(u,((e,r,s)=>`\n${s} ${t}[${r}]${i}`)).replace(p,((e,t)=>t));h=`${h}\n${t}`;for(let e=0;et[0]===s?"[Circular ~]":"[Circular ~."+e.slice(0,t.indexOf(s)).join(".")+"]";return function(s,n){if(t.length>0){const a=t.indexOf(this);~a?(t.length=a+1,e.length=a+1,e[a]=s):(t.push(this),e.push(s)),~t.indexOf(n)&&(n=r.call(this,s,n))}else t.push(n);if(n){const e=n[a.annotations];if(e){if(Array.isArray(n)){const t=[];for(let r=0;r{const s=r(27),n=r(30),a=r(31),i=r(100);let o;const l={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e,t={}){s("string"==typeof e,"Invalid reference key:",e),i.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),s(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const r=Object.assign({},l.defaults,t);delete r.prefix;const n=r.separator,a=l.context(e,n,t.prefix);if(r.type=a.type,e=a.key,"value"===r.type)if(a.root&&(s(!n||e[0]!==n,"Cannot specify relative path with root prefix"),r.ancestor="root",e||(e=null)),n&&n===e)e=null,r.ancestor=0;else if(void 0!==r.ancestor)s(!n||!e||e[0]!==n,"Cannot combine prefix with ancestor option");else{const[t,s]=l.ancestor(e,n);s&&""===(e=e.slice(s))&&(e=null),r.ancestor=t}return r.path=n?null===e?[]:e.split(n):[e],new l.Ref(r)},t.in=function(e,r={}){return t.create(e,{...r,in:!0})},t.isRef=function(e){return!!e&&!!e[i.symbols.ref]},l.Ref=class{constructor(e){s("object"==typeof e,"Invalid reference construction"),i.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),s([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),s(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),s(!e.map||Array.isArray(e.map),"options.map must be an array"),s(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,l.defaults,e),s("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,t,r,n,a={}){return s(!this.in||a.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(r.context,t,a):"local"===this.type?this._resolve(n,t,a):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,a):(s(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,a)):this._resolve(e,t,a)}_resolve(e,t,r){let s;if("value"===this.type&&t.mainstay.shadow&&!1!==r.shadow&&(s=t.mainstay.shadow.get(this.absolute(t))),void 0===s&&(s=a(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(s=this.adjust(s)),this.map){const e=this.map.get(s);void 0!==e&&(s=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,s),s}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new l.Ref(this)}describe(){const e={path:this.path};"value"!==this.type&&(e.type=this.type),"."!==this.separator&&(e.separator=this.separator),"value"===this.type&&1!==this.ancestor&&(e.ancestor=this.ancestor),this.map&&(e.map=[...this.map]);for(const t of["adjust","iterables","render"])null!==this[t]&&void 0!==this[t]&&(e[t]=this[t]);return!1!==this.in&&(e.in=!0),{ref:e}}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display=`ref:${this.type}:${e}`);if(!this.separator)return void(this.display=`ref:${e}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${e}`);if("root"===this.ancestor)return void(this.display=`ref:root:${e}`);if(1===this.ancestor)return void(this.display=`ref:${e||".."}`);const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${t}${e||""}`}},l.Ref.prototype[i.symbols.ref]=!0,t.build=function(e){return"value"===(e=Object.assign({},l.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new l.Ref(e)},l.context=function(e,t,r={}){if(e=e.trim(),r){const s=void 0===r.global?"$":r.global;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"global"};const n=void 0===r.local?"#":r.local;if(n!==t&&e.startsWith(n))return{key:e.slice(n.length),type:"local"};const a=void 0===r.root?"/":r.root;if(a!==t&&e.startsWith(a))return{key:e.slice(a.length),type:"value",root:!0}}return{key:e,type:"value"}},l.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let r=2;for(;e[r]===t;)++r;return[r-1,r]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,s){if(e)if(s=void 0===s?t.toParent:s,Array.isArray(e))for(const t of e)this.register(t,s);else if(i.isSchema(e))for(const t of e._refs.refs)t.ancestor-s>=0&&this.refs.push({ancestor:t.ancestor-s,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-s>=0&&this.refs.push({ancestor:e.ancestor-s,root:e.root}),o=o||r(104),o.isTemplate(e)&&this.register(e.refs(),s)}get length(){return this.refs.length}clone(){const e=new t.Manager;return e.refs=n(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter((e=>!e.ancestor)).map((e=>e.root))}}},(e,t,r)=>{const s=r(27),n=r(100),a=r(108),i={};t.schema=function(e,t,r={}){n.assertOptions(r,["appendPath","override"]);try{return i.schema(e,t,r)}catch(e){throw r.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},i.schema=function(e,t,r){s(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(s(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const a=(t,...s)=>!1!==r.override?t.valid(e.override,...s):t.valid(...s);if(i.simple(t))return a(e,t);if("function"==typeof t)return e.custom(t);if(s("object"==typeof t,"Invalid schema content:",typeof t),n.isResolvable(t))return a(e,t);if(n.isSchema(t))return t;if(Array.isArray(t)){for(const r of t)if(!i.simple(r))return e.alternatives().try(...t);return a(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?a(e.date(),t):(s(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return a.isRef(e)?e:a.create(e,t)},t.compile=function(e,r,a={}){n.assertOptions(a,["legacy"]);const o=r&&r[n.symbols.any];if(o)return s(a.legacy||o.version===n.version,"Cannot mix different versions of joi schemas:",o.version,n.version),r;if("object"!=typeof r||!a.legacy)return t.schema(e,r,{appendPath:!0});const l=i.walk(r);return l?l.compile(l.root,r):t.schema(e,r,{appendPath:!0})},i.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=i.walk(t);if(e)return e}return null}const t=e[n.symbols.any];if(t)return{root:e[t.root],compile:t.compile};s(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const r=i.walk(e[t]);if(r)return r}return null},i.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,r,o){if(void 0===o&&(s(r&&"object"==typeof r,"Missing options"),o=r,r=a.create(".")),Array.isArray(o)&&(o={switch:o}),n.assertOptions(o,["is","not","then","otherwise","switch","break"]),n.isSchema(r))return s(void 0===o.is,'"is" can not be used with a schema condition'),s(void 0===o.not,'"not" can not be used with a schema condition'),s(void 0===o.switch,'"switch" can not be used with a schema condition'),i.condition(e,{is:r,then:o.then,otherwise:o.otherwise,break:o.break});if(s(a.isRef(r)||"string"==typeof r,"Invalid condition:",r),s(void 0===o.not||void 0===o.is,'Cannot combine "is" with "not"'),void 0===o.switch){let l=o;void 0!==o.not&&(l={is:o.not,then:o.otherwise,otherwise:o.then,break:o.break});let c=void 0!==l.is?e.$_compile(l.is):e.$_root.invalid(null,!1,0,"").required();return s(void 0!==l.then||void 0!==l.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),s(void 0===l.break||void 0===l.then||void 0===l.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===o.is||a.isRef(o.is)||n.isSchema(o.is)||(c=c.required()),i.condition(e,{ref:t.ref(r),is:c,then:l.then,otherwise:l.otherwise,break:l.break})}s(Array.isArray(o.switch),'"switch" must be an array'),s(void 0===o.is,'Cannot combine "switch" with "is"'),s(void 0===o.not,'Cannot combine "switch" with "not"'),s(void 0===o.then,'Cannot combine "switch" with "then"');const l={ref:t.ref(r),switch:[],break:o.break};for(let t=0;t{const s=r(27),n=r(30),a=r(100),i=r(103),o={};t.type=function(e,t){const r=Object.getPrototypeOf(e),l=n(r),c=e._assign(Object.create(l)),u=Object.assign({},t);delete u.base,l._definition=u;const p=r._definition||{};u.messages=i.merge(p.messages,u.messages),u.properties=Object.assign({},p.properties,u.properties),c.type=u.type,u.flags=Object.assign({},p.flags,u.flags);const h=Object.assign({},p.terms);if(u.terms)for(const e in u.terms){const t=u.terms[e];s(void 0===c.$_terms[e],"Invalid term override for",u.type,e),c.$_terms[e]=t.init,h[e]=t}u.terms=h,u.args||(u.args=p.args),u.prepare=o.prepare(u.prepare,p.prepare),u.coerce&&("function"==typeof u.coerce&&(u.coerce={method:u.coerce}),u.coerce.from&&!Array.isArray(u.coerce.from)&&(u.coerce={method:u.coerce.method,from:[].concat(u.coerce.from)})),u.coerce=o.coerce(u.coerce,p.coerce),u.validate=o.validate(u.validate,p.validate);const d=Object.assign({},p.rules);if(u.rules)for(const e in u.rules){const t=u.rules[e];s("object"==typeof t,"Invalid rule definition for",u.type,e);let r=t.method;if(void 0===r&&(r=function(){return this.$_addRule(e)}),r&&(s(!l[e],"Rule conflict in",u.type,e),l[e]=r),s(!d[e],"Rule conflict in",u.type,e),d[e]=t,t.alias){const e=[].concat(t.alias);for(const r of e)l[r]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map((e=>("string"==typeof e&&(e={name:e}),s(!t.argsByName.has(e.name),"Duplicated argument name",e.name),a.isSchema(e.assert)&&(e.assert=e.assert.strict().label(e.name)),t.argsByName.set(e.name,e),e))))}u.rules=d;const f=Object.assign({},p.modifiers);if(u.modifiers)for(const e in u.modifiers){s(!l[e],"Rule conflict in",u.type,e);const t=u.modifiers[e];s("function"==typeof t,"Invalid modifier definition for",u.type,e);const r=function(t){return this.rule({[e]:t})};l[e]=r,f[e]=t}if(u.modifiers=f,u.overrides){l._super=r,c.$_super={};for(const e in u.overrides)s(r[e],"Cannot override missing",e),u.overrides[e][a.symbols.parent]=r[e],c.$_super[e]=r[e].bind(c);Object.assign(l,u.overrides)}u.cast=Object.assign({},p.cast,u.cast);const m=Object.assign({},p.manifest,u.manifest);return m.build=o.build(u.manifest&&u.manifest.build,p.manifest&&p.manifest.build),u.manifest=m,u.rebuild=o.rebuild(u.rebuild,p.rebuild),c},o.build=function(e,t){return e&&t?function(r,s){return t(e(r,s),s)}:e||t},o.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(r,s){let n;if((!t.from||t.from.includes(typeof r))&&(n=t.method(r,s),n)){if(n.errors||void 0===n.value)return n;r=n.value}if(!e.from||e.from.includes(typeof r)){const t=e.method(r,s);if(t)return t}return n}}:e||t},o.prepare=function(e,t){return e&&t?function(r,s){const n=e(r,s);if(n){if(n.errors||void 0===n.value)return n;r=n.value}return t(r,s)||n}:e||t},o.rebuild=function(e,t){return e&&t?function(r){t(r),e(r)}:e||t},o.validate=function(e,t){return e&&t?function(r,s){const n=t(r,s);if(n){if(n.errors&&(!Array.isArray(n.errors)||n.errors.length))return n;r=n.value}return e(r,s)||n}:e||t}},(e,t,r)=>{var s=r(14).Buffer;const n=r(27),a=r(30),i=r(100),o=r(103),l=r(108),c=r(104);let u;const p={};t.describe=function(e){const t=e._definition,r={type:e.type,flags:{},rules:[]};for(const t in e._flags)"_"!==t[0]&&(r.flags[t]=p.describe(e._flags[t]));Object.keys(r.flags).length||delete r.flags,e._preferences&&(r.preferences=a(e._preferences,{shallow:["messages"]}),delete r.preferences[i.symbols.prefs],r.preferences.messages&&(r.preferences.messages=o.decompile(r.preferences.messages))),e._valids&&(r.allow=e._valids.describe()),e._invalids&&(r.invalid=e._invalids.describe());for(const s of e._rules){if(!1===t.rules[s.name].manifest)continue;const e={name:s.name};for(const r in t.modifiers)void 0!==s[r]&&(e[r]=p.describe(s[r]));if(s.args){e.args={};for(const t in s.args){const r=s.args[t];("options"!==t||Object.keys(r).length)&&(e.args[t]=p.describe(r,{assign:t}))}Object.keys(e.args).length||delete e.args}r.rules.push(e)}r.rules.length||delete r.rules;for(const s in e.$_terms){if("_"===s[0])continue;n(!r[s],"Cannot describe schema due to internal name conflict with",s);const a=e.$_terms[s];if(!a)continue;if(a instanceof Map){a.size&&(r[s]=[...a.entries()]);continue}if(i.isValues(a)){r[s]=a.describe();continue}n(t.terms[s],"Term",s,"missing configuration");const o=t.terms[s].manifest,l="object"==typeof o;if(!a.length&&!l)continue;const c=[];for(const e of a)c.push(p.describe(e));if(l){const{from:e,to:t}=o.mapped;r[s]={};for(const n of c)r[s][n[t]]=n[e]}else"single"!==o?r[s]=c:(n(1===c.length,"Term",s,"contains more than one item"),r[s]=c[0])}return p.validate(e.$_root,r),r},p.describe=function(e,t={}){if(Array.isArray(e))return e.map(p.describe);if(e===i.symbols.deepDefault)return{special:"deep"};if("object"!=typeof e||null===e)return e;if("options"===t.assign)return a(e);if(s&&s.isBuffer(e))return{buffer:e.toString("binary")};if(e instanceof Date)return e.toISOString();if(e instanceof Error)return e;if(e instanceof RegExp)return"regex"===t.assign?e.toString():{regex:e.toString()};if(e[i.symbols.literal])return{function:e.literal};if("function"==typeof e.describe)return"ref"===t.assign?e.describe().ref:e.describe();const r={};for(const t in e){const s=e[t];void 0!==s&&(r[t]=p.describe(s,{assign:t}))}return r},t.build=function(e,t){return new p.Builder(e).parse(t)},p.Builder=class{constructor(e){this.joi=e}parse(e){p.validate(this.joi,e);let t=this.joi[e.type]()._bare();const r=t._definition;if(e.flags)for(const s in e.flags){const a=r.flags[s]&&r.flags[s].setter||s;n("function"==typeof t[a],"Invalid flag",s,"for type",e.type),t=t[a](this.build(e.flags[s]))}if(e.preferences&&(t=t.preferences(this.build(e.preferences))),e.allow&&(t=t.allow(...this.build(e.allow))),e.invalid&&(t=t.invalid(...this.build(e.invalid))),e.rules)for(const s of e.rules){n("function"==typeof t[s.name],"Invalid rule",s.name,"for type",e.type);const a=[];if(s.args){const t={};for(const e in s.args)t[e]=this.build(s.args[e],{assign:e});const i=Object.keys(t),o=r.rules[s.name].args;if(o){n(i.length<=o.length,"Invalid number of arguments for",e.type,s.name,"(expected up to",o.length,", found",i.length,")");for(const{name:e}of o)a.push(t[e])}else n(1===i.length,"Invalid number of arguments for",e.type,s.name,"(expected up to 1, found",i.length,")"),a.push(t[i[0]])}t=t[s.name](...a);const i={};for(const e in r.modifiers)void 0!==s[e]&&(i[e]=this.build(s[e]));Object.keys(i).length&&(t=t.rule(i))}const s={};for(const t in e){if(["allow","flags","invalid","whens","preferences","rules","type"].includes(t))continue;n(r.terms[t],"Term",t,"missing configuration");const a=r.terms[t].manifest;if("schema"!==a)if("values"!==a)if("single"!==a)if("object"!=typeof a)s[t]=this.build(e[t]);else{s[t]={};for(const r in e[t]){const n=e[t][r];s[t][r]=this.parse(n)}}else s[t]=this.build(e[t]);else s[t]=e[t].map((e=>this.build(e)));else s[t]=e[t].map((e=>this.parse(e)))}return e.whens&&(s.whens=e.whens.map((e=>this.build(e)))),t=r.manifest.build(t,s),t.$_temp.ruleset=!1,t}build(e,t={}){if(null===e)return null;if(Array.isArray(e))return e.map((e=>this.build(e)));if(e instanceof Error)return e;if("options"===t.assign)return a(e);if("regex"===t.assign)return p.regex(e);if("ref"===t.assign)return l.build(e);if("object"!=typeof e)return e;if(1===Object.keys(e).length){if(e.buffer)return n(s,"Buffers are not supported"),s&&s.from(e.buffer,"binary");if(e.function)return{[i.symbols.literal]:!0,literal:e.function};if(e.override)return i.symbols.override;if(e.ref)return l.build(e.ref);if(e.regex)return p.regex(e.regex);if(e.special)return n(["deep"].includes(e.special),"Unknown special value",e.special),i.symbols.deepDefault;if(e.value)return a(e.value)}if(e.type)return this.parse(e);if(e.template)return c.build(e);const r={};for(const t in e)r[t]=this.build(e[t],{assign:t});return r}},p.regex=function(e){const t=e.lastIndexOf("/"),r=e.slice(1,t),s=e.slice(t+1);return new RegExp(r,s)},p.validate=function(e,t){u=u||r(102),e.assert(t,u.description)}},(e,t,r)=>{const s=r(39),n=r(113),a=r(106),i={codes:{error:1,pass:2,full:3},labels:{0:"never used",1:"always error",2:"always pass"}};t.setup=function(e){const t=function(){return e._tracer=e._tracer||new i.Tracer,e._tracer};e.trace=t,e[Symbol.for("@hapi/lab/coverage/initialize")]=t,e.untrace=()=>{e._tracer=null}},t.location=function(e){return e.$_setFlag("_tracerLocation",n.location(2))},i.Tracer=class{constructor(){this.name="Joi",this._schemas=new Map}_register(e){const t=this._schemas.get(e);if(t)return t.store;const r=new i.Store(e),{filename:s,line:a}=e._flags._tracerLocation||n.location(5);return this._schemas.set(e,{filename:s,line:a,store:r}),r}_combine(e,t){for(const{store:r}of this._schemas.values())r._combine(e,t)}report(e){const t=[];for(const{filename:r,line:s,store:n}of this._schemas.values()){if(e&&e!==r)continue;const a=[],o=[];for(const[e,t]of n._sources.entries()){if(i.sub(t.paths,o))continue;if(!t.entry){a.push({status:"never reached",paths:[...t.paths]}),o.push(...t.paths);continue}for(const r of["valid","invalid"]){const s=e[`_${r}s`];if(!s)continue;const n=new Set(s._values),i=new Set(s._refs);for(const{value:e,ref:s}of t[r])n.delete(e),i.delete(s);(n.size||i.size)&&a.push({status:[...n,...[...i].map((e=>e.display))],rule:`${r}s`})}const r=e._rules.map((e=>e.name));for(const t of["default","failover"])void 0!==e._flags[t]&&r.push(t);for(const e of r){const r=i.labels[t.rule[e]||0];if(r){const s={rule:e,status:r};t.paths.size&&(s.paths=[...t.paths]),a.push(s)}}}a.length&&t.push({filename:r,line:s,missing:a,severity:"error",message:`Schema missing tests for ${a.map(i.message).join(", ")}`})}return t.length?t:null}},i.Store=class{constructor(e){this.active=!0,this._sources=new Map,this._combos=new Map,this._scan(e)}debug(e,t,r,s){e.mainstay.debug&&e.mainstay.debug.push({type:t,name:r,result:s,path:e.path})}entry(e,t){i.debug(t,{type:"entry"}),this._record(e,(e=>{e.entry=!0}))}filter(e,t,r,s){i.debug(t,{type:r,...s}),this._record(e,(e=>{e[r].add(s)}))}log(e,t,r,s,n){i.debug(t,{type:r,name:s,result:"full"===n?"pass":n}),this._record(e,(e=>{e[r][s]=e[r][s]||0,e[r][s]|=i.codes[n]}))}resolve(e,t,r){if(!e.mainstay.debug)return;const s={type:"resolve",ref:t.display,to:r,path:e.path};e.mainstay.debug.push(s)}value(e,t,r,n,a){if(!e.mainstay.debug||s(r,n))return;const i={type:"value",by:t,from:r,to:n,path:e.path};a&&(i.name=a),e.mainstay.debug.push(i)}_record(e,t){const r=this._sources.get(e);if(r)return void t(r);const s=this._combos.get(e);for(const e of s)this._record(e,t)}_scan(e,t){const r=t||[];let s=this._sources.get(e);s||(s={paths:new Set,entry:!1,rule:{},valid:new Set,invalid:new Set},this._sources.set(e,s)),r.length&&s.paths.add(r);e.$_modify({each:(e,t)=>{const s=i.id(e,t);this._scan(e,r.concat(s))},ref:!1})}_combine(e,t){this._combos.set(e,t)}},i.message=function(e){return`${e.paths?a.path(e.paths[0])+(e.rule?":":""):""}${e.rule||""} (${e.status})`},i.id=function(e,{source:t,name:r,path:s,key:n}){return e._flags.id?e._flags.id:n||(r=`@${r}`,"terms"===t?[r,s[Math.min(s.length-1,1)]]:r)},i.sub=function(e,t){for(const r of e)for(const e of t)if(s(r.slice(0,e.length),e))return!0;return!1},i.debug=function(e,t){e.mainstay.debug&&(t.path=e.debug?[...e.path,e.debug]:e.path,e.mainstay.debug.push(t))}},(e,t)=>{t.location=function(e=0){const t=Error.prepareStackTrace;Error.prepareStackTrace=(e,t)=>t;const r={};Error.captureStackTrace(r,this);const s=r.stack[e+1];return Error.prepareStackTrace=t,{filename:s.getFileName(),line:s.getLineNumber()}}},(e,t,r)=>{const s=r(27),n=r(34),a=r(115),i=r(100),o=r(109),l=r(106),c=r(108),u={};e.exports=a.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:c.toSibling}},args:(e,...t)=>1===t.length&&Array.isArray(t[0])?e.try(...t[0]):e.try(...t),validate(e,t){const{schema:r,error:s,state:a,prefs:i}=t;if(r._flags.match){const t=[],o=[];for(let s=0;sl.details(e,{override:!1})))})}}if("one"===r._flags.match)return 1===t.length?{value:t[0]}:{errors:s("alternatives.one")};if(t.length!==r.$_terms.matches.length){return{errors:s("alternatives.all",{details:o.map((e=>l.details(e,{override:!1})))})}}const c=e=>e.$_terms.matches.some((e=>"object"===e.schema.type||"alternatives"===e.schema.type&&c(e.schema)));return c(r)?{value:t.reduce(((e,t)=>n(e,t,{mergeArrays:!1})))}:{value:t[t.length-1]}}const o=[];for(let t=0;t"is"!==r.path[0]&&"string"!=typeof t._flags.label?t.label(e):void 0,ref:!1})}},rebuild(e){e.$_modify({each:t=>{i.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(e,t){if(t.matches)for(const r of t.matches){const{schema:t,ref:s,is:n,not:a,then:i,otherwise:o}=r;e=t?e.try(t):s?e.conditional(s,{is:n,then:i,not:a,otherwise:o,switch:r.switch}):e.conditional(n,{then:i,otherwise:o})}return e}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),u.errors=function(e,{error:t,state:r}){if(!e.length)return{errors:t("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const s=new Set,n=[];for(const{reports:a,schema:i}of e){if(a.length>1)return u.unmatched(e,t);const o=a[0];if(o instanceof l.Report==!1)return u.unmatched(e,t);if(o.state.path.length!==r.path.length){n.push({type:i.type,report:o});continue}if("any.only"===o.code){for(const e of o.local.valids)s.add(e);continue}const[c,p]=o.code.split(".");"base"===p?s.add(c):n.push({type:i.type,report:o})}return n.length?1===n.length?{errors:n[0].report}:u.unmatched(e,t):{errors:t("alternatives.types",{types:[...s]})}},u.unmatched=function(e,t){const r=[];for(const t of e)r.push(...t.reports);return{errors:t("alternatives.match",l.details(r,{override:!1}))}}},(e,t,r)=>{const s=r(27),n=r(116),a=r(100),i=r(103);e.exports=n.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(e,t){return s("function"==typeof e,"Method must be a function"),s(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:e,description:t}})},validate(e,t,{method:r}){try{return r(e,t)}catch(e){return t.error("any.custom",{error:e})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(e){s(a.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const t=this.clone();return t.$_terms.shared=t.$_terms.shared||[],t.$_terms.shared.push(e),t.$_mutateRegister(e),t}},warning:{method(e,t){return s(e&&"string"==typeof e,"Invalid warning code"),this.$_addRule({name:"warning",args:{code:e,local:t},warn:!0})},validate:(e,t,{code:r,local:s})=>t.error(r,s),args:["code","local"],multi:!0}},modifiers:{keep(e,t=!0){e.keep=t},message(e,t){e.message=i.compile(t)},warn(e,t=!0){e.warn=t}},manifest:{build(e,t){for(const r in t){const s=t[r];if(["examples","externals","metas","notes","tags"].includes(r))for(const t of s)e=e[r.slice(0,-1)](t);else if("alterations"!==r)if("whens"!==r){if("shared"===r)for(const t of s)e=e.shared(t)}else for(const t of s){const{ref:r,is:s,not:n,then:a,otherwise:i,concat:o}=t;e=o?e.concat(o):r?e.when(r,{is:s,not:n,then:a,otherwise:i,switch:t.switch,break:t.break}):e.when(s,{then:a,otherwise:i,break:t.break})}else{const t={};for(const{target:e,adjuster:r}of s)t[e]=r;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},(e,t,r)=>{const s=r(27),n=r(30),a=r(39),i=r(34),o=r(99),l=r(100),c=r(109),u=r(106),p=r(110),h=r(111),d=r(103),f=r(117),m=r(108),g=r(112),y=r(118),b=r(120),v={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new f.Ids,this._preferences=null,this._refs=new m.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return s("function"==typeof h.describe,"Manifest functionality disabled"),h.describe(this)}allow(...e){return l.verifyFlat(e,"allow"),this._values(e,"_valids")}alter(e){s(e&&"object"==typeof e&&!Array.isArray(e),"Invalid targets argument"),s(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const r in e){const n=e[r];s("function"==typeof n,"Alteration adjuster for",r,"must be a function"),t.$_terms.alterations.push({target:r,adjuster:n})}return t.$_temp.ruleset=!1,t}artifact(e){return s(void 0!==e,"Artifact cannot be undefined"),s(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",e)}cast(e){return s(!1===e||"string"==typeof e,"Invalid to value"),s(!1===e||this._definition.cast[e],"Type",this.type,"does not support casting to",e),this.$_setFlag("cast",!1===e?void 0:e)}default(e,t){return this._default("default",e,t)}description(e){return s(e&&"string"==typeof e,"Description must be a non-empty string"),this.$_setFlag("description",e)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(e){return s(e,"Missing error"),s(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}example(e,t={}){return s(void 0!==e,"Missing example"),l.assertOptions(t,["override"]),this._inner("examples",e,{single:!0,override:t.override})}external(e,t){return"object"==typeof e&&(s(!t,"Cannot combine options with description"),t=e.description,e=e.method),s("function"==typeof e,"Method must be a function"),s(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this._inner("externals",{method:e,description:t},{single:!0})}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(e){return e?(s("string"==typeof e,"id must be a non-empty string"),s(/^[^\.]+$/.test(e),"id cannot contain period character"),this.$_setFlag("id",e)):this.$_setFlag("id",void 0)}invalid(...e){return this._values(e,"_invalids")}label(e){return s(e&&"string"==typeof e,"Label name must be a non-empty string"),this.$_setFlag("label",e)}meta(e){return s(void 0!==e,"Meta cannot be undefined"),this._inner("metas",e,{single:!0})}note(...e){s(e.length,"Missing notes");for(const t of e)s(t&&"string"==typeof t,"Notes must be non-empty strings");return this._inner("notes",e)}only(e=!0){return s("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){s(e,"Missing preferences"),s(void 0===e.context,"Cannot override context"),s(void 0===e.externals,"Cannot override externals"),s(void 0===e.warnings,"Cannot override warnings"),s(void 0===e.debug,"Cannot override debug"),l.checkPreferences(e);const t=this.clone();return t._preferences=l.preferences(t._preferences,e),t}presence(e){return s(["optional","required","forbidden"].includes(e),"Unknown presence mode",e),this.$_setFlag("presence",e)}raw(e=!0){return this.$_setFlag("result",e?"raw":void 0)}result(e){return s(["raw","strip"].includes(e),"Unknown result mode",e),this.$_setFlag("result",e)}required(){return this.presence("required")}strict(e){const t=this.clone(),r=void 0!==e&&!e;return t._preferences=l.preferences(t._preferences,{convert:r}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}tag(...e){s(e.length,"Missing tags");for(const t of e)s(t&&"string"==typeof t,"Tags must be non-empty strings");return this._inner("tags",e)}unit(e){return s(e&&"string"==typeof e,"Unit name must be a non-empty string"),this.$_setFlag("unit",e)}valid(...e){l.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(e,t){const r=this.clone();r.$_terms.whens||(r.$_terms.whens=[]);const n=c.when(r,e,t);if(!["any","link"].includes(r.type)){const e=n.is?[n]:n.switch;for(const t of e)s(!t.then||"any"===t.then.type||t.then.type===r.type,"Cannot combine",r.type,"with",t.then&&t.then.type),s(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===r.type,"Cannot combine",r.type,"with",t.otherwise&&t.otherwise.type)}return r.$_terms.whens.push(n),r.$_mutateRebuild()}cache(e){s(!this._inRuleset(),"Cannot set caching inside a ruleset"),s(!this._cache,"Cannot override schema cache"),s(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const t=this.clone();return t._cache=e||o.provider.provision(),t.$_temp.ruleset=!1,t}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){s(l.isSchema(e),"Invalid schema object"),s("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type),s(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),s(!e._inRuleset(),"Cannot concatenate a schema with open ruleset");let t=this.clone();if("any"===this.type&&"any"!==e.type){const r=e.clone();for(const e of Object.keys(t))"type"!==e&&(r[e]=t[e]);t=r}t._ids.concat(e._ids),t._refs.register(e,m.toSibling),t._preferences=t._preferences?l.preferences(t._preferences,e._preferences):e._preferences,t._valids=b.merge(t._valids,e._valids,e._invalids),t._invalids=b.merge(t._invalids,e._invalids,e._valids);for(const r of e._singleRules.keys())t._singleRules.has(r)&&(t._rules=t._rules.filter((e=>e.keep||e.name!==r)),t._singleRules.delete(r));for(const r of e._rules)e._definition.rules[r.method].multi||t._singleRules.set(r.name,r),t._rules.push(r);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const r=Object.assign({},e._flags);delete r.empty,i(t._flags,r)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const r=Object.assign({},e._flags);delete r.empty,i(t._flags,r)}else i(t._flags,e._flags);for(const r in e.$_terms){const s=e.$_terms[r];s?t.$_terms[r]?t.$_terms[r]=t.$_terms[r].concat(s):t.$_terms[r]=s.slice():t.$_terms[r]||(t.$_terms[r]=s)}return this.$_root._tracer&&this.$_root._tracer._combine(t,[this,e]),t.$_mutateRebuild()}extend(e){return s(!e.base,"Cannot extend type with another base"),p.type(this,e)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(e,t){s(!this._inRuleset(),"Cannot fork inside a ruleset");let r=this;for(let s of[].concat(e))s=Array.isArray(s)?s:s.split("."),r=r._ids.fork(s,t,r);return r.$_temp.ruleset=!1,r}rule(e){const t=this._definition;l.assertOptions(e,Object.keys(t.modifiers)),s(!1!==this.$_temp.ruleset,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const r=null===this.$_temp.ruleset?this._rules.length-1:this.$_temp.ruleset;s(r>=0&&rt.tailor(e),ref:!1}),t.$_temp.ruleset=!1,t.$_mutateRebuild()}tracer(){return g.location?g.location(this):this}validate(e,t){return y.entry(e,this,t)}validateAsync(e,t){return y.entryAsync(e,this,t)}$_addRule(e){"string"==typeof e&&(e={name:e}),s(e&&"object"==typeof e,"Invalid options"),s(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)s("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const r=this._definition.rules[t.method],n=t.args;s(r,"Unknown rule",t.method);const a=this.clone();if(n){s(1===Object.keys(n).length||Object.keys(n).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in n){let i=n[e];if(r.argsByName){const o=r.argsByName.get(e);if(o.ref&&l.isResolvable(i))t._resolve.push(e),a.$_mutateRegister(i);else if(o.normalize&&(i=o.normalize(i),n[e]=i),o.assert){const t=l.validateArg(i,e,o);s(!t,t,"or reference")}}void 0!==i?n[e]=i:delete n[e]}}return r.multi||(a._ruleRemove(t.name,{clone:!1}),a._singleRules.set(t.name,t)),!1===a.$_temp.ruleset&&(a.$_temp.ruleset=null),r.priority?a._rules.unshift(t):a._rules.push(t),a}$_compile(e,t){return c.schema(this.$_root,e,t)}$_createError(e,t,r,s,n,a={}){const i=!1!==a.flags?this._flags:{},o=a.messages?d.merge(this._definition.messages,a.messages):this._definition.messages;return new u.Report(e,t,r,i,o,s,n)}$_getFlag(e){return this._flags[e]}$_getRule(e){return this._singleRules.get(e)}$_mapLabels(e){return e=Array.isArray(e)?e:e.split("."),this._ids.labels(e)}$_match(e,t,r,s){(r=Object.assign({},r)).abortEarly=!0,r._externals=!1,t.snapshot();const n=!y.validate(e,this,t,r,s).errors;return t.restore(),n}$_modify(e){return l.assertOptions(e,["each","once","ref","schema"]),f.schema(this,e)||this}$_mutateRebuild(){s(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset();return this.$_modify({each:(e,{source:t,name:r,path:s,key:n})=>{const a=this._definition[t][r]&&this._definition[t][r].register;!1!==a&&this.$_mutateRegister(e,{family:a,key:n})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e,{family:t,key:r}={}){this._refs.register(e,t),this._ids.register(e,{key:r})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t,r={}){s("_"===e[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const n=this._definition.flags[e]||{};if(a(t,n.default)&&(t=void 0),a(t,this._flags[e]))return this;const i=!1!==r.clone?this.clone():this;return void 0!==t?(i._flags[e]=t,i.$_mutateRegister(t)):delete i._flags[e],"_"!==e[0]&&(i.$_temp.ruleset=!1),i}$_parent(e,...t){return this[e][l.symbols.parent].call(this,...t)}$_validate(e,t,r){return y.validate(e,this,t,r)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=n(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_bare(){const e=this.clone();e._reset();const t=e._definition.terms;for(const r in t){const s=t[r];e.$_terms[r]=s.init}return e.$_mutateRebuild()}_default(e,t,r={}){l.assertOptions(r,"literal"),s(void 0!==t,"Missing",e,"value"),s("function"==typeof t||!r.literal,"Only function value supports literal option"),"function"==typeof t&&r.literal&&(t={[l.symbols.literal]:!0,literal:t});return this.$_setFlag(e,t)}_generate(e,t,r){if(!this.$_terms.whens)return{schema:this};const s=[],n=[];for(let a=0;ac)break}const a=n.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",a),!a)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[a])return{schema:this.$_temp.whens[a],id:a};let i=this;this._definition.generate&&(i=this._definition.generate(this,e,t,r));for(const e of s)i=i.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(i,[this,...s]),this.$_temp.whens[a]=i,{schema:i,id:a}}_inner(e,t,r={}){s(!this._inRuleset(),`Cannot set ${e} inside a ruleset`);const n=this.clone();return n.$_terms[e]&&!r.override||(n.$_terms[e]=[]),r.single?n.$_terms[e].push(t):n.$_terms[e].push(...t),n.$_temp.ruleset=!1,n}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e,t={}){if(!this._singleRules.has(e))return this;const r=!1!==t.clone?this.clone():this;r._singleRules.delete(e);const s=[];for(let t=0;t{const s=r(27),n=r(100),a=r(108),i={};t.Ids=i.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new i.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,r]of e._byId.entries())s(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,r);for(const[t,r]of e._byKey.entries())s(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,r)}fork(e,t,r){const a=this._collect(e);a.push({schema:r});const o=a.shift();let l={id:o.id,schema:t(o.schema)};s(n.isSchema(l.schema),"adjuster function failed to return a joi schema type");for(const e of a)l={id:e.id,schema:i.fork(e.schema,l.id,l.schema)};return l.schema}labels(e,t=[]){const r=e[0],s=this._get(r);if(!s)return[...t,...e].join(".");const n=e.slice(1);return t=[...t,s.schema._flags.label||r],n.length?s.schema._ids.labels(n,t):t.join(".")}reach(e,t=[]){const r=e[0],n=this._get(r);s(n,"Schema does not contain path",[...t,...e].join("."));const a=e.slice(1);return a.length?n.schema._ids.reach(a,[...t,r]):n.schema}register(e,{key:t}={}){if(!e||!n.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const r=e._flags.id;if(r){const t=this._byId.get(r);s(!t||t.schema===e,"Cannot add different schemas with the same id:",r),s(!this._byKey.has(r),"Schema id conflicts with existing key:",r),this._byId.set(r,{schema:e,id:r})}t&&(s(!this._byKey.has(t),"Schema already contains key:",t),s(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,{schema:e,id:t}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e,t=[],r=[]){const n=e[0],a=this._get(n);s(a,"Schema does not contain path",[...t,...e].join(".")),r=[a,...r];const i=e.slice(1);return i.length?a.schema._ids._collect(i,[...t,n],r):r}_get(e){return this._byId.get(e)||this._byKey.get(e)}},i.fork=function(e,r,s){const n=t.schema(e,{each:(e,{key:t})=>{if(r===(e._flags.id||t))return s},ref:!1});return n?n.$_mutateRebuild():e},t.schema=function(e,t){let r;for(const s in e._flags){if("_"===s[0])continue;const n=i.scan(e._flags[s],{source:"flags",name:s},t);void 0!==n&&(r=r||e.clone(),r._flags[s]=n)}for(let s=0;s{const s=r(27),n=r(30),a=r(37),i=r(31),o=r(100),l=r(106),c=r(119),u={result:Symbol("result")};t.entry=function(e,t,r){let n=o.defaults;r&&(s(void 0===r.warnings,"Cannot override warnings preference in synchronous validation"),s(void 0===r.artifacts,"Cannot override artifacts preference in synchronous validation"),n=o.preferences(o.defaults,r));const a=u.entry(e,t,n);s(!a.mainstay.externals.length,"Schema with external rules must use validateAsync()");const i={value:a.value};return a.error&&(i.error=a.error),a.mainstay.warnings.length&&(i.warning=l.details(a.mainstay.warnings)),a.mainstay.debug&&(i.debug=a.mainstay.debug),a.mainstay.artifacts&&(i.artifacts=a.mainstay.artifacts),i},t.entryAsync=async function(e,t,r){let s=o.defaults;r&&(s=o.preferences(o.defaults,r));const n=u.entry(e,t,s),a=n.mainstay;if(n.error)throw a.debug&&(n.error.debug=a.debug),n.error;if(a.externals.length){let t=n.value;const c=[];for(const n of a.externals){const p=n.state.path,h="link"===n.schema.type?a.links.get(n.schema):null;let d,f,m=t;const g=p.length?[t]:[],y=p.length?i(e,p):e;if(p.length){d=p[p.length-1];let e=t;for(const t of p.slice(0,-1))e=e[t],g.unshift(e);f=g[0],m=f[d]}try{const e=(e,t)=>(h||n.schema).$_createError(e,m,t,n.state,s),i=await n.method(m,{schema:n.schema,linked:h,state:n.state,prefs:r,original:y,error:e,errorsArray:u.errorsArray,warn:(e,t)=>a.warnings.push((h||n.schema).$_createError(e,m,t,n.state,s)),message:(e,t)=>(h||n.schema).$_createError("external",m,t,n.state,s,{messages:e})});if(void 0===i||i===m)continue;if(i instanceof l.Report){if(a.tracer.log(n.schema,n.state,"rule","external","error"),c.push(i),s.abortEarly)break;continue}if(Array.isArray(i)&&i[o.symbols.errors]){if(a.tracer.log(n.schema,n.state,"rule","external","error"),c.push(...i),s.abortEarly)break;continue}f?(a.tracer.value(n.state,"rule",m,i,"external"),f[d]=i):(a.tracer.value(n.state,"rule",t,i,"external"),t=i)}catch(e){throw s.errors.label&&(e.message+=` (${n.label})`),e}}if(n.value=t,c.length)throw n.error=l.process(c,e,s),a.debug&&(n.error.debug=a.debug),n.error}if(!s.warnings&&!s.debug&&!s.artifacts)return n.value;const c={value:n.value};return a.warnings.length&&(c.warning=l.details(a.warnings)),a.debug&&(c.debug=a.debug),a.artifacts&&(c.artifacts=a.artifacts),c},u.Mainstay=class{constructor(e,t,r){this.externals=[],this.warnings=[],this.tracer=e,this.debug=t,this.links=r,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const e=this._snapshots.pop();this.externals=e.externals,this.warnings=e.warnings}commit(){this._snapshots.pop()}},u.entry=function(e,r,s){const{tracer:n,cleanup:a}=u.tracer(r,s),i=s.debug?[]:null,o=r._ids._schemaChain?new Map:null,p=new u.Mainstay(n,i,o),h=r._ids._schemaChain?[{schema:r}]:null,d=new c([],[],{mainstay:p,schemas:h}),f=t.validate(e,r,d,s);a&&r.$_root.untrace();const m=l.process(f.errors,e,s);return{value:f.value,error:m,mainstay:p}},u.tracer=function(e,t){return e.$_root._tracer?{tracer:e.$_root._tracer._register(e)}:t.debug?(s(e.$_root.trace,"Debug mode not supported"),{tracer:e.$_root.trace()._register(e),cleanup:!0}):{tracer:u.ignore}},t.validate=function(e,t,r,s,n={}){if(t.$_terms.whens&&(t=t._generate(e,r,s).schema),t._preferences&&(s=u.prefs(t,s)),t._cache&&s.cache){const s=t._cache.get(e);if(r.mainstay.tracer.debug(r,"validate","cached",!!s),s)return s}const a=(n,a,i)=>t.$_createError(n,e,a,i||r,s),i={original:e,prefs:s,schema:t,state:r,error:a,errorsArray:u.errorsArray,warn:(e,t,s)=>r.mainstay.warnings.push(a(e,t,s)),message:(n,a)=>t.$_createError("custom",e,a,r,s,{messages:n})};r.mainstay.tracer.entry(t,r);const l=t._definition;if(l.prepare&&void 0!==e&&s.convert){const t=l.prepare(e,i);if(t){if(r.mainstay.tracer.value(r,"prepare",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),i);e=t.value}}if(l.coerce&&void 0!==e&&s.convert&&(!l.coerce.from||l.coerce.from.includes(typeof e))){const t=l.coerce.method(e,i);if(t){if(r.mainstay.tracer.value(r,"coerced",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),i);e=t.value}}const c=t._flags.empty;c&&c.$_match(u.trim(e,t),r.nest(c),o.defaults)&&(r.mainstay.tracer.value(r,"empty",e,void 0),e=void 0);const p=n.presence||t._flags.presence||(t._flags._endedSwitch?null:s.presence);if(void 0===e){if("forbidden"===p)return u.finalize(e,null,i);if("required"===p)return u.finalize(e,[t.$_createError("any.required",e,null,r,s)],i);if("optional"===p){if(t._flags.default!==o.symbols.deepDefault)return u.finalize(e,null,i);r.mainstay.tracer.value(r,"default",e,{}),e={}}}else if("forbidden"===p)return u.finalize(e,[t.$_createError("any.unknown",e,null,r,s)],i);const h=[];if(t._valids){const n=t._valids.get(e,r,s,t._flags.insensitive);if(n)return s.convert&&(r.mainstay.tracer.value(r,"valids",e,n.value),e=n.value),r.mainstay.tracer.filter(t,r,"valid",n),u.finalize(e,null,i);if(t._flags.only){const n=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},r,s);if(s.abortEarly)return u.finalize(e,[n],i);h.push(n)}}if(t._invalids){const n=t._invalids.get(e,r,s,t._flags.insensitive);if(n){r.mainstay.tracer.filter(t,r,"invalid",n);const a=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,s);if(s.abortEarly)return u.finalize(e,[a],i);h.push(a)}}if(l.validate){const t=l.validate(e,i);if(t&&(r.mainstay.tracer.value(r,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return h.push(t.errors),u.finalize(e,h,i);if(t.errors.length)return h.push(...t.errors),u.finalize(e,h,i)}}return t._rules.length?u.rules(e,h,i):u.finalize(e,h,i)},u.rules=function(e,t,r){const{schema:s,state:n,prefs:a}=r;for(const i of s._rules){const l=s._definition.rules[i.method];if(l.convert&&a.convert){n.mainstay.tracer.log(s,n,"rule",i.name,"full");continue}let c,p=i.args;if(i._resolve.length){p=Object.assign({},p);for(const t of i._resolve){const r=l.argsByName.get(t),i=p[t].resolve(e,n,a),u=r.normalize?r.normalize(i):i,h=o.validateArg(u,null,r);if(h){c=s.$_createError("any.ref",i,{arg:t,ref:p[t],reason:h},n,a);break}p[t]=u}}c=c||l.validate(e,r,p,i);const h=u.rule(c,i);if(h.errors){if(n.mainstay.tracer.log(s,n,"rule",i.name,"error"),i.warn){n.mainstay.warnings.push(...h.errors);continue}if(a.abortEarly)return u.finalize(e,h.errors,r);t.push(...h.errors)}else n.mainstay.tracer.log(s,n,"rule",i.name,"pass"),n.mainstay.tracer.value(n,"rule",e,h.value,i.name),e=h.value}return u.finalize(e,t,r)},u.rule=function(e,t){return e instanceof l.Report?(u.error(e,t),{errors:[e],value:null}):Array.isArray(e)&&e[o.symbols.errors]?(e.forEach((e=>u.error(e,t))),{errors:e,value:null}):{errors:null,value:e}},u.error=function(e,t){return t.message&&e._setTemplate(t.message),e},u.finalize=function(e,t,r){t=t||[];const{schema:n,state:a,prefs:i}=r;if(t.length){const s=u.default("failover",void 0,t,r);void 0!==s&&(a.mainstay.tracer.value(a,"failover",e,s),e=s,t=[])}if(t.length&&n._flags.error)if("function"==typeof n._flags.error){t=n._flags.error(t),Array.isArray(t)||(t=[t]);for(const e of t)s(e instanceof Error||e instanceof l.Report,"error() must return an Error object")}else t=[n._flags.error];if(void 0===e){const s=u.default("default",e,t,r);a.mainstay.tracer.value(a,"default",e,s),e=s}if(n._flags.cast&&void 0!==e){const t=n._definition.cast[n._flags.cast];if(t.from(e)){const s=t.to(e,r);a.mainstay.tracer.value(a,"cast",e,s,n._flags.cast),e=s}}if(n.$_terms.externals&&i.externals&&!1!==i._externals)for(const{method:e}of n.$_terms.externals)a.mainstay.externals.push({method:e,schema:n,state:a,label:l.label(n._flags,a,i)});const o={value:e,errors:t.length?t:null};return n._flags.result&&(o.value="strip"===n._flags.result?void 0:r.original,a.mainstay.tracer.value(a,n._flags.result,e,o.value),a.shadow(e,n._flags.result)),n._cache&&!1!==i.cache&&!n._refs.length&&n._cache.set(r.original,o),void 0===e||o.errors||void 0===n._flags.artifact||(a.mainstay.artifacts=a.mainstay.artifacts||new Map,a.mainstay.artifacts.has(n._flags.artifact)||a.mainstay.artifacts.set(n._flags.artifact,[]),a.mainstay.artifacts.get(n._flags.artifact).push(a.path)),o},u.prefs=function(e,t){const r=t===o.defaults;return r&&e._preferences[o.symbols.prefs]?e._preferences[o.symbols.prefs]:(t=o.preferences(t,e._preferences),r&&(e._preferences[o.symbols.prefs]=t),t)},u.default=function(e,t,r,s){const{schema:a,state:i,prefs:l}=s,c=a._flags[e];if(l.noDefaults||void 0===c)return t;if(i.mainstay.tracer.log(a,i,"rule",e,"full"),!c)return c;if("function"==typeof c){const t=c.length?[n(i.ancestors[0]),s]:[];try{return c(...t)}catch(t){return void r.push(a.$_createError(`any.${e}`,null,{error:t},i,l))}}return"object"!=typeof c?c:c[o.symbols.literal]?c.literal:o.isResolvable(c)?c.resolve(t,i,l):n(c)},u.trim=function(e,t){if("string"!=typeof e)return e;const r=t.$_getRule("trim");return r&&r.args.enabled?e.trim():e},u.ignore={active:!1,debug:a,entry:a,filter:a,log:a,resolve:a,value:a},u.errorsArray=function(){const e=[];return e[o.symbols.errors]=!0,e}},(e,t,r)=>{const s=r(30),n=r(31),a=r(100),i={value:Symbol("value")};e.exports=i.State=class{constructor(e,t,r){this.path=e,this.ancestors=t,this.mainstay=r.mainstay,this.schemas=r.schemas,this.debug=null}localize(e,t=null,r=null){const s=new i.State(e,t,this);return r&&s.schemas&&(s.schemas=[i.schemas(r),...s.schemas]),s}nest(e,t){const r=new i.State(this.path,this.ancestors,this);return r.schemas=r.schemas&&[i.schemas(e),...r.schemas],r.debug=t,r}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new i.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=s(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},i.schemas=function(e){return a.isSchema(e)?{schema:e}:e},i.Shadow=class{constructor(){this._values=null}set(e,t,r){if(!e.length)return;if("strip"===r&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let s=this._values;for(let t=0;t{const s=r(27),n=r(39),a=r(100),i={};e.exports=i.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=i.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){a.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,r){if(e=e||new i.Values,t){if(t._override)return t.clone();for(const r of[...t._values,...t._refs])e.add(r)}if(r)for(const t of[...r._values,...r._refs])e.remove(t);return e.length?e:null}remove(e){a.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,r,s){return!!this.get(e,t,r,s)}get(e,t,r,s){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&s){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const t of this._values)if(n(t,e))return{value:t};if(t)for(const a of this._refs){const i=a.resolve(e,t,r,null,{in:!0});if(void 0===i)continue;const o=a.in&&"object"==typeof i?Array.isArray(i)?i:Object.keys(i):[i];for(const t of o)if(typeof t==typeof e)if(s&&e&&"string"==typeof e){if(t.toLowerCase()===e.toLowerCase())return{value:t,ref:a}}else if(n(t,e))return{value:t,ref:a}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new i.Values(this._values,this._refs);return e._override=this._override,e}concat(e){s(!e._override,"Cannot concat override set of values");const t=new i.Values([...this._values,...e._values],[...this._refs,...e._refs]);return t._override=this._override,t}describe(){const e=[];this._override&&e.push({override:!0});for(const t of this._values.values())e.push(t&&"object"==typeof t?{value:t}:t);for(const t of this._refs.values())e.push(t.describe());return e}},i.Values.prototype[a.symbols.values]=!0,i.Values.prototype.slice=i.Values.prototype.clone,i.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t}},(e,t,r)=>{const s=r(27),n=r(39),a=r(31),i=r(115),o=r(100),l=r(109),c={};e.exports=i.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,{schema:t,state:r,prefs:s}){if(!Array.isArray(e))return;const n=t.$_getRule("sort");return n?c.sort(t,e,n.args.options,r,s):void 0}},validate(e,{schema:t,error:r}){if(!Array.isArray(e)){if(t._flags.single){const t=[e];return t[o.symbols.arraySingle]=!0,{value:t}}return{errors:r("array.base")}}if(t.$_getRule("items")||t.$_terms.externals)return{value:e.slice()}},rules:{has:{method(e){e=this.$_compile(e,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:e}});return t.$_mutateRegister(e),t},validate(e,{state:t,prefs:r,error:s},{schema:n}){const a=[e,...t.ancestors];for(let s=0;sthis.$_compile(e[r])),r,{append:!0});t.$_terms.items.push(s)}return t.$_mutateRebuild()},validate(e,{schema:t,error:r,state:s,prefs:n,errorsArray:a}){const i=t.$_terms._requireds.slice(),l=t.$_terms.ordered.slice(),u=[...t.$_terms._inclusions,...i],p=!e[o.symbols.arraySingle];delete e[o.symbols.arraySingle];const h=a();let d=e.length;for(let a=0;a="})}},ordered:{method(...e){o.verifyFlat(e,"ordered");const t=this.$_addRule("items");for(let r=0;rthis.$_compile(e[r])),r,{append:!0});c.validateSingle(s,t),t.$_mutateRegister(s),t.$_terms.ordered.push(s)}return t.$_mutateRebuild()}},single:{method(e){const t=void 0===e||!!e;return s(!t||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",t)}},sort:{method(e={}){o.assertOptions(e,["by","order"]);const t={order:e.order||"ascending"};return e.by&&(t.by=l.ref(e.by,{ancestor:0}),s(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(e,{error:t,state:r,prefs:s,schema:n},{options:a}){const{value:i,errors:o}=c.sort(n,e,a,r,s);if(o)return o;for(let r=0;rnew Set(e)}},rebuild(e){e.$_terms._inclusions=[],e.$_terms._exclusions=[],e.$_terms._requireds=[];for(const t of e.$_terms.items)c.validateSingle(t,e),"required"===t._flags.presence?e.$_terms._requireds.push(t):"forbidden"===t._flags.presence?e.$_terms._exclusions.push(t):e.$_terms._inclusions.push(t);for(const t of e.$_terms.ordered)c.validateSingle(t,e)},manifest:{build:(e,t)=>(t.items&&(e=e.items(...t.items)),t.ordered&&(e=e.ordered(...t.ordered)),e)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),c.fillMissedErrors=function(e,t,r,s,n,a){const i=[];let o=0;for(const e of r){const t=e._flags.label;t?i.push(t):++o}i.length?o?t.push(e.$_createError("array.includesRequiredBoth",s,{knownMisses:i,unknownMisses:o},n,a)):t.push(e.$_createError("array.includesRequiredKnowns",s,{knownMisses:i},n,a)):t.push(e.$_createError("array.includesRequiredUnknowns",s,{unknownMisses:o},n,a))},c.fillOrderedErrors=function(e,t,r,s,n,a){const i=[];for(const e of r)"required"===e._flags.presence&&i.push(e);i.length&&c.fillMissedErrors(e,t,i,s,n,a)},c.fillDefault=function(e,t,r,s){const n=[];let a=!0;for(let i=e.length-1;i>=0;--i){const o=e[i],l=[t,...r.ancestors],c=o.$_validate(void 0,r.localize(r.path,l,o),s).value;if(a){if(void 0===c)continue;a=!1}n.unshift(c)}n.length&&t.push(...n)},c.fastSplice=function(e,t){let r=t;for(;r{let p=c.compare(l,u,i,o);if(null!==p)return p;if(r.by&&(l=r.by.resolve(l,s,n),u=r.by.resolve(u,s,n)),p=c.compare(l,u,i,o),null!==p)return p;const h=typeof l;if(h!==typeof u)throw e.$_createError("array.sort.mismatching",t,null,s,n);if("number"!==h&&"string"!==h)throw e.$_createError("array.sort.unsupported",t,{type:h},s,n);return"number"===h?(l-u)*a:l{const s=r(27),n=r(115),a=r(100),i=r(120),o={isBool:function(e){return"boolean"==typeof e}};e.exports=n.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(e,{schema:t}){if("boolean"!=typeof e){if("string"==typeof e){const r=t._flags.sensitive?e:e.toLowerCase();e="true"===r||"false"!==r&&e}return"boolean"!=typeof e&&(e=t.$_terms.truthy&&t.$_terms.truthy.has(e,null,null,!t._flags.sensitive)||(!t.$_terms.falsy||!t.$_terms.falsy.has(e,null,null,!t._flags.sensitive))&&e),{value:e}}},validate(e,{error:t}){if("boolean"!=typeof e)return{value:e,errors:t("boolean.base")}},rules:{truthy:{method(...e){a.verifyFlat(e,"truthy");const t=this.clone();t.$_terms.truthy=t.$_terms.truthy||new i;for(let r=0;re?1:0},string:{from:o.isBool,to:(e,t)=>e?"true":"false"}},manifest:{build:(e,t)=>(t.truthy&&(e=e.truthy(...t.truthy)),t.falsy&&(e=e.falsy(...t.falsy)),e)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},(e,t,r)=>{const s=r(27),n=r(115),a=r(100),i=r(104),o={isDate:function(e){return e instanceof Date}};e.exports=n.extend({type:"date",coerce:{from:["number","string"],method:(e,{schema:t})=>({value:o.parse(e,t._flags.format)||e})},validate(e,{schema:t,error:r,prefs:s}){if(e instanceof Date&&!isNaN(e.getTime()))return;const n=t._flags.format;return s.convert&&n&&"string"==typeof e?{value:e,errors:r("date.format",{format:n})}:{value:e,errors:r("date.base")}},rules:{compare:{method:!1,validate(e,t,{date:r},{name:s,operator:n,args:i}){const o="now"===r?Date.now():r.getTime();return a.compare(e.getTime(),o,n)?e:t.error("date."+s,{limit:i.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:o.parse(e),assert:e=>null!==e,message:"must have a valid date format"}]},format:{method(e){return s(["iso","javascript","unix"].includes(e),"Unknown date format",e),this.$_setFlag("format",e)}},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{date:e},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{date:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{date:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{date:e},operator:">="})}},timestamp:{method(e="javascript"){return s(["javascript","unix"].includes(e),'"type" must be one of "javascript, unix"'),this.format(e)}}},cast:{number:{from:o.isDate,to:(e,t)=>e.getTime()},string:{from:o.isDate,to:(e,{prefs:t})=>i.date(e,t)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),o.parse=function(e,t){if(e instanceof Date)return e;if("string"!=typeof e&&(isNaN(e)||!isFinite(e)))return null;if(/^\s*$/.test(e))return null;if("iso"===t)return a.isIsoDate(e)?o.date(e.toString()):null;const r=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return o.date(1*e);if("unix"===t)return o.date(1e3*e);if("string"==typeof r)return null}return o.date(e)},o.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t}},(e,t,r)=>{const s=r(27),n=r(125);e.exports=n.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(e){return s(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:e}})},validate:(e,t,{n:r})=>e.length===r?e:t.error("function.arity",{n:r})},class:{method(){return this.$_addRule("class")},validate:(e,t)=>/^\s*class\s/.test(e.toString())?e:t.error("function.class",{value:e})},minArity:{method(e){return s(Number.isSafeInteger(e)&&e>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:e}})},validate:(e,t,{n:r})=>e.length>=r?e:t.error("function.minArity",{n:r})},maxArity:{method(e){return s(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:e}})},validate:(e,t,{n:r})=>e.length<=r?e:t.error("function.maxArity",{n:r})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},(e,t,r)=>{const s=r(26),n=r(27),a=r(30),i=r(73),o=r(115),l=r(100),c=r(109),u=r(106),p=r(108),h=r(104),d={renameDefaults:{alias:!1,multiple:!1,override:!1}};e.exports=o.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:!1}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(e,t)=>e.keys(t),validate(e,{schema:t,error:r,state:s,prefs:n}){if(!e||typeof e!==t.$_property("typeof")||Array.isArray(e))return{value:e,errors:r("object.base",{type:t.$_property("typeof")})};if(!(t.$_terms.renames||t.$_terms.dependencies||t.$_terms.keys||t.$_terms.patterns||t.$_terms.externals))return;e=d.clone(e,n);const a=[];if(t.$_terms.renames&&!d.rename(t,e,s,n,a))return{value:e,errors:a};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:a};const i=new Set(Object.keys(e));if(t.$_terms.keys){const r=[e,...s.ancestors];for(const o of t.$_terms.keys){const t=o.key,l=e[t];i.delete(t);const c=s.localize([...s.path,t],r,o),u=o.schema.$_validate(l,c,n);if(u.errors){if(n.abortEarly)return{value:e,errors:u.errors};void 0!==u.value&&(e[t]=u.value),a.push(...u.errors)}else"strip"===o.schema._flags.result||void 0===u.value&&void 0!==l?delete e[t]:void 0!==u.value&&(e[t]=u.value)}}if(i.size||t._flags._hasPatternMatch){const r=d.unknown(t,e,i,a,s,n);if(r)return r}if(t.$_terms.dependencies)for(const r of t.$_terms.dependencies){if(null!==r.key&&!1===d.isPresent(r.options)(r.key.resolve(e,s,n,null,{shadow:!1})))continue;const i=d.dependencies[r.rel](t,r,e,s,n);if(i){const r=t.$_createError(i.code,e,i.context,s,n);if(n.abortEarly)return{value:e,errors:r};a.push(r)}}return{value:e,errors:a}},rules:{and:{method(...e){return l.verifyFlat(e,"and"),d.dependency(this,"and",null,e)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,t,r){h.isTemplate(e)||(e=c.ref(e)),n(void 0===r||"string"==typeof r,"Message must be a string"),t=this.$_compile(t,{appendPath:!0});const s=this.$_addRule({name:"assert",args:{subject:e,schema:t,message:r}});return s.$_mutateRegister(e),s.$_mutateRegister(t),s},validate(e,{error:t,prefs:r,state:s},{subject:n,schema:a,message:i}){const o=n.resolve(e,s,r),l=p.isRef(n)?n.absolute(s):[];return a.$_match(o,s.localize(l,[e,...s.ancestors],a),r)?e:t("object.assert",{subject:n,message:i})},args:["subject","schema","message"],multi:!0},instance:{method(e,t){return n("function"==typeof e,"constructor must be a function"),t=t||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:t}})},validate:(e,t,{constructor:r,name:s})=>e instanceof r?e:t.error("object.instance",{type:s,value:e}),args:["constructor","name"]},keys:{method(e){n(void 0===e||"object"==typeof e,"Object schema must be a valid object"),n(!l.isSchema(e),"Object schema cannot be a joi schema");const t=this.clone();if(e)if(Object.keys(e).length){t.$_terms.keys=t.$_terms.keys?t.$_terms.keys.filter((t=>!e.hasOwnProperty(t.key))):new d.Keys;for(const r in e)l.tryWithPath((()=>t.$_terms.keys.push({key:r,schema:this.$_compile(e[r])})),r)}else t.$_terms.keys=new d.Keys;else t.$_terms.keys=null;return t.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:s,operator:n,args:a})=>l.compare(Object.keys(e).length,r,n)?e:t.error("object."+s,{limit:a.limit,value:e}),args:[{name:"limit",ref:!0,assert:l.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},nand:{method(...e){return l.verifyFlat(e,"nand"),d.dependency(this,"nand",null,e)}},or:{method(...e){return l.verifyFlat(e,"or"),d.dependency(this,"or",null,e)}},oxor:{method(...e){return d.dependency(this,"oxor",null,e)}},pattern:{method(e,t,r={}){const s=e instanceof RegExp;s||(e=this.$_compile(e,{appendPath:!0})),n(void 0!==t,"Invalid rule"),l.assertOptions(r,["fallthrough","matches"]),s&&n(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),t=this.$_compile(t,{appendPath:!0});const a=this.clone();a.$_terms.patterns=a.$_terms.patterns||[];const i={[s?"regex":"schema"]:e,rule:t};return r.matches&&(i.matches=this.$_compile(r.matches),"array"!==i.matches.type&&(i.matches=i.matches.$_root.array().items(i.matches)),a.$_mutateRegister(i.matches),a.$_setFlag("_hasPatternMatch",!0,{clone:!1})),r.fallthrough&&(i.fallthrough=!0),a.$_terms.patterns.push(i),a.$_mutateRegister(t),a}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>p.isRef(e)?e:t.error("object.refType",{value:e})},regex:{method(){return this.$_addRule("regex")},validate:(e,t)=>e instanceof RegExp?e:t.error("object.regex",{value:e})},rename:{method(e,t,r={}){n("string"==typeof e||e instanceof RegExp,"Rename missing the from argument"),n("string"==typeof t||t instanceof h,"Invalid rename to argument"),n(t!==e,"Cannot rename key to same name:",e),l.assertOptions(r,["alias","ignoreUndefined","override","multiple"]);const a=this.clone();a.$_terms.renames=a.$_terms.renames||[];for(const t of a.$_terms.renames)n(t.from!==e,"Cannot rename the same key multiple times");return t instanceof h&&a.$_mutateRegister(t),a.$_terms.renames.push({from:e,to:t,options:s(d.renameDefaults,r)}),a}},schema:{method(e="any"){return this.$_addRule({name:"schema",args:{type:e}})},validate:(e,t,{type:r})=>!l.isSchema(e)||"any"!==r&&e.type!==r?t.error("object.schema",{type:r}):e},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t,r={}){return d.dependency(this,"with",e,t,r)}},without:{method(e,t,r={}){return d.dependency(this,"without",e,t,r)}},xor:{method(...e){return l.verifyFlat(e,"xor"),d.dependency(this,"xor",null,e)}}},overrides:{default(e,t){return void 0===e&&(e=l.symbols.deepDefault),this.$_parent("default",e,t)}},rebuild(e){if(e.$_terms.keys){const t=new i.Sorter;for(const r of e.$_terms.keys)l.tryWithPath((()=>t.add(r,{after:r.schema.$_rootReferences(),group:r.key})),r.key);e.$_terms.keys=new d.Keys(...t.nodes)}},manifest:{build(e,t){if(t.keys&&(e=e.keys(t.keys)),t.dependencies)for(const{rel:r,key:s=null,peers:n,options:a}of t.dependencies)e=d.dependency(e,r,s,n,a);if(t.patterns)for(const{regex:r,schema:s,rule:n,fallthrough:a,matches:i}of t.patterns)e=e.pattern(r||s,n,{fallthrough:a,matches:i});if(t.renames)for(const{from:r,to:s,options:n}of t.renames)e=e.rename(r,s,n);return e}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),d.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return a(e,{shallow:!0});const r=Object.create(Object.getPrototypeOf(e));return Object.assign(r,e),r}const r=function(...t){return e.apply(this,t)};return r.prototype=a(e.prototype),Object.defineProperty(r,"name",{value:e.name,writable:!1}),Object.defineProperty(r,"length",{value:e.length,writable:!1}),Object.assign(r,e),r},d.dependency=function(e,t,r,s,a){n(null===r||"string"==typeof r,t,"key must be a strings"),a||(a=s.length>1&&"object"==typeof s[s.length-1]?s.pop():{}),l.assertOptions(a,["separator","isPresent"]),s=[].concat(s);const i=l.default(a.separator,"."),o=[];for(const e of s)n("string"==typeof e,t,"peers must be strings"),o.push(c.ref(e,{separator:i,ancestor:0,prefix:!1}));null!==r&&(r=c.ref(r,{separator:i,ancestor:0,prefix:!1}));const u=e.clone();return u.$_terms.dependencies=u.$_terms.dependencies||[],u.$_terms.dependencies.push(new d.Dependency(t,r,o,s,a)),u},d.dependencies={and(e,t,r,s,n){const a=[],i=[],o=t.peers.length,l=d.isPresent(t.options);for(const e of t.peers)!1===l(e.resolve(r,s,n,null,{shadow:!1}))?a.push(e.key):i.push(e.key);if(a.length!==o&&i.length!==o)return{code:"object.and",context:{present:i,presentWithLabels:d.keysToLabels(e,i),missing:a,missingWithLabels:d.keysToLabels(e,a)}}},nand(e,t,r,s,n){const a=[],i=d.isPresent(t.options);for(const e of t.peers)i(e.resolve(r,s,n,null,{shadow:!1}))&&a.push(e.key);if(a.length!==t.peers.length)return;const o=t.paths[0],l=t.paths.slice(1);return{code:"object.nand",context:{main:o,mainWithLabel:d.keysToLabels(e,o),peers:l,peersWithLabels:d.keysToLabels(e,l)}}},or(e,t,r,s,n){const a=d.isPresent(t.options);for(const e of t.peers)if(a(e.resolve(r,s,n,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:t.paths,peersWithLabels:d.keysToLabels(e,t.paths)}}},oxor(e,t,r,s,n){const a=[],i=d.isPresent(t.options);for(const e of t.peers)i(e.resolve(r,s,n,null,{shadow:!1}))&&a.push(e.key);if(!a.length||1===a.length)return;const o={peers:t.paths,peersWithLabels:d.keysToLabels(e,t.paths)};return o.present=a,o.presentWithLabels=d.keysToLabels(e,a),{code:"object.oxor",context:o}},with(e,t,r,s,n){const a=d.isPresent(t.options);for(const i of t.peers)if(!1===a(i.resolve(r,s,n,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:d.keysToLabels(e,t.key.key),peer:i.key,peerWithLabel:d.keysToLabels(e,i.key)}}},without(e,t,r,s,n){const a=d.isPresent(t.options);for(const i of t.peers)if(a(i.resolve(r,s,n,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:d.keysToLabels(e,t.key.key),peer:i.key,peerWithLabel:d.keysToLabels(e,i.key)}}},xor(e,t,r,s,n){const a=[],i=d.isPresent(t.options);for(const e of t.peers)i(e.resolve(r,s,n,null,{shadow:!1}))&&a.push(e.key);if(1===a.length)return;const o={peers:t.paths,peersWithLabels:d.keysToLabels(e,t.paths)};return 0===a.length?{code:"object.missing",context:o}:(o.present=a,o.presentWithLabels=d.keysToLabels(e,a),{code:"object.xor",context:o})}},d.keysToLabels=function(e,t){return Array.isArray(t)?t.map((t=>e.$_mapLabels(t))):e.$_mapLabels(t)},d.isPresent=function(e){return"function"==typeof e.isPresent?e.isPresent:e=>void 0!==e},d.rename=function(e,t,r,s,n){const a={};for(const i of e.$_terms.renames){const o=[],l="string"!=typeof i.from;if(l)for(const e in t){if(void 0===t[e]&&i.options.ignoreUndefined)continue;if(e===i.to)continue;const r=i.from.exec(e);r&&o.push({from:e,to:i.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,i.from)||void 0===t[i.from]&&i.options.ignoreUndefined||o.push(i);for(const c of o){const o=c.from;let u=c.to;if(u instanceof h&&(u=u.render(t,r,s,c.match)),o!==u){if(!i.options.multiple&&a[u]&&(n.push(e.$_createError("object.rename.multiple",t,{from:o,to:u,pattern:l},r,s)),s.abortEarly))return!1;if(Object.prototype.hasOwnProperty.call(t,u)&&!i.options.override&&!a[u]&&(n.push(e.$_createError("object.rename.override",t,{from:o,to:u,pattern:l},r,s)),s.abortEarly))return!1;void 0===t[o]?delete t[u]:t[u]=t[o],a[u]=!0,i.options.alias||delete t[o]}}}return!0},d.unknown=function(e,t,r,s,n,a){if(e.$_terms.patterns){let i=!1;const o=e.$_terms.patterns.map((e=>{if(e.matches)return i=!0,[]})),l=[t,...n.ancestors];for(const i of r){const c=t[i],u=[...n.path,i];for(let p=0;p{const s=r(27),n=r(115),a=r(100),i=r(109),o=r(106),l={};e.exports=n.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(e,t)=>e.ref(t),validate(e,{schema:t,state:r,prefs:n}){s(t.$_terms.link,"Uninitialized link schema");const a=l.generate(t,e,r,n),i=t.$_terms.link[0].ref;return a.$_validate(e,r.nest(a,`link:${i.display}:${a.type}`),n)},generate:(e,t,r,s)=>l.generate(e,t,r,s),rules:{ref:{method(e){s(!this.$_terms.link,"Cannot reinitialize schema"),e=i.ref(e),s("value"===e.type||"local"===e.type,"Invalid reference type:",e.type),s("local"===e.type||"root"===e.ancestor||e.ancestor>0,"Link cannot reference itself");const t=this.clone();return t.$_terms.link=[{ref:e}],t}},relative:{method(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(e){s(this.$_terms.link,"Uninitialized link schema"),s(a.isSchema(e),"Invalid schema object"),s("link"!==e.type,"Cannot merge type link with another link");const t=this.clone();return t.$_terms.whens||(t.$_terms.whens=[]),t.$_terms.whens.push({concat:e}),t.$_mutateRebuild()}},manifest:{build:(e,t)=>(s(t.link,"Invalid link description missing link"),e.ref(t.link))}}),l.generate=function(e,t,r,s){let n=r.mainstay.links.get(e);if(n)return n._generate(t,r,s).schema;const a=e.$_terms.link[0].ref,{perspective:i,path:o}=l.perspective(a,r);l.assert(i,"which is outside of schema boundaries",a,e,r,s);try{n=o.length?i.$_reach(o):i}catch(t){l.assert(!1,"to non-existing schema",a,e,r,s)}return l.assert("link"!==n.type,"which is another link",a,e,r,s),e._flags.relative||r.mainstay.links.set(e,n),n._generate(t,r,s).schema},l.perspective=function(e,t){if("local"===e.type){for(const{schema:r,key:s}of t.schemas){if((r._flags.id||s)===e.path[0])return{perspective:r,path:e.path.slice(1)};if(r.$_terms.shared)for(const t of r.$_terms.shared)if(t._flags.id===e.path[0])return{perspective:t,path:e.path.slice(1)}}return{perspective:null,path:null}}return"root"===e.ancestor?{perspective:t.schemas[t.schemas.length-1].schema,path:e.path}:{perspective:t.schemas[e.ancestor]&&t.schemas[e.ancestor].schema,path:e.path}},l.assert=function(e,t,r,n,a,i){e||s(!1,`"${o.label(n._flags,a,i)}" contains link reference "${r.display}" ${t}`)}},(e,t,r)=>{const s=r(27),n=r(115),a=r(100),i={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/,decimalPlaces(e){const t=e.toString(),r=t.indexOf("."),s=t.indexOf("e");return(r<0?0:(s<0?t.length:s)-r-1)+(s<0?0:Math.max(0,-parseInt(t.slice(s+1))))}};e.exports=n.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:r}){if(!e.match(i.numberRx))return;e=e.trim();const s={value:parseFloat(e)};if(0===s.value&&(s.value=0),!t._flags.unsafe)if(e.match(/e/i)){if(i.extractSignificantDigits(e)!==i.extractSignificantDigits(String(s.value)))return s.errors=r("number.unsafe"),s}else{const t=s.value.toString();if(t.match(/e/i))return s;if(t!==i.normalizeDecimal(e))return s.errors=r("number.unsafe"),s}return s}},validate(e,{schema:t,error:r,prefs:s}){if(e===1/0||e===-1/0)return{value:e,errors:r("number.infinity")};if(!a.isNumber(e))return{value:e,errors:r("number.base")};const n={value:e};if(s.convert){const e=t.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);n.value=Math.round(n.value*t)/t}}return 0===n.value&&(n.value=0),!t._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||ea.compare(e,r,n)?e:t.error("number."+s,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:a.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){const t="number"==typeof e?i.decimalPlaces(e):null,r=Math.pow(10,t);return this.$_addRule({name:"multiple",args:{base:e,baseDecimalPlace:t,pfactor:r}})},validate:(e,t,{base:r,baseDecimalPlace:s,pfactor:n},a)=>i.decimalPlaces(e)>s?t.error("number.multiple",{multiple:a.args.base,value:e}):Math.round(n*e)%Math.round(n*r)==0?e:t.error("number.multiple",{multiple:a.args.base,value:e}),args:[{name:"base",ref:!0,assert:e=>"number"==typeof e&&isFinite(e)&&e>0,message:"must be a positive number"},"baseDecimalPlace","pfactor"],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,t)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:t.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(e){return s(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,t,{limit:r}){const s=e.toString().match(i.precisionRx);return Math.max((s[1]?s[1].length:0)-(s[2]?parseInt(s[2],10):0),0)<=r?e:t.error("number.precision",{limit:r,value:e})},convert:!0},sign:{method(e){return s(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate:(e,t,{sign:r})=>"negative"===r&&e<0||"positive"===r&&e>0?e:t.error(`number.${r}`)},unsafe:{method(e=!0){return s("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("unsafe",e)}}},cast:{string:{from:e=>"number"==typeof e,to:(e,t)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),i.extractSignificantDigits=function(e){return e.replace(i.exponentialPartRegex,"").replace(i.dotRegex,"").replace(i.trailingZerosRegex,"").replace(i.leadingSignAndZerosRegex,"")},i.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e}},(e,t,r)=>{const s=r(125);e.exports=s.extend({type:"object",cast:{map:{from:e=>e&&"object"==typeof e,to:(e,t)=>new Map(Object.entries(e))}}})},(e,t,r)=>{var s=r(14).Buffer;const n=r(27),a=r(130),i=r(132),o=r(133),l=r(40),c=r(135),u=r(134),p=r(115),h=r(100),d={tlds:c instanceof Set&&{tlds:{allow:c,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:{withPrefix:/^0x[0-9a-f]+$/i,withOptionalPrefix:/^(?:0x)?[0-9a-f]+$/i,withoutPrefix:/^[0-9a-f]+$/i},ipRegex:o.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};e.exports=p.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,{schema:t,state:r,prefs:s}){const n=t.$_getRule("normalize");n&&(e=e.normalize(n.args.form));const a=t.$_getRule("case");a&&(e="upper"===a.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const i=t.$_getRule("trim");if(i&&i.args.enabled&&(e=e.trim()),t.$_terms.replacements)for(const r of t.$_terms.replacements)e=e.replace(r.pattern,r.replacement);const o=t.$_getRule("hex");if(o&&o.args.options.byteAligned&&e.length%2!=0&&(e=`0${e}`),t.$_getRule("isoDate")){const t=d.isoDate(e);t&&(e=t)}if(t._flags.truncate){const n=t.$_getRule("max");if(n){let a=n.args.limit;if(h.isResolvable(a)&&(a=a.resolve(e,r,s),!h.limit(a)))return{value:e,errors:t.$_createError("any.ref",a,{ref:n.args.limit,arg:"limit",reason:"must be a positive integer"},r,s)};e=e.slice(0,a)}}return{value:e}}},validate(e,{schema:t,error:r}){if("string"!=typeof e)return{value:e,errors:r("string.base")};if(""===e){const s=t.$_getRule("min");if(s&&0===s.args.limit)return;return{value:e,errors:r("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(e,t)=>/^[a-zA-Z0-9]+$/.test(e)?e:t.error("string.alphanum")},base64:{method(e={}){return h.assertOptions(e,["paddingRequired","urlSafe"]),e={urlSafe:!1,paddingRequired:!0,...e},n("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),n("boolean"==typeof e.urlSafe,"urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:e}})},validate:(e,t,{options:r})=>d.base64Regex[r.paddingRequired][r.urlSafe].test(e)?e:t.error("string.base64")},case:{method(e){return n(["lower","upper"].includes(e),"Invalid case:",e),this.$_addRule({name:"case",args:{direction:e}})},validate:(e,t,{direction:r})=>"lower"===r&&e===e.toLocaleLowerCase()||"upper"===r&&e===e.toLocaleUpperCase()?e:t.error(`string.${r}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let r=e.length,s=0,n=1;for(;r--;){const t=e.charAt(r)*n;s+=t-9*(t>9),n^=3}return s>0&&s%10==0?e:t.error("string.creditCard")}},dataUri:{method(e={}){return h.assertOptions(e,["paddingRequired"]),e={paddingRequired:!0,...e},n("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:e}})},validate(e,t,{options:r}){const s=e.match(d.dataUriRegex);if(s){if(!s[2])return e;if("base64"!==s[2])return e;if(d.base64Regex[r.paddingRequired].false.test(s[3]))return e}return t.error("string.dataUri")}},domain:{method(e){e&&h.assertOptions(e,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const t=d.addressOptions(e);return this.$_addRule({name:"domain",args:{options:e},address:t})},validate:(e,t,r,{address:s})=>a.isValid(e,s)?e:t.error("string.domain")},email:{method(e={}){h.assertOptions(e,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),n(void 0===e.multiple||"boolean"==typeof e.multiple,"multiple option must be an boolean");const t=d.addressOptions(e),r=new RegExp(`\\s*[${e.separator?l(e.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:e},regex:r,address:t})},validate(e,t,{options:r},{regex:s,address:n}){const a=r.multiple?e.split(s):[e],o=[];for(const e of a)i.isValid(e,n)||o.push(e);return o.length?t.error("string.email",{value:e,invalids:o}):e}},guid:{alias:"uuid",method(e={}){h.assertOptions(e,["version","separator"]);let t="";if(e.version){const r=[].concat(e.version);n(r.length>=1,"version must have at least 1 valid version specified");const s=new Set;for(let e=0;e("optional"===r.prefix?d.hexRegex.withOptionalPrefix:!0===r.prefix?d.hexRegex.withPrefix:d.hexRegex.withoutPrefix).test(e)?r.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(e,t)=>a.isValid(e,{minDomainSegments:1})||d.ipRegex.test(e)?e:t.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(e={}){h.assertOptions(e,["cidr","version"]);const{cidr:t,versions:r,regex:s}=o.regex(e),n=e.version?r:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:t,version:n}},regex:s})},validate:(e,t,{options:r},{regex:s})=>s.test(e)?e:r.version?t.error("string.ipVersion",{value:e,cidr:r.cidr,version:r.version}):t.error("string.ip",{value:e,cidr:r.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(e,{error:t})=>d.isoDate(e)?e:t("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>d.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return d.length(this,"length",e,"=",t)},validate(e,t,{limit:r,encoding:n},{name:a,operator:i,args:o}){const l=n?s&&s.byteLength(e,n):e.length;return h.compare(l,r,i)?e:t.error("string."+a,{limit:o.limit,value:e,encoding:n})},args:[{name:"limit",ref:!0,assert:h.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return d.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return d.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(e="NFC"){return n(d.normalizationForms.includes(e),"normalization form must be one of "+d.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:e}})},validate:(e,{error:t},{form:r})=>e===e.normalize(r)?e:t("string.normalize",{value:e,form:r}),convert:!0},pattern:{alias:"regex",method(e,t={}){n(e instanceof RegExp,"regex must be a RegExp"),n(!e.flags.includes("g")&&!e.flags.includes("y"),"regex should not use global or sticky mode"),"string"==typeof t&&(t={name:t}),h.assertOptions(t,["invert","name"]);const r=["string.pattern",t.invert?".invert":"",t.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:e,options:t},errorCode:r})},validate:(e,t,{regex:r,options:s},{errorCode:n})=>r.test(e)^s.invert?e:t.error(n,{name:s.name,regex:r,value:e}),args:["regex","options"],multi:!0},replace:{method(e,t){"string"==typeof e&&(e=new RegExp(l(e),"g")),n(e instanceof RegExp,"pattern must be a RegExp"),n("string"==typeof t,"replacement must be a String");const r=this.clone();return r.$_terms.replacements||(r.$_terms.replacements=[]),r.$_terms.replacements.push({pattern:e,replacement:t}),r}},token:{method(){return this.$_addRule("token")},validate:(e,t)=>/^\w+$/.test(e)?e:t.error("string.token")},trim:{method(e=!0){return n("boolean"==typeof e,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:e}})},validate:(e,t,{enabled:r})=>r&&e!==e.trim()?t.error("string.trim"):e,convert:!0},truncate:{method(e=!0){return n("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("truncate",e)}},uppercase:{method(){return this.case("upper")}},uri:{method(e={}){h.assertOptions(e,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme"]),e.domain&&h.assertOptions(e.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:t,scheme:r}=u.regex(e),s=e.domain?d.addressOptions(e.domain):null;return this.$_addRule({name:"uri",args:{options:e},regex:t,domain:s,scheme:r})},validate(e,t,{options:r},{regex:s,domain:n,scheme:i}){if(["http:/","https:/"].includes(e))return t.error("string.uri");const o=s.exec(e);if(o){const s=o[1]||o[2];return!n||r.allowRelative&&!s||a.isValid(s,n)?e:t.error("string.domain",{value:s})}return r.relativeOnly?t.error("string.uriRelativeOnly"):r.scheme?t.error("string.uriCustomScheme",{scheme:i,value:e}):t.error("string.uri")}}},manifest:{build(e,t){if(t.replacements)for(const{pattern:r,replacement:s}of t.replacements)e=e.replace(r,s);return e}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),d.addressOptions=function(e){if(!e)return d.tlds||e;if(n(void 0===e.minDomainSegments||Number.isSafeInteger(e.minDomainSegments)&&e.minDomainSegments>0,"minDomainSegments must be a positive integer"),n(void 0===e.maxDomainSegments||Number.isSafeInteger(e.maxDomainSegments)&&e.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),!1===e.tlds)return e;if(!0===e.tlds||void 0===e.tlds)return n(d.tlds,"Built-in TLD list disabled"),Object.assign({},e,d.tlds);n("object"==typeof e.tlds,"tlds must be true, false, or an object");const t=e.tlds.deny;if(t)return Array.isArray(t)&&(e=Object.assign({},e,{tlds:{deny:new Set(t)}})),n(e.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),n(!e.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),d.validateTlds(e.tlds.deny,"tlds.deny"),e;const r=e.tlds.allow;return r?!0===r?(n(d.tlds,"Built-in TLD list disabled"),Object.assign({},e,d.tlds)):(Array.isArray(r)&&(e=Object.assign({},e,{tlds:{allow:new Set(r)}})),n(e.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),d.validateTlds(e.tlds.allow,"tlds.allow"),e):e},d.validateTlds=function(e,t){for(const r of e)n(a.isValid(r,{minDomainSegments:1,maxDomainSegments:1}),`${t} must contain valid top level domain names`)},d.isoDate=function(e){if(!h.isIsoDate(e))return null;/.*T.*[+-]\d\d$/.test(e)&&(e+="00");const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},d.length=function(e,t,r,a,i){return n(!i||s&&s.isEncoding(i),"Invalid encoding:",i),e.$_addRule({name:t,method:"length",args:{limit:r,encoding:i},operator:a})}},(e,t,r)=>{const s=r(9),n=r(131),a={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:s.URL||URL};t.analyze=function(e,t={}){if(!e)return n.code("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return n.code("DOMAIN_TOO_LONG");if(!!a.nonAsciiRx.test(e)){if(!1===t.allowUnicode)return n.code("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(a.domainControlRx.test(e))return n.code("DOMAIN_INVALID_CHARS");e=a.punycode(e),t.allowFullyQualified&&"."===e[e.length-1]&&(e=e.slice(0,-1));const r=t.minDomainSegments||a.minDomainSegments,s=e.split(".");if(s.lengtht.maxDomainSegments)return n.code("DOMAIN_SEGMENTS_COUNT_MAX");const i=t.tlds;if(i){const e=s[s.length-1].toLowerCase();if(i.deny&&i.deny.has(e)||i.allow&&!i.allow.has(e))return n.code("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e63)return n.code("DOMAIN_LONG_SEGMENT");if(e{t.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},t.code=function(e){return{code:e,error:t.codes[e]}}},(e,t,r)=>{const s=r(88),n=r(130),a=r(131),i={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(s.TextEncoder||TextEncoder)};t.analyze=function(e,t){return i.email(e,t)},t.isValid=function(e,t){return!i.email(e,t)},i.email=function(e,t={}){if("string"!=typeof e)throw new Error("Invalid input: email must be a string");if(!e)return a.code("EMPTY_STRING");const r=!i.nonAsciiRx.test(e);if(!r){if(!1===t.allowUnicode)return a.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const s=e.split("@");if(2!==s.length)return s.length>2?a.code("MULTIPLE_AT_CHAR"):a.code("MISSING_AT_CHAR");const[o,l]=s;if(!o)return a.code("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return a.code("ADDRESS_TOO_LONG");if(i.encoder.encode(o).length>64)return a.code("LOCAL_TOO_LONG")}return i.local(o,r)||n.analyze(l,t)},i.local=function(e,t){const r=e.split(".");for(const e of r){if(!e.length)return a.code("EMPTY_LOCAL_SEGMENT");if(t){if(!i.atextRx.test(e))return a.code("INVALID_LOCAL_CHARS")}else for(const t of e){if(i.atextRx.test(t))continue;const e=i.binary(t);if(!i.atomRx.test(e))return a.code("INVALID_LOCAL_CHARS")}}},i.binary=function(e){return Array.from(i.encoder.encode(e)).map((e=>String.fromCharCode(e))).join("")},i.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,i.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},(e,t,r)=>{const s=r(27),n=r(134);t.regex=function(e={}){s(void 0===e.cidr||"string"==typeof e.cidr,"options.cidr must be a string");const t=e.cidr?e.cidr.toLowerCase():"optional";s(["required","optional","forbidden"].includes(t),"options.cidr must be one of required, optional, forbidden"),s(void 0===e.version||"string"==typeof e.version||Array.isArray(e.version),"options.version must be a string or an array of string");let r=e.version||["ipv4","ipv6","ipvfuture"];Array.isArray(r)||(r=[r]),s(r.length>=1,"options.version must have at least 1 version specified");for(let e=0;e{if("forbidden"===t)return n.ip[e];const r=`\\/${"ipv4"===e?n.ip.v4Cidr:n.ip.v6Cidr}`;return"required"===t?`${n.ip[e]}${r}`:`${n.ip[e]}(?:${r})?`})).join("|")})`,i=new RegExp(`^${a}$`);return{cidr:t,versions:r,regex:i,raw:a}}},(e,t,r)=>{const s=r(27),n=r(40),a={generate:function(){const e={},t="\\dA-Fa-f",r="["+t+"]",s="\\w-\\.~",n="!\\$&'\\(\\)\\*\\+,;=",a="%"+t,i=s+a+n+":@",o="["+i+"]",l="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4address="(?:"+l+"\\.){3}"+l;const c=r+"{1,4}",u="(?:"+c+":"+c+"|"+e.ipv4address+")",p="(?:"+c+":){6}"+u,h="::(?:"+c+":){5}"+u,d="(?:"+c+")?::(?:"+c+":){4}"+u,f="(?:(?:"+c+":){0,1}"+c+")?::(?:"+c+":){3}"+u,m="(?:(?:"+c+":){0,2}"+c+")?::(?:"+c+":){2}"+u,g="(?:(?:"+c+":){0,3}"+c+")?::"+c+":"+u,y="(?:(?:"+c+":){0,4}"+c+")?::"+u,b="(?:(?:"+c+":){0,5}"+c+")?::"+c,v="(?:(?:"+c+":){0,6}"+c+")?::";e.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",e.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",e.ipv6address="(?:"+p+"|"+h+"|"+d+"|"+f+"|"+m+"|"+g+"|"+y+"|"+b+"|"+v+")",e.ipvFuture="v"+r+"+\\.["+s+n+":]+",e.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",e.schemeRegex=new RegExp(e.scheme);const _="["+s+a+n+":]*",w="["+s+a+n+"]{1,255}",A="(?:"+("\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]")+"|"+e.ipv4address+"|"+w+")",E="(?:"+_+"@)?"+A+"(?::\\d*)?",R="(?:"+_+"@)?("+A+")(?::\\d*)?",S=o+"*",$=o+"+",x="(?:\\/"+S+")*",O="\\/(?:"+$+x+")?",I=$+x,T="["+s+a+n+"@]+"+x,C="(?:\\/\\/\\/"+S+x+")";return e.hierPart="(?:(?:\\/\\/"+E+x+")|"+O+"|"+I+"|"+C+")",e.hierPartCapture="(?:(?:\\/\\/"+R+x+")|"+O+"|"+I+")",e.relativeRef="(?:(?:\\/\\/"+E+x+")|"+O+"|"+T+"|)",e.relativeRefCapture="(?:(?:\\/\\/"+R+x+")|"+O+"|"+T+"|)",e.query="["+i+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+i+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+i+"\\/\\?]*",e}};a.rfc3986=a.generate(),t.ip={v4Cidr:a.rfc3986.ipv4Cidr,v6Cidr:a.rfc3986.ipv6Cidr,ipv4:a.rfc3986.ipv4address,ipv6:a.rfc3986.ipv6address,ipvfuture:a.rfc3986.ipvFuture},a.createRegex=function(e){const t=a.rfc3986,r="(?:\\?"+(e.allowQuerySquareBrackets?t.queryWithSquareBrackets:t.query)+")?(?:#"+t.fragment+")?",i=e.domain?t.relativeRefCapture:t.relativeRef;if(e.relativeOnly)return a.wrap(i+r);let o="";if(e.scheme){s(e.scheme instanceof RegExp||"string"==typeof e.scheme||Array.isArray(e.scheme),"scheme must be a RegExp, String, or Array");const r=[].concat(e.scheme);s(r.length>=1,"scheme must have at least 1 scheme specified");const a=[];for(let e=0;e{const t={tlds:["AAA","AARP","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"]};e.exports=new Set(t.tlds.map((e=>e.toLowerCase())))},(e,t,r)=>{const s=r(27),n=r(115),a={};a.Map=class extends Map{slice(){return new a.Map(this)}},e.exports=n.extend({type:"symbol",terms:{map:{init:new a.Map}},coerce:{method(e,{schema:t,error:r}){const s=t.$_terms.map.get(e);return s&&(e=s),t._flags.only&&"symbol"!=typeof e?{value:e,errors:r("symbol.map",{map:t.$_terms.map})}:{value:e}}},validate(e,{error:t}){if("symbol"!=typeof e)return{value:e,errors:t("symbol.base")}},rules:{map:{method(e){e&&!e[Symbol.iterator]&&"object"==typeof e&&(e=Object.entries(e)),s(e&&e[Symbol.iterator],"Iterable must be an iterable or object");const t=this.clone(),r=[];for(const n of e){s(n&&n[Symbol.iterator],"Entry must be an iterable");const[e,a]=n;s("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),s("symbol"==typeof a,"Value must be a Symbol"),t.$_terms.map.set(e,a),r.push(a)}return t.valid(...r)}}},manifest:{build:(e,t)=>(t.map&&(e=e.map(t.map)),e)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},(e,t,r)=>{var s=r(14).Buffer;const n=r(27),a=r(115),i=r(100);e.exports=a.extend({type:"binary",coerce:{from:["string","object"],method(e,{schema:t}){if("string"==typeof e||null!==e&&"Buffer"===e.type)try{return{value:s.from(e,t._flags.encoding)}}catch(e){}}},validate(e,{error:t}){if(!s.isBuffer(e))return{value:e,errors:t("binary.base")}},rules:{encoding:{method(e){return n(s.isEncoding(e),"Invalid encoding:",e),this.$_setFlag("encoding",e)}},length:{method(e){return this.$_addRule({name:"length",method:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:s,operator:n,args:a})=>i.compare(e.length,r,n)?e:t.error("binary."+s,{limit:a.limit,value:e}),args:[{name:"limit",ref:!0,assert:i.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}}},cast:{string:{from:e=>s.isBuffer(e),to:(e,t)=>e.toString()}},messages:{"binary.base":"{{#label}} must be a buffer or a string","binary.length":"{{#label}} must be {{#limit}} bytes","binary.max":"{{#label}} must be less than or equal to {{#limit}} bytes","binary.min":"{{#label}} must be at least {{#limit}} bytes"}})},(e,t,r)=>{const{authPlugin:s}=r(139),{assetsPlugin:n}=r(144),{handlersPlugin:a}=r(145),{htmlPlugin:i}=r(147),{routesPlugin:o}=r(150),{storagePlugin:l}=r(230),c=[s,n,a,i,o,l];e.exports=c},(e,t,r)=>{r.r(t),r.d(t,{authPlugin:()=>g});var s=r(88),n=r(2),a=r.n(n),i=r(87),o=r.n(i),l=r(140),c=r.n(l),u=r(141),p=r.n(u),h=r(5),d=r.n(h),f=r(142),m=r(143);const g={register:async e=>{e.auth.scheme("extension-secret",(()=>({authenticate:(e,t)=>{const r=e.headers["x-api-key"];return e.storage.getApiKey().then((e=>{if(r&&r===(e=>o().createHmac("sha256",`${e} + ${d()("AUTH0_CLIENT_SECRET")}`).update(d()("EXTENSION_SECRET")).digest("hex"))(e))return t.authenticated({credentials:{user:"rule"}});throw a().unauthorized("Invalid API Key")}))}}))),e.auth.strategy("extension-secret","extension-secret");const t={dashboardAdmin:{key:d()("EXTENSION_SECRET"),verifyOptions:{audience:"urn:api-authz",issuer:d()("PUBLIC_WT_URL"),algorithms:["HS256"]}},resourceServer:{key:c().hapiJwt2Key({cache:!0,rateLimit:!0,jwksRequestsPerMinute:2,jwksUri:`https://${d()("AUTH0_DOMAIN")}/.well-known/jwks.json`}),verifyOptions:{audience:"urn:auth0-authz-api",issuer:`https://${d()("AUTH0_DOMAIN")}/`,algorithms:["RS256"]}}};e.auth.strategy("jwt","jwt",{complete:!0,verify:async(e,r)=>{try{if(!e)return{isValid:!1};const n=r.headers.authorization;if(!n||0===!n.indexOf("Bearer "))return{isValid:!1};const a=n.split(" ")[1],i=e&&e.payload&&e.payload.iss===`https://${d()("AUTH0_DOMAIN")}/`,o=e&&e.payload&&e.payload.iss===d()("PUBLIC_WT_URL"),l=(0,s.promisify)(t.resourceServer.key),c=(0,s.promisify)(p().verify);if(i){if(e.payload.gty&&"client-credentials"!==e.payload.gty)return{isValid:!1};if(!e.payload.sub.endsWith("@clients"))return{isValid:!1};const r=await l(e);return r?(await c(a,r,t.resourceServer.verifyOptions),e.payload.scope&&"string"==typeof e.payload.scope&&(e.payload.scope=e.payload.scope.split(" ")),{credentials:e.payload,isValid:!0}):{isValid:!1}}if(o)return e.payload.access_token&&e.payload.access_token.length?(await c(a,t.dashboardAdmin.key,t.dashboardAdmin.verifyOptions),e.payload.scope=f.scopes.map((e=>e.value)),{credentials:e.payload,isValid:!0}):{isValid:!1}}catch(e){return{isValid:!1}}}}),e.auth.default("jwt");const r={plugin:m.plugin,options:{stateKey:"authz-state",nonceKey:"authz-nonce",sessionStorageKey:"authz:apiToken",rta:d()("AUTH0_RTA").replace("https://",""),domain:d()("AUTH0_DOMAIN"),scopes:"read:resource_servers create:resource_servers update:resource_servers delete:resource_servers read:clients read:connections read:rules create:rules update:rules update:rules_configs read:users read:configuration",baseUrl:d()("PUBLIC_WT_URL"),audience:"urn:api-authz",secret:d()("EXTENSION_SECRET"),clientName:"Authorization Extension",onLoginSuccess:(e,t)=>{if(e)return e.scope=f.scopes.map((e=>e.value)),e;throw a().unauthorized("Invalid token","Token")}}};e.register(r)},name:"auth"}},e=>{e.exports=require("jwks-rsa@3.0.1")},e=>{e.exports=require("jsonwebtoken@9.0.1")},(e,t,r)=>{r.r(t),r.d(t,{createApi:()=>h,deleteApi:()=>f,getApi:()=>p,scopes:()=>m,updateApi:()=>d});var s=r(3),n=r.n(s),a=r(4),i=r(5),o=r.n(i);const l="urn:auth0-authz-api",c=[{value:"read:users"},{value:"read:applications"},{value:"read:connections"},{value:"read:configuration"},{value:"update:configuration"},{value:"read:groups"},{value:"create:groups"},{value:"update:groups"},{value:"delete:groups"},{value:"read:roles"},{value:"create:roles"},{value:"update:roles"},{value:"delete:roles"},{value:"read:permissions"},{value:"create:permissions"},{value:"update:permissions"},{value:"delete:permissions"},{value:"read:resource-server"},{value:"create:resource-server"},{value:"update:resource-server"},{value:"delete:resource-server"}],u=(e,t,r,s)=>new Promise(((i,l)=>(e=>e.auth&&e.auth.credentials&&e.auth.credentials.access_token&&e.auth.credentials.access_token.length?Promise.resolve(e.auth.credentials.access_token):a.managementApi.getAccessTokenCached(o()("AUTH0_DOMAIN"),o()("AUTH0_CLIENT_ID"),o()("AUTH0_CLIENT_SECRET")))(e).then((e=>{n()(r,`https://${o()("AUTH0_DOMAIN")}/api/v2/${t}`).send(s||{}).set("Content-Type","application/json").set("Authorization",`Bearer ${e}`).end(((e,t)=>e?l(e):i(t.body)))})))),p=e=>u(e,`resource-servers/${l}`,"GET").catch((()=>({}))),h=(e,t)=>u(e,"resource-servers","POST",{name:"auth0-authorization-extension-api",identifier:l,signing_alg:"RS256",scopes:c,token_lifetime:t}),d=(e,t)=>p(e).then((r=>r.id?u(e,`resource-servers/${r.id}`,"PATCH",{token_lifetime:t||86400}):h(e,t||86400))),f=(e,t)=>p(e).then((r=>r.id?u(e,`resource-servers/${r.id}`,"DELETE"):r.id||t?Promise.resolve():Promise.reject(new Error("Unable to disable resource-server. Is it enabled?")))),m=c},(e,t,r)=>{r.r(t),r.d(t,{plugin:()=>m});const{promisify:s}=r(88),n=r(2),a=r(19),i=r(87),o=r(141),l=r(4),c=r(140),{getBasePath:u,getBaseUrl:p}=r(8),h=r(5),d=function(e){return a.join.apply(null,e).replace(/\\/g,"/").replace("http:/","http://").replace("https:/","https://")},f=function(e,t){return Array.isArray(e)?-1===e.indexOf(t):e!==t},m={register:async function(e,t){if(!t||"object"!=typeof t)return new l.ArgumentError("Must provide the options");if(null===t.onLoginSuccess||void 0===t.onLoginSuccess)return new l.ArgumentError("Must provide a valid login callback");if(null===t.secret||void 0===t.secret)return new l.ArgumentError("Must provide a valid secret");if("string"!=typeof t.secret||0===t.secret.length)return new l.ArgumentError("The provided secret is invalid: "+t.secret);if(null===t.audience||void 0===t.audience)return new l.ArgumentError("Must provide a valid audience");if("string"!=typeof t.audience||0===t.audience.length)return new l.ArgumentError("The provided audience is invalid: "+t.audience);if(null===t.rta||void 0===t.rta)return new l.ArgumentError("Must provide a valid rta");if("string"!=typeof t.rta||0===t.rta.length)return new l.ArgumentError("The provided rta is invalid: "+t.rta);if(null===t.domain||void 0===t.domain)return new l.ArgumentError("Must provide a valid domain");if("string"!=typeof t.domain||0===t.domain.length)return new l.ArgumentError("The provided domain is invalid: "+t.domain);if(null===t.baseUrl||void 0===t.baseUrl)return new l.ArgumentError("Must provide a valid base URL");if("string"!=typeof t.baseUrl||0===t.baseUrl.length)return new l.ArgumentError("The provided base URL is invalid: "+t.baseUrl);if(null===t.clientName||void 0===t.clientName)return new l.ArgumentError("Must provide a valid client name");if("string"!=typeof t.clientName||0===t.clientName.length)return new l.ArgumentError("The provided client name is invalid: "+t.clientName);const r=t.stateKey||"state",a=t.nonceKey||"nonce",m=t.urlPrefix||"",g=t.sessionStorageKey||"apiToken",y=t.sessionManager||new l.SessionManager(t.rta,t.domain,t.baseUrl),b={isHttpOnly:!0};e.state(a,Object.assign({},b,{isSameSite:"None",isSecure:!0})),e.state(r,Object.assign({},b,{isSameSite:"None",isSecure:!0})),e.state(a+"_compat",b),e.state(r+"_compat",b),e.route({method:"GET",path:m+"/login",options:{auth:!1},handler:function(e,s){const n=i.randomBytes(16).toString("hex"),o=i.randomBytes(16).toString("hex"),l=y.createAuthorizeUrl({redirectUri:d([p(e),m,"/login/callback"]),scopes:t.scopes,expiration:t.expiration,nonce:o,state:n});return s.redirect(l).state(a,o,{path:u(e)}).state(r,n,{path:u(e)}).state(a+"_compat",o,{path:u(e)}).state(r+"_compat",n,{path:u(e)})}}),e.route({method:"POST",path:m+"/login/callback",options:{auth:!1},handler:async function(i,l){var m;const b=s(o.verify),v=i.payload.id_token;try{m=o.decode(v,{complete:!0});const e=c.hapiJwt2Key({cache:!0,rateLimit:!0,jwksRequestsPerMinute:2,jwksUri:`${h("AUTH0_RTA")}/.well-known/jwks.json`}),t=s(e),r=await t(m);if(!r)return n.unauthorized("Invalid token");const a={audience:h("PUBLIC_WT_URL"),issuer:`${h("AUTH0_RTA")}/`,algorithms:["RS256"]};await b(v,r,a)}catch(e){m=null}if(!m)return n.unauthorized("Invalid token");if(i.state&&i.state[a]&&f(i.state[a],m.payload.nonce)||i.state&&i.state[a+"_compat"]&&f(i.state[a+"_compat"],m.payload.nonce))return n.badRequest("Nonce mismatch");if(i.state&&i.state[r]&&f(i.state[r],i.payload.state)||i.state&&i.state[r+"_compat"]&&f(i.state[r+"_compat"],i.payload.state))return n.badRequest("State mismatch");let _;try{_=await y.create(i.payload.id_token,i.payload.access_token,{secret:t.secret,issuer:t.baseUrl,audience:t.audience})}catch(t){return e.log(["error"],"Login callback failed",t),n.boomify(t)}return l.response('<% } %> <% if (assets.app) { %><% } %> <% if (assets.version) { %> - - + + <% } %> `; From deb809deb62fd8a9e6809d2869696d0483ba2bd2 Mon Sep 17 00:00:00 2001 From: Tim Saunders Date: Fri, 9 Jan 2026 13:55:37 +0000 Subject: [PATCH 06/29] Add debug logging --- server/init.js | 17 +++++++---- .../storage/contexts/BlobRecordProvider.js | 27 +++++++++++++++++- .../storage/contexts/WebtaskStorageContext.js | 28 +++++++++++++++++++ server/lib/storage/database.js | 19 ++++++++++--- server/lib/storage/providers.js | 10 +++++++ 5 files changed, 91 insertions(+), 10 deletions(-) diff --git a/server/init.js b/server/init.js index 6faf030b..b4db92bd 100644 --- a/server/init.js +++ b/server/init.js @@ -35,11 +35,18 @@ export default (cfg, storageContext, cb) => { // Initialize the storage layer. - initDb( - new Database({ - provider: createProvider(storageContext) - }) - ); + console.log('[init] Initializing storage layer'); + console.log('[init] storageContext provided:', !!storageContext); + console.log('[init] storageContext type:', typeof storageContext); + + const provider = createProvider(storageContext); + console.log('[init] Provider created:', provider.constructor.name); + + const database = new Database({ provider }); + console.log('[init] Database created'); + + initDb(database); + console.log('[init] Database initialized in getdb'); // Start the server. return createServer(cb); diff --git a/server/lib/storage/contexts/BlobRecordProvider.js b/server/lib/storage/contexts/BlobRecordProvider.js index c68dc0bc..110f47f9 100644 --- a/server/lib/storage/contexts/BlobRecordProvider.js +++ b/server/lib/storage/contexts/BlobRecordProvider.js @@ -6,15 +6,23 @@ const NotFoundError = require('../../errors').NotFoundError; const ValidationError = require('../../errors').ValidationError; const getDataForCollection = function(storageContext, collectionName) { + console.log('[getDataForCollection] Reading data for collection:', collectionName); return storageContext.read() .then(function(data) { + console.log('[getDataForCollection] Data read successfully, keys:', Object.keys(data || {})); data[collectionName] = data[collectionName] || []; + console.log('[getDataForCollection] Collection', collectionName, 'has', data[collectionName].length, 'items'); return data; + }) + .catch(function(err) { + console.log('[getDataForCollection] Error reading data:', err.message || err); + throw err; }); }; // Simple promise retry implementation const promiseRetry = function(fn, options) { + console.log('[promiseRetry] Starting with options:', JSON.stringify(options)); let attempt = 0; const maxRetries = options.retries || 10; const factor = options.factor || 2; @@ -23,20 +31,26 @@ const promiseRetry = function(fn, options) { const retry = function(err) { attempt++; + console.log('[promiseRetry] Retry attempt', attempt, 'of', maxRetries); + console.log('[promiseRetry] Retry error:', err.message || err); if (attempt > maxRetries) { + console.log('[promiseRetry] Max retries exceeded, rejecting'); return Promise.reject(err); } // Calculate timeout with exponential backoff const timeout = Math.min(minTimeout * Math.pow(factor, attempt - 1), maxTimeout); + console.log('[promiseRetry] Waiting', timeout, 'ms before retry'); return new Promise(function(resolve) { setTimeout(resolve, timeout); }).then(function() { + console.log('[promiseRetry] Retrying function after timeout'); return fn(retry); }); }; + console.log('[promiseRetry] Executing function (attempt 0)'); return fn(retry); }; @@ -50,16 +64,27 @@ const withRetry = function(storageContext, action) { }; return function() { + console.log('[withRetry] Starting action with retry wrapper'); return promiseRetry(function(retry) { + console.log('[withRetry] Executing action'); return action() + .then(function(result) { + console.log('[withRetry] Action succeeded'); + return result; + }) .catch(function(err) { + console.log('[withRetry] Action failed:', err.message || err); const writeRetryCondition = storageContext.writeRetryCondition || function() { return false; }; - if (writeRetryCondition(err)) { + const shouldRetry = writeRetryCondition(err); + console.log('[withRetry] Should retry:', shouldRetry); + if (shouldRetry) { + console.log('[withRetry] Retrying due to write conflict'); return retry(err); } + console.log('[withRetry] Not retrying, throwing error'); throw err; }); }, retryOptions); diff --git a/server/lib/storage/contexts/WebtaskStorageContext.js b/server/lib/storage/contexts/WebtaskStorageContext.js index a39f27dd..68c7e288 100644 --- a/server/lib/storage/contexts/WebtaskStorageContext.js +++ b/server/lib/storage/contexts/WebtaskStorageContext.js @@ -26,14 +26,29 @@ function WebtaskStorageContext(storage, options) { */ WebtaskStorageContext.prototype.read = function() { const ctx = this; + console.log('[WebtaskStorageContext] read() called'); + console.log('[WebtaskStorageContext] storage object type:', typeof ctx.storage); + console.log('[WebtaskStorageContext] storage.get type:', typeof ctx.storage.get); + console.log('[WebtaskStorageContext] options:', JSON.stringify(ctx.options)); + return new Promise(function readWebtaskStorageContext(resolve, reject) { + console.log('[WebtaskStorageContext] Calling storage.get()...'); + ctx.storage.get(function(err, data) { + console.log('[WebtaskStorageContext] storage.get() callback invoked'); + console.log('[WebtaskStorageContext] err:', err); + console.log('[WebtaskStorageContext] data:', data ? 'present' : 'null/undefined'); + if (err) { + console.log('[WebtaskStorageContext] Rejecting with error:', err.message || err); return reject(err); } + console.log('[WebtaskStorageContext] Resolving with data'); return resolve(data || ctx.defaultData); }); + + console.log('[WebtaskStorageContext] storage.get() called, waiting for callback...'); }); }; @@ -44,14 +59,27 @@ WebtaskStorageContext.prototype.read = function() { */ WebtaskStorageContext.prototype.write = function(data) { const ctx = this; + console.log('[WebtaskStorageContext] write() called'); + console.log('[WebtaskStorageContext] data keys:', data ? Object.keys(data) : 'null/undefined'); + console.log('[WebtaskStorageContext] options:', JSON.stringify(ctx.options)); + return new Promise(function(resolve, reject) { + console.log('[WebtaskStorageContext] Calling storage.set()...'); + ctx.storage.set(data, ctx.options, function(err) { + console.log('[WebtaskStorageContext] storage.set() callback invoked'); + console.log('[WebtaskStorageContext] err:', err); + if (err) { + console.log('[WebtaskStorageContext] Rejecting with error:', err.message || err, 'code:', err.code); return reject(err); } + console.log('[WebtaskStorageContext] Resolving write'); return resolve(); }); + + console.log('[WebtaskStorageContext] storage.set() called, waiting for callback...'); }); }; diff --git a/server/lib/storage/database.js b/server/lib/storage/database.js index 316d1471..cc72dd4a 100644 --- a/server/lib/storage/database.js +++ b/server/lib/storage/database.js @@ -31,13 +31,24 @@ export default class Database { } getStatus() { + console.log('[Database] getStatus() called'); + console.log('[Database] STORAGE_TYPE:', config('STORAGE_TYPE')); + if (!config('STORAGE_TYPE') || config('STORAGE_TYPE') === 'webtask') { - return this.provider.storageContext.read().then((data) => ({ - size: Buffer.byteLength(JSON.stringify(data), 'utf8'), - type: 'default' - })); + console.log('[Database] Reading from storageContext...'); + return this.provider.storageContext.read().then((data) => { + console.log('[Database] Read completed, calculating size'); + return { + size: Buffer.byteLength(JSON.stringify(data), 'utf8'), + type: 'default' + }; + }).catch((err) => { + console.log('[Database] Read failed:', err.message || err); + throw err; + }); } + console.log('[Database] Non-webtask storage, returning null size'); return Promise.resolve({ size: null, type: config('STORAGE_TYPE') }); } diff --git a/server/lib/storage/providers.js b/server/lib/storage/providers.js index ab3ca46c..0278a516 100644 --- a/server/lib/storage/providers.js +++ b/server/lib/storage/providers.js @@ -24,10 +24,20 @@ function createProvider(storageContext) { case 'webtask': default: { logger.info('Initializing the Webtask Storage Context.'); + console.log('[providers] storageContext provided:', !!storageContext); + console.log('[providers] storageContext type:', typeof storageContext); + + if (storageContext) { + console.log('[providers] storageContext.get type:', typeof storageContext.get); + console.log('[providers] storageContext.set type:', typeof storageContext.set); + console.log('[providers] storageContext keys:', Object.keys(storageContext)); + } const context = storageContext ? new WebtaskStorageContext(storageContext, { force: 0 }) : new FileStorageContext(path.join(__dirname, '../../data.json'), { mergeWrites: true }); + + console.log('[providers] Created context type:', context.constructor.name); return new BlobRecordProvider(context, { concurrentWrites: false }); } } From cb6a800a68f6b8a2e7f4b23e43fd408b35096ace Mon Sep 17 00:00:00 2001 From: Tim Saunders Date: Fri, 9 Jan 2026 14:09:09 +0000 Subject: [PATCH 07/29] fix logging --- server/init.js | 12 +++--- .../storage/contexts/BlobRecordProvider.js | 37 +++++++++-------- .../storage/contexts/WebtaskStorageContext.js | 41 ++++++++++--------- server/lib/storage/database.js | 13 +++--- server/lib/storage/providers.js | 12 +++--- 5 files changed, 59 insertions(+), 56 deletions(-) diff --git a/server/init.js b/server/init.js index b4db92bd..6a17bc6c 100644 --- a/server/init.js +++ b/server/init.js @@ -35,18 +35,18 @@ export default (cfg, storageContext, cb) => { // Initialize the storage layer. - console.log('[init] Initializing storage layer'); - console.log('[init] storageContext provided:', !!storageContext); - console.log('[init] storageContext type:', typeof storageContext); + logger.info('[init] Initializing storage layer'); + logger.info('[init] storageContext provided:', !!storageContext); + logger.info('[init] storageContext type:', typeof storageContext); const provider = createProvider(storageContext); - console.log('[init] Provider created:', provider.constructor.name); + logger.info('[init] Provider created:', provider.constructor.name); const database = new Database({ provider }); - console.log('[init] Database created'); + logger.info('[init] Database created'); initDb(database); - console.log('[init] Database initialized in getdb'); + logger.info('[init] Database initialized in getdb'); // Start the server. return createServer(cb); diff --git a/server/lib/storage/contexts/BlobRecordProvider.js b/server/lib/storage/contexts/BlobRecordProvider.js index 110f47f9..fcefb65c 100644 --- a/server/lib/storage/contexts/BlobRecordProvider.js +++ b/server/lib/storage/contexts/BlobRecordProvider.js @@ -4,25 +4,26 @@ const seriesQueue = require('./seriesQueue'); const ArgumentError = require('../../errors').ArgumentError; const NotFoundError = require('../../errors').NotFoundError; const ValidationError = require('../../errors').ValidationError; +const logger = require('../../logger'); const getDataForCollection = function(storageContext, collectionName) { - console.log('[getDataForCollection] Reading data for collection:', collectionName); + logger.info('[getDataForCollection] Reading data for collection:', collectionName); return storageContext.read() .then(function(data) { - console.log('[getDataForCollection] Data read successfully, keys:', Object.keys(data || {})); + logger.info('[getDataForCollection] Data read successfully, keys:', Object.keys(data || {})); data[collectionName] = data[collectionName] || []; - console.log('[getDataForCollection] Collection', collectionName, 'has', data[collectionName].length, 'items'); + logger.info('[getDataForCollection] Collection', collectionName, 'has', data[collectionName].length, 'items'); return data; }) .catch(function(err) { - console.log('[getDataForCollection] Error reading data:', err.message || err); + logger.info('[getDataForCollection] Error reading data:', err.message || err); throw err; }); }; // Simple promise retry implementation const promiseRetry = function(fn, options) { - console.log('[promiseRetry] Starting with options:', JSON.stringify(options)); + logger.info('[promiseRetry] Starting with options:', JSON.stringify(options)); let attempt = 0; const maxRetries = options.retries || 10; const factor = options.factor || 2; @@ -31,26 +32,26 @@ const promiseRetry = function(fn, options) { const retry = function(err) { attempt++; - console.log('[promiseRetry] Retry attempt', attempt, 'of', maxRetries); - console.log('[promiseRetry] Retry error:', err.message || err); + logger.info('[promiseRetry] Retry attempt', attempt, 'of', maxRetries); + logger.info('[promiseRetry] Retry error:', err.message || err); if (attempt > maxRetries) { - console.log('[promiseRetry] Max retries exceeded, rejecting'); + logger.info('[promiseRetry] Max retries exceeded, rejecting'); return Promise.reject(err); } // Calculate timeout with exponential backoff const timeout = Math.min(minTimeout * Math.pow(factor, attempt - 1), maxTimeout); - console.log('[promiseRetry] Waiting', timeout, 'ms before retry'); + logger.info('[promiseRetry] Waiting', timeout, 'ms before retry'); return new Promise(function(resolve) { setTimeout(resolve, timeout); }).then(function() { - console.log('[promiseRetry] Retrying function after timeout'); + logger.info('[promiseRetry] Retrying function after timeout'); return fn(retry); }); }; - console.log('[promiseRetry] Executing function (attempt 0)'); + logger.info('[promiseRetry] Executing function (attempt 0)'); return fn(retry); }; @@ -64,27 +65,27 @@ const withRetry = function(storageContext, action) { }; return function() { - console.log('[withRetry] Starting action with retry wrapper'); + logger.info('[withRetry] Starting action with retry wrapper'); return promiseRetry(function(retry) { - console.log('[withRetry] Executing action'); + logger.info('[withRetry] Executing action'); return action() .then(function(result) { - console.log('[withRetry] Action succeeded'); + logger.info('[withRetry] Action succeeded'); return result; }) .catch(function(err) { - console.log('[withRetry] Action failed:', err.message || err); + logger.info('[withRetry] Action failed:', err.message || err); const writeRetryCondition = storageContext.writeRetryCondition || function() { return false; }; const shouldRetry = writeRetryCondition(err); - console.log('[withRetry] Should retry:', shouldRetry); + logger.info('[withRetry] Should retry:', shouldRetry); if (shouldRetry) { - console.log('[withRetry] Retrying due to write conflict'); + logger.info('[withRetry] Retrying due to write conflict'); return retry(err); } - console.log('[withRetry] Not retrying, throwing error'); + logger.info('[withRetry] Not retrying, throwing error'); throw err; }); }, retryOptions); diff --git a/server/lib/storage/contexts/WebtaskStorageContext.js b/server/lib/storage/contexts/WebtaskStorageContext.js index 68c7e288..1dabbaab 100644 --- a/server/lib/storage/contexts/WebtaskStorageContext.js +++ b/server/lib/storage/contexts/WebtaskStorageContext.js @@ -1,4 +1,5 @@ const ArgumentError = require('../../errors').ArgumentError; +const logger = require('../../logger'); /** * Create a new WebtaskStorageContext. @@ -26,29 +27,29 @@ function WebtaskStorageContext(storage, options) { */ WebtaskStorageContext.prototype.read = function() { const ctx = this; - console.log('[WebtaskStorageContext] read() called'); - console.log('[WebtaskStorageContext] storage object type:', typeof ctx.storage); - console.log('[WebtaskStorageContext] storage.get type:', typeof ctx.storage.get); - console.log('[WebtaskStorageContext] options:', JSON.stringify(ctx.options)); + logger.info('[WebtaskStorageContext] read() called'); + logger.info('[WebtaskStorageContext] storage object type:', typeof ctx.storage); + logger.info('[WebtaskStorageContext] storage.get type:', typeof ctx.storage.get); + logger.info('[WebtaskStorageContext] options:', JSON.stringify(ctx.options)); return new Promise(function readWebtaskStorageContext(resolve, reject) { - console.log('[WebtaskStorageContext] Calling storage.get()...'); + logger.info('[WebtaskStorageContext] Calling storage.get()...'); ctx.storage.get(function(err, data) { - console.log('[WebtaskStorageContext] storage.get() callback invoked'); - console.log('[WebtaskStorageContext] err:', err); - console.log('[WebtaskStorageContext] data:', data ? 'present' : 'null/undefined'); + logger.info('[WebtaskStorageContext] storage.get() callback invoked'); + logger.info('[WebtaskStorageContext] err:', err); + logger.info('[WebtaskStorageContext] data:', data ? 'present' : 'null/undefined'); if (err) { - console.log('[WebtaskStorageContext] Rejecting with error:', err.message || err); + logger.info('[WebtaskStorageContext] Rejecting with error:', err.message || err); return reject(err); } - console.log('[WebtaskStorageContext] Resolving with data'); + logger.info('[WebtaskStorageContext] Resolving with data'); return resolve(data || ctx.defaultData); }); - console.log('[WebtaskStorageContext] storage.get() called, waiting for callback...'); + logger.info('[WebtaskStorageContext] storage.get() called, waiting for callback...'); }); }; @@ -59,27 +60,27 @@ WebtaskStorageContext.prototype.read = function() { */ WebtaskStorageContext.prototype.write = function(data) { const ctx = this; - console.log('[WebtaskStorageContext] write() called'); - console.log('[WebtaskStorageContext] data keys:', data ? Object.keys(data) : 'null/undefined'); - console.log('[WebtaskStorageContext] options:', JSON.stringify(ctx.options)); + logger.info('[WebtaskStorageContext] write() called'); + logger.info('[WebtaskStorageContext] data keys:', data ? Object.keys(data) : 'null/undefined'); + logger.info('[WebtaskStorageContext] options:', JSON.stringify(ctx.options)); return new Promise(function(resolve, reject) { - console.log('[WebtaskStorageContext] Calling storage.set()...'); + logger.info('[WebtaskStorageContext] Calling storage.set()...'); ctx.storage.set(data, ctx.options, function(err) { - console.log('[WebtaskStorageContext] storage.set() callback invoked'); - console.log('[WebtaskStorageContext] err:', err); + logger.info('[WebtaskStorageContext] storage.set() callback invoked'); + logger.info('[WebtaskStorageContext] err:', err); if (err) { - console.log('[WebtaskStorageContext] Rejecting with error:', err.message || err, 'code:', err.code); + logger.info('[WebtaskStorageContext] Rejecting with error:', err.message || err, 'code:', err.code); return reject(err); } - console.log('[WebtaskStorageContext] Resolving write'); + logger.info('[WebtaskStorageContext] Resolving write'); return resolve(); }); - console.log('[WebtaskStorageContext] storage.set() called, waiting for callback...'); + logger.info('[WebtaskStorageContext] storage.set() called, waiting for callback...'); }); }; diff --git a/server/lib/storage/database.js b/server/lib/storage/database.js index cc72dd4a..a620852d 100644 --- a/server/lib/storage/database.js +++ b/server/lib/storage/database.js @@ -1,6 +1,7 @@ import _ from 'lodash'; import { ArgumentError, ValidationError } from '../errors/index.js'; import config from '../config'; +import logger from '../logger'; const checkUnique = ( items = [], @@ -31,24 +32,24 @@ export default class Database { } getStatus() { - console.log('[Database] getStatus() called'); - console.log('[Database] STORAGE_TYPE:', config('STORAGE_TYPE')); + logger.info('[Database] getStatus() called'); + logger.info('[Database] STORAGE_TYPE:', config('STORAGE_TYPE')); if (!config('STORAGE_TYPE') || config('STORAGE_TYPE') === 'webtask') { - console.log('[Database] Reading from storageContext...'); + logger.info('[Database] Reading from storageContext...'); return this.provider.storageContext.read().then((data) => { - console.log('[Database] Read completed, calculating size'); + logger.info('[Database] Read completed, calculating size'); return { size: Buffer.byteLength(JSON.stringify(data), 'utf8'), type: 'default' }; }).catch((err) => { - console.log('[Database] Read failed:', err.message || err); + logger.info('[Database] Read failed:', err.message || err); throw err; }); } - console.log('[Database] Non-webtask storage, returning null size'); + logger.info('[Database] Non-webtask storage, returning null size'); return Promise.resolve({ size: null, type: config('STORAGE_TYPE') }); } diff --git a/server/lib/storage/providers.js b/server/lib/storage/providers.js index 0278a516..878a0fda 100644 --- a/server/lib/storage/providers.js +++ b/server/lib/storage/providers.js @@ -24,20 +24,20 @@ function createProvider(storageContext) { case 'webtask': default: { logger.info('Initializing the Webtask Storage Context.'); - console.log('[providers] storageContext provided:', !!storageContext); - console.log('[providers] storageContext type:', typeof storageContext); + logger.info('[providers] storageContext provided:', !!storageContext); + logger.info('[providers] storageContext type:', typeof storageContext); if (storageContext) { - console.log('[providers] storageContext.get type:', typeof storageContext.get); - console.log('[providers] storageContext.set type:', typeof storageContext.set); - console.log('[providers] storageContext keys:', Object.keys(storageContext)); + logger.info('[providers] storageContext.get type:', typeof storageContext.get); + logger.info('[providers] storageContext.set type:', typeof storageContext.set); + logger.info('[providers] storageContext keys:', Object.keys(storageContext)); } const context = storageContext ? new WebtaskStorageContext(storageContext, { force: 0 }) : new FileStorageContext(path.join(__dirname, '../../data.json'), { mergeWrites: true }); - console.log('[providers] Created context type:', context.constructor.name); + logger.info('[providers] Created context type:', context.constructor.name); return new BlobRecordProvider(context, { concurrentWrites: false }); } } From b8f25ca3a29a98bdcdd6124bd6f90c3a4a61cec0 Mon Sep 17 00:00:00 2001 From: Tim Saunders Date: Fri, 9 Jan 2026 14:10:12 +0000 Subject: [PATCH 08/29] Update build --- dist/auth0-authz.extension.2.13.3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/auth0-authz.extension.2.13.3.js b/dist/auth0-authz.extension.2.13.3.js index 70d896c4..58cf47c2 100644 --- a/dist/auth0-authz.extension.2.13.3.js +++ b/dist/auth0-authz.extension.2.13.3.js @@ -1,2 +1,2 @@ /*! For license information please see auth0-authz.extension.2.13.3.js.LICENSE.txt */ -"use strict";var __webpack_modules__=[(e,t,r)=>{const n=r(1),s=r(4),i=r(5),{getWebtaskUrl:a}=r(7),o=(e,t)=>{i.info("Starting Authorization Extension - Version:","2.13.3"),i.info(" > WT_URL:",e("WT_URL")),i.info(" > PUBLIC_WT_URL:",e("PUBLIC_WT_URL"));return(0,r(9).default)(e,t)};e.exports=(e,t,r)=>{((e,t,r)=>{setImmediate((()=>{t.x_wt&&t.x_wt.ectx&&t.x_wt.ectx.PUBLIC_WT_URL||s.setValue("PUBLIC_WT_URL",a(t)),n.createServer(o)(e,t,r)}))})(e,t,r)}},(e,t,r)=>{const n=r(2),s=r(3);e.exports.createServer=function(e){return t=function(e){return function(t){return e((function(e){return t&&t.secrets?t.secrets[e]:null}),t&&t.storage?t.storage:null)}}(e),async function(e,u,d){if(l=function(e){return e.read=e.secrets.EXT_STORAGE_URL?r:t,e.write=e.secrets.EXT_STORAGE_URL?a:i,e;function t(e,t,r){"function"==typeof t&&(r=t,t={}),r(n.preconditionFailed("Storage is not available in this context"))}function r(t,r,i){"function"==typeof r&&(i=r,r={}),s.get(e.secrets.EXT_STORAGE_URL).set(r.headers||{}).query({path:t}).then((e=>404===e.statusCode&&Object.hasOwnProperty.call(r,"defaultValue")?i(null,r.defaultValue):e.statusCode>=400?i(n.create(e.statusCode,e.body&&e.body.message)):i(null,e.body))).catch((e=>i(n.boomify(e,502))))}function i(e,t,r,s){"function"==typeof r&&(s=r,r={}),s(n.preconditionFailed("Storage is not available in this context"))}function a(t,r,i,a){"function"==typeof i&&(a=i,i={}),s.put(e.secrets.EXT_STORAGE_URL).set(i.headers||{}).query({path:t}).send(r).then((e=>e.statusCode>=400?a(n.create(e.statusCode,e.body&&e.body.message)):a(null))).catch((e=>a(n.boomify(e,502))))}}(e),null==r){if(!(r=await t(l)))throw new Error("Server factory did not return a server instance");r.ext("onRequest",(function(e,t){const r=function(e){if(!e.container)return null;const t=e.container.replace(i,"\\$&"),r=e.jtn?e.jtn.replace(i,"\\$&"):"";if(e.url_format===c)return new RegExp("^/api/run/"+t+"/(?:"+r+"/?)?");if(e.url_format===o)return new RegExp("^/"+t+"/(?:"+r+"/?)?");if(e.url_format===a)return new RegExp("^/(?:"+r+"/?)?");throw new Error("Unsupported webtask URL format.")}(e.raw.req.x_wt);return r&&(e.originalUrl=e.path,e.setUrl(`${e.path}${e.url.search}`.replace(r,"/"))),e.headers["x-forwarded-proto"]&&(e.headers["x-forwarded-proto"]=e.headers["x-forwarded-proto"].split(",").shift()),e.webtaskContext=l,t.continue}))}r.listener.emit("request",u,d)};var t,r,l};const i=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;const a=3,o=2,c=1},e=>{e.exports=require("@hapi/boom@10.0.1")},e=>{e.exports=require("superagent@10.2.3")},e=>{e.exports=function(){const e={};let t=null;const r=function(r){if(e&&e[r])return e[r];if(!t)throw new Error("A configuration provider has not been set");return t(r)};return r.setProvider=function(e){t=e},r.setValue=function(t,r){e[t]=r},r}()},(e,t,r)=>{const n=r(6),s=new n.createLogger({format:n.format.json(),transports:[new n.transports.Console({level:"debug",json:!1})],exitOnError:!1});e.exports=s},e=>{e.exports=require("winston@3.10.0")},(e,t,r)=>{const n=r(8);e.exports.getBasePath=function(e){return t=e.originalUrl||"",r=e.path,(s=(s=n.parse(t).pathname||"").replace(r,"").replace(/^\/|\/$/g,"")).startsWith("/")||(s="/"+s),s.endsWith("/")||(s+="/"),s;var t,r,s},e.exports.getBaseUrl=function(e,t){const r=n.parse(e.originalUrl||"").pathname||"";return n.format({protocol:t||"https",host:e.headers.host,pathname:r.replace(e.path,"").replace(/\/$/g,"")})};const s=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports.getWebtaskUrl=function(e){const t=function(e){if(!e.container)return null;const t=e.container.replace(s,"\\$&"),r=e.jtn?e.jtn.replace(s,"\\$&"):"";if(1===e.url_format)return new RegExp("^/api/run/"+t+"/(?:"+r+"/?)?");if(2===e.url_format)return new RegExp("^/"+t+"/(?:"+r+"/?)?");if(3===e.url_format)return new RegExp("^/(?:"+r+"/?)?");throw new Error("Unsupported webtask URL format.")}(e.x_wt),r=e.url,i=e.url.replace(t,"/"),a=n.parse(i||"").pathname,o=n.parse(r||"").pathname||"";var c=n.format({protocol:"https",host:e.headers.host,pathname:o.replace(a,"").replace(/\/$/g,"")});if(e.x_wt){const t=".it.auth0.com/api/run/"+e.x_wt.container+"/",r=function(e,t){if(!e)return null;const r=e.indexOf("sandbox8")>=0?"8":"";return"https://"+t+"."+(e.split(".it.auth0.com")[0].split("-")[1]||"us")+r+".webtask.io/"}(c,e.x_wt.container);c.indexOf(t)>=0&&(c=c.replace("https://"+e.headers.host+"/api/run/"+e.x_wt.container+"/",r))}return c}},e=>{e.exports=require("url")},(e,t,r)=>{r.r(t),r.d(t,{default:()=>p});var n=r(10),s=r(4),i=r.n(s),a=r(11),o=r(24),c=r(25),l=r(35),u=r(5),d=r.n(u);const p=(e,t,r)=>{null==r&&(r=e=>{if(e){d().error("Hapi initialization failed.");const{stack:t,details:r,message:n}=e;d().error({stack:t,details:r,message:n}),d().error(e)}else d().info("Hapi initialization completed.")}),i().setProvider((t=>e(t)||{WARN_DB_SIZE:409600,MAX_MULTISELECT_USERS:5,MULTISELECT_DEBOUNCE_MS:250,PER_PAGE:10,NODE_ENV:"production",CLIENT_VERSION:"2.13.3"}[t]));const s=i()("PUBLIC_WT_URL"),u="auth0c.com"===new n.URL(s).hostname.split(".").slice(-2).join(".");return i().setValue("IS_LAYER0_TEST_SPACE",u),(0,o.init)(new a.default({provider:(0,c.createProvider)(t)})),(0,l.default)(r)}},e=>{e.exports=require("node:url")},(e,t,r)=>{r.r(t),r.d(t,{default:()=>u});var n=r(12),s=r.n(n),i=r(13),a=r(4),o=r.n(a),c=r(21).Buffer;const l=(e=[],t="Record with that identifier is already exists.",r)=>0===e.length||r&&1===e.length&&e[0]._id===r?null:Promise.reject(new i.ValidationError(t));class u{constructor(e={}){if(!e.provider)throw new i.ArgumentError("The 'provider' has to be set when initializing the database.");this.provider=e.provider}getStatus(){return o()("STORAGE_TYPE")&&"webtask"!==o()("STORAGE_TYPE")?Promise.resolve({size:null,type:o()("STORAGE_TYPE")}):this.provider.storageContext.read().then((e=>({size:c.byteLength(JSON.stringify(e),"utf8"),type:"default"})))}canChange(e,t,r){return this.provider.getAll(e).then((e=>s().filter(e,(e=>e[t]&&s().includes(e[t],r))))).then((r=>{if(r.length){const n=r.map((e=>e.name)).join(", "),s=`Unable to touch ${t} while used in ${e}: ${n}`;return Promise.reject(new i.ValidationError(s))}return Promise.resolve()}))}getApiKey(){return this.provider.getAll("configuration").then((e=>e.length?e[0].apikey:null))}updateApiKey(e){return this.provider.getAll("configuration").then((e=>e.length?e[0]:{})).then((t=>this.provider.update("configuration","v1",{...t,apikey:e},!0)))}getConfiguration(){return this.provider.getAll("configuration").then((e=>e.length?e[0]:null))}updateConfiguration(e){return this.provider.update("configuration","v1",e,!0)}getRules(){return this.provider.getAll("rules")}createRule(e){return this.provider.create("rules",e)}getPermissions(){return this.provider.getAll("permissions")}getPermission(e){return this.provider.get("permissions",e)}createPermission(e){return this.getPermissions().then((t=>l(t.filter((t=>t.name.toLowerCase()===e.name.toLowerCase()&&t.applicationId===e.applicationId)),`Permission with name "${e.name}" already exists for this application`))).then((()=>this.provider.create("permissions",e)))}updatePermission(e,t){return this.getPermissions().then((r=>l(r.filter((e=>e.name.toLowerCase()===t.name.toLowerCase()&&e.applicationId===t.applicationId)),`Permission with name "${t.name}" already exists for this application`,e))).then((()=>this.canChange("roles","permissions",e))).then((()=>this.canChange("groups","permissions",e))).then((()=>this.provider.update("permissions",e,t)))}deletePermission(e){return this.canChange("roles","permissions",e).then((()=>this.provider.delete("permissions",e)))}getRoles(){return this.provider.getAll("roles")}getRole(e){return this.provider.get("roles",e)}createRole(e){return this.getRoles().then((t=>l(t.filter((t=>t.name.toLowerCase()===e.name.toLowerCase()&&t.applicationId===e.applicationId)),`Role with name "${e.name}" already exists for this application`))).then((()=>this.provider.create("roles",e)))}updateRole(e,t){return this.getRoles().then((r=>l(r.filter((e=>e.name.toLowerCase()===t.name.toLowerCase()&&e.applicationId===t.applicationId)),`Role with name "${t.name}" already exists for this application`,e))).then((()=>this.provider.update("roles",e,t)))}deleteRole(e){return this.canChange("groups","roles",e).then((()=>this.provider.delete("roles",e)))}getGroups(){return this.provider.getAll("groups")}getGroup(e){return this.provider.get("groups",e)}createGroup(e){return this.getGroups().then((t=>l(t.filter((t=>t.name.toLowerCase()===e.name.toLowerCase())),`Group with name "${e.name}" already exists`))).then((()=>this.provider.create("groups",e)))}updateGroup(e,t){return this.getGroups().then((r=>l(r.filter((e=>e.name.toLowerCase()===t.name.toLowerCase())),`Group with name "${t.name}" already exists`,e))).then((()=>this.provider.update("groups",e,t)))}deleteGroup(e){return this.canChange("groups","nested",e).then((()=>this.provider.delete("groups",e)))}getApplications(){return this.provider.getAll("applications")}getApplication(e){return this.provider.get("applications",e)}updateApplication(e,t){return this.provider.update("applications",e,t,!0)}}},e=>{e.exports=require("lodash@4.17.21")},(e,t,r)=>{const n=r(14),s=r(15),i=r(16),a=r(17),o=r(18),c=r(19),l=r(20);e.exports={ArgumentError:n,ValidationError:s,HookTokenError:i,NotFoundError:a,ManagementApiError:o,UnauthorizedError:c,ForbiddenError:l},e.exports.ArgumentError=n,e.exports.ValidationError=s,e.exports.HookTokenError=i,e.exports.NotFoundError=a,e.exports.ManagementApiError=o,e.exports.UnauthorizedError=c,e.exports.ForbiddenError=l},e=>{class t extends Error{constructor(e){super(e),this.name="ArgumentError",this.status=400,this.statusCode=400,Error.captureStackTrace(this,this.constructor)}}e.exports=t},e=>{class t extends Error{constructor(e){super(e),this.name="ValidationError",this.status=400,this.statusCode=400,Error.captureStackTrace(this,this.constructor)}}e.exports=t},e=>{class t extends Error{constructor(e,t){super(e),this.name="HookTokenError",this.status=401,this.statusCode=401,this.innerError=t,Error.captureStackTrace(this,this.constructor)}}e.exports=t},e=>{class t extends Error{constructor(e){super(e),this.name="NotFoundError",this.status=404,this.statusCode=404,Error.captureStackTrace(this,this.constructor)}}e.exports=t},e=>{class t extends Error{constructor(e,t,r){super(t),this.name="ManagementApiError",this.code=e,this.status=r||500,this.statusCode=r||500,Error.captureStackTrace(this,this.constructor)}}e.exports=t},e=>{class t extends Error{constructor(e){super(e),this.name="UnauthorizedError",this.status=401,this.statusCode=401,Error.captureStackTrace(this,this.constructor)}}e.exports=t},e=>{class t extends Error{constructor(e){super(e),this.name="ForbiddenError",this.status=403,this.statusCode=403,Error.captureStackTrace(this,this.constructor)}}e.exports=t},(e,t,r)=>{var n=r(22),s=r(23),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50;var a=2147483647;function o(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|m(e,t),n=o(r),s=n.write(e,t);s!==r&&(n=n.slice(0,s));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(B(e,Uint8Array)){var t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(B(e,ArrayBuffer)||e&&B(e.buffer,ArrayBuffer))return h(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(B(e,SharedArrayBuffer)||e&&B(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);var s=function(e){if(c.isBuffer(e)){var t=0|f(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||J(e.length)?o(0):p(e);if("Buffer"===e.type&&Array.isArray(e.data))return p(e.data)}(e);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return u(e),o(e<0?0:0|f(e))}function p(e){for(var t=e.length<0?0:0|f(e.length),r=o(t),n=0;n=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function m(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||B(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var s=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return D(e).length;default:if(s)return n?-1:U(e).length;t=(""+t).toLowerCase(),s=!0}}function g(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,r);case"utf8":case"utf-8":return O(this,t,r);case"ascii":return T(this,t,r);case"latin1":case"binary":return C(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function _(e,t,r,n,s){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=s?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(s)return-1;r=e.length-1}else if(r<0){if(!s)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,s);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,s){var i,a=1,o=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,o/=2,c/=2,r/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(s){var u=-1;for(i=r;io&&(r=o-c),i=r;i>=0;i--){for(var d=!0,p=0;ps&&(n=s):n=s;var i=t.length;n>i/2&&(n=i/2);for(var a=0;a>8,s=r%256,i.push(s),i.push(n);return i}(t,e.length-r),e,r,n)}function A(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function O(e,t,r){r=Math.min(e.length,r);for(var n=[],s=t;s239?4:l>223?3:l>191?2:1;if(s+d<=r)switch(d){case 1:l<128&&(u=l);break;case 2:128==(192&(i=e[s+1]))&&(c=(31&l)<<6|63&i)>127&&(u=c);break;case 3:i=e[s+1],a=e[s+2],128==(192&i)&&128==(192&a)&&(c=(15&l)<<12|(63&i)<<6|63&a)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:i=e[s+1],a=e[s+2],o=e[s+3],128==(192&i)&&128==(192&a)&&128==(192&o)&&(c=(15&l)<<18|(63&i)<<12|(63&a)<<6|63&o)>65535&&c<1114112&&(u=c)}null===u?(u=65533,d=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),s+=d}return function(e){var t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nn.length?c.from(i).copy(n,s):Uint8Array.prototype.set.call(n,i,s);else{if(!c.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,s)}s+=i.length}return n},c.byteLength=m,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,s){if(B(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),t<0||r>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=r)return 0;if(n>=s)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(s>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),o=Math.min(i,a),l=this.slice(n,s),u=e.slice(t,r),d=0;d>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var s=this.length-t;if((void 0===r||r>s)&&(r=s),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return E(this,e,t,r);case"base64":return R(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var P=4096;function T(e,t,r){var n="";r=Math.min(e.length,r);for(var s=t;sn)&&(r=n);for(var s="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function j(e,t,r,n,s,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||te.length)throw new RangeError("Index out of range")}function N(e,t,r,n,s,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function $(e,t,r,n,i){return t=+t,r>>>=0,i||N(e,0,r,4),s.write(e,t,r,n,23,4),r+4}function M(e,t,r,n,i){return t=+t,r>>>=0,i||N(e,0,r,8),s.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e],s=1,i=0;++i>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e+--t],s=1;t>0&&(s*=256);)n+=this[e+--t]*s;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e],s=1,i=0;++i=(s*=128)&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||x(e,t,this.length);for(var n=t,s=1,i=this[e+--n];n>0&&(s*=256);)i+=this[e+--n]*s;return i>=(s*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||x(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||x(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return e>>>=0,t||x(e,4,this.length),s.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||x(e,4,this.length),s.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||x(e,8,this.length),s.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||x(e,8,this.length),s.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||j(this,e,t,r,Math.pow(2,8*r)-1,0);var s=1,i=0;for(this[t]=255&e;++i>>=0,r>>>=0,n)||j(this,e,t,r,Math.pow(2,8*r)-1,0);var s=r-1,i=1;for(this[t+s]=255&e;--s>=0&&(i*=256);)this[t+s]=e/i&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var s=Math.pow(2,8*r-1);j(this,e,t,r,s-1,-s)}var i=0,a=1,o=0;for(this[t]=255&e;++i>0)-o&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var s=Math.pow(2,8*r-1);j(this,e,t,r,s-1,-s)}var i=r-1,a=1,o=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeFloatLE=function(e,t,r){return $(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return $(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return M(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return M(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&r<57344){if(!s){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}s=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),s=r;continue}r=65536+(s-55296<<10|r-56320)}else s&&(t-=3)>-1&&i.push(239,191,189);if(s=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function D(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function L(e,t,r,n){for(var s=0;s=t.length||s>=e.length);++s)t[s+r]=e[s];return s}function B(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}var G=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,s=0;s<16;++s)t[n+s]=e[r]+e[s];return t}()},(e,t)=>{t.byteLength=function(e){var t=o(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,i=o(e),a=i[0],c=i[1],l=new s(function(e,t,r){return 3*(t+r)/4-r}(0,a,c)),u=0,d=c>0?a-4:a;for(r=0;r>16&255,l[u++]=t>>8&255,l[u++]=255&t;2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,l[u++]=255&t);1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t);return l},t.fromByteArray=function(e){for(var t,n=e.length,s=n%3,i=[],a=16383,o=0,l=n-s;ol?l:o+a));1===s?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===s&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};for(var r=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=i[a],n[i.charCodeAt(a)]=a;function o(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,n){for(var s,i,a=[],o=t;o>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},(e,t)=>{t.read=function(e,t,r,n,s){var i,a,o=8*s-n-1,c=(1<>1,u=-7,d=r?s-1:0,p=r?-1:1,h=e[t+d];for(d+=p,i=h&(1<<-u)-1,h>>=-u,u+=o;u>0;i=256*i+e[t+d],d+=p,u-=8);for(a=i&(1<<-u)-1,i>>=-u,u+=n;u>0;a=256*a+e[t+d],d+=p,u-=8);if(0===i)i=1-l;else{if(i===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),i-=l}return(h?-1:1)*a*Math.pow(2,i-n)},t.write=function(e,t,r,n,s,i){var a,o,c,l=8*i-s-1,u=(1<>1,p=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,f=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?p/c:p*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=u?(o=0,a=u):a+d>=1?(o=(t*c-1)*Math.pow(2,s),a+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,s),a=0));s>=8;e[r+h]=255&o,h+=f,o/=256,s-=8);for(a=a<0;e[r+h]=255&a,h+=f,a/=256,l-=8);e[r+h-f]|=128*m}},e=>{let t=null;e.exports.init=e=>{t=e},e.exports.getDb=()=>{if(!t)throw new Error("The database has not been initialized.");return t}},(e,t,r)=>{const n=r(26),s=r(27),i=r(29),a=r(30),{S3StorageContext:o}=r(33),c=r(4),l=r(5);e.exports={createProvider:function(e){if("s3"===c("STORAGE_TYPE")){l.info("Initializing the S3 Storage Context.");const e=new o({path:c("S3_PATH"),bucket:c("S3_BUCKET"),keyId:c("S3_KEY"),keySecret:c("S3_SECRET"),defaultData:{}});return new a(e,{concurrentWrites:!1})}{l.info("Initializing the Webtask Storage Context.");const t=e?new i(e,{force:0}):new s(n.join(__dirname,"../../data.json"),{mergeWrites:!0});return new a(t,{concurrentWrites:!1})}}}},e=>{e.exports=require("path")},(e,t,r)=>{const n=r(28),s=r(13).ArgumentError;function i(e,t){if(null==e)throw new s("Must provide the path to the file");if("string"!=typeof e||0===e.length)throw new s("The provided path is invalid: "+e);t=t||{mergeWrites:!0},this.path=e,this.mergeWrites=t.mergeWrites,this.defaultData=t.defaultData||{}}i.prototype.read=function(){const e=this;return new Promise((function(t,r){n.readFile(e.path,"utf8",(function(n,s){if(n)return"ENOENT"===n.code?t(e.defaultData):r(n);try{return s&&s.length?t(JSON.parse(s)):t(e.defaultData)}catch(e){return r(e)}}))}))},i.prototype.write=function(e){const t=this;let r=Promise.resolve(e);return t.mergeWrites&&(r=r.then((function(e){return t.read().then((function(t){return Object.assign({},t,e)}))}))),r.then((function(e){return new Promise((function(r,s){try{return n.writeFile(t.path,JSON.stringify(e,null,2),"utf8",(function(e){return e?s(e):r()}))}catch(e){return s(e)}}))}))},e.exports=i},e=>{e.exports=require("fs")},(e,t,r)=>{const n=r(13).ArgumentError;function s(e,t){if(null==e)throw new n("Must provide the Webtask storage object");t=t||{force:1},this.storage=e,this.options=t,this.defaultData=t.defaultData||{}}s.prototype.read=function(){const e=this;return new Promise((function(t,r){e.storage.get((function(n,s){return n?r(n):t(s||e.defaultData)}))}))},s.prototype.write=function(e){const t=this;return new Promise((function(r,n){t.storage.set(e,t.options,(function(e){return e?n(e):r()}))}))},s.prototype.writeRetryCondition=function(e){return 409===e.code},e.exports=s},(e,t,r)=>{const n=r(31),s=r(32),i=r(13).ArgumentError,a=r(13).NotFoundError,o=r(13).ValidationError,c=function(e,t){return e.read().then((function(e){return e[t]=e[t]||[],e}))},l=function(e,t){const r={retries:10,factor:2,minTimeout:100,maxTimeout:1/0,randomize:!1};return function(){return function(e,t){let r=0;const n=t.retries||10,s=t.factor||2,i=t.minTimeout||100,a=t.maxTimeout||1/0,o=function(t){if(r++,r>n)return Promise.reject(t);const c=Math.min(i*Math.pow(s,r-1),a);return new Promise((function(e){setTimeout(e,c)})).then((function(){return e(o)}))};return e(o)}((function(r){return t().catch((function(t){if((e.writeRetryCondition||function(){return!1})(t))return r(t);throw t}))}),r)}};function u(e,t){if(null==e)throw new i("Must provide a storage context");this.storageContext=e,this.queue=s(),this.options=t||{concurrentWrites:!0}}u.prototype.write=function(e,t){const r=l(e,t);if(this.options.concurrentWrites)return r();const n=this.queue;return new Promise((function(e,t){n(r,(function(r,n){return r?t(r):e(n)}))}))},u.prototype.getAll=function(e){return c(this.storageContext,e).then((function(t){return t[e]}))},u.prototype.get=function(e,t){return this.getAll(e).then((function(r){const n=r.find((function(e){return e._id===t}));return n||Promise.reject(new a("The record "+t+" in "+e+" does not exist."))}))},u.prototype.create=function(e,t){const r=this.storageContext;return this.write(r,(function(){return c(r,e).then((function(s){t._id||(t._id=n.v4());return s[e].findIndex((function(e){return e._id===t._id}))>-1?Promise.reject(new o("The record "+t._id+" in "+e+" already exists.")):(s[e].push(t),r.write(s).then((function(){return t})))}))}))},u.prototype.update=function(e,t,r,n){const s=this.storageContext;return this.write(s,(function(){return c(s,e).then((function(i){const o=i[e].findIndex((function(e){return e._id===t}));if(o<0&&!n)throw new a("The record "+t+" in "+e+" does not exist.");const c=Object.assign({_id:t},o<0?{}:i[e][o],r);return o<0?i[e].push(c):i[e][o]=c,s.write(i).then((function(){return c}))}))}))},u.prototype.delete=function(e,t){const r=this.storageContext;return this.write(r,(function(){return c(r,e).then((function(n){const s=n[e].findIndex((function(e){return e._id===t}));return!(s<0)&&(n[e].splice(s,1),r.write(n).then((function(){return!0})))}))}))},e.exports=u},e=>{e.exports=require("node-uuid@1.4.8")},e=>{e.exports=function(){const e=[];let t=!1;const r=function(){if(0===e.length)return void(t=!1);t=!0;const n=e.shift();n.action((function(e,t){n.callback(e,t),r()}))};return function(n,s){e.push({action:n,callback:s}),t||r()}}},(e,t,r)=>{r.r(t),r.d(t,{S3StorageContext:()=>a});var n=r(34),s=r(13);const i=r(5);class a{#e=["AuthorizationHeaderMalformed","BadRequest","PermanentRedirect",301];constructor(e){if(null==e)throw new s.ArgumentError("The 'options' object is required when configuring the S3StorageContext.");if(!e.path||0===e.path.length)throw new s.ArgumentError("The 'path' property is required when configuring the S3StorageContext.");if(!e.bucket||0===e.bucket.length)throw new s.ArgumentError("The 'bucket' property is required when configuring the S3StorageContext.");if(!e.keyId||0===e.keyId.length)throw new s.ArgumentError("The 'keyId' property is required when configuring the S3StorageContext.");if(!e.keySecret||0===e.keySecret.length)throw new s.ArgumentError("The 'keySecret' property is required when configuring the S3StorageContext.");this.options=e,this.defaultData=e.defaultData||{},this.#t()}async read(){return this.#r((async()=>{const e={Key:this.options.path,Bucket:this.options.bucket};try{const t=await this.s3Client.send(new n.GetObjectCommand(e)),r=await(t?.Body?.transformToString());return r?JSON.parse(r):this.defaultData}catch(e){if("NoSuchKey"===e.Code)return this.defaultData;throw e}}))}async write(e){return this.#r((async()=>{const t={Key:this.options.path,Bucket:this.options.bucket,Body:JSON.stringify(e,null,2),ContentType:"application/json"};await this.s3Client.send(new n.PutObjectCommand(t))}))}async#r(e){try{return await e()}catch(t){i.info("Trying to resolve s3 bucket region...");const r=t.$response?.headers["x-amz-bucket-region"]||null,n=await this.s3Client.config.region();if(-1!==this.#e.indexOf(t.Code)&&r&&r!==n)return i.info(`Resolved following s3 bucket region: ${r}.`),this.#t(r),await e();throw t}}#t(e="us-east-1"){this.s3Client=new n.S3Client({credentials:{accessKeyId:this.options.keyId,secretAccessKey:this.options.keySecret},region:e})}}},e=>{e.exports=require("@aws-sdk/client-s3@3.738.0")},(e,t,r)=>{r.r(t),r.d(t,{default:()=>b});var n=r(36),s=r.n(n),i=r(37),a=r(107),o=r.n(a),c=r(108),l=r.n(c),u=r(109),d=r.n(u),p=r(110),h=r.n(p),f=r(4),m=r.n(f),g=r(5),y=r.n(g),_=r(150),v=r.n(_);const b=async()=>{const e={plugin:{...r(410).plugin,name:"@hapi/good"},options:{ops:{interval:3e4},reporters:{console:[]}}};e.options.reporters.console.push(new(d())({color:!!m()("LOG_COLOR")})),e.options.reporters.console.push("stdout");const t=new(s().Server)({host:"localhost",port:3e3,routes:{cors:!0}});t.validator(h());const n=[e,{plugin:{...i,name:"inert"}},{plugin:{...o(),name:"blipp"}},{plugin:{...l(),name:"jwt"}}];return await t.register([...n,...v()]),y().debug=(...e)=>{t.log(["debug"],e.join(" "))},y().info=(...e)=>{t.log(["info"],e.join(" "))},y().error=(...e)=>{t.log(["error"],e.join(" "))},t.ext("onPreResponse",((e,r)=>{const n=e.response?.statusCode??e.response?.status;if(n>=400){e.response.output.statusCode=n;let t=e.response.name;400===n?t="Bad Request":401===n?t="Unauthorized":403===n?t="Forbidden":404===n?t="Not Found":429===n&&(t="Too Many Requests"),e.response.output.payload={statusCode:n,error:t,message:e.response.message}}return e.response&&e.response.isBoom&&(t.log(["error"],`Request: ${e.method.toUpperCase()} ${e.path}`),t.log(["error"],`Response: ${JSON.stringify(e.response,null,2)}`)),r.continue})),t}},e=>{e.exports=require("@hapi/hapi@21.3.3")},(e,t,r)=>{const n=r(38),s=r(63),i=r(93),a=r(99),o=r(96),c={schema:s.object({etagsCacheMaxSize:s.number().integer().min(0).default(1e3)}).required(),fileMethod:function(e,t={}){return void 0!==t.confine&&!0!==t.confine||(t.confine="."),n.assert(void 0===t.end||+t.start<=+t.end,"options.start must be less than or equal to options.end"),this.response(o.response(e,t,this.request))}};t.plugin={pkg:r(106),once:!0,requirements:{hapi:">=20.0.0"},register(e,t){n.assert(0===Object.keys(t).length,"Inert does not support registration options");const r=s.attempt(e.settings.plugins?.inert??{},c.schema,'Invalid "inert" server options');e.expose("_etags",r.etagsCacheMaxSize>0?new a.Cache({max:r.etagsCacheMaxSize}):null),e.decorate("handler","file",o.handler),e.decorate("handler","directory",i.handler),e.decorate("toolkit","file",c.fileMethod)}}},(e,t,r)=>{t.applyToDefaults=r(39),t.assert=r(40),t.Bench=r(48),t.block=r(49),t.clone=r(43),t.contain=r(51),t.deepEqual=r(52),t.Error=r(41),t.escapeHeaderAttribute=r(54),t.escapeHtml=r(55),t.escapeJson=r(56),t.escapeRegex=r(53),t.flatten=r(57),t.ignore=r(50),t.intersect=r(58),t.isPromise=r(59),t.merge=r(47),t.once=r(60),t.reach=r(44),t.reachTemplate=r(61),t.stringify=r(42),t.wait=r(62)},(e,t,r)=>{const n=r(40),s=r(43),i=r(47),a=r(44),o={};e.exports=function(e,t,r={}){if(n(e&&"object"==typeof e,"Invalid defaults value: must be an object"),n(!t||!0===t||"object"==typeof t,"Invalid source value: must be true, falsy or an object"),n("object"==typeof r,"Invalid options: must be an object"),!t)return null;if(r.shallow)return o.applyToDefaultsWithShallow(e,t,r);const a=s(e);if(!0===t)return a;const c=void 0!==r.nullOverride&&r.nullOverride;return i(a,t,{nullOverride:c,mergeArrays:!1})},o.applyToDefaultsWithShallow=function(e,t,r){const c=r.shallow;n(Array.isArray(c),"Invalid keys");const l=new Map,u=!0===t?null:new Set;for(let r of c){r=Array.isArray(r)?r:r.split(".");const n=a(e,r);n&&"object"==typeof n?l.set(n,u&&a(t,r)||n):u&&u.add(r)}const d=s(e,{},l);if(!u)return d;for(const e of u)o.reachCopy(d,t,e);const p=void 0!==r.nullOverride&&r.nullOverride;return i(d,t,{nullOverride:p,mergeArrays:!1})},o.reachCopy=function(e,t,r){for(const e of r){if(!(e in t))return;const r=t[e];if("object"!=typeof r||null===r)return;t=r}const n=t;let s=e;for(let e=0;e{const n=r(41);e.exports=function(e,...t){if(!e){if(1===t.length&&t[0]instanceof Error)throw t[0];throw new n(t)}}},(e,t,r)=>{const n=r(42);e.exports=class extends Error{constructor(e){super(e.filter((e=>""!==e)).map((e=>"string"==typeof e?e:e instanceof Error?e.message:n(e))).join(" ")||"Unknown error"),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t.assert)}}},e=>{e.exports=function(...e){try{return JSON.stringify(...e)}catch(e){return"[Cannot display object: "+e.message+"]"}}},(e,t,r)=>{var n=r(21).Buffer;const s=r(44),i=r(45),a=r(46),o={needsProtoHack:new Set([i.set,i.map,i.weakSet,i.weakMap])};e.exports=o.clone=function(e,t={},r=null){if("object"!=typeof e||null===e)return e;let s=o.clone,c=r;if(t.shallow){if(!0!==t.shallow)return o.cloneWithShallow(e,t);s=e=>e}else if(c){const t=c.get(e);if(t)return t}else c=new Map;const l=i.getInternalProto(e);if(l===i.buffer)return n&&n.from(e);if(l===i.date)return new Date(e.getTime());if(l===i.regex)return new RegExp(e);const u=o.base(e,l,t);if(u===e)return e;if(c&&c.set(e,u),l===i.set)for(const r of e)u.add(s(r,t,c));else if(l===i.map)for(const[r,n]of e)u.set(r,s(n,t,c));const d=a.keys(e,t);for(const r of d){if("__proto__"===r)continue;if(l===i.array&&"length"===r){u.length=e.length;continue}const n=Object.getOwnPropertyDescriptor(e,r);n?n.get||n.set?Object.defineProperty(u,r,n):n.enumerable?u[r]=s(e[r],t,c):Object.defineProperty(u,r,{enumerable:!1,writable:!0,configurable:!0,value:s(e[r],t,c)}):Object.defineProperty(u,r,{enumerable:!0,writable:!0,configurable:!0,value:s(e[r],t,c)})}return u},o.cloneWithShallow=function(e,t){const r=t.shallow;(t=Object.assign({},t)).shallow=!1;const n=new Map;for(const t of r){const r=s(e,t);"object"!=typeof r&&"function"!=typeof r||n.set(r,r)}return o.clone(e,t,n)},o.base=function(e,t,r){if(!1===r.prototype)return o.needsProtoHack.has(t)?new t.constructor:t===i.array?[]:{};const n=Object.getPrototypeOf(e);if(n&&n.isImmutable)return e;if(t===i.array){const e=[];return n!==t&&Object.setPrototypeOf(e,n),e}if(o.needsProtoHack.has(t)){const e=new n.constructor;return n!==t&&Object.setPrototypeOf(e,n),e}return Object.create(n)}},(e,t,r)=>{const n=r(40),s={};e.exports=function(e,t,r){if(!1===t||null==t)return e;"string"==typeof(r=r||{})&&(r={separator:r});const i=Array.isArray(t);n(!i||!r.separator,"Separator option is not valid for array-based chain");const a=i?t:t.split(r.separator||".");let o=e;for(let e=0;e{var n=r(21).Buffer;const s={};t=e.exports={array:Array.prototype,buffer:n&&n.prototype,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},s.typeMap=new Map([["[object Error]",t.error],["[object Map]",t.map],["[object Promise]",t.promise],["[object Set]",t.set],["[object WeakMap]",t.weakMap],["[object WeakSet]",t.weakSet]]),t.getInternalProto=function(e){if(Array.isArray(e))return t.array;if(n&&e instanceof n)return t.buffer;if(e instanceof Date)return t.date;if(e instanceof RegExp)return t.regex;if(e instanceof Error)return t.error;const r=Object.prototype.toString.call(e);return s.typeMap.get(r)||t.generic}},(e,t)=>{t.keys=function(e,t={}){return!1!==t.symbols?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}},(e,t,r)=>{var n=r(21).Buffer;const s=r(40),i=r(43),a=r(46),o={};e.exports=o.merge=function(e,t,r){if(s(e&&"object"==typeof e,"Invalid target value: must be an object"),s(null==t||"object"==typeof t,"Invalid source value: must be null, undefined, or an object"),!t)return e;if(r=Object.assign({nullOverride:!0,mergeArrays:!0},r),Array.isArray(t)){s(Array.isArray(e),"Cannot merge array onto an object"),r.mergeArrays||(e.length=0);for(let n=0;n{const t={};e.exports=t.Bench=class{constructor(){this.ts=0,this.reset()}reset(){this.ts=t.Bench.now()}elapsed(){return t.Bench.now()-this.ts}static now(){const e=process.hrtime();return 1e3*e[0]+e[1]/1e6}}},(e,t,r)=>{const n=r(50);e.exports=function(){return new Promise(n)}},e=>{e.exports=function(){}},(e,t,r)=>{const n=r(40),s=r(52),i=r(53),a=r(46),o={};e.exports=function(e,t,r={}){return"object"!=typeof t&&(t=[t]),n(!Array.isArray(t)||t.length,"Values array cannot be empty"),"string"==typeof e?o.string(e,t,r):Array.isArray(e)?o.array(e,t,r):(n("object"==typeof e,"Reference must be string or an object"),o.object(e,t,r))},o.array=function(e,t,r){if(Array.isArray(t)||(t=[t]),!e.length)return!1;if(r.only&&r.once&&e.length!==t.length)return!1;let n;const s=new Map;for(const e of t)if(r.deep&&e&&"object"==typeof e){n=n||o.compare(r);let t=!1;for(const[r,i]of s.entries())if(n(r,e)){++i.allowed,t=!0;break}t||s.set(e,{allowed:1,hits:0})}else{const t=s.get(e);t?++t.allowed:s.set(e,{allowed:1,hits:0})}let i=0;for(const t of e){let e;if(r.deep&&t&&"object"==typeof t){n=n||o.compare(r);for(const[r,i]of s.entries())if(n(r,t)){e=i;break}}else e=s.get(t);if(e&&(++e.hits,++i,r.once&&e.hits>e.allowed))return!1}if(r.only&&i!==e.length)return!1;for(const e of s.values())if(e.hits!==e.allowed&&e.hitst.propertyIsEnumerable(e))),c=[...Object.keys(t),...i],l=o.compare(r),u=new Set(c);for(const n of s)if(u.has(n)){if(!l(t[n],e[n]))return!1;u.delete(n)}else if(r.only)return!1;return!u.size||!!r.part&&u.size""!==e));const s=new Map,a=[];for(const e of t)if(n("string"==typeof e,"Cannot compare string reference to non-string value"),e){const t=s.get(e);t?++t.allowed:(s.set(e,{allowed:1,hits:0}),a.push(i(e)))}else if(r.once||r.only)return!1;if(!a.length)return!0;const o=new RegExp(`(${a.join("|")})`,"g"),c=e.replace(o,((e,t)=>(++s.get(t).hits,"")));if(r.only&&c)return!1;let l=!1;for(const e of s.values())if(e.hits&&(l=!0),e.hits!==e.allowed){if(e.hitss(e,t,n)},o.shallow=function(e,t){return e===t}},(e,t,r)=>{var n=r(21).Buffer;const s=r(45),i={mismatched:null};e.exports=function(e,t,r){return r=Object.assign({prototype:!0},r),!!i.isDeepEqual(e,t,r,[])},i.isDeepEqual=function(e,t,r,a){if(e===t)return 0!==e||1/e==1/t;const o=typeof e;if(o!==typeof t)return!1;if(null===e||null===t)return!1;if("function"===o){if(!r.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==o)return e!=e&&t!=t;const c=i.getSharedType(e,t,!!r.prototype);switch(c){case s.buffer:return n&&n.prototype.equals.call(e,t);case s.promise:return e===t;case s.regex:return e.toString()===t.toString();case i.mismatched:return!1}for(let r=a.length-1;r>=0;--r)if(a[r].isSame(e,t))return!0;a.push(new i.SeenEntry(e,t));try{return!!i.isDeepEqualObj(c,e,t,r,a)}finally{a.pop()}},i.getSharedType=function(e,t,r){if(r)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?i.mismatched:s.getInternalProto(e);const n=s.getInternalProto(e);return n!==s.getInternalProto(t)?i.mismatched:n},i.valueOf=function(e){const t=e.valueOf;if(void 0===t)return e;try{return t.call(e)}catch(e){return e}},i.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)},i.isSetSimpleEqual=function(e,t){for(const r of Set.prototype.values.call(e))if(!Set.prototype.has.call(t,r))return!1;return!0},i.isDeepEqualObj=function(e,t,r,n,a){const{isDeepEqual:o,valueOf:c,hasOwnEnumerableProperty:l}=i,{keys:u,getOwnPropertySymbols:d}=Object;if(e===s.array){if(!n.part){if(t.length!==r.length)return!1;for(let e=0;e{e.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},(e,t,r)=>{const n=r(40);e.exports=function(e){return n(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(e),"Bad attribute value ("+e+")"),e.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')}},e=>{const t={};e.exports=function(e){if(!e)return"";let r="";for(let n=0;n=256)return"&#"+e+";";return`&#x${e.toString(16).padStart(2,"0")};`},t.isSafe=function(e){return t.safeCharCodes.has(e)},t.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]),t.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&e.add(t);return e}()},e=>{const t={};e.exports=function(e){return e?e.replace(/[<>&\u2028\u2029]/g,t.escape):""},t.escape=function(e){return t.replacements.get(e)},t.replacements=new Map([["<","\\u003c"],[">","\\u003e"],["&","\\u0026"],["\u2028","\\u2028"],["\u2029","\\u2029"]])},e=>{const t={};e.exports=t.flatten=function(e,r){const n=r||[];for(const r of e)Array.isArray(r)?t.flatten(r,n):n.push(r);return n}},e=>{const t={};e.exports=function(e,r,n={}){if(!e||!r)return n.first?null:[];const s=[],i=Array.isArray(e)?new Set(e):e,a=new Set;for(const e of r)if(t.has(i,e)&&!a.has(e)){if(n.first)return e;s.push(e),a.add(e)}return n.first?null:s},t.has=function(e,t){return"function"==typeof e.has?e.has(t):void 0!==e[t]}},e=>{e.exports=function(e){return!!e&&"function"==typeof e.then}},e=>{const t=Symbol("wrapped");e.exports=function(e){if(e[t])return e;let r=!1;const n=function(...t){r||(r=!0,e(...t))};return n[t]=!0,n}},(e,t,r)=>{const n=r(44);e.exports=function(e,t,r){return t.replace(/{([^{}]+)}/g,((t,s)=>{const i=n(e,s,r);return null==i?"":i}))}},e=>{const t=2**31-1;e.exports=function(e,r,n){if("bigint"==typeof e&&(e=Number(e)),e>=Number.MAX_SAFE_INTEGER&&(e=1/0),"number"!=typeof e&&void 0!==e)throw new TypeError("Timeout must be a number or bigint");return new Promise((s=>{const i=n?n.setTimeout:setTimeout,a=()=>{const n=Math.min(e,t);e-=n,i((()=>e>0?a():s(r)),n)};e!==1/0&&a()}))}},(e,t,r)=>{var n=r(21).Buffer;const s=r(40),i=r(43),a=r(64),o=r(70),c=r(71),l=r(69),u={types:{alternatives:r(73),any:r(74),array:r(81),boolean:r(82),date:r(83),function:r(84),link:r(87),number:r(88),object:r(89),string:r(90),symbol:r(91)},aliases:{alt:"alternatives",bool:"boolean",func:"function"}};n&&(u.types.binary=r(92)),u.root=function(){const e={_types:new Set(Object.keys(u.types))};for(const t of e._types)e[t]=function(...e){return s(!e.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),u.generate(this,u.types[t],e)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(...e){return this.any()[t](...e)};Object.assign(e,u.methods);for(const t in u.aliases){const r=u.aliases[t];e[t]=e[r]}return e},u.methods={ValidationError:c.ValidationError,version:a.version,assert(e,t,...r){u.assert(e,t,!0,r)},attempt:(e,t,...r)=>u.assert(e,t,!1,r),checkPreferences(e){a.checkPreferences(e)},compile(e,t){return o.compile(this,e,t)},isError:c.ValidationError.isError,isRef:l.isRef,isSchema:a.isSchema,in:(...e)=>l.in(...e),override:a.symbols.override,ref:(...e)=>l.create(...e)},u.assert=function(e,t,r,n){const s=n[0]instanceof Error||"string"==typeof n[0]?n[0]:null,o=s?n[1]:n[0],l=t.validate(e,a.preferences({errors:{stack:!0}},o||{}));let u=l.error;if(!u)return l.value;if(s instanceof Error)throw s;const d=r&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof c.ValidationError==!1&&(u=i(u)),u.message=s?`${s} ${d}`:d,u},u.generate=function(e,t,r){return s(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&r.length?t._definition.args(t,...r):t},e.exports=u.root()},(e,t,r)=>{const n=r(40),s=r(41),i=r(65);let a,o;const c={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};t.version=i.version,t.defaults={abortEarly:!0,allowUnknown:!1,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1},t.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},t.assertOptions=function(e,t,r="Options"){n(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const s=Object.keys(e).filter((e=>!t.includes(e)));n(0===s.length,`${r} contain unknown keys: ${s}`)},t.checkPreferences=function(e){o=o||r(66);const t=o.preferences.validate(e);if(t.error)throw new s([t.error.details[0].message])},t.compare=function(e,t,r){switch(r){case"=":return e===t;case">":return e>t;case"<":return e=":return e>=t;case"<=":return e<=t}},t.default=function(e,t){return void 0===e?t:e},t.isIsoDate=function(e){return c.isoDate.test(e)},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.isResolvable=function(e){return!!e&&(e[t.symbols.ref]||e[t.symbols.template])},t.isSchema=function(e,r={}){return!(!e||!e[t.symbols.any])},t.limit=function(e){return Number.isSafeInteger(e)&&e>=0},t.preferences=function(e,n){a=a||r(67),e=e||{},n=n||{};const s=Object.assign({},e,n);return n.errors&&e.errors&&(s.errors=Object.assign({},e.errors,n.errors),s.errors.wrap=Object.assign({},e.errors.wrap,n.errors.wrap)),n.messages&&(s.messages=a.compile(n.messages,e.messages)),delete s[t.symbols.prefs],s},t.tryWithPath=function(e,t,r={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,r.append&&(e.message=`${e.message} (${e.path})`),e}},t.validateArg=function(e,r,{assert:n,message:s}){if(t.isSchema(n)){const t=n.validate(e);if(!t.error)return;return t.error.message}if(!n(e))return r?`${r} ${s}`:s},t.verifyFlat=function(e,t){for(const r of e)n(!Array.isArray(r),"Method no longer accepts array arguments:",t)}},e=>{e.exports=JSON.parse('{"name":"@hapi/validate","description":"Object schema validation","version":"1.1.3","repository":"git://github.com/hapijs/validate","main":"lib/index.js","files":["lib/**/*"],"dependencies":{"@hapi/hoek":"^9.0.0","@hapi/topo":"^5.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/lab":"24.x.x"},"scripts":{"test":"lab -t 100 -a @hapi/code -L","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause"}')},(e,t,r)=>{const n=r(63),s={};s.wrap=n.string().min(1).max(2).allow(!1),t.preferences=n.object({allowUnknown:n.boolean(),abortEarly:n.boolean(),context:n.object(),convert:n.boolean(),dateFormat:n.valid("date","iso","string","time","utc"),errors:{escapeHtml:n.boolean(),label:n.valid("path","key",!1),language:[n.string(),n.object().ref()],render:n.boolean(),stack:n.boolean(),wrap:{label:s.wrap,array:s.wrap}},messages:n.object(),noDefaults:n.boolean(),nonEnumerables:n.boolean(),presence:n.valid("required","optional","forbidden"),skipFunctions:n.boolean(),stripUnknown:n.object({arrays:n.boolean(),objects:n.boolean()}).or("arrays","objects").allow(!0,!1)}).strict()},(e,t,r)=>{const n=r(40),s=r(43),i=r(68);t.compile=function(e,t){if("string"==typeof e)return n(!t,"Cannot set single message string"),new i(e);if(i.isTemplate(e))return n(!t,"Cannot set single message template"),e;n("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?s(t):{};for(let r in e){const s=e[r];if("root"===r||i.isTemplate(s)){t[r]=s;continue}if("string"==typeof s){t[r]=new i(s);continue}n("object"==typeof s&&!Array.isArray(s),"Invalid message for",r);const a=r;for(r in t[a]=t[a]||{},s){const e=s[r];"root"===r||i.isTemplate(e)?t[a][r]=e:(n("string"==typeof e,"Invalid message for",r,"in",a),t[a][r]=new i(e))}}return t},t.merge=function(e,r){if(!e)return t.compile(r);if(!r)return e;if("string"==typeof r)return new i(r);if(i.isTemplate(r))return r;const a=s(e);for(let e in r){const t=r[e];if("root"===e||i.isTemplate(t)){a[e]=t;continue}if("string"==typeof t){a[e]=new i(t);continue}n("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const s=e;for(e in a[s]=a[s]||{},t){const r=t[e];"root"===e||i.isTemplate(r)?a[s][e]=r:(n("string"==typeof r,"Invalid message for",e,"in",s),a[s][e]=new i(r))}}return a}},(e,t,r)=>{const n=r(40),s=r(43),i=r(55),a=r(64),o=r(69),c={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};e.exports=c.Template=class{constructor(e,t){n("string"==typeof e,"Template source must be a string"),n(!e.includes("\0")&&!e.includes(""),"Template source cannot contain reserved control characters"),this.source=e,this.rendered=e,this._template=null,this._settings=s(t),this._parse()}_parse(){if(!this.source.includes("{"))return;const e=c.encode(this.source),t=c.split(e),r=[],n=t.shift();n&&r.push(n);for(const e of t){const t="{"!==e[0],n=t?"}":"}}",s=e.indexOf(n);let i=e.slice(t?0:1,s);const a=":"===i[0];a&&(i=i.slice(1));const o=this._ref(c.decode(i),{raw:t,wrapped:a});r.push(o);const l=e.slice(s+n.length);l&&r.push(c.decode(l))}this._template=r}static date(e,t){return c.dateFormat[t.dateFormat].call(e)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[a.symbols.template]}render(e,t,r,n,s={}){if(!this.isDynamic())return this.rendered;const a=[];for(const o of this._template)if("string"==typeof o)a.push(o);else{const l=o.ref.resolve(e,t,r,n,s),u=c.stringify(l,r,s.errors),d=o.raw||!1===(s.errors&&s.errors.escapeHtml)?u:i(u);a.push(c.wrap(d,o.wrapped&&r.errors.wrap.label))}return a.join("")}_ref(e,{raw:t,wrapped:r}){const n=o.create(e,this._settings);return{ref:n,raw:t,wrapped:r||"local"===n.type&&"label"===n.key}}toString(){return this.source}},c.Template.prototype[a.symbols.template]=!0,c.Template.prototype.isImmutable=!0,c.encode=function(e){return e.replace(/\\(\{+)/g,((e,t)=>c.opens.slice(0,t.length))).replace(/\\(\}+)/g,((e,t)=>c.closes.slice(0,t.length)))},c.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},c.split=function(e){const t=[];let r="";for(let n=0;n ${n.toString()}`);e=t}if(!Array.isArray(e))return e.toString();let s="";for(const n of e)s=s+(s.length?", ":"")+c.stringify(n,t,r);return c.wrap(s,t.errors.wrap.array)}},(e,t,r)=>{const n=r(40),s=r(43),i=r(44),a=r(64),o={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e,t={}){n("string"==typeof e,"Invalid reference key:",e),a.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","separator"]),n(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const r=Object.assign({},o.defaults,t);delete r.prefix;const s=r.separator,i=o.context(e,s,t.prefix);if(r.type=i.type,e=i.key,"value"===r.type)if(i.root&&(n(!s||e[0]!==s,"Cannot specify relative path with root prefix"),r.ancestor="root",e||(e=null)),s&&s===e)e=null,r.ancestor=0;else if(void 0!==r.ancestor)n(!s||!e||e[0]!==s,"Cannot combine prefix with ancestor option");else{const[t,n]=o.ancestor(e,s);n&&""===(e=e.slice(n))&&(e=null),r.ancestor=t}return r.path=s?null===e?[]:e.split(s):[e],new o.Ref(r)},t.in=function(e,r={}){return t.create(e,Object.assign({},r,{in:!0}))},t.isRef=function(e){return!!e&&!!e[a.symbols.ref]},o.Ref=class{constructor(e){n("object"==typeof e,"Invalid reference construction"),a.assertOptions(e,["adjust","ancestor","in","iterables","map","path","separator","type","depth","key","root","display"]),n([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),n(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),n(!e.map||Array.isArray(e.map),"options.map must be an array"),n(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,o.defaults,e),n("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,t,r,s,i={}){return n(!this.in||i.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(r.context,t,i):"local"===this.type?this._resolve(s,t,i):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,i):(n(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,i)):this._resolve(e,t,i)}_resolve(e,t,r){let n;if("value"===this.type&&t.mainstay.shadow&&!1!==r.shadow&&(n=t.mainstay.shadow.get(this.absolute(t))),void 0===n&&(n=i(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(n=this.adjust(n)),this.map){const e=this.map.get(n);void 0!==e&&(n=e)}return n}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new o.Ref(this)}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display=`ref:${this.type}:${e}`);if(!this.separator)return void(this.display=`ref:${e}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${e}`);if("root"===this.ancestor)return void(this.display=`ref:root:${e}`);if(1===this.ancestor)return void(this.display=`ref:${e||".."}`);const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${t}${e||""}`}},o.Ref.prototype[a.symbols.ref]=!0,o.context=function(e,t,r={}){if(e=e.trim(),r){const n=void 0===r.global?"$":r.global;if(n!==t&&e.startsWith(n))return{key:e.slice(n.length),type:"global"};const s=void 0===r.local?"#":r.local;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"local"};const i=void 0===r.root?"/":r.root;if(i!==t&&e.startsWith(i))return{key:e.slice(i.length),type:"value",root:!0}}return{key:e,type:"value"}},o.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let r=2;for(;e[r]===t;)++r;return[r-1,r]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,r){if(e)if(r=void 0===r?t.toParent:r,Array.isArray(e))for(const t of e)this.register(t,r);else if(a.isSchema(e))for(const t of e._refs.refs)t.ancestor-r>=0&&this.refs.push({ancestor:t.ancestor-r,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-r>=0&&this.refs.push({ancestor:e.ancestor-r,root:e.root})}clone(){const e=new t.Manager;return e.refs=s(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter((e=>!e.ancestor)).map((e=>e.root))}}},(e,t,r)=>{const n=r(40),s=r(64),i=r(69),a={};t.schema=function(e,t,r={}){s.assertOptions(r,["appendPath","override"]);try{return a.schema(e,t,r)}catch(e){throw r.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},a.schema=function(e,t,r){n(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(n(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const i=(t,...n)=>!1!==r.override?t.valid(e.override,...n):t.valid(...n);if(a.simple(t))return i(e,t);if("function"==typeof t)return e.custom(t);if(n("object"==typeof t,"Invalid schema content:",typeof t),s.isResolvable(t))return i(e,t);if(s.isSchema(t))return t;if(Array.isArray(t)){for(const r of t)if(!a.simple(r))return e.alternatives().try(...t);return i(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?i(e.date(),t):(n(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return i.isRef(e)?e:i.create(e,t)},t.compile=function(e,r){const i=r&&r[s.symbols.any];return i?(n(i.version===s.version,"Cannot mix different versions of joi schemas:",i.version,s.version),r):t.schema(e,r,{appendPath:!0})},a.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,r,o){if(void 0===o&&(n(r&&"object"==typeof r,"Missing options"),o=r,r=i.create(".")),Array.isArray(o)&&(o={switch:o}),s.assertOptions(o,["is","not","then","otherwise","switch","break"]),s.isSchema(r))return n(void 0===o.is,'"is" can not be used with a schema condition'),n(void 0===o.not,'"not" can not be used with a schema condition'),n(void 0===o.switch,'"switch" can not be used with a schema condition'),a.condition(e,{is:r,then:o.then,otherwise:o.otherwise,break:o.break});if(n(i.isRef(r)||"string"==typeof r,"Invalid condition:",r),n(void 0===o.not||void 0===o.is,'Cannot combine "is" with "not"'),void 0===o.switch){let c=o;void 0!==o.not&&(c={is:o.not,then:o.otherwise,otherwise:o.then,break:o.break});let l=void 0!==c.is?e.$_compile(c.is):e.$_root.invalid(null,!1,0,"").required();return n(void 0!==c.then||void 0!==c.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),n(void 0===c.break||void 0===c.then||void 0===c.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===o.is||i.isRef(o.is)||s.isSchema(o.is)||(l=l.required()),a.condition(e,{ref:t.ref(r),is:l,then:c.then,otherwise:c.otherwise,break:c.break})}n(Array.isArray(o.switch),'"switch" must be an array'),n(void 0===o.is,'Cannot combine "switch" with "is"'),n(void 0===o.not,'Cannot combine "switch" with "not"'),n(void 0===o.then,'Cannot combine "switch" with "then"');const c={ref:t.ref(r),switch:[],break:o.break};for(let t=0;t{const n=r(72),s=r(64),i=r(68);t.Report=class{constructor(e,r,n,s,i,a,o){if(this.code=e,this.flags=s,this.messages=i,this.path=a.path,this.prefs=o,this.state=a,this.value=r,this.message=null,this.local=n||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?`Error code "${e}" is not defined, your custom type is missing the correct messages definition`:(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(e){return t.template(this.value,e,this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const r of e)"object"!=typeof r&&("string"==typeof r?(t&&(t+="."),t+=r):t+=`[${r}]`);return t},t.template=function(e,t,r,n,a){if(i.isTemplate(t))return"root"!==r?t:null;let o=a.errors.language;return s.isResolvable(o)&&(o=o.resolve(e,n,a)),o&&t[o]&&void 0!==t[o][r]?t[o][r]:t[r]},t.label=function(e,r,n,s){if(!n.errors.label)return"";let i=r.path;"key"===n.errors.label&&r.path.length>1&&(i=r.path.slice(-1));const a=t.path(i);return a||(t.template(null,n.messages,"root",r,n)||t.template(null,s,"root",r,n)||"value")},t.process=function(e,r,n){if(!e)return null;const{override:s,message:i,details:a}=t.details(e);if(s)return s;if(n.errors.stack)return new t.ValidationError(i,a,r);const o=Error.stackTraceLimit;Error.stackTraceLimit=0;const c=new t.ValidationError(i,a,r);return Error.stackTraceLimit=o,c},t.details=function(e,t={}){let r=[];const n=[];for(const s of e){if(s instanceof Error){if(!1!==t.override)return{override:s};const e=s.toString();r.push(e),n.push({message:e,type:"override",context:{error:s}});continue}const e=s.toString();r.push(e),n.push({message:e,path:s.path.filter((e=>"object"!=typeof e)),type:s.code,context:s.local})}return r.length>1&&(r=[...new Set(r)]),{message:r.join(". "),details:n}},t.ValidationError=class extends Error{constructor(e,t,r){super(e),this._original=r,this.details=t}static isError(e){return e instanceof t.ValidationError}},t.ValidationError.prototype.isJoi=!0,t.ValidationError.prototype.name="ValidationError",t.ValidationError.prototype.annotate=n.error},(e,t,r)=>{const n=r(43),s=r(64),i={annotations:Symbol("annotations")};t.error=function(e){if(!this._original||"object"!=typeof this._original)return this.details[0].message;const t=e?"":"",r=e?"":"",a=e?"":"",o=n(this._original);for(let e=this.details.length-1;e>=0;--e){const t=e+1,r=this.details[e],n=r.path;let a=o;for(let e=0;;++e){const o=n[e];if(s.isSchema(a)&&(a=a.clone()),!(e+1`" ${t}[${r}]${a}`)).replace(l,((e,n,s)=>`${r}"${n}"${a}${t} [${s}]: -- missing --${a}`)).replace(u,((e,r,n)=>`\n${n} ${t}[${r}]${a}`)).replace(d,((e,t)=>t));p=`${p}\n${t}`;for(let e=0;et[0]===n?"[Circular ~]":"[Circular ~."+e.slice(0,t.indexOf(n)).join(".")+"]";return function(n,s){if(t.length>0){const i=t.indexOf(this);~i?(t.length=i+1,e.length=i+1,e[i]=n):(t.push(this),e.push(n)),~t.indexOf(s)&&(s=r.call(this,n,s))}else t.push(s);if(s){const e=s[i.annotations];if(e){if(Array.isArray(s)){const t=[];for(let r=0;r{const n=r(40),s=r(74),i=r(64),a=r(70),o=r(71),c=r(69),l={};e.exports=s._extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:c.toSibling}},args:(e,...t)=>1===t.length&&Array.isArray(t[0])?e.try(...t[0]):e.try(...t),validate(e,t){const{schema:r,error:n,state:s,prefs:i}=t;if(r._flags.match){let t,a=0;for(let n=0;n{i.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),l.errors=function(e,{error:t,state:r}){if(!e.length)return{errors:t("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const n=new Set,s=[];for(const{reports:i,schema:a}of e){if(i.length>1)return l.unmatched(e,t);const c=i[0];if(c instanceof o.Report==!1)return l.unmatched(e,t);if(c.state.path.length!==r.path.length){s.push({type:a.type,report:c});continue}if("any.only"===c.code){for(const e of c.local.valids)n.add(e);continue}const[u,d]=c.code.split(".");"base"===d?n.add(u):s.push({type:a.type,report:c})}return s.length?1===s.length?{errors:s[0].report}:l.unmatched(e,t):{errors:t("alternatives.types",{types:[...n]})}},l.unmatched=function(e,t){const r=[];for(const t of e)r.push(...t.reports);return{errors:t("alternatives.match",o.details(r,{override:!1}))}}},(e,t,r)=>{const n=r(40),s=r(75),i=r(64);e.exports=s._extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(e,t){return n("function"==typeof e,"Method must be a function"),n(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:e,description:t}})},validate(e,t,{method:r}){try{return r(e,t)}catch(e){return t.error("any.custom",{error:e})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(e){n(i.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const t=this.clone();return t.$_terms.shared=t.$_terms.shared||[],t.$_terms.shared.push(e),t.$_mutateRegister(e),t}}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":"{{#label}} must be one of {{#valids}}","any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},(e,t,r)=>{const n=r(40),s=r(43),i=r(52),a=r(47),o=r(64),c=r(70),l=r(71),u=r(76),d=r(67),p=r(77),h=r(69),f=r(78),m=r(80),g={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._ids=new p.Ids,this._preferences=null,this._refs=new h.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={whens:{}}}allow(...e){return o.verifyFlat(e,"allow"),this._values(e,"_valids")}cast(e){return n(!1===e||"string"==typeof e,"Invalid to value"),n(!1===e||this._definition.cast[e],"Type",this.type,"does not support casting to",e),this.$_setFlag("cast",!1===e?void 0:e)}default(e,t){return this._default("default",e,t)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(e){return n(e,"Missing error"),n(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(e){return e?(n("string"==typeof e,"id must be a non-empty string"),n(/^[^\.]+$/.test(e),"id cannot contain period character"),this.$_setFlag("id",e)):this.$_setFlag("id",void 0)}invalid(...e){return this._values(e,"_invalids")}only(e=!0){return n("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){n(e,"Missing preferences"),n(void 0===e.context,"Cannot override context"),o.checkPreferences(e);const t=this.clone();return t._preferences=o.preferences(t._preferences,e),t}presence(e){return n(["optional","required","forbidden"].includes(e),"Unknown presence mode",e),this.$_setFlag("presence",e)}raw(e=!0){return this.$_setFlag("result",e?"raw":void 0)}required(){return this.presence("required")}strict(e){const t=this.clone(),r=void 0!==e&&!e;return t._preferences=o.preferences(t._preferences,{convert:r}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}valid(...e){o.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(e,t){const r=this.clone();r.$_terms.whens||(r.$_terms.whens=[]);const s=c.when(r,e,t);if(!["any","link"].includes(r.type)){const e=s.is?[s]:s.switch;for(const t of e)n(!t.then||"any"===t.then.type||t.then.type===r.type,"Cannot combine",r.type,"with",t.then&&t.then.type),n(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===r.type,"Cannot combine",r.type,"with",t.otherwise&&t.otherwise.type)}return r.$_terms.whens.push(s),r.$_mutateRebuild()}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){n(o.isSchema(e),"Invalid schema object"),n("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type);let t=this.clone();if("any"===this.type&&"any"!==e.type){const r=e.clone();for(const e of Object.keys(t))"type"!==e&&(r[e]=t[e]);t=r}t._ids.concat(e._ids),t._refs.register(e,h.toSibling),t._preferences=t._preferences?o.preferences(t._preferences,e._preferences):e._preferences,t._valids=m.merge(t._valids,e._valids,e._invalids),t._invalids=m.merge(t._invalids,e._invalids,e._valids);for(const r of e._singleRules.keys())t._singleRules.has(r)&&(t._rules=t._rules.filter((e=>e.name!==r)),t._singleRules.delete(r));for(const r of e._rules)e._definition.rules[r.method].multi||t._singleRules.set(r.name,r),t._rules.push(r);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const r=Object.assign({},e._flags);delete r.empty,a(t._flags,r)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const r=Object.assign({},e._flags);delete r.empty,a(t._flags,r)}else a(t._flags,e._flags);for(const r in e.$_terms){const n=e.$_terms[r];n?t.$_terms[r]?t.$_terms[r]=t.$_terms[r].concat(n):t.$_terms[r]=n.slice():t.$_terms[r]||(t.$_terms[r]=n)}return t.$_mutateRebuild()}validate(e,t){return f.entry(e,this,t)}validateAsync(e,t){const r=this.validate(e,t);if(r.error)throw r.error;return r.value}$_addRule(e){"string"==typeof e&&(e={name:e}),n(e&&"object"==typeof e,"Invalid options"),n(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)n("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const r=this._definition.rules[t.method],s=t.args;n(r,"Unknown rule",t.method);const i=this.clone();if(s){n(1===Object.keys(s).length||Object.keys(s).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in s){let a=s[e];if(void 0!==a){if(r.argsByName){const c=r.argsByName.get(e);if(c.ref&&o.isResolvable(a))t._resolve.push(e),i.$_mutateRegister(a);else if(c.normalize&&(a=c.normalize(a),s[e]=a),c.assert){const t=o.validateArg(a,e,c);n(!t,t,"or reference")}}s[e]=a}else delete s[e]}}return r.multi||(i._ruleRemove(t.name),i._singleRules.set(t.name,t)),r.priority?i._rules.unshift(t):i._rules.push(t),i}$_compile(e,t){return c.schema(this.$_root,e,t)}$_createError(e,t,r,n,s,i={}){const a=!1!==i.flags?this._flags:{},o=i.messages?d.merge(this._definition.messages,i.messages):this._definition.messages;return new l.Report(e,t,r,a,o,n,s)}$_getRule(e){return this._singleRules.get(e)}$_match(e,t,r,n){(r=Object.assign({},r)).abortEarly=!0,r._externals=!1,t.snapshot();const s=!f.validate(e,this,t,r,n).errors;return t.restore(),s}$_modify(e){return o.assertOptions(e,["each","once","ref","schema"]),p.schema(this,e)||this}$_mutateRebuild(){this._refs.reset(),this._ids.reset();return this.$_modify({each:(e,{source:t,name:r,path:n,key:s})=>{const i=this._definition[t][r]&&this._definition[t][r].register;!1!==i&&this.$_mutateRegister(e,{family:i,key:s})}}),this._definition.rebuild&&this._definition.rebuild(this),this}$_mutateRegister(e,{family:t,key:r}={}){this._refs.register(e,t),this._ids.register(e,{key:r})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t,r={}){const n=this._definition.flags[e]||{};if(i(t,n.default)&&(t=void 0),i(t,this._flags[e]))return this;const s=!1!==r.clone?this.clone():this;return void 0!==t?(s._flags[e]=t,s.$_mutateRegister(t)):delete s._flags[e],s}$_parent(e,...t){return this[e][o.symbols.parent].call(this,...t)}$_validate(e,t,r){return f.validate(e,this,t,r)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=s(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_default(e,t,r={}){o.assertOptions(r,"literal"),n(void 0!==t,"Missing",e,"value"),n("function"==typeof t||!r.literal,"Only function value supports literal option"),"function"==typeof t&&r.literal&&(t={[o.symbols.literal]:!0,literal:t});return this.$_setFlag(e,t)}_extend(e){return n(!e.base,"Cannot extend type with another base"),u.type(this,e)}_generate(e,t,r){if(!this.$_terms.whens)return{schema:this};const n=[],s=[];for(let i=0;il)break}const i=s.join(", ");if(!i)return{schema:this};if(this.$_temp.whens[i])return{schema:this.$_temp.whens[i],id:i};let a=this;this._definition.generate&&(a=this._definition.generate(this,e,t,r));for(const e of n)a=a.concat(e);return this.$_temp.whens[i]=a,{schema:a,id:i}}_ruleRemove(e){if(!this._singleRules.has(e))return this;this._singleRules.delete(e);const t=[];for(let r=0;r{const n=r(40),s=r(43),i=r(64),a=r(67);t.type=function(e,t){const r=Object.getPrototypeOf(e),o=s(r),c=e._assign(Object.create(o)),l=Object.assign({},t);delete l.base,o._definition=l;const u=r._definition||{};l.messages=a.merge(u.messages,l.messages),l.properties=Object.assign({},u.properties,l.properties),c.type=l.type,l.flags=Object.assign({},u.flags,l.flags);const d=Object.assign({},u.terms);if(l.terms)for(const e in l.terms){const t=l.terms[e];n(void 0===c.$_terms[e],"Invalid term override for",l.type,e),c.$_terms[e]=t.init,d[e]=t}l.terms=d,l.args||(l.args=u.args),l.coerce&&("function"==typeof l.coerce&&(l.coerce={method:l.coerce}),l.coerce.from&&!Array.isArray(l.coerce.from)&&(l.coerce={method:l.coerce.method,from:[].concat(l.coerce.from)})),l.coerce=l.coerce||u.coerce,l.validate=l.validate||u.validate;const p=Object.assign({},u.rules);if(l.rules)for(const e in l.rules){const t=l.rules[e];n("object"==typeof t,"Invalid rule definition for",l.type,e);const r=t.method;if(r&&(n(!o[e],"Rule conflict in",l.type,e),o[e]=r),n(!p[e],"Rule conflict in",l.type,e),p[e]=t,t.alias){const e=[].concat(t.alias);for(const r of e)o[r]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map((e=>("string"==typeof e&&(e={name:e}),n(!t.argsByName.has(e.name),"Duplicated argument name",e.name),t.argsByName.set(e.name,e),e))))}if(l.rules=p,l.overrides){o._super=r,c.$_super={};for(const e in l.overrides)n(r[e],"Cannot override missing",e),l.overrides[e][i.symbols.parent]=r[e],c.$_super[e]=r[e].bind(c);Object.assign(o,l.overrides)}return l.cast=Object.assign({},u.cast,l.cast),l.rebuild=l.rebuild||u.rebuild,c}},(e,t,r)=>{const n=r(40),s=r(64),i=r(69),a={};t.Ids=a.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new a.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,r]of e._byId.entries())n(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,r);for(const[t,r]of e._byKey.entries())n(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,r)}reach(e,t=[]){const r=e[0],s=this._get(r);n(s,"Schema does not contain path",[...t,...e].join("."));const i=e.slice(1);return i.length?s.schema._ids.reach(i,[...t,r]):s.schema}register(e,{key:t}={}){if(!e||!s.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const r=e._flags.id;if(r){const t=this._byId.get(r);n(!t||t.schema===e,"Cannot add different schemas with the same id:",r),n(!this._byKey.has(r),"Schema id conflicts with existing key:",r),this._byId.set(r,{schema:e,id:r})}t&&(n(!this._byKey.has(t),"Schema already contains key:",t),n(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,{schema:e,id:t}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_get(e){return this._byId.get(e)||this._byKey.get(e)}},t.schema=function(e,t){let r;for(const n in e._flags){if("_"===n[0])continue;const s=a.scan(e._flags[n],{source:"flags",name:n},t);void 0!==s&&(r=r||e.clone(),r._flags[n]=s)}for(let n=0;n{const n=r(40),s=r(43),i=r(64),a=r(71),o=r(79),c={result:Symbol("result")};t.entry=function(e,t,r){let n=i.defaults;r&&(n=i.preferences(i.defaults,r));const s=c.entry(e,t,n),a={value:s.value};return s.error&&(a.error=s.error),a},c.entry=function(e,r,n){const s={links:r._ids._schemaChain?new Map:null},i=r._ids._schemaChain?[{schema:r}]:null,c=new o([],[],{mainstay:s,schemas:i}),l=t.validate(e,r,c,n),u=a.process(l.errors,e,n);return{value:l.value,error:u,mainstay:s}},t.validate=function(e,t,r,n,s={}){t.$_terms.whens&&(t=t._generate(e,r,n).schema),t._preferences&&(n=c.prefs(t,n));const a={original:e,prefs:n,schema:t,state:r,error:(s,i,a)=>t.$_createError(s,e,i,a||r,n),errorsArray:c.errorsArray,message:(s,i)=>t.$_createError("custom",e,i,r,n,{messages:s})},o=t._definition;if(o.coerce&&void 0!==e&&n.convert&&(!o.coerce.from||o.coerce.from.includes(typeof e))){const t=o.coerce.method(e,a);if(t){if(t.errors)return c.finalize(t.value,[].concat(t.errors),a);e=t.value}}const l=t._flags.empty;l&&l.$_match(c.trim(e,t),r.nest(l),i.defaults)&&(e=void 0);const u=s.presence||t._flags.presence||(t._flags._endedSwitch?null:n.presence);if(void 0===e){if("forbidden"===u)return c.finalize(e,null,a);if("required"===u)return c.finalize(e,[t.$_createError("any.required",e,null,r,n)],a);if("optional"===u){if(t._flags.default!==i.symbols.deepDefault)return c.finalize(e,null,a);e={}}}else if("forbidden"===u)return c.finalize(e,[t.$_createError("any.unknown",e,null,r,n)],a);const d=[];if(t._valids){const s=t._valids.get(e,r,n,t._flags.insensitive);if(s)return n.convert&&(e=s.value),c.finalize(e,null,a);if(t._flags.only){const s=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},r,n);if(n.abortEarly)return c.finalize(e,[s],a);d.push(s)}}if(t._invalids){if(t._invalids.get(e,r,n,t._flags.insensitive)){const s=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,n);if(n.abortEarly)return c.finalize(e,[s],a);d.push(s)}}if(o.validate){const t=o.validate(e,a);if(t&&(e=t.value,t.errors)){if(!Array.isArray(t.errors))return d.push(t.errors),c.finalize(e,d,a);if(t.errors.length)return d.push(...t.errors),c.finalize(e,d,a)}}return t._rules.length?c.rules(e,d,a):c.finalize(e,d,a)},c.rules=function(e,t,r){const{schema:n,state:s,prefs:a}=r;for(const o of n._rules){const l=n._definition.rules[o.method];if(l.convert&&a.convert)continue;let u,d=o.args;if(o._resolve.length){d=Object.assign({},d);for(const t of o._resolve){const r=l.argsByName.get(t),o=d[t].resolve(e,s,a),c=r.normalize?r.normalize(o):o,p=i.validateArg(c,null,r);if(p){u=n.$_createError("any.ref",o,{arg:t,ref:d[t],reason:p},s,a);break}d[t]=c}}u=u||l.validate(e,r,d,o);const p=c.rule(u,o);if(p.errors){if(a.abortEarly)return c.finalize(e,p.errors,r);t.push(...p.errors)}else e=p.value}return c.finalize(e,t,r)},c.rule=function(e,t){return e instanceof a.Report?{errors:[e],value:null}:Array.isArray(e)&&e[i.symbols.errors]?{errors:e,value:null}:{errors:null,value:e}},c.finalize=function(e,t,r){t=t||[];const{schema:s,state:i}=r;if(t.length){const n=c.default("failover",void 0,t,r);void 0!==n&&(e=n,t=[])}if(t.length&&s._flags.error)if("function"==typeof s._flags.error){t=s._flags.error(t),Array.isArray(t)||(t=[t]);for(const e of t)n(e instanceof Error||e instanceof a.Report,"error() must return an Error object")}else t=[s._flags.error];if(void 0===e){e=c.default("default",e,t,r)}if(s._flags.cast&&void 0!==e){const t=s._definition.cast[s._flags.cast];if(t.from(e)){e=t.to(e,r)}}const o={value:e,errors:t.length?t:null};return s._flags.result&&(o.value="strip"===s._flags.result?void 0:r.original,i.shadow(e,s._flags.result)),o},c.prefs=function(e,t){const r=t===i.defaults;return r&&e._preferences[i.symbols.prefs]?e._preferences[i.symbols.prefs]:(t=i.preferences(t,e._preferences),r&&(e._preferences[i.symbols.prefs]=t),t)},c.default=function(e,t,r,n){const{schema:a,state:o,prefs:c}=n,l=a._flags[e];if(c.noDefaults||void 0===l)return t;if(!l)return l;if("function"==typeof l){const t=l.length?[s(o.ancestors[0]),n]:[];try{return l(...t)}catch(t){return void r.push(a.$_createError(`any.${e}`,null,{error:t},o,c))}}return"object"!=typeof l?l:l[i.symbols.literal]?l.literal:i.isResolvable(l)?l.resolve(t,o,c):s(l)},c.trim=function(e,t){if("string"!=typeof e)return e;const r=t.$_getRule("trim");return r&&r.args.enabled?e.trim():e},c.errorsArray=function(){const e=[];return e[i.symbols.errors]=!0,e}},(e,t,r)=>{const n=r(43),s=r(44),i=r(64),a={value:Symbol("value")};e.exports=a.State=class{constructor(e,t,r){this.path=e,this.ancestors=t,this.mainstay=r.mainstay,this.schemas=r.schemas}localize(e,t=null,r=null){const n=new a.State(e,t,this);return r&&n.schemas&&(n.schemas=[a.schemas(r),...n.schemas]),n}nest(e){const t=new a.State(this.path,this.ancestors,this);return t.schemas=t.schemas&&[a.schemas(e),...t.schemas],t}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new a.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=n(this.mainstay.shadow.node(this.path)))}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0)}},a.schemas=function(e){return i.isSchema(e)?{schema:e}:e},a.Shadow=class{constructor(){this._values=null}set(e,t,r){if(!e.length)return;if("strip"===r&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let n=this._values;for(let t=0;t{const n=r(40),s=r(52),i=r(64),a={};e.exports=a.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=a.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){i.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,r){if(e=e||new a.Values,t){if(t._override)return t.clone();for(const r of[...t._values,...t._refs])e.add(r)}if(r)for(const t of[...r._values,...r._refs])e.remove(t);return e.length?e:null}remove(e){i.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,r,n){return!!this.get(e,t,r,n)}get(e,t,r,n){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&n){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const t of this._values)if(s(t,e))return{value:t};if(t)for(const i of this._refs){const a=i.resolve(e,t,r,null,{in:!0});if(void 0===a)continue;const o=i.in&&"object"==typeof a?Array.isArray(a)?a:Object.keys(a):[a];for(const t of o)if(typeof t==typeof e)if(n&&e&&"string"==typeof e){if(t.toLowerCase()===e.toLowerCase())return{value:t,ref:i}}else if(s(t,e))return{value:t,ref:i}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new a.Values(this._values,this._refs);return e._override=this._override,e}concat(e){n(!e._override,"Cannot concat override set of values");const t=new a.Values([...this._values,...e._values],[...this._refs,...e._refs]);return t._override=this._override,t}},a.Values.prototype[i.symbols.values]=!0,a.Values.prototype.slice=a.Values.prototype.clone,a.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t}},(e,t,r)=>{const n=r(40),s=r(52),i=r(44),a=r(74),o=r(64),c=r(70),l={};e.exports=a._extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[]},ordered:{init:[]},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,{schema:t,state:r,prefs:n}){if(!Array.isArray(e))return;const s=t.$_getRule("sort");return s?l.sort(t,e,s.args.options,r,n):void 0}},validate(e,{schema:t,error:r}){if(!Array.isArray(e)){if(t._flags.single){const t=[e];return t[o.symbols.arraySingle]=!0,{value:t}}return{errors:r("array.base")}}if(t.$_getRule("items"))return{value:e.slice()}},rules:{has:{method(e){e=this.$_compile(e,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:e}});return t.$_mutateRegister(e),t},validate(e,{state:t,prefs:r,error:n},{schema:s}){const i=[e,...t.ancestors];for(let n=0;nthis.$_compile(e[r])),r,{append:!0});t.$_terms.items.push(n)}return t.$_mutateRebuild()},validate(e,{schema:t,error:r,state:n,prefs:s,errorsArray:i}){const a=t.$_terms._requireds.slice(),c=t.$_terms.ordered.slice(),u=[...t.$_terms._inclusions,...a],d=!e[o.symbols.arraySingle];delete e[o.symbols.arraySingle];const p=i();let h=e.length;for(let i=0;i="})}},ordered:{method(...e){o.verifyFlat(e,"ordered");const t=this.$_addRule("items");for(let r=0;rthis.$_compile(e[r])),r,{append:!0});l.validateSingle(n,t),t.$_mutateRegister(n),t.$_terms.ordered.push(n)}return t.$_mutateRebuild()}},single:{method(e){const t=void 0===e||!!e;return n(!t||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",t)}},sort:{method(e={}){o.assertOptions(e,["by","order"]);const t={order:e.order||"ascending"};return e.by&&(t.by=c.ref(e.by,{ancestor:0}),n(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(e,{error:t,state:r,prefs:n,schema:s},{options:i}){const{value:a,errors:o}=l.sort(s,e,i,r,n);if(o)return o;for(let r=0;rnew Set(e)}},rebuild(e){e.$_terms._inclusions=[],e.$_terms._exclusions=[],e.$_terms._requireds=[];for(const t of e.$_terms.items)l.validateSingle(t,e),"required"===t._flags.presence?e.$_terms._requireds.push(t):"forbidden"===t._flags.presence?e.$_terms._exclusions.push(t):e.$_terms._inclusions.push(t);for(const t of e.$_terms.ordered)l.validateSingle(t,e)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),l.fillMissedErrors=function(e,t,r,n,s,i){let a=0;for(let e=0;e{let d=l.compare(c,u,a,o);if(null!==d)return d;if(r.by&&(c=r.by.resolve(c,n,s),u=r.by.resolve(u,n,s)),d=l.compare(c,u,a,o),null!==d)return d;const p=typeof c;if(p!==typeof u)throw e.$_createError("array.sort.mismatching",t,null,n,s);if("number"!==p&&"string"!==p)throw e.$_createError("array.sort.unsupported",t,{type:p},n,s);return"number"===p?(c-u)*i:c{const n=r(40),s=r(74),i=r(64),a=r(80),o={isBool:function(e){return"boolean"==typeof e}};e.exports=s._extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null},truthy:{init:null}},coerce(e,{schema:t}){if("boolean"!=typeof e){if("string"==typeof e){const r=t._flags.sensitive?e:e.toLowerCase();e="true"===r||"false"!==r&&e}return"boolean"!=typeof e&&(e=t.$_terms.truthy&&t.$_terms.truthy.has(e,null,null,!t._flags.sensitive)||(!t.$_terms.falsy||!t.$_terms.falsy.has(e,null,null,!t._flags.sensitive))&&e),{value:e}}},validate(e,{error:t}){if("boolean"!=typeof e)return{value:e,errors:t("boolean.base")}},rules:{truthy:{method(...e){i.verifyFlat(e,"truthy");const t=this.clone();t.$_terms.truthy=t.$_terms.truthy||new a;for(let r=0;re?1:0},string:{from:o.isBool,to:(e,t)=>e?"true":"false"}},messages:{"boolean.base":"{{#label}} must be a boolean"}})},(e,t,r)=>{const n=r(40),s=r(74),i=r(64),a=r(68),o={isDate:function(e){return e instanceof Date}};e.exports=s._extend({type:"date",coerce:{from:["number","string"],method:(e,{schema:t})=>({value:o.parse(e,t._flags.format)||e})},validate(e,{schema:t,error:r,prefs:n}){if(e instanceof Date&&!isNaN(e.getTime()))return;const s=t._flags.format;return n.convert&&s&&"string"==typeof e?{value:e,errors:r("date.format",{format:s})}:{value:e,errors:r("date.base")}},rules:{compare:{method:!1,validate(e,t,{date:r},{name:n,operator:s,args:a}){const o="now"===r?Date.now():r.getTime();return i.compare(e.getTime(),o,s)?e:t.error("date."+n,{limit:a.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:o.parse(e),assert:e=>null!==e,message:"must have a valid date format"}]},format:{method(e){return n(["iso","javascript","unix"].includes(e),"Unknown date format",e),this.$_setFlag("format",e)}},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{date:e},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{date:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{date:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{date:e},operator:">="})}},timestamp:{method(e="javascript"){return n(["javascript","unix"].includes(e),'"type" must be one of "javascript, unix"'),this.format(e)}}},cast:{number:{from:o.isDate,to:(e,t)=>e.getTime()},string:{from:o.isDate,to:(e,{prefs:t})=>a.date(e,t)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":"{{#label}} must be in {{#format}} format","date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}"}}),o.parse=function(e,t){if(e instanceof Date)return e;if("string"!=typeof e&&(isNaN(e)||!isFinite(e)))return null;if(/^\s*$/.test(e))return null;if("iso"===t)return i.isIsoDate(e)?o.date(e.toString()):null;const r=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return o.date(1*e);if("unix"===t)return o.date(1e3*e);if("string"==typeof r)return null}return o.date(e)},o.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t}},(e,t,r)=>{const n=r(40),s=r(85);e.exports=s._extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(e){return n(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:e}})},validate:(e,t,{n:r})=>e.length===r?e:t.error("function.arity",{n:r})},class:{method(){return this.$_addRule("class")},validate:(e,t)=>/^\s*class\s/.test(e.toString())?e:t.error("function.class",{value:e})},minArity:{method(e){return n(Number.isSafeInteger(e)&&e>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:e}})},validate:(e,t,{n:r})=>e.length>=r?e:t.error("function.minArity",{n:r})},maxArity:{method(e){return n(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:e}})},validate:(e,t,{n:r})=>e.length<=r?e:t.error("function.maxArity",{n:r})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},(e,t,r)=>{const n=r(39),s=r(40),i=r(43),a=r(86),o=r(74),c=r(64),l=r(70),u=r(71),d=r(69),p={renameDefaults:{alias:!1,multiple:!1,override:!1}};e.exports=o._extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:!1}},terms:{dependencies:{init:null},keys:{init:null},patterns:{init:null},renames:{init:null}},args:(e,t)=>e.keys(t),validate(e,{schema:t,error:r,state:n,prefs:s}){if(!e||typeof e!==t.$_property("typeof")||Array.isArray(e))return{value:e,errors:r("object.base",{type:t.$_property("typeof")})};if(!(t.$_terms.renames||t.$_terms.dependencies||t.$_terms.keys||t.$_terms.patterns))return;e=p.clone(e,s);const i=[];if(t.$_terms.renames&&!p.rename(t,e,n,s,i))return{value:e,errors:i};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:i};const a=new Set(Object.keys(e));if(t.$_terms.keys){const r=[e,...n.ancestors];for(const o of t.$_terms.keys){const t=o.key,c=e[t];a.delete(t);const l=n.localize([...n.path,t],r,o),u=o.schema.$_validate(c,l,s);if(u.errors){if(s.abortEarly)return{value:e,errors:u.errors};i.push(...u.errors)}else"strip"===o.schema._flags.result||void 0===u.value&&void 0!==c?delete e[t]:void 0!==u.value&&(e[t]=u.value)}}if(a.size||t._flags._hasPatternMatch){const r=p.unknown(t,e,a,i,n,s);if(r)return r}if(t.$_terms.dependencies)for(const r of t.$_terms.dependencies){if(r.key&&void 0===r.key.resolve(e,n,s,null,{shadow:!1}))continue;const a=p.dependencies[r.rel](t,r,e,n,s);if(a){const r=t.$_createError(a.code,e,a.context,n,s);if(s.abortEarly)return{value:e,errors:r};i.push(r)}}return{value:e,errors:i}},rules:{and:{method(...e){return c.verifyFlat(e,"and"),p.dependency(this,"and",null,e)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,t,r){e=l.ref(e),s(void 0===r||"string"==typeof r,"Message must be a string"),t=this.$_compile(t,{appendPath:!0});const n=this.$_addRule({name:"assert",args:{subject:e,schema:t,message:r}});return n.$_mutateRegister(e),n.$_mutateRegister(t),n},validate(e,{error:t,prefs:r,state:n},{subject:s,schema:i,message:a}){const o=s.resolve(e,n,r),c=s.absolute(n);return i.$_match(o,n.localize(c,[e,...n.ancestors],i),r)?e:t("object.assert",{subject:s,message:a})},args:["subject","schema","message"],multi:!0},instance:{method(e,t){return s("function"==typeof e,"constructor must be a function"),t=t||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:t}})},validate:(e,t,{constructor:r,name:n})=>e instanceof r?e:t.error("object.instance",{type:n,value:e}),args:["constructor","name"]},keys:{method(e){s(void 0===e||"object"==typeof e,"Object schema must be a valid object"),s(!c.isSchema(e),"Object schema cannot be a joi schema");const t=this.clone();if(e)if(Object.keys(e).length){t.$_terms.keys=t.$_terms.keys?t.$_terms.keys.filter((t=>!e.hasOwnProperty(t.key))):new p.Keys;for(const r in e)c.tryWithPath((()=>t.$_terms.keys.push({key:r,schema:this.$_compile(e[r])})),r)}else t.$_terms.keys=new p.Keys;else t.$_terms.keys=null;return t.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:n,operator:s,args:i})=>c.compare(Object.keys(e).length,r,s)?e:t.error("object."+n,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:c.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},nand:{method(...e){return c.verifyFlat(e,"nand"),p.dependency(this,"nand",null,e)}},or:{method(...e){return c.verifyFlat(e,"or"),p.dependency(this,"or",null,e)}},oxor:{method(...e){return p.dependency(this,"oxor",null,e)}},pattern:{method(e,t,r={}){const n=e instanceof RegExp;n||(e=this.$_compile(e,{appendPath:!0})),s(void 0!==t,"Invalid rule"),c.assertOptions(r,["fallthrough","matches"]),n&&s(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),t=this.$_compile(t,{appendPath:!0});const i=this.clone();i.$_terms.patterns=i.$_terms.patterns||[];const a={[n?"regex":"schema"]:e,rule:t};return r.matches&&(a.matches=this.$_compile(r.matches),"array"!==a.matches.type&&(a.matches=a.matches.$_root.array().items(a.matches)),i.$_mutateRegister(a.matches),i.$_setFlag("_hasPatternMatch",!0,{clone:!1})),r.fallthrough&&(a.fallthrough=!0),i.$_terms.patterns.push(a),i.$_mutateRegister(t),i}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>d.isRef(e)?e:t.error("object.refType",{value:e})},regex:{method(){return this.$_addRule("regex")},validate:(e,t)=>e instanceof RegExp?e:t.error("object.regex",{value:e})},rename:{method(e,t,r={}){s("string"==typeof e||e instanceof RegExp,"Rename missing the from argument"),s("string"==typeof t,"Invalid rename to argument"),s(t!==e,"Cannot rename key to same name:",e),c.assertOptions(r,["alias","ignoreUndefined","override","multiple"]);const i=this.clone();i.$_terms.renames=i.$_terms.renames||[];for(const t of i.$_terms.renames)s(t.from!==e,"Cannot rename the same key multiple times");return i.$_terms.renames.push({from:e,to:t,options:n(p.renameDefaults,r)}),i}},schema:{method(e="any"){return this.$_addRule({name:"schema",args:{type:e}})},validate:(e,t,{type:r})=>!c.isSchema(e)||"any"!==r&&e.type!==r?t.error("object.schema",{type:r}):e},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t,r={}){return p.dependency(this,"with",e,t,r)}},without:{method(e,t,r={}){return p.dependency(this,"without",e,t,r)}},xor:{method(...e){return c.verifyFlat(e,"xor"),p.dependency(this,"xor",null,e)}}},overrides:{default(e,t){return void 0===e&&(e=c.symbols.deepDefault),this.$_parent("default",e,t)}},rebuild(e){if(e.$_terms.keys){const t=new a.Sorter;for(const r of e.$_terms.keys)c.tryWithPath((()=>t.add(r,{after:r.schema.$_rootReferences(),group:r.key})),r.key);e.$_terms.keys=new p.Keys(...t.nodes)}},messages:{"object.and":"{{#label}} contains {{#present}} without its required peers {{#missing}}","object.assert":"{{#label}} is invalid because it failed to pass the assertion test","object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":"{{#label}} must have {{#limit}} keys","object.max":"{{#label}} must have less than or equal to {{#limit}} keys","object.min":"{{#label}} must have at least {{#limit}} keys","object.missing":"{{#label}} must contain at least one of {{#peers}}","object.nand":"{{:#main}} must not exist simultaneously with {{#peers}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peers}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#main}} missing required peer {{:#peer}}","object.without":"{{:#main}} conflict with forbidden peer {{:#peer}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peers}}"}}),p.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return i(e,{shallow:!0});const r=Object.create(Object.getPrototypeOf(e));return Object.assign(r,e),r}const r=function(...t){return e.apply(this,t)};return r.prototype=i(e.prototype),Object.defineProperty(r,"name",{value:e.name,writable:!1}),Object.defineProperty(r,"length",{value:e.length,writable:!1}),Object.assign(r,e),r},p.dependency=function(e,t,r,n,i){s(null===r||"string"==typeof r,t,"key must be a strings"),i||(i=n.length>1&&"object"==typeof n[n.length-1]?n.pop():{}),c.assertOptions(i,["separator"]),n=[].concat(n);const a=c.default(i.separator,"."),o=[];for(const e of n)s("string"==typeof e,t,"peers must be a string or a reference"),o.push(l.ref(e,{separator:a,ancestor:0,prefix:!1}));null!==r&&(r=l.ref(r,{separator:a,ancestor:0,prefix:!1}));const u=e.clone();return u.$_terms.dependencies=u.$_terms.dependencies||[],u.$_terms.dependencies.push(new p.Dependency(t,r,o,n)),u},p.dependencies={and(e,t,r,n,s){const i=[],a=[],o=t.peers.length;for(const e of t.peers)void 0===e.resolve(r,n,s,null,{shadow:!1})?i.push(e.key):a.push(e.key);if(i.length!==o&&a.length!==o)return{code:"object.and",context:{present:a,missing:i}}},nand(e,t,r,n,s){const i=[];for(const e of t.peers)void 0!==e.resolve(r,n,s,null,{shadow:!1})&&i.push(e.key);if(i.length!==t.peers.length)return;return{code:"object.nand",context:{main:t.paths[0],peers:t.paths.slice(1)}}},or(e,t,r,n,s){for(const e of t.peers)if(void 0!==e.resolve(r,n,s,null,{shadow:!1}))return;return{code:"object.missing",context:{peers:t.paths}}},oxor(e,t,r,n,s){const i=[];for(const e of t.peers)void 0!==e.resolve(r,n,s,null,{shadow:!1})&&i.push(e.key);if(!i.length||1===i.length)return;const a={peers:t.paths};return a.present=i,{code:"object.oxor",context:a}},with(e,t,r,n,s){for(const e of t.peers)if(void 0===e.resolve(r,n,s,null,{shadow:!1}))return{code:"object.with",context:{main:t.key.key,peer:e.key}}},without(e,t,r,n,s){for(const e of t.peers)if(void 0!==e.resolve(r,n,s,null,{shadow:!1}))return{code:"object.without",context:{main:t.key.key,peer:e.key}}},xor(e,t,r,n,s){const i=[];for(const e of t.peers)void 0!==e.resolve(r,n,s,null,{shadow:!1})&&i.push(e.key);if(1===i.length)return;const a={peers:t.paths};return 0===i.length?{code:"object.missing",context:a}:(a.present=i,{code:"object.xor",context:a})}},p.rename=function(e,t,r,n,s){const i={};for(const a of e.$_terms.renames){const o=[],c="string"!=typeof a.from;if(c)for(const e in t){if(void 0===t[e]&&a.options.ignoreUndefined)continue;if(e===a.to)continue;const r=a.from.exec(e);r&&o.push({from:e,to:a.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,a.from)||void 0===t[a.from]&&a.options.ignoreUndefined||o.push(a);for(const l of o){const o=l.from,u=l.to;if(!a.options.multiple&&i[u]&&(s.push(e.$_createError("object.rename.multiple",t,{from:o,to:u,pattern:c},r,n)),n.abortEarly))return!1;if(Object.prototype.hasOwnProperty.call(t,u)&&!a.options.override&&!i[u]&&(s.push(e.$_createError("object.rename.override",t,{from:o,to:u,pattern:c},r,n)),n.abortEarly))return!1;void 0===t[o]?delete t[u]:t[u]=t[o],i[u]=!0,a.options.alias||delete t[o]}}return!0},p.unknown=function(e,t,r,n,s,i){if(e.$_terms.patterns){let a=!1;const o=e.$_terms.patterns.map((e=>{if(e.matches)return a=!0,[]})),c=[t,...s.ancestors];for(const a of r){const l=t[a],u=[...s.path,a];for(let d=0;d{const{assert:n}=r(38),s={};t.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(e,t){const r=[].concat((t=t??{}).before??[]),s=[].concat(t.after??[]),i=t.group??"?",a=t.sort??0;n(!r.includes(i),`Item cannot come before itself: ${i}`),n(!r.includes("?"),"Item cannot come before unassociated items"),n(!s.includes(i),`Item cannot come after itself: ${i}`),n(!s.includes("?"),"Item cannot come after unassociated items"),Array.isArray(e)||(e=[e]);for(const t of e){const e={seq:this._items.length,sort:a,before:r,after:s,group:i,node:t};this._items.push(e)}if(!t.manual){const e=this._sort();n(e,"item","?"!==i?`added into group ${i}`:"","created a dependencies error")}return this.nodes}merge(e){Array.isArray(e)||(e=[e]);for(const t of e)if(t)for(const e of t._items)this._items.push(Object.assign({},e));this._items.sort(s.mergeSort);for(let e=0;ee.sort===t.sort?0:e.sort{const n=r(40),s=r(74),i=r(64),a=r(70),o=r(71),c={};e.exports=s._extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,register:!1}},args:(e,t)=>e.ref(t),validate(e,{schema:t,state:r,prefs:s}){n(t.$_terms.link,"Uninitialized link schema");const i=c.generate(t,e,r,s),a=t.$_terms.link[0].ref;return i.$_validate(e,r.nest(i,`link:${a.display}:${i.type}`),s)},generate:(e,t,r,n)=>c.generate(e,t,r,n),rules:{ref:{method(e){n(!this.$_terms.link,"Cannot reinitialize schema"),e=a.ref(e),n("value"===e.type||"local"===e.type,"Invalid reference type:",e.type),n("local"===e.type||"root"===e.ancestor||e.ancestor>0,"Link cannot reference itself");const t=this.clone();return t.$_terms.link=[{ref:e}],t}},relative:{method(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(e){n(this.$_terms.link,"Uninitialized link schema"),n(i.isSchema(e),"Invalid schema object"),n("link"!==e.type,"Cannot merge type link with another link");const t=this.clone();return t.$_terms.whens||(t.$_terms.whens=[]),t.$_terms.whens.push({concat:e}),t.$_mutateRebuild()}}}),c.generate=function(e,t,r,n){let s=r.mainstay.links.get(e);if(s)return s._generate(t,r,n).schema;const i=e.$_terms.link[0].ref,{perspective:a,path:o}=c.perspective(i,r);c.assert(a,"which is outside of schema boundaries",i,e,r,n);try{s=o.length?a.$_reach(o):a}catch(t){c.assert(!1,"to non-existing schema",i,e,r,n)}return c.assert("link"!==s.type,"which is another link",i,e,r,n),e._flags.relative||r.mainstay.links.set(e,s),s._generate(t,r,n).schema},c.perspective=function(e,t){if("local"===e.type){for(const{schema:r,key:n}of t.schemas){if((r._flags.id||n)===e.path[0])return{perspective:r,path:e.path.slice(1)};if(r.$_terms.shared)for(const t of r.$_terms.shared)if(t._flags.id===e.path[0])return{perspective:t,path:e.path.slice(1)}}return{perspective:null,path:null}}return"root"===e.ancestor?{perspective:t.schemas[t.schemas.length-1].schema,path:e.path}:{perspective:t.schemas[e.ancestor]&&t.schemas[e.ancestor].schema,path:e.path}},c.assert=function(e,t,r,s,i,a){e||n(!1,`"${o.label(s._flags,i,a)}" contains link reference "${r.display}" ${t}`)}},(e,t,r)=>{const n=r(40),s=r(74),i=r(64),a={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/};e.exports=s._extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:r}){const n=e.match(a.numberRx);if(!n)return;e=e.trim();const s={value:parseFloat(e)};if(0===s.value&&(s.value=0),!t._flags.unsafe)if(e.match(/e/i)){if(a.normalizeExponent(`${s.value/Math.pow(10,n[1])}e${n[1]}`)!==a.normalizeExponent(e))return s.errors=r("number.unsafe"),s}else{const t=s.value.toString();if(t.match(/e/i))return s;if(t!==a.normalizeDecimal(e))return s.errors=r("number.unsafe"),s}return s}},validate(e,{schema:t,error:r,prefs:n}){if(e===1/0||e===-1/0)return{value:e,errors:r("number.infinity")};if(!i.isNumber(e))return{value:e,errors:r("number.base")};const s={value:e};if(n.convert){const e=t.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);s.value=Math.round(s.value*t)/t}}return 0===s.value&&(s.value=0),!t._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||ei.compare(e,r,s)?e:t.error("number."+n,{limit:a.limit,value:e}),args:[{name:"limit",ref:!0,assert:i.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){return this.$_addRule({name:"multiple",args:{base:e}})},validate:(e,t,{base:r},n)=>e%r==0?e:t.error("number.multiple",{multiple:n.args.base,value:e}),args:[{name:"base",ref:!0,assert:e=>"number"==typeof e&&isFinite(e)&&e>0,message:"must be a positive number"}],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,t)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:t.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(e){return n(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,t,{limit:r}){const n=e.toString().match(a.precisionRx);return Math.max((n[1]?n[1].length:0)-(n[2]?parseInt(n[2],10):0),0)<=r?e:t.error("number.precision",{limit:r,value:e})},convert:!0},sign:{method(e){return n(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate:(e,t,{sign:r})=>"negative"===r&&e<0||"positive"===r&&e>0?e:t.error(`number.${r}`)},unsafe:{method(e=!0){return n("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("unsafe",e)}}},cast:{string:{from:e=>"number"==typeof e,to:(e,t)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),a.normalizeExponent=function(e){return e.replace(/E/,"e").replace(/\.(\d*[1-9])?0+e/,".$1e").replace(/\.e/,"e").replace(/e\+/,"e").replace(/^\+/,"").replace(/^(-?)0+([1-9])/,"$1$2")},a.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0+$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([1-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e}},(e,t,r)=>{const n=r(85);e.exports=n._extend({type:"object",cast:{map:{from:e=>e&&"object"==typeof e,to:(e,t)=>new Map(Object.entries(e))}}})},(e,t,r)=>{var n=r(21).Buffer;const s=r(8),i=r(40),a=r(53),o=r(74),c=r(64),l={base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:/^[a-f0-9]+$/i,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"],domainControlRx:/[\x00-\x20@\:\/]/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,finalSegmentAdditionalRx:/[^0-9]/};e.exports=o._extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,{schema:t,state:r,prefs:n}){const s=t.$_getRule("normalize");s&&(e=e.normalize(s.args.form));const i=t.$_getRule("case");i&&(e="upper"===i.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const a=t.$_getRule("trim");if(a&&a.args.enabled&&(e=e.trim()),t.$_terms.replacements)for(const r of t.$_terms.replacements)e=e.replace(r.pattern,r.replacement);const o=t.$_getRule("hex");if(o&&o.args.options.byteAligned&&e.length%2!=0&&(e=`0${e}`),t.$_getRule("isoDate")){const t=l.isoDate(e);t&&(e=t)}if(t._flags.truncate){const s=t.$_getRule("max");if(s){let i=s.args.limit;if(c.isResolvable(i)&&(i=i.resolve(e,r,n),!c.limit(i)))return{value:e,errors:t.$_createError("any.ref",i,{ref:s.args.limit,arg:"limit",reason:"must be a positive integer"},r,n)};e=e.slice(0,i)}}return{value:e}}},validate:(e,{error:t})=>"string"!=typeof e?{value:e,errors:t("string.base")}:""===e?{value:e,errors:t("string.empty")}:void 0,rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(e,t)=>/^[a-zA-Z0-9]+$/.test(e)?e:t.error("string.alphanum")},base64:{method(e={}){return c.assertOptions(e,["paddingRequired","urlSafe"]),e={urlSafe:!1,paddingRequired:!0,...e},i("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),i("boolean"==typeof e.urlSafe,"urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:e}})},validate:(e,t,{options:r})=>l.base64Regex[r.paddingRequired][r.urlSafe].test(e)?e:t.error("string.base64")},case:{method(e){return i(["lower","upper"].includes(e),"Invalid case:",e),this.$_addRule({name:"case",args:{direction:e}})},validate:(e,t,{direction:r})=>"lower"===r&&e===e.toLocaleLowerCase()||"upper"===r&&e===e.toLocaleUpperCase()?e:t.error(`string.${r}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let r=e.length,n=0,s=1;for(;r--;){const t=e.charAt(r)*s;n+=t-9*(t>9),s^=3}return n>0&&n%10==0?e:t.error("string.creditCard")}},dataUri:{method(e={}){return c.assertOptions(e,["paddingRequired"]),e={paddingRequired:!0,...e},i("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:e}})},validate(e,t,{options:r}){const n=e.match(l.dataUriRegex);if(n){if(!n[2])return e;if("base64"!==n[2])return e;if(l.base64Regex[r.paddingRequired].false.test(n[3]))return e}return t.error("string.dataUri")}},guid:{alias:"uuid",method(e={}){c.assertOptions(e,["version","separator"]);let t="";if(e.version){const r=[].concat(e.version);i(r.length>=1,"version must have at least 1 valid version specified");const n=new Set;for(let e=0;el.hexRegex.test(e)?r.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(e,t)=>l.isDomainValid(e)||l.ipRegex.test(e)?e:t.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},isoDate:{method(){return this.$_addRule("isoDate")},validate:(e,{error:t})=>l.isoDate(e)?e:t("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>l.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return l.length(this,"length",e,"=",t)},validate(e,t,{limit:r,encoding:s},{name:i,operator:a,args:o}){const l=s?n&&n.byteLength(e,s):e.length;return c.compare(l,r,a)?e:t.error("string."+i,{limit:o.limit,value:e,encoding:s})},args:[{name:"limit",ref:!0,assert:c.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return l.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return l.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(e="NFC"){return i(l.normalizationForms.includes(e),"normalization form must be one of "+l.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:e}})},validate:(e,{error:t},{form:r})=>e===e.normalize(r)?e:t("string.normalize",{value:e,form:r}),convert:!0},pattern:{alias:"regex",method(e,t={}){i(e instanceof RegExp,"regex must be a RegExp"),i(!e.flags.includes("g")&&!e.flags.includes("y"),"regex should not use global or sticky mode"),"string"==typeof t&&(t={name:t}),c.assertOptions(t,["invert","name"]);const r=["string.pattern",t.invert?".invert":"",t.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:e,options:t},errorCode:r})},validate:(e,t,{regex:r,options:n},{errorCode:s})=>r.test(e)^n.invert?e:t.error(s,{name:n.name,regex:r,value:e}),args:["regex","options"],multi:!0},replace:{method(e,t){"string"==typeof e&&(e=new RegExp(a(e),"g")),i(e instanceof RegExp,"pattern must be a RegExp"),i("string"==typeof t,"replacement must be a String");const r=this.clone();return r.$_terms.replacements||(r.$_terms.replacements=[]),r.$_terms.replacements.push({pattern:e,replacement:t}),r}},token:{method(){return this.$_addRule("token")},validate:(e,t)=>/^\w+$/.test(e)?e:t.error("string.token")},trim:{method(e=!0){return i("boolean"==typeof e,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:e}})},validate:(e,t,{enabled:r})=>r&&e!==e.trim()?t.error("string.trim"):e,convert:!0},truncate:{method(e=!0){return i("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("truncate",e)}},uppercase:{method(){return this.case("upper")}}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:.} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:.} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:.} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:.} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uppercase":"{{#label}} must only contain uppercase characters"}}),l.isoDate=function(e){if(!c.isIsoDate(e))return null;const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},l.length=function(e,t,r,s,a){return i(!a||n&&n.isEncoding(a),"Invalid encoding:",a),e.$_addRule({name:t,method:"length",args:{limit:r,encoding:a},operator:s})},l.rfc3986=function(){const e={},t="[\\dA-Fa-f]",r="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4="(?:"+r+"\\.){3}"+r;const n=t+"{1,4}",s="(?:"+n+":"+n+"|"+e.ipv4+")",i="(?:"+n+":){6}"+s,a="::(?:"+n+":){5}"+s,o="(?:"+n+")?::(?:"+n+":){4}"+s,c="(?:(?:"+n+":){0,1}"+n+")?::(?:"+n+":){3}"+s,l="(?:(?:"+n+":){0,2}"+n+")?::(?:"+n+":){2}"+s,u="(?:(?:"+n+":){0,3}"+n+")?::"+n+":"+s,d="(?:(?:"+n+":){0,4}"+n+")?::"+s,p="(?:(?:"+n+":){0,5}"+n+")?::"+n,h="(?:(?:"+n+":){0,6}"+n+")?::";return e.v4Cidr="(?:\\d|[1-2]\\d|3[0-2])",e.v6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",e.ipv6="(?:"+i+"|"+a+"|"+o+"|"+c+"|"+l+"|"+u+"|"+d+"|"+p+"|"+h+")",e.ipvfuture="v"+t+"+\\.[\\w-\\.~!\\$&'\\(\\)\\*\\+,;=:]+",e},l.ipRegex=function(){const e=l.rfc3986(),t=`(?:${["ipv4","ipv6","ipvfuture"].map((t=>{const r=`\\/${"ipv4"===t?e.v4Cidr:e.v6Cidr}`;return`${e[t]}(?:${r})?`})).join("|")})`;return new RegExp(`^${t}$`)}(),l.isDomainValid=function(e){if(e.length>256)return!1;if(e=e.normalize("NFC"),l.domainControlRx.test(e))return!1;const t=(e=l.punycode(e)).split(".");for(let e=0;e63)return!1;if(!l.domainSegmentRx.test(r))return!1;if(e===t.length-1&&!l.finalSegmentAdditionalRx.test(r))return!1}return!0},l.punycode=function(e){try{return new s.URL(`http://${e}`).host}catch(t){return e}}},(e,t,r)=>{const n=r(40),s=r(74),i={};i.Map=class extends Map{slice(){return new i.Map(this)}},e.exports=s._extend({type:"symbol",terms:{map:{init:new i.Map}},coerce:{method(e,{schema:t,error:r}){const n=t.$_terms.map.get(e);return n&&(e=n),t._flags.only&&"symbol"!=typeof e?{value:e,errors:r("symbol.map",{map:t.$_terms.map})}:{value:e}}},validate(e,{error:t}){if("symbol"!=typeof e)return{value:e,errors:t("symbol.base")}},rules:{map:{method(e){e&&!e[Symbol.iterator]&&"object"==typeof e&&(e=Object.entries(e)),n(e&&e[Symbol.iterator],"Iterable must be an iterable or object");const t=this.clone(),r=[];for(const s of e){n(s&&s[Symbol.iterator],"Entry must be an iterable");const[e,i]=s;n("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),n("symbol"==typeof i,"Value must be a Symbol"),t.$_terms.map.set(e,i),r.push(i)}return t.valid(...r)}}},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},(e,t,r)=>{var n=r(21).Buffer;const s=r(40),i=r(74),a=r(64);e.exports=i._extend({type:"binary",coerce:{from:"string",method(e,{schema:t}){try{return{value:n.from(e,t._flags.encoding)}}catch(e){}}},validate(e,{error:t}){if(!n.isBuffer(e))return{value:e,errors:t("binary.base")}},rules:{encoding:{method(e){return s(n.isEncoding(e),"Invalid encoding:",e),this.$_setFlag("encoding",e)}},length:{method(e){return this.$_addRule({name:"length",method:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:n,operator:s,args:i})=>a.compare(e.length,r,s)?e:t.error("binary."+n,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:a.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}}},cast:{string:{from:e=>n.isBuffer(e),to:(e,t)=>e.toString()}},messages:{"binary.base":"{{#label}} must be a buffer or a string","binary.length":"{{#label}} must be {{#limit}} bytes","binary.max":"{{#label}} must be less than or equal to {{#limit}} bytes","binary.min":"{{#label}} must be at least {{#limit}} bytes"}})},(e,t,r)=>{const n=r(26),s=r(2),i=r(94),a=r(38),o=r(63),c=r(96),l=r(105),u={};u.schema=o.object({path:o.alternatives(o.array().items(o.string()).single(),o.func()).required(),index:o.alternatives(o.boolean(),o.array().items(o.string()).single()).default(!0),listing:o.boolean(),showHidden:o.boolean(),redirectToSlash:o.boolean(),lookupCompressed:o.boolean(),lookupMap:o.object().min(1).pattern(/.+/,o.string()),etagMethod:o.string().valid("hash","simple").allow(!1),defaultExtension:o.string().alphanum()}),u.resolvePathOption=function(e){if(e instanceof Error)throw e;if("string"==typeof e)return[e];if(Array.isArray(e))return e;throw s.internal("Invalid path function")},t.handler=function(e,t){const r=o.attempt(t,u.schema,"Invalid directory handler options ("+e.path+")");a.assert("}"===e.path[e.path.length-1],"The route path for a directory handler must end with a parameter:",e.path);const l=/\w+/.exec(e.path.slice(e.path.lastIndexOf("{")))[0],d=e.settings.files.relativeTo,p=Array.isArray(r.path)?r.path:null,h=!0===r.index?["index.html"]:r.index||[];return async(e,t)=>{const a=p??u.resolvePathOption(r.path.call(null,e)),o=e.params[l]??"";if(n.isAbsolute(o))throw s.notFound(null,{});if(o&&!r.showHidden&&u.isFileHidden(o))throw s.notFound(null,{});o||!e.server.settings.router.stripTrailingSlash&&e.path.endsWith("/")||(e.path+="/");const f=e.path,m=f.endsWith("/"),g={confine:null,lookupCompressed:r.lookupCompressed,lookupMap:r.lookupMap,etagMethod:r.etagMethod},y=async a=>{g.confine=a;let l,p=o;try{return await c.load(p,e,g)}catch(e){i.ignore(e,"boom"),l=e}if(u.isNotFound(l)){if(!r.defaultExtension)throw l;return m&&(p=p.slice(0,-1)),await c.load(p+"."+r.defaultExtension,e,g)}if(u.isDirectory(l)){if(!1!==r.redirectToSlash&&!e.server.settings.router.stripTrailingSlash&&!m)return t.redirect(f+"/");for(const t of h){const r=n.join(p,t);try{return await c.load(r,e,g)}catch(e){if(i.ignore(e,"boom"),!u.isNotFound(e))throw s.internal(t+" is a directory",e)}}if(r.listing)return u.generateListing(n.join(d,a,p),f,o,m,r,e)}throw l};for(let e=0;e

Directory: "+p+"

    ";if(r){const e=t.substring(0,t.lastIndexOf("/",t.length-(n?2:1)))+"/";h=h+'
  • Parent Directory
  • '}for(const e of d)!o.showHidden&&u.isFileHidden(e)||(h=h+'
  • '+a.escapeHtml(e)+"
  • ");return h+="
",c.generateResponse(h)},u.isFileHidden=function(e){return/(^|[\\\/])\.([^.\\\/]|\.[^\\\/])/.test(e)},u.pathEncode=function(e){return encodeURIComponent(e).replace(/%2F/g,"/").replace(/%5C/g,"\\")},u.isNotFound=function(e){return 404===e.output.statusCode},u.isDirectory=function(e){return 403===e.output.statusCode&&"EISDIR"===e.data.code}},(e,t,r)=>{const n=r(95),s=r(2),i=r(38),a={system:[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,n.AssertionError,i.Error]};t.rethrow=function(e,t,r={}){return a.catch(e,t,r,!0)},t.ignore=function(e,t,r={}){return a.catch(e,t,r,!1)},a.catch=function(e,t,r,n){if(a.match(e,t)===n){if(r.override&&(e=r.override),r.decorate&&Object.assign(e,r.decorate),r.return)return e;throw e}},t.background=async function(e,r="rethrow",n="system",s={}){try{"function"==typeof e?await e():await e}catch(e){t[r](e,n,s)}},t.isBoom=function(e){return s.isBoom(e)},t.isError=function(e){return e instanceof Error},t.isSystem=function(e){if(!e)return!1;if(e.isBoom)return!1;for(const t of a.system)if(e instanceof t)return!0;return!1},a.rules={system:t.isSystem,boom:t.isBoom},a.match=function(e,t){if(!t)return!0;t=Array.isArray(t)?t:[t];for(const r of t)if("string"==typeof r){if(a.rules[r](e))return!0}else if("object"==typeof r){if(i.contain(e,r,{deep:!0,part:!0}))return!0}else if(e instanceof r)return!0;return!1}},e=>{e.exports=require("assert")},(e,t,r)=>{const n=r(26),s=r(97),i=r(2),a=r(94),o=r(38),c=r(63),l=r(99),u=r(105),d={defaultMap:{gzip:".gz"}};d.schema=c.alternatives([c.string(),c.func(),c.object({path:c.alternatives(c.string(),c.func()).required(),confine:c.alternatives(c.string(),c.boolean()).default(!0),filename:c.string(),mode:c.string().valid("attachment","inline").allow(!1),lookupCompressed:c.boolean(),lookupMap:c.object().min(1).pattern(/.+/,c.string()),etagMethod:c.string().valid("hash","simple").allow(!1),start:c.number().integer().min(0).default(0),end:c.number().integer().min(c.ref("start"))}).with("filename","mode")]),t.handler=function(e,r){let n=c.attempt(r,d.schema,"Invalid file handler options ("+e.path+")");n="object"!=typeof r?{path:r,confine:"."}:n,n.confine=!0===n.confine?".":n.confine,o.assert("string"!=typeof n.path||"/"!==n.path[n.path.length-1],"File path cannot end with a '/':",e.path);return e=>{const r="function"==typeof n.path?n.path(e):n.path;return t.response(r,n,e)}},t.load=function(e,r,n){const s=t.response(e,n,r,!0);return d.prepare(s)},t.response=function(e,t,r,s){if(o.assert(!t.mode||-1!==["attachment","inline"].indexOf(t.mode),"options.mode must be either false, attachment, or inline"),t.confine){const s=n.resolve(r.route.settings.files.relativeTo,t.confine);0!==(e=n.isAbsolute(e)?n.normalize(e):n.join(s,e)).lastIndexOf(s,0)&&(e=null)}else e=n.isAbsolute(e)?n.normalize(e):n.join(r.route.settings.files.relativeTo,e);const i={path:e,settings:t,stat:null,file:null},a=s?null:d.prepare;return r.generateResponse(i,{variety:"file",marshal:d.marshal,prepare:a,close:d.close})},d.prepare=async function(e){const{request:t,source:r}=e,{settings:s,path:a}=r;if(null===a)throw i.forbidden(null,{code:"EACCES"});const o=r.file=new u.File(a);try{const r=await o.openStat("r"),i=s.start??0;if(void 0!==s.end?e.bytes(s.end-i+1):e.bytes(r.size-i),e.headers["content-type"]||e.type(t.server.mime.path(a).type??"application/octet-stream"),e.header("last-modified",r.mtime.toUTCString()),s.mode){const t=s.filename??n.basename(a);e.header("content-disposition",s.mode+"; filename="+encodeURIComponent(t))}return await l.apply(e,r),e}catch(t){throw d.close(e),t}},d.marshal=async function(e){const{request:t,source:r}=e,{settings:n}=r;if(n.lookupCompressed&&!n.start&&void 0===n.end&&!1!==t.server.settings.compression){const i=n.lookupMap??d.defaultMap,o=t.info.acceptEncoding,c=i.hasOwnProperty(o)?i[o]:null;if(c){const t=new u.File(`${r.path}${c}`);try{var s=await t.openStat("r")}catch(e){t.close(),a.ignore(e,"boom")}s&&(r.file.close(),r.file=t,e.bytes(s.size),e.header("content-encoding",o),e.vary("accept-encoding"))}}return d.createStream(e)},d.addContentRange=function(e){const{request:t}=e;let r=null;if(t.route.settings.response.ranges){const n=e.headers["content-length"];if(t.headers.range&&n&&(!t.headers["if-range"]||t.headers["if-range"]===e.headers.etag)){const a=t.server.mime.type(e.headers["content-type"]||"application/octet-stream"),o=t.server.settings.compression&&a.compressible&&!e.headers["content-encoding"]?t.info.acceptEncoding:null;if("identity"===o||!o){const a=s.header(t.headers.range,n);if(!a){const e=i.rangeNotSatisfiable();throw e.output.headers["content-range"]="bytes */"+n,e}1===a.length&&(r=a[0],e.code(206),e.bytes(r.to-r.from+1),e.header("content-range","bytes "+r.from+"-"+r.to+"/"+n))}}e.header("accept-ranges","bytes")}return r},d.createStream=function(e){const{settings:t,file:r}=e.source;o.assert(null!==r);const n=d.addContentRange(e),s={start:t.start??0,end:t.end};return n&&(s.end=n.to+s.start,s.start=n.from+s.start),r.createReadStream(s)},d.close=function(e){const{source:t}=e;null!==t.file&&(t.file.close(),t.file=null)}},(e,t,r)=>{const n=r(98),s=r(38),i={headerRx:/^bytes=[\s,]*((?:(?:\d+\-\d*)|(?:\-\d+))(?:\s*,\s*(?:(?:\d+\-\d*)|(?:\-\d+)))*)$/i};t.header=function(e,t){const r=i.headerRx.exec(e);if(!r)return null;const n=t-1,s=[],a=r[1].match(/\d*\-\d*/g);for(let e of a){let r,a;if(e=e.split("-"),e[0]&&(r=parseInt(e[0],10)),e[1]?(a=parseInt(e[1],10),void 0!==r?a>n&&(a=n):(r=t-a,a=n)):a=n,r>a)return null;s.push(new i.Range(r,a))}if(1===s.length)return s;s.sort(((e,t)=>e.from-t.from));const o=[];for(let e=s.length-1;e>0;--e){const t=s[e],r=s[e-1];t.from<=r.to+1?r.to=t.to:o.unshift(t)}return o.unshift(s[0]),o},i.Range=class{constructor(e,t){this.from=e,this.to=t}},t.Clip=class extends n.Transform{constructor(e){if(!(e instanceof i.Range)){s.assert("object"==typeof e,'Expected "range" object');const t=e.from??0;s.assert("number"==typeof t,'"range.from" must be a number'),s.assert(t===parseInt(t,10)&&t>=0,'"range.from" must be a positive integer');const r=e.to??0;s.assert("number"==typeof r,'"range.to" must be a number'),s.assert(r===parseInt(r,10)&&r>=0,'"range.to" must be a positive integer'),s.assert(r>=t,'"range.to" must be greater than or equal to "range.from"'),e=new i.Range(t,r)}super(),this._range=e,this._next=0,this._pipes=new Set,this.on("pipe",(e=>this._pipes.add(e))),this.on("unpipe",(e=>this._pipes.delete(e)))}_transform(e,t,r){try{i.processChunk(this,e)}catch(e){return r(e)}return r()}_flush(e){this._pipes.clear(),e()}},i.processChunk=function(e,t){const r=e._next;if(e._next=e._next+t.length,e._next<=e._range.from)return;if(r>e._range.to){for(const t of e._pipes)t.unpipe(e);return e._pipes.clear(),void e.end()}const n=Math.max(0,e._range.from-r),s=Math.min(t.length,e._range.to-r+1);e.push(t.slice(n,s))}},e=>{e.exports=require("stream")},(e,t,r)=>{const n=r(100),s=r(98),i=r(101),a=r(2),o=r(94),c=r(102),l={pendings:new Map,streamEnd:i.promisify(s.finished),computeHashed:async function(e,t){const r=e.request.server.plugins.inert._etags;if(!r)return null;const n=[e.source.path,t.ino,t.size,t.mtime.getTime()].join("-"),s=r.get(n);if(s)return s;let i=l.pendings.get(n);if(i)return await i;return l.pendings.set(n,i=(async()=>{try{const t=await l.hashFile(e);return r.set(n,t),t}finally{l.pendings.delete(n)}})()),await i},hashFile:async function(e){const t=n.createHash("sha1");t.setEncoding("hex");const r=e.source.file.createReadStream({autoClose:!1});r.pipe(t);try{return await l.streamEnd(r),t.read()}catch(t){throw o.rethrow(t,"system"),a.boomify(t,{message:"Failed to hash file",data:{path:e.source.path}})}},computeSimple:function(e,t){return t.size.toString(16)+"-"+t.mtime.getTime().toString(16)}};t.apply=async function(e,t){const r=e.source.settings.etagMethod;if(!1===r)return;let n;n="simple"===r?l.computeSimple(e,t):await l.computeHashed(e,t),null!==n&&e.etag(n,{vary:!0})},t.Cache=c},e=>{e.exports=require("crypto")},e=>{e.exports=require("util")},(e,t,r)=>{const n=r(103),s=Symbol("max"),i=Symbol("length"),a=Symbol("lengthCalculator"),o=Symbol("allowStale"),c=Symbol("maxAge"),l=Symbol("dispose"),u=Symbol("noDisposeOnSet"),d=Symbol("lruList"),p=Symbol("cache"),h=Symbol("updateAgeOnGet"),f=()=>1;const m=(e,t,r)=>{const n=e[p].get(t);if(n){const t=n.value;if(g(e,t)){if(_(e,n),!e[o])return}else r&&(e[h]&&(n.value.now=Date.now()),e[d].unshiftNode(n));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[c])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[c]&&r>e[c]},y=e=>{if(e[i]>e[s])for(let t=e[d].tail;e[i]>e[s]&&null!==t;){const r=t.prev;_(e,t),t=r}},_=(e,t)=>{if(t){const r=t.value;e[l]&&e[l](r.key,r.value),e[i]-=r.length,e[p].delete(r.key),e[d].removeNode(t)}};class v{constructor(e,t,r,n,s){this.key=e,this.value=t,this.length=r,this.now=n,this.maxAge=s||0}}const b=(e,t,r,n)=>{let s=r.value;g(e,s)&&(_(e,r),e[o]||(s=void 0)),s&&t.call(n,s.value,s.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[s]=e.max||1/0;const t=e.length||f;if(this[a]="function"!=typeof t?f:t,this[o]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[c]=e.maxAge||0,this[l]=e.dispose,this[u]=e.noDisposeOnSet||!1,this[h]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[s]=e||1/0,y(this)}get max(){return this[s]}set allowStale(e){this[o]=!!e}get allowStale(){return this[o]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[c]=e,y(this)}get maxAge(){return this[c]}set lengthCalculator(e){"function"!=typeof e&&(e=f),e!==this[a]&&(this[a]=e,this[i]=0,this[d].forEach((e=>{e.length=this[a](e.value,e.key),this[i]+=e.length}))),y(this)}get lengthCalculator(){return this[a]}get length(){return this[i]}get itemCount(){return this[d].length}rforEach(e,t){t=t||this;for(let r=this[d].tail;null!==r;){const n=r.prev;b(this,e,r,t),r=n}}forEach(e,t){t=t||this;for(let r=this[d].head;null!==r;){const n=r.next;b(this,e,r,t),r=n}}keys(){return this[d].toArray().map((e=>e.key))}values(){return this[d].toArray().map((e=>e.value))}reset(){this[l]&&this[d]&&this[d].length&&this[d].forEach((e=>this[l](e.key,e.value))),this[p]=new Map,this[d]=new n,this[i]=0}dump(){return this[d].map((e=>!g(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[d]}set(e,t,r){if((r=r||this[c])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,o=this[a](t,e);if(this[p].has(e)){if(o>this[s])return _(this,this[p].get(e)),!1;const a=this[p].get(e).value;return this[l]&&(this[u]||this[l](e,a.value)),a.now=n,a.maxAge=r,a.value=t,this[i]+=o-a.length,a.length=o,this.get(e),y(this),!0}const h=new v(e,t,o,n,r);return h.length>this[s]?(this[l]&&this[l](e,t),!1):(this[i]+=h.length,this[d].unshift(h),this[p].set(e,this[d].head),y(this),!0)}has(e){if(!this[p].has(e))return!1;const t=this[p].get(e).value;return!g(this,t)}get(e){return m(this,e,!0)}peek(e){return m(this,e,!1)}pop(){const e=this[d].tail;return e?(_(this,e),e.value):null}del(e){_(this,this[p].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const n=e[r],s=n.e||0;if(0===s)this.set(n.k,n.v);else{const e=s-t;e>0&&this.set(n.k,n.v,e)}}}prune(){this[p].forEach(((e,t)=>m(this,t,!1)))}}},(e,t,r)=>{function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var r=0,s=arguments.length;r1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var s=0;null!==n;s++)r=e(r,n.value,s),n=n.next;return r},n.prototype.reduceReverse=function(e,t){var r,n=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var s=this.length-1;null!==n;s--)r=e(r,n.value,s),n=n.prev;return r},n.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},n.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},n.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new n;if(tthis.length&&(t=this.length);for(var s=0,i=this.head;null!==i&&sthis.length&&(t=this.length);for(var s=this.length,i=this.tail;null!==i&&s>t;s--)i=i.prev;for(;null!==i&&s>e;s--,i=i.prev)r.push(i.value);return r},n.prototype.splice=function(e,t){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var r=0,n=this.head;null!==n&&r{e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},(e,t,r)=>{const n=r(28),s=r(101),i=r(2),a=r(94),o=r(38),c={methods:{promised:["open","close","fstat","readdir"],raw:["createReadStream"]},notFound:new Set(["ENOENT","ENOTDIR"])};t.File=class{constructor(e){this.path=e,this.fd=null}async open(e){o.assert(null===this.fd);try{this.fd=await t.open(this.path,e)}catch(e){const t={path:this.path};if(-1!==this.path.indexOf("\0")||c.notFound.has(e.code))throw i.notFound(null,t);if("EACCES"===e.code||"EPERM"===e.code)throw t.code=e.code,i.forbidden(null,t);throw i.boomify(e,{message:"Failed to open file",data:t})}}close(){null!==this.fd&&(a.background(t.close(this.fd)),this.fd=null)}async stat(){o.assert(null!==this.fd);try{const e=await t.fstat(this.fd);if(e.isDirectory())throw i.forbidden(null,{code:"EISDIR",path:this.path});return e}catch(e){throw this.close(this.fd),a.rethrow(e,["boom","system"]),i.boomify(e,{message:"Failed to stat file",data:{path:this.path}})}}async openStat(e){return await this.open(e),this.stat()}createReadStream(e){o.assert(null!==this.fd),e=Object.assign({fd:this.fd,start:0},e);const r=t.createReadStream(this.path,e);return!1!==e.autoClose&&(this.fd=null),r}};for(const e of c.methods.raw)t[e]=n[e].bind(n);for(const e of c.methods.promised)t[e]=s.promisify(n[e])},e=>{e.exports=JSON.parse('{"name":"@hapi/inert","description":"Static file and directory handlers plugin for hapi.js","version":"7.1.0","repository":"https://github.com/hapijs/inert.git","main":"lib/index.js","types":"lib/index.d.ts","files":["lib"],"keywords":["file","directory","handler","hapi","plugin"],"eslintConfig":{"extends":["plugin:@hapi/module"]},"dependencies":{"@hapi/ammo":"^6.0.1","@hapi/boom":"^10.0.1","@hapi/bounce":"^3.0.1","@hapi/hoek":"^11.0.2","@hapi/validate":"^2.0.1","lru-cache":"^7.14.1"},"devDependencies":{"@hapi/code":"^9.0.3","@hapi/eslint-plugin":"*","@hapi/file":"^3.0.0","@hapi/hapi":"^21.3.0","@hapi/lab":"^25.1.2","@types/node":"^14.18.37","joi":"^17.8.3","typescript":"^4.9.5"},"scripts":{"test":"lab -f -a @hapi/code -t 100 -L -Y","test-cov-html":"lab -f -a @hapi/code -r html -o coverage.html"},"license":"BSD-3-Clause"}')},e=>{e.exports=require("blipp@4.0.2")},e=>{e.exports=require("hapi-auth-jwt2@10.5.1")},e=>{e.exports=require("@hapi/good-console@9.0.1")},(e,t,r)=>{var n=r(21).Buffer;const s=r(40),i=r(43),a=r(111),o=r(112),c=r(121),l=r(118),u=r(122),d=r(123),p=r(120),h=r(116),f=r(124);let m;const g={types:{alternatives:r(126),any:r(127),array:r(133),boolean:r(134),date:r(135),function:r(136),link:r(138),number:r(139),object:r(140),string:r(141),symbol:r(148)},aliases:{alt:"alternatives",bool:"boolean",func:"function"}};n&&(g.types.binary=r(149)),g.root=function(){const e={_types:new Set(Object.keys(g.types))};for(const t of e._types)e[t]=function(...e){return s(!e.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),g.generate(this,g.types[t],e)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(...e){return this.any()[t](...e)};Object.assign(e,g.methods);for(const t in g.aliases){const r=g.aliases[t];e[t]=e[r]}return e.x=e.expression,f.setup&&f.setup(e),e},g.methods={ValidationError:l.ValidationError,version:o.version,cache:a.provider,assert(e,t,...r){g.assert(e,t,!0,r)},attempt:(e,t,...r)=>g.assert(e,t,!1,r),build(e){return s("function"==typeof d.build,"Manifest functionality disabled"),d.build(this,e)},checkPreferences(e){o.checkPreferences(e)},compile(e,t){return c.compile(this,e,t)},defaults(e){s("function"==typeof e,"modifier must be a function");const t=Object.assign({},this);for(const r of t._types){const n=e(t[r]());s(o.isSchema(n),"modifier must return a valid schema object"),t[r]=function(...e){return g.generate(this,n,e)}}return t},expression:(...e)=>new h(...e),extend(...e){o.verifyFlat(e,"extend"),m=m||r(114),s(e.length,"You need to provide at least one extension"),this.assert(e,m.extensions);const t=Object.assign({},this);t._types=new Set(t._types);for(let r of e){"function"==typeof r&&(r=r(t)),this.assert(r,m.extension);const e=g.expandExtension(r,t);for(const r of e){s(void 0===t[r.type]||t._types.has(r.type),"Cannot override name",r.type);const e=r.base||this.any(),n=u.type(e,r);t._types.add(r.type),t[r.type]=function(...e){return g.generate(this,n,e)}}}return t},isError:l.ValidationError.isError,isExpression:h.isTemplate,isRef:p.isRef,isSchema:o.isSchema,in:(...e)=>p.in(...e),override:o.symbols.override,ref:(...e)=>p.create(...e),types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in g.aliases)e[t]=this[t]();return e}},g.assert=function(e,t,r,n){const s=n[0]instanceof Error||"string"==typeof n[0]?n[0]:null,a=null!==s?n[1]:n[0],c=t.validate(e,o.preferences({errors:{stack:!0}},a||{}));let u=c.error;if(!u)return c.value;if(s instanceof Error)throw s;const d=r&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof l.ValidationError==!1&&(u=i(u)),u.message=s?`${s} ${d}`:d,u},g.generate=function(e,t,r){return s(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&r.length?t._definition.args(t,...r):t},g.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const r=[];for(const n of t._types)if(e.type.test(n)){const s=Object.assign({},e);s.type=n,s.base=t[n](),r.push(s)}return r},e.exports=g.root()},(e,t,r)=>{const n=r(40),s=r(43),i=r(112),a={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new a.Cache(e)},a.Cache=class{constructor(e={}){i.assertOptions(e,["max"]),n(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||a.max,this._map=new Map,this._list=new a.List}get length(){return this._map.size}set(e,t){if(null!==e&&!a.supported.has(typeof e))return;let r=this._map.get(e);if(r)return r.value=t,void this._list.first(r);r=this._list.unshift({key:e,value:t}),this._map.set(e,r),this._compact()}get(e){const t=this._map.get(e);if(t)return this._list.first(t),s(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},a.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:t,prev:r}=e;return t.prev=r,r&&(r.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}}},(e,t,r)=>{const n=r(40),s=r(41),i=r(113);let a,o;const c={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};t.version=i.version,t.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},t.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},t.assertOptions=function(e,t,r="Options"){n(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const s=Object.keys(e).filter((e=>!t.includes(e)));n(0===s.length,`${r} contain unknown keys: ${s}`)},t.checkPreferences=function(e){o=o||r(114);const t=o.preferences.validate(e);if(t.error)throw new s([t.error.details[0].message])},t.compare=function(e,t,r){switch(r){case"=":return e===t;case">":return e>t;case"<":return e=":return e>=t;case"<=":return e<=t}},t.default=function(e,t){return void 0===e?t:e},t.isIsoDate=function(e){return c.isoDate.test(e)},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.isResolvable=function(e){return!!e&&(e[t.symbols.ref]||e[t.symbols.template])},t.isSchema=function(e,r={}){const s=e&&e[t.symbols.any];return!!s&&(n(r.legacy||s.version===t.version,"Cannot mix different versions of joi schemas"),!0)},t.isValues=function(e){return e[t.symbols.values]},t.limit=function(e){return Number.isSafeInteger(e)&&e>=0},t.preferences=function(e,n){a=a||r(115),e=e||{},n=n||{};const s=Object.assign({},e,n);return n.errors&&e.errors&&(s.errors=Object.assign({},e.errors,n.errors),s.errors.wrap=Object.assign({},e.errors.wrap,n.errors.wrap)),n.messages&&(s.messages=a.compile(n.messages,e.messages)),delete s[t.symbols.prefs],s},t.tryWithPath=function(e,t,r={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,r.append&&(e.message=`${e.message} (${e.path})`),e}},t.validateArg=function(e,r,{assert:n,message:s}){if(t.isSchema(n)){const t=n.validate(e);if(!t.error)return;return t.error.message}if(!n(e))return r?`${r} ${s}`:s},t.verifyFlat=function(e,t){for(const r of e)n(!Array.isArray(r),"Method no longer accepts array arguments:",t)}},e=>{e.exports=JSON.parse('{"name":"joi","description":"Object schema validation","version":"17.12.2","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause"}')},(e,t,r)=>{const n=r(110),s={};s.wrap=n.string().min(1).max(2).allow(!1),t.preferences=n.object({allowUnknown:n.boolean(),abortEarly:n.boolean(),artifacts:n.boolean(),cache:n.boolean(),context:n.object(),convert:n.boolean(),dateFormat:n.valid("date","iso","string","time","utc"),debug:n.boolean(),errors:{escapeHtml:n.boolean(),label:n.valid("path","key",!1),language:[n.string(),n.object().ref()],render:n.boolean(),stack:n.boolean(),wrap:{label:s.wrap,array:s.wrap,string:s.wrap}},externals:n.boolean(),messages:n.object(),noDefaults:n.boolean(),nonEnumerables:n.boolean(),presence:n.valid("required","optional","forbidden"),skipFunctions:n.boolean(),stripUnknown:n.object({arrays:n.boolean(),objects:n.boolean()}).or("arrays","objects").allow(!0,!1),warnings:n.boolean()}).strict(),s.nameRx=/^[a-zA-Z0-9]\w*$/,s.rule=n.object({alias:n.array().items(n.string().pattern(s.nameRx)).single(),args:n.array().items(n.string(),n.object({name:n.string().pattern(s.nameRx).required(),ref:n.boolean(),assert:n.alternatives([n.function(),n.object().schema()]).conditional("ref",{is:!0,then:n.required()}),normalize:n.function(),message:n.string().when("assert",{is:n.function(),then:n.required()})})),convert:n.boolean(),manifest:n.boolean(),method:n.function().allow(!1),multi:n.boolean(),validate:n.function()}),t.extension=n.object({type:n.alternatives([n.string(),n.object().regex()]).required(),args:n.function(),cast:n.object().pattern(s.nameRx,n.object({from:n.function().maxArity(1).required(),to:n.function().minArity(1).maxArity(2).required()})),base:n.object().schema().when("type",{is:n.object().regex(),then:n.forbidden()}),coerce:[n.function().maxArity(3),n.object({method:n.function().maxArity(3).required(),from:n.array().items(n.string()).single()})],flags:n.object().pattern(s.nameRx,n.object({setter:n.string(),default:n.any()})),manifest:{build:n.function().arity(2)},messages:[n.object(),n.string()],modifiers:n.object().pattern(s.nameRx,n.function().minArity(1).maxArity(2)),overrides:n.object().pattern(s.nameRx,n.function()),prepare:n.function().maxArity(3),rebuild:n.function().arity(1),rules:n.object().pattern(s.nameRx,s.rule),terms:n.object().pattern(s.nameRx,n.object({init:n.array().allow(null).required(),manifest:n.object().pattern(/.+/,[n.valid("schema","single"),n.object({mapped:n.object({from:n.string().required(),to:n.string().required()}).required()})])})),validate:n.function().maxArity(3)}).strict(),t.extensions=n.array().items(n.object(),n.function().arity(1)).strict(),s.desc={buffer:n.object({buffer:n.string()}),func:n.object({function:n.function().required(),options:{literal:!0}}),override:n.object({override:!0}),ref:n.object({ref:n.object({type:n.valid("value","global","local"),path:n.array().required(),separator:n.string().length(1).allow(!1),ancestor:n.number().min(0).integer().allow("root"),map:n.array().items(n.array().length(2)).min(1),adjust:n.function(),iterables:n.boolean(),in:n.boolean(),render:n.boolean()}).required()}),regex:n.object({regex:n.string().min(3)}),special:n.object({special:n.valid("deep").required()}),template:n.object({template:n.string().required(),options:n.object()}),value:n.object({value:n.alternatives([n.object(),n.array()]).required()})},s.desc.entity=n.alternatives([n.array().items(n.link("...")),n.boolean(),n.function(),n.number(),n.string(),s.desc.buffer,s.desc.func,s.desc.ref,s.desc.regex,s.desc.special,s.desc.template,s.desc.value,n.link("/")]),s.desc.values=n.array().items(null,n.boolean(),n.function(),n.number().allow(1/0,-1/0),n.string().allow(""),n.symbol(),s.desc.buffer,s.desc.func,s.desc.override,s.desc.ref,s.desc.regex,s.desc.template,s.desc.value),s.desc.messages=n.object().pattern(/.+/,[n.string(),s.desc.template,n.object().pattern(/.+/,[n.string(),s.desc.template])]),t.description=n.object({type:n.string().required(),flags:n.object({cast:n.string(),default:n.any(),description:n.string(),empty:n.link("/"),failover:s.desc.entity,id:n.string(),label:n.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:n.boolean(),unit:n.string()}).unknown(),preferences:{allowUnknown:n.boolean(),abortEarly:n.boolean(),artifacts:n.boolean(),cache:n.boolean(),convert:n.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:n.boolean(),label:["path","key"],language:[n.string(),s.desc.ref],wrap:{label:s.wrap,array:s.wrap}},externals:n.boolean(),messages:s.desc.messages,noDefaults:n.boolean(),nonEnumerables:n.boolean(),presence:["required","optional","forbidden"],skipFunctions:n.boolean(),stripUnknown:n.object({arrays:n.boolean(),objects:n.boolean()}).or("arrays","objects").allow(!0,!1),warnings:n.boolean()},allow:s.desc.values,invalid:s.desc.values,rules:n.array().min(1).items({name:n.string().required(),args:n.object().min(1),keep:n.boolean(),message:[n.string(),s.desc.messages],warn:n.boolean()}),keys:n.object().pattern(/.*/,n.link("/")),link:s.desc.ref}).pattern(/^[a-z]\w*$/,n.any())},(e,t,r)=>{const n=r(40),s=r(43),i=r(116);t.compile=function(e,t){if("string"==typeof e)return n(!t,"Cannot set single message string"),new i(e);if(i.isTemplate(e))return n(!t,"Cannot set single message template"),e;n("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?s(t):{};for(let r in e){const s=e[r];if("root"===r||i.isTemplate(s)){t[r]=s;continue}if("string"==typeof s){t[r]=new i(s);continue}n("object"==typeof s&&!Array.isArray(s),"Invalid message for",r);const a=r;for(r in t[a]=t[a]||{},s){const e=s[r];"root"===r||i.isTemplate(e)?t[a][r]=e:(n("string"==typeof e,"Invalid message for",r,"in",a),t[a][r]=new i(e))}}return t},t.decompile=function(e){const t={};for(let r in e){const n=e[r];if("root"===r){t.root=n;continue}if(i.isTemplate(n)){t[r]=n.describe({compact:!0});continue}const s=r;for(r in t[s]={},n){const e=n[r];"root"!==r?t[s][r]=e.describe({compact:!0}):t[s].root=e}}return t},t.merge=function(e,r){if(!e)return t.compile(r);if(!r)return e;if("string"==typeof r)return new i(r);if(i.isTemplate(r))return r;const a=s(e);for(let e in r){const t=r[e];if("root"===e||i.isTemplate(t)){a[e]=t;continue}if("string"==typeof t){a[e]=new i(t);continue}n("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const s=e;for(e in a[s]=a[s]||{},t){const r=t[e];"root"===e||i.isTemplate(r)?a[s][e]=r:(n("string"==typeof r,"Invalid message for",e,"in",s),a[s][e]=new i(r))}}return a}},(e,t,r)=>{const n=r(40),s=r(43),i=r(55),a=r(117),o=r(112),c=r(118),l=r(120),u={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};e.exports=u.Template=class{constructor(e,t){if(n("string"==typeof e,"Template source must be a string"),n(!e.includes("\0")&&!e.includes(""),"Template source cannot contain reserved control characters"),this.source=e,this.rendered=e,this._template=null,t){const{functions:e,...r}=t;this._settings=Object.keys(r).length?s(r):void 0,this._functions=e,this._functions&&(n(Object.keys(this._functions).every((e=>"string"==typeof e)),"Functions keys must be strings"),n(Object.values(this._functions).every((e=>"function"==typeof e)),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const e=u.encode(this.source),t=u.split(e);let r=!1;const n=[],s=t.shift();s&&n.push(s);for(const e of t){const t="{"!==e[0],s=t?"}":"}}",i=e.indexOf(s);if(-1===i||"{"===e[1]){n.push(`{${u.decode(e)}`);continue}let a=e.slice(t?0:1,i);const o=":"===a[0];o&&(a=a.slice(1));const c=this._ref(u.decode(a),{raw:t,wrapped:o});n.push(c),"string"!=typeof c&&(r=!0);const l=e.slice(i+s.length);l&&n.push(u.decode(l))}r?this._template=n:this.rendered=n.join("")}static date(e,t){return u.dateFormat[t.dateFormat].call(e)}describe(e={}){if(!this._settings&&e.compact)return this.source;const t={template:this.source};return this._settings&&(t.options=this._settings),this._functions&&(t.functions=this._functions),t}static build(e){return new u.Template(e.template,e.options||e.functions?{...e.options,functions:e.functions}:void 0)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[o.symbols.template]}refs(){if(!this._template)return;const e=[];for(const t of this._template)"string"!=typeof t&&e.push(...t.refs);return e}resolve(e,t,r,n){return this._template&&1===this._template.length?this._part(this._template[0],e,t,r,n,{}):this.render(e,t,r,n)}_part(e,...t){return e.ref?e.ref.resolve(...t):e.formula.evaluate(t)}render(e,t,r,n,s={}){if(!this.isDynamic())return this.rendered;const a=[];for(const o of this._template)if("string"==typeof o)a.push(o);else{const c=this._part(o,e,t,r,n,s),l=u.stringify(c,e,t,r,n,s);if(void 0!==l){const e=o.raw||!1===(s.errors&&s.errors.escapeHtml)?l:i(l);a.push(u.wrap(e,o.wrapped&&r.errors.wrap.label))}}return a.join("")}_ref(e,{raw:t,wrapped:r}){const n=[],s=e=>{const t=l.create(e,this._settings);return n.push(t),e=>{const r=t.resolve(...e);return void 0!==r?r:null}};try{const t=this._functions?{...u.functions,...this._functions}:u.functions;var i=new a.Parser(e,{reference:s,functions:t,constants:u.constants})}catch(t){throw t.message=`Invalid template variable "${e}" fails due to: ${t.message}`,t}if(i.single){if("reference"===i.single.type){const e=n[0];return{ref:e,raw:t,refs:n,wrapped:r||"local"===e.type&&"label"===e.key}}return u.stringify(i.single.value)}return{formula:i,raw:t,refs:n}}toString(){return this.source}},u.Template.prototype[o.symbols.template]=!0,u.Template.prototype.isImmutable=!0,u.encode=function(e){return e.replace(/\\(\{+)/g,((e,t)=>u.opens.slice(0,t.length))).replace(/\\(\}+)/g,((e,t)=>u.closes.slice(0,t.length)))},u.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},u.split=function(e){const t=[];let r="";for(let n=0;n ${n.toString()}`);e=t}if(!Array.isArray(e))return e.toString();const d=[];for(const a of e)d.push(u.stringify(a,t,r,n,s,{arrayItems:!0,...i}));return u.wrap(d.join(", "),!c&&o.array)},u.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},u.functions={if:(e,t,r)=>e?t:r,length:e=>"string"==typeof e?e.length:e&&"object"==typeof e?Array.isArray(e)?e.length:Object.keys(e).length:null,msg(e){const[t,r,n,s,i]=this,a=i.messages;if(!a)return"";const o=c.template(t,a[0],e,r,n)||c.template(t,a[1],e,r,n);return o?o.render(t,r,n,s,i):""},number:e=>"number"==typeof e?e:"string"==typeof e?parseFloat(e):"boolean"==typeof e?e?1:0:e instanceof Date?e.getTime():null}},(e,t)=>{const r={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};t.Parser=class{constructor(e,t={}){if(!t[r.settings]&&t.constants)for(const e in t.constants){const r=t.constants[e];if(null!==r&&!["boolean","number","string"].includes(typeof r))throw new Error(`Formula constant ${e} contains invalid ${typeof r} value type`)}this.settings=t[r.settings]?t:Object.assign({[r.settings]:!0,constants:{},functions:{}},t),this.single=null,this._parts=null,this._parse(e)}_parse(e){let n=[],s="",i=0,a=!1;const o=e=>{if(i)throw new Error("Formula missing closing parenthesis");const o=n.length?n[n.length-1]:null;if(a||s||e){if(o&&"reference"===o.type&&")"===e)return o.type="function",o.value=this._subFormula(s,o.value),void(s="");if(")"===e){const e=new t.Parser(s,this.settings);n.push({type:"segment",value:e})}else if(a){if("]"===a)return n.push({type:"reference",value:s}),void(s="");n.push({type:"literal",value:s})}else if(r.operatorCharacters.includes(s))o&&"operator"===o.type&&r.operators.includes(o.value+s)?o.value+=s:n.push({type:"operator",value:s});else if(s.match(r.numberRx))n.push({type:"constant",value:parseFloat(s)});else if(void 0!==this.settings.constants[s])n.push({type:"constant",value:this.settings.constants[s]});else{if(!s.match(r.tokenRx))throw new Error(`Formula contains invalid token: ${s}`);n.push({type:"reference",value:s})}s=""}};for(const t of e)a?t===a?(o(),a=!1):s+=t:i?"("===t?(s+=t,++i):")"===t?(--i,i?s+=t:o(t)):s+=t:t in r.literals?a=r.literals[t]:"("===t?(o(),++i):r.operatorCharacters.includes(t)?(o(),s=t,o()):" "!==t?s+=t:o();o(),n=n.map(((e,t)=>"operator"!==e.type||"-"!==e.value||t&&"operator"!==n[t-1].type?e:{type:"operator",value:"n"}));let c=!1;for(const e of n){if("operator"===e.type){if(r.operatorsPrefix.includes(e.value))continue;if(!c)throw new Error("Formula contains an operator in invalid position");if(!r.operators.includes(e.value))throw new Error(`Formula contains an unknown operator ${e.value}`)}else if(c)throw new Error("Formula missing expected operator");c=!c}if(!c)throw new Error("Formula contains invalid trailing operator");1===n.length&&["reference","literal","constant"].includes(n[0].type)&&(this.single={type:"reference"===n[0].type?"reference":"value",value:n[0].value}),this._parts=n.map((e=>{if("operator"===e.type)return r.operatorsPrefix.includes(e.value)?e:e.value;if("reference"!==e.type)return e.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(e.value))throw new Error(`Formula contains invalid reference ${e.value}`);return this.settings.reference?this.settings.reference(e.value):r.reference(e.value)}))}_subFormula(e,n){const s=this.settings.functions[n];if("function"!=typeof s)throw new Error(`Formula contains unknown function ${n}`);let i=[];if(e){let t="",s=0,a=!1;const o=()=>{if(!t)throw new Error(`Formula contains function ${n} with invalid arguments ${e}`);i.push(t),t=""};for(let n=0;nnew t.Parser(e,this.settings))),function(e){const t=[];for(const r of i)t.push(r.evaluate(e));return s.call(e,...t)}}evaluate(e){const t=this._parts.slice();for(let n=t.length-2;n>=0;--n){const s=t[n];if(s&&"operator"===s.type){const i=t[n+1];t.splice(n+1,1);const a=r.evaluate(i,e);t[n]=r.single(s.value,a)}}return r.operatorsOrder.forEach((n=>{for(let s=1;s":return t>n;case">=":return t>=n;case"==":return t===n;case"!=":return t!==n;case"&&":return t&&n;case"||":return t||n}return null},r.exists=function(e){return null!=e}},(e,t,r)=>{const n=r(119),s=r(112),i=r(116);t.Report=class{constructor(e,r,n,s,i,a,o){if(this.code=e,this.flags=s,this.messages=i,this.path=a.path,this.prefs=o,this.state=a,this.value=r,this.message=null,this.template=null,this.local=n||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}_setTemplate(e){if(this.template=e,!this.flags.label&&0===this.path.length){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?`Error code "${e}" is not defined, your custom type is missing the correct messages definition`:(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(e,r){return t.template(this.value,e,r||this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const r of e)"object"!=typeof r&&("string"==typeof r?(t&&(t+="."),t+=r):t+=`[${r}]`);return t},t.template=function(e,t,r,n,a){if(!t)return;if(i.isTemplate(t))return"root"!==r?t:null;let o=a.errors.language;if(s.isResolvable(o)&&(o=o.resolve(e,n,a)),o&&t[o]){if(void 0!==t[o][r])return t[o][r];if(void 0!==t[o]["*"])return t[o]["*"]}return t[r]?t[r]:t["*"]},t.label=function(e,r,n,s){if(e.label)return e.label;if(!n.errors.label)return"";let i=r.path;"key"===n.errors.label&&r.path.length>1&&(i=r.path.slice(-1));const a=t.path(i);return a||(t.template(null,n.messages,"root",r,n)||s&&t.template(null,s,"root",r,n)||"value")},t.process=function(e,r,n){if(!e)return null;const{override:s,message:i,details:a}=t.details(e);if(s)return s;if(n.errors.stack)return new t.ValidationError(i,a,r);const o=Error.stackTraceLimit;Error.stackTraceLimit=0;const c=new t.ValidationError(i,a,r);return Error.stackTraceLimit=o,c},t.details=function(e,t={}){let r=[];const n=[];for(const s of e){if(s instanceof Error){if(!1!==t.override)return{override:s};const e=s.toString();r.push(e),n.push({message:e,type:"override",context:{error:s}});continue}const e=s.toString();r.push(e),n.push({message:e,path:s.path.filter((e=>"object"!=typeof e)),type:s.code,context:s.local})}return r.length>1&&(r=[...new Set(r)]),{message:r.join(". "),details:n}},t.ValidationError=class extends Error{constructor(e,t,r){super(e),this._original=r,this.details=t}static isError(e){return e instanceof t.ValidationError}},t.ValidationError.prototype.isJoi=!0,t.ValidationError.prototype.name="ValidationError",t.ValidationError.prototype.annotate=n.error},(e,t,r)=>{const n=r(43),s=r(112),i={annotations:Symbol("annotations")};t.error=function(e){if(!this._original||"object"!=typeof this._original)return this.details[0].message;const t=e?"":"",r=e?"":"",a=e?"":"",o=n(this._original);for(let e=this.details.length-1;e>=0;--e){const t=e+1,r=this.details[e],n=r.path;let a=o;for(let e=0;;++e){const o=n[e];if(s.isSchema(a)&&(a=a.clone()),!(e+1`" ${t}[${r}]${a}`)).replace(l,((e,n,s)=>`${r}"${n}"${a}${t} [${s}]: -- missing --${a}`)).replace(u,((e,r,n)=>`\n${n} ${t}[${r}]${a}`)).replace(d,((e,t)=>t));p=`${p}\n${t}`;for(let e=0;et[0]===n?"[Circular ~]":"[Circular ~."+e.slice(0,t.indexOf(n)).join(".")+"]";return function(n,s){if(t.length>0){const i=t.indexOf(this);~i?(t.length=i+1,e.length=i+1,e[i]=n):(t.push(this),e.push(n)),~t.indexOf(s)&&(s=r.call(this,n,s))}else t.push(s);if(s){const e=s[i.annotations];if(e){if(Array.isArray(s)){const t=[];for(let r=0;r{const n=r(40),s=r(43),i=r(44),a=r(112);let o;const c={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e,t={}){n("string"==typeof e,"Invalid reference key:",e),a.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),n(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const r=Object.assign({},c.defaults,t);delete r.prefix;const s=r.separator,i=c.context(e,s,t.prefix);if(r.type=i.type,e=i.key,"value"===r.type)if(i.root&&(n(!s||e[0]!==s,"Cannot specify relative path with root prefix"),r.ancestor="root",e||(e=null)),s&&s===e)e=null,r.ancestor=0;else if(void 0!==r.ancestor)n(!s||!e||e[0]!==s,"Cannot combine prefix with ancestor option");else{const[t,n]=c.ancestor(e,s);n&&""===(e=e.slice(n))&&(e=null),r.ancestor=t}return r.path=s?null===e?[]:e.split(s):[e],new c.Ref(r)},t.in=function(e,r={}){return t.create(e,{...r,in:!0})},t.isRef=function(e){return!!e&&!!e[a.symbols.ref]},c.Ref=class{constructor(e){n("object"==typeof e,"Invalid reference construction"),a.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),n([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),n(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),n(!e.map||Array.isArray(e.map),"options.map must be an array"),n(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,c.defaults,e),n("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,t,r,s,i={}){return n(!this.in||i.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(r.context,t,i):"local"===this.type?this._resolve(s,t,i):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,i):(n(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,i)):this._resolve(e,t,i)}_resolve(e,t,r){let n;if("value"===this.type&&t.mainstay.shadow&&!1!==r.shadow&&(n=t.mainstay.shadow.get(this.absolute(t))),void 0===n&&(n=i(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(n=this.adjust(n)),this.map){const e=this.map.get(n);void 0!==e&&(n=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,n),n}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new c.Ref(this)}describe(){const e={path:this.path};"value"!==this.type&&(e.type=this.type),"."!==this.separator&&(e.separator=this.separator),"value"===this.type&&1!==this.ancestor&&(e.ancestor=this.ancestor),this.map&&(e.map=[...this.map]);for(const t of["adjust","iterables","render"])null!==this[t]&&void 0!==this[t]&&(e[t]=this[t]);return!1!==this.in&&(e.in=!0),{ref:e}}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display=`ref:${this.type}:${e}`);if(!this.separator)return void(this.display=`ref:${e}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${e}`);if("root"===this.ancestor)return void(this.display=`ref:root:${e}`);if(1===this.ancestor)return void(this.display=`ref:${e||".."}`);const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${t}${e||""}`}},c.Ref.prototype[a.symbols.ref]=!0,t.build=function(e){return"value"===(e=Object.assign({},c.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new c.Ref(e)},c.context=function(e,t,r={}){if(e=e.trim(),r){const n=void 0===r.global?"$":r.global;if(n!==t&&e.startsWith(n))return{key:e.slice(n.length),type:"global"};const s=void 0===r.local?"#":r.local;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"local"};const i=void 0===r.root?"/":r.root;if(i!==t&&e.startsWith(i))return{key:e.slice(i.length),type:"value",root:!0}}return{key:e,type:"value"}},c.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let r=2;for(;e[r]===t;)++r;return[r-1,r]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,n){if(e)if(n=void 0===n?t.toParent:n,Array.isArray(e))for(const t of e)this.register(t,n);else if(a.isSchema(e))for(const t of e._refs.refs)t.ancestor-n>=0&&this.refs.push({ancestor:t.ancestor-n,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-n>=0&&this.refs.push({ancestor:e.ancestor-n,root:e.root}),o=o||r(116),o.isTemplate(e)&&this.register(e.refs(),n)}get length(){return this.refs.length}clone(){const e=new t.Manager;return e.refs=s(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter((e=>!e.ancestor)).map((e=>e.root))}}},(e,t,r)=>{const n=r(40),s=r(112),i=r(120),a={};t.schema=function(e,t,r={}){s.assertOptions(r,["appendPath","override"]);try{return a.schema(e,t,r)}catch(e){throw r.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},a.schema=function(e,t,r){n(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(n(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const i=(t,...n)=>!1!==r.override?t.valid(e.override,...n):t.valid(...n);if(a.simple(t))return i(e,t);if("function"==typeof t)return e.custom(t);if(n("object"==typeof t,"Invalid schema content:",typeof t),s.isResolvable(t))return i(e,t);if(s.isSchema(t))return t;if(Array.isArray(t)){for(const r of t)if(!a.simple(r))return e.alternatives().try(...t);return i(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?i(e.date(),t):(n(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return i.isRef(e)?e:i.create(e,t)},t.compile=function(e,r,i={}){s.assertOptions(i,["legacy"]);const o=r&&r[s.symbols.any];if(o)return n(i.legacy||o.version===s.version,"Cannot mix different versions of joi schemas:",o.version,s.version),r;if("object"!=typeof r||!i.legacy)return t.schema(e,r,{appendPath:!0});const c=a.walk(r);return c?c.compile(c.root,r):t.schema(e,r,{appendPath:!0})},a.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=a.walk(t);if(e)return e}return null}const t=e[s.symbols.any];if(t)return{root:e[t.root],compile:t.compile};n(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const r=a.walk(e[t]);if(r)return r}return null},a.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,r,o){if(void 0===o&&(n(r&&"object"==typeof r,"Missing options"),o=r,r=i.create(".")),Array.isArray(o)&&(o={switch:o}),s.assertOptions(o,["is","not","then","otherwise","switch","break"]),s.isSchema(r))return n(void 0===o.is,'"is" can not be used with a schema condition'),n(void 0===o.not,'"not" can not be used with a schema condition'),n(void 0===o.switch,'"switch" can not be used with a schema condition'),a.condition(e,{is:r,then:o.then,otherwise:o.otherwise,break:o.break});if(n(i.isRef(r)||"string"==typeof r,"Invalid condition:",r),n(void 0===o.not||void 0===o.is,'Cannot combine "is" with "not"'),void 0===o.switch){let c=o;void 0!==o.not&&(c={is:o.not,then:o.otherwise,otherwise:o.then,break:o.break});let l=void 0!==c.is?e.$_compile(c.is):e.$_root.invalid(null,!1,0,"").required();return n(void 0!==c.then||void 0!==c.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),n(void 0===c.break||void 0===c.then||void 0===c.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===o.is||i.isRef(o.is)||s.isSchema(o.is)||(l=l.required()),a.condition(e,{ref:t.ref(r),is:l,then:c.then,otherwise:c.otherwise,break:c.break})}n(Array.isArray(o.switch),'"switch" must be an array'),n(void 0===o.is,'Cannot combine "switch" with "is"'),n(void 0===o.not,'Cannot combine "switch" with "not"'),n(void 0===o.then,'Cannot combine "switch" with "then"');const c={ref:t.ref(r),switch:[],break:o.break};for(let t=0;t{const n=r(40),s=r(43),i=r(112),a=r(115),o={};t.type=function(e,t){const r=Object.getPrototypeOf(e),c=s(r),l=e._assign(Object.create(c)),u=Object.assign({},t);delete u.base,c._definition=u;const d=r._definition||{};u.messages=a.merge(d.messages,u.messages),u.properties=Object.assign({},d.properties,u.properties),l.type=u.type,u.flags=Object.assign({},d.flags,u.flags);const p=Object.assign({},d.terms);if(u.terms)for(const e in u.terms){const t=u.terms[e];n(void 0===l.$_terms[e],"Invalid term override for",u.type,e),l.$_terms[e]=t.init,p[e]=t}u.terms=p,u.args||(u.args=d.args),u.prepare=o.prepare(u.prepare,d.prepare),u.coerce&&("function"==typeof u.coerce&&(u.coerce={method:u.coerce}),u.coerce.from&&!Array.isArray(u.coerce.from)&&(u.coerce={method:u.coerce.method,from:[].concat(u.coerce.from)})),u.coerce=o.coerce(u.coerce,d.coerce),u.validate=o.validate(u.validate,d.validate);const h=Object.assign({},d.rules);if(u.rules)for(const e in u.rules){const t=u.rules[e];n("object"==typeof t,"Invalid rule definition for",u.type,e);let r=t.method;if(void 0===r&&(r=function(){return this.$_addRule(e)}),r&&(n(!c[e],"Rule conflict in",u.type,e),c[e]=r),n(!h[e],"Rule conflict in",u.type,e),h[e]=t,t.alias){const e=[].concat(t.alias);for(const r of e)c[r]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map((e=>("string"==typeof e&&(e={name:e}),n(!t.argsByName.has(e.name),"Duplicated argument name",e.name),i.isSchema(e.assert)&&(e.assert=e.assert.strict().label(e.name)),t.argsByName.set(e.name,e),e))))}u.rules=h;const f=Object.assign({},d.modifiers);if(u.modifiers)for(const e in u.modifiers){n(!c[e],"Rule conflict in",u.type,e);const t=u.modifiers[e];n("function"==typeof t,"Invalid modifier definition for",u.type,e);const r=function(t){return this.rule({[e]:t})};c[e]=r,f[e]=t}if(u.modifiers=f,u.overrides){c._super=r,l.$_super={};for(const e in u.overrides)n(r[e],"Cannot override missing",e),u.overrides[e][i.symbols.parent]=r[e],l.$_super[e]=r[e].bind(l);Object.assign(c,u.overrides)}u.cast=Object.assign({},d.cast,u.cast);const m=Object.assign({},d.manifest,u.manifest);return m.build=o.build(u.manifest&&u.manifest.build,d.manifest&&d.manifest.build),u.manifest=m,u.rebuild=o.rebuild(u.rebuild,d.rebuild),l},o.build=function(e,t){return e&&t?function(r,n){return t(e(r,n),n)}:e||t},o.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(r,n){let s;if((!t.from||t.from.includes(typeof r))&&(s=t.method(r,n),s)){if(s.errors||void 0===s.value)return s;r=s.value}if(!e.from||e.from.includes(typeof r)){const t=e.method(r,n);if(t)return t}return s}}:e||t},o.prepare=function(e,t){return e&&t?function(r,n){const s=e(r,n);if(s){if(s.errors||void 0===s.value)return s;r=s.value}return t(r,n)||s}:e||t},o.rebuild=function(e,t){return e&&t?function(r){t(r),e(r)}:e||t},o.validate=function(e,t){return e&&t?function(r,n){const s=t(r,n);if(s){if(s.errors&&(!Array.isArray(s.errors)||s.errors.length))return s;r=s.value}return e(r,n)||s}:e||t}},(e,t,r)=>{var n=r(21).Buffer;const s=r(40),i=r(43),a=r(112),o=r(115),c=r(120),l=r(116);let u;const d={};t.describe=function(e){const t=e._definition,r={type:e.type,flags:{},rules:[]};for(const t in e._flags)"_"!==t[0]&&(r.flags[t]=d.describe(e._flags[t]));Object.keys(r.flags).length||delete r.flags,e._preferences&&(r.preferences=i(e._preferences,{shallow:["messages"]}),delete r.preferences[a.symbols.prefs],r.preferences.messages&&(r.preferences.messages=o.decompile(r.preferences.messages))),e._valids&&(r.allow=e._valids.describe()),e._invalids&&(r.invalid=e._invalids.describe());for(const n of e._rules){if(!1===t.rules[n.name].manifest)continue;const e={name:n.name};for(const r in t.modifiers)void 0!==n[r]&&(e[r]=d.describe(n[r]));if(n.args){e.args={};for(const t in n.args){const r=n.args[t];("options"!==t||Object.keys(r).length)&&(e.args[t]=d.describe(r,{assign:t}))}Object.keys(e.args).length||delete e.args}r.rules.push(e)}r.rules.length||delete r.rules;for(const n in e.$_terms){if("_"===n[0])continue;s(!r[n],"Cannot describe schema due to internal name conflict with",n);const i=e.$_terms[n];if(!i)continue;if(i instanceof Map){i.size&&(r[n]=[...i.entries()]);continue}if(a.isValues(i)){r[n]=i.describe();continue}s(t.terms[n],"Term",n,"missing configuration");const o=t.terms[n].manifest,c="object"==typeof o;if(!i.length&&!c)continue;const l=[];for(const e of i)l.push(d.describe(e));if(c){const{from:e,to:t}=o.mapped;r[n]={};for(const s of l)r[n][s[t]]=s[e]}else"single"!==o?r[n]=l:(s(1===l.length,"Term",n,"contains more than one item"),r[n]=l[0])}return d.validate(e.$_root,r),r},d.describe=function(e,t={}){if(Array.isArray(e))return e.map(d.describe);if(e===a.symbols.deepDefault)return{special:"deep"};if("object"!=typeof e||null===e)return e;if("options"===t.assign)return i(e);if(n&&n.isBuffer(e))return{buffer:e.toString("binary")};if(e instanceof Date)return e.toISOString();if(e instanceof Error)return e;if(e instanceof RegExp)return"regex"===t.assign?e.toString():{regex:e.toString()};if(e[a.symbols.literal])return{function:e.literal};if("function"==typeof e.describe)return"ref"===t.assign?e.describe().ref:e.describe();const r={};for(const t in e){const n=e[t];void 0!==n&&(r[t]=d.describe(n,{assign:t}))}return r},t.build=function(e,t){return new d.Builder(e).parse(t)},d.Builder=class{constructor(e){this.joi=e}parse(e){d.validate(this.joi,e);let t=this.joi[e.type]()._bare();const r=t._definition;if(e.flags)for(const n in e.flags){const i=r.flags[n]&&r.flags[n].setter||n;s("function"==typeof t[i],"Invalid flag",n,"for type",e.type),t=t[i](this.build(e.flags[n]))}if(e.preferences&&(t=t.preferences(this.build(e.preferences))),e.allow&&(t=t.allow(...this.build(e.allow))),e.invalid&&(t=t.invalid(...this.build(e.invalid))),e.rules)for(const n of e.rules){s("function"==typeof t[n.name],"Invalid rule",n.name,"for type",e.type);const i=[];if(n.args){const t={};for(const e in n.args)t[e]=this.build(n.args[e],{assign:e});const a=Object.keys(t),o=r.rules[n.name].args;if(o){s(a.length<=o.length,"Invalid number of arguments for",e.type,n.name,"(expected up to",o.length,", found",a.length,")");for(const{name:e}of o)i.push(t[e])}else s(1===a.length,"Invalid number of arguments for",e.type,n.name,"(expected up to 1, found",a.length,")"),i.push(t[a[0]])}t=t[n.name](...i);const a={};for(const e in r.modifiers)void 0!==n[e]&&(a[e]=this.build(n[e]));Object.keys(a).length&&(t=t.rule(a))}const n={};for(const t in e){if(["allow","flags","invalid","whens","preferences","rules","type"].includes(t))continue;s(r.terms[t],"Term",t,"missing configuration");const i=r.terms[t].manifest;if("schema"!==i)if("values"!==i)if("single"!==i)if("object"!=typeof i)n[t]=this.build(e[t]);else{n[t]={};for(const r in e[t]){const s=e[t][r];n[t][r]=this.parse(s)}}else n[t]=this.build(e[t]);else n[t]=e[t].map((e=>this.build(e)));else n[t]=e[t].map((e=>this.parse(e)))}return e.whens&&(n.whens=e.whens.map((e=>this.build(e)))),t=r.manifest.build(t,n),t.$_temp.ruleset=!1,t}build(e,t={}){if(null===e)return null;if(Array.isArray(e))return e.map((e=>this.build(e)));if(e instanceof Error)return e;if("options"===t.assign)return i(e);if("regex"===t.assign)return d.regex(e);if("ref"===t.assign)return c.build(e);if("object"!=typeof e)return e;if(1===Object.keys(e).length){if(e.buffer)return s(n,"Buffers are not supported"),n&&n.from(e.buffer,"binary");if(e.function)return{[a.symbols.literal]:!0,literal:e.function};if(e.override)return a.symbols.override;if(e.ref)return c.build(e.ref);if(e.regex)return d.regex(e.regex);if(e.special)return s(["deep"].includes(e.special),"Unknown special value",e.special),a.symbols.deepDefault;if(e.value)return i(e.value)}if(e.type)return this.parse(e);if(e.template)return l.build(e);const r={};for(const t in e)r[t]=this.build(e[t],{assign:t});return r}},d.regex=function(e){const t=e.lastIndexOf("/"),r=e.slice(1,t),n=e.slice(t+1);return new RegExp(r,n)},d.validate=function(e,t){u=u||r(114),e.assert(t,u.description)}},(e,t,r)=>{const n=r(52),s=r(125),i=r(118),a={codes:{error:1,pass:2,full:3},labels:{0:"never used",1:"always error",2:"always pass"}};t.setup=function(e){const t=function(){return e._tracer=e._tracer||new a.Tracer,e._tracer};e.trace=t,e[Symbol.for("@hapi/lab/coverage/initialize")]=t,e.untrace=()=>{e._tracer=null}},t.location=function(e){return e.$_setFlag("_tracerLocation",s.location(2))},a.Tracer=class{constructor(){this.name="Joi",this._schemas=new Map}_register(e){const t=this._schemas.get(e);if(t)return t.store;const r=new a.Store(e),{filename:n,line:i}=e._flags._tracerLocation||s.location(5);return this._schemas.set(e,{filename:n,line:i,store:r}),r}_combine(e,t){for(const{store:r}of this._schemas.values())r._combine(e,t)}report(e){const t=[];for(const{filename:r,line:n,store:s}of this._schemas.values()){if(e&&e!==r)continue;const i=[],o=[];for(const[e,t]of s._sources.entries()){if(a.sub(t.paths,o))continue;if(!t.entry){i.push({status:"never reached",paths:[...t.paths]}),o.push(...t.paths);continue}for(const r of["valid","invalid"]){const n=e[`_${r}s`];if(!n)continue;const s=new Set(n._values),a=new Set(n._refs);for(const{value:e,ref:n}of t[r])s.delete(e),a.delete(n);(s.size||a.size)&&i.push({status:[...s,...[...a].map((e=>e.display))],rule:`${r}s`})}const r=e._rules.map((e=>e.name));for(const t of["default","failover"])void 0!==e._flags[t]&&r.push(t);for(const e of r){const r=a.labels[t.rule[e]||0];if(r){const n={rule:e,status:r};t.paths.size&&(n.paths=[...t.paths]),i.push(n)}}}i.length&&t.push({filename:r,line:n,missing:i,severity:"error",message:`Schema missing tests for ${i.map(a.message).join(", ")}`})}return t.length?t:null}},a.Store=class{constructor(e){this.active=!0,this._sources=new Map,this._combos=new Map,this._scan(e)}debug(e,t,r,n){e.mainstay.debug&&e.mainstay.debug.push({type:t,name:r,result:n,path:e.path})}entry(e,t){a.debug(t,{type:"entry"}),this._record(e,(e=>{e.entry=!0}))}filter(e,t,r,n){a.debug(t,{type:r,...n}),this._record(e,(e=>{e[r].add(n)}))}log(e,t,r,n,s){a.debug(t,{type:r,name:n,result:"full"===s?"pass":s}),this._record(e,(e=>{e[r][n]=e[r][n]||0,e[r][n]|=a.codes[s]}))}resolve(e,t,r){if(!e.mainstay.debug)return;const n={type:"resolve",ref:t.display,to:r,path:e.path};e.mainstay.debug.push(n)}value(e,t,r,s,i){if(!e.mainstay.debug||n(r,s))return;const a={type:"value",by:t,from:r,to:s,path:e.path};i&&(a.name=i),e.mainstay.debug.push(a)}_record(e,t){const r=this._sources.get(e);if(r)return void t(r);const n=this._combos.get(e);for(const e of n)this._record(e,t)}_scan(e,t){const r=t||[];let n=this._sources.get(e);n||(n={paths:new Set,entry:!1,rule:{},valid:new Set,invalid:new Set},this._sources.set(e,n)),r.length&&n.paths.add(r);e.$_modify({each:(e,t)=>{const n=a.id(e,t);this._scan(e,r.concat(n))},ref:!1})}_combine(e,t){this._combos.set(e,t)}},a.message=function(e){return`${e.paths?i.path(e.paths[0])+(e.rule?":":""):""}${e.rule||""} (${e.status})`},a.id=function(e,{source:t,name:r,path:n,key:s}){return e._flags.id?e._flags.id:s||(r=`@${r}`,"terms"===t?[r,n[Math.min(n.length-1,1)]]:r)},a.sub=function(e,t){for(const r of e)for(const e of t)if(n(r.slice(0,e.length),e))return!0;return!1},a.debug=function(e,t){e.mainstay.debug&&(t.path=e.debug?[...e.path,e.debug]:e.path,e.mainstay.debug.push(t))}},(e,t)=>{t.location=function(e=0){const t=Error.prepareStackTrace;Error.prepareStackTrace=(e,t)=>t;const r={};Error.captureStackTrace(r,this);const n=r.stack[e+1];return Error.prepareStackTrace=t,{filename:n.getFileName(),line:n.getLineNumber()}}},(e,t,r)=>{const n=r(40),s=r(47),i=r(127),a=r(112),o=r(121),c=r(118),l=r(120),u={};e.exports=i.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:l.toSibling}},args:(e,...t)=>1===t.length&&Array.isArray(t[0])?e.try(...t[0]):e.try(...t),validate(e,t){const{schema:r,error:n,state:i,prefs:a}=t;if(r._flags.match){const t=[],o=[];for(let n=0;nc.details(e,{override:!1})))})}}if("one"===r._flags.match)return 1===t.length?{value:t[0]}:{errors:n("alternatives.one")};if(t.length!==r.$_terms.matches.length){return{errors:n("alternatives.all",{details:o.map((e=>c.details(e,{override:!1})))})}}const l=e=>e.$_terms.matches.some((e=>"object"===e.schema.type||"alternatives"===e.schema.type&&l(e.schema)));return l(r)?{value:t.reduce(((e,t)=>s(e,t,{mergeArrays:!1})))}:{value:t[t.length-1]}}const o=[];for(let t=0;t"is"!==r.path[0]&&"string"!=typeof t._flags.label?t.label(e):void 0,ref:!1})}},rebuild(e){e.$_modify({each:t=>{a.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(e,t){if(t.matches)for(const r of t.matches){const{schema:t,ref:n,is:s,not:i,then:a,otherwise:o}=r;e=t?e.try(t):n?e.conditional(n,{is:s,then:a,not:i,otherwise:o,switch:r.switch}):e.conditional(s,{then:a,otherwise:o})}return e}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),u.errors=function(e,{error:t,state:r}){if(!e.length)return{errors:t("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const n=new Set,s=[];for(const{reports:i,schema:a}of e){if(i.length>1)return u.unmatched(e,t);const o=i[0];if(o instanceof c.Report==!1)return u.unmatched(e,t);if(o.state.path.length!==r.path.length){s.push({type:a.type,report:o});continue}if("any.only"===o.code){for(const e of o.local.valids)n.add(e);continue}const[l,d]=o.code.split(".");"base"===d?n.add(l):s.push({type:a.type,report:o})}return s.length?1===s.length?{errors:s[0].report}:u.unmatched(e,t):{errors:t("alternatives.types",{types:[...n]})}},u.unmatched=function(e,t){const r=[];for(const t of e)r.push(...t.reports);return{errors:t("alternatives.match",c.details(r,{override:!1}))}}},(e,t,r)=>{const n=r(40),s=r(128),i=r(112),a=r(115);e.exports=s.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(e,t){return n("function"==typeof e,"Method must be a function"),n(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:e,description:t}})},validate(e,t,{method:r}){try{return r(e,t)}catch(e){return t.error("any.custom",{error:e})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(e){n(i.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const t=this.clone();return t.$_terms.shared=t.$_terms.shared||[],t.$_terms.shared.push(e),t.$_mutateRegister(e),t}},warning:{method(e,t){return n(e&&"string"==typeof e,"Invalid warning code"),this.$_addRule({name:"warning",args:{code:e,local:t},warn:!0})},validate:(e,t,{code:r,local:n})=>t.error(r,n),args:["code","local"],multi:!0}},modifiers:{keep(e,t=!0){e.keep=t},message(e,t){e.message=a.compile(t)},warn(e,t=!0){e.warn=t}},manifest:{build(e,t){for(const r in t){const n=t[r];if(["examples","externals","metas","notes","tags"].includes(r))for(const t of n)e=e[r.slice(0,-1)](t);else if("alterations"!==r)if("whens"!==r){if("shared"===r)for(const t of n)e=e.shared(t)}else for(const t of n){const{ref:r,is:n,not:s,then:i,otherwise:a,concat:o}=t;e=o?e.concat(o):r?e.when(r,{is:n,not:s,then:i,otherwise:a,switch:t.switch,break:t.break}):e.when(n,{then:i,otherwise:a,break:t.break})}else{const t={};for(const{target:e,adjuster:r}of n)t[e]=r;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},(e,t,r)=>{const n=r(40),s=r(43),i=r(52),a=r(47),o=r(111),c=r(112),l=r(121),u=r(118),d=r(122),p=r(123),h=r(115),f=r(129),m=r(120),g=r(124),y=r(130),_=r(132),v={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new f.Ids,this._preferences=null,this._refs=new m.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return n("function"==typeof p.describe,"Manifest functionality disabled"),p.describe(this)}allow(...e){return c.verifyFlat(e,"allow"),this._values(e,"_valids")}alter(e){n(e&&"object"==typeof e&&!Array.isArray(e),"Invalid targets argument"),n(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const r in e){const s=e[r];n("function"==typeof s,"Alteration adjuster for",r,"must be a function"),t.$_terms.alterations.push({target:r,adjuster:s})}return t.$_temp.ruleset=!1,t}artifact(e){return n(void 0!==e,"Artifact cannot be undefined"),n(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",e)}cast(e){return n(!1===e||"string"==typeof e,"Invalid to value"),n(!1===e||this._definition.cast[e],"Type",this.type,"does not support casting to",e),this.$_setFlag("cast",!1===e?void 0:e)}default(e,t){return this._default("default",e,t)}description(e){return n(e&&"string"==typeof e,"Description must be a non-empty string"),this.$_setFlag("description",e)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(e){return n(e,"Missing error"),n(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}example(e,t={}){return n(void 0!==e,"Missing example"),c.assertOptions(t,["override"]),this._inner("examples",e,{single:!0,override:t.override})}external(e,t){return"object"==typeof e&&(n(!t,"Cannot combine options with description"),t=e.description,e=e.method),n("function"==typeof e,"Method must be a function"),n(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this._inner("externals",{method:e,description:t},{single:!0})}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(e){return e?(n("string"==typeof e,"id must be a non-empty string"),n(/^[^\.]+$/.test(e),"id cannot contain period character"),this.$_setFlag("id",e)):this.$_setFlag("id",void 0)}invalid(...e){return this._values(e,"_invalids")}label(e){return n(e&&"string"==typeof e,"Label name must be a non-empty string"),this.$_setFlag("label",e)}meta(e){return n(void 0!==e,"Meta cannot be undefined"),this._inner("metas",e,{single:!0})}note(...e){n(e.length,"Missing notes");for(const t of e)n(t&&"string"==typeof t,"Notes must be non-empty strings");return this._inner("notes",e)}only(e=!0){return n("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){n(e,"Missing preferences"),n(void 0===e.context,"Cannot override context"),n(void 0===e.externals,"Cannot override externals"),n(void 0===e.warnings,"Cannot override warnings"),n(void 0===e.debug,"Cannot override debug"),c.checkPreferences(e);const t=this.clone();return t._preferences=c.preferences(t._preferences,e),t}presence(e){return n(["optional","required","forbidden"].includes(e),"Unknown presence mode",e),this.$_setFlag("presence",e)}raw(e=!0){return this.$_setFlag("result",e?"raw":void 0)}result(e){return n(["raw","strip"].includes(e),"Unknown result mode",e),this.$_setFlag("result",e)}required(){return this.presence("required")}strict(e){const t=this.clone(),r=void 0!==e&&!e;return t._preferences=c.preferences(t._preferences,{convert:r}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}tag(...e){n(e.length,"Missing tags");for(const t of e)n(t&&"string"==typeof t,"Tags must be non-empty strings");return this._inner("tags",e)}unit(e){return n(e&&"string"==typeof e,"Unit name must be a non-empty string"),this.$_setFlag("unit",e)}valid(...e){c.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(e,t){const r=this.clone();r.$_terms.whens||(r.$_terms.whens=[]);const s=l.when(r,e,t);if(!["any","link"].includes(r.type)){const e=s.is?[s]:s.switch;for(const t of e)n(!t.then||"any"===t.then.type||t.then.type===r.type,"Cannot combine",r.type,"with",t.then&&t.then.type),n(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===r.type,"Cannot combine",r.type,"with",t.otherwise&&t.otherwise.type)}return r.$_terms.whens.push(s),r.$_mutateRebuild()}cache(e){n(!this._inRuleset(),"Cannot set caching inside a ruleset"),n(!this._cache,"Cannot override schema cache"),n(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const t=this.clone();return t._cache=e||o.provider.provision(),t.$_temp.ruleset=!1,t}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){n(c.isSchema(e),"Invalid schema object"),n("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type),n(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),n(!e._inRuleset(),"Cannot concatenate a schema with open ruleset");let t=this.clone();if("any"===this.type&&"any"!==e.type){const r=e.clone();for(const e of Object.keys(t))"type"!==e&&(r[e]=t[e]);t=r}t._ids.concat(e._ids),t._refs.register(e,m.toSibling),t._preferences=t._preferences?c.preferences(t._preferences,e._preferences):e._preferences,t._valids=_.merge(t._valids,e._valids,e._invalids),t._invalids=_.merge(t._invalids,e._invalids,e._valids);for(const r of e._singleRules.keys())t._singleRules.has(r)&&(t._rules=t._rules.filter((e=>e.keep||e.name!==r)),t._singleRules.delete(r));for(const r of e._rules)e._definition.rules[r.method].multi||t._singleRules.set(r.name,r),t._rules.push(r);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const r=Object.assign({},e._flags);delete r.empty,a(t._flags,r)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const r=Object.assign({},e._flags);delete r.empty,a(t._flags,r)}else a(t._flags,e._flags);for(const r in e.$_terms){const n=e.$_terms[r];n?t.$_terms[r]?t.$_terms[r]=t.$_terms[r].concat(n):t.$_terms[r]=n.slice():t.$_terms[r]||(t.$_terms[r]=n)}return this.$_root._tracer&&this.$_root._tracer._combine(t,[this,e]),t.$_mutateRebuild()}extend(e){return n(!e.base,"Cannot extend type with another base"),d.type(this,e)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(e,t){n(!this._inRuleset(),"Cannot fork inside a ruleset");let r=this;for(let n of[].concat(e))n=Array.isArray(n)?n:n.split("."),r=r._ids.fork(n,t,r);return r.$_temp.ruleset=!1,r}rule(e){const t=this._definition;c.assertOptions(e,Object.keys(t.modifiers)),n(!1!==this.$_temp.ruleset,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const r=null===this.$_temp.ruleset?this._rules.length-1:this.$_temp.ruleset;n(r>=0&&rt.tailor(e),ref:!1}),t.$_temp.ruleset=!1,t.$_mutateRebuild()}tracer(){return g.location?g.location(this):this}validate(e,t){return y.entry(e,this,t)}validateAsync(e,t){return y.entryAsync(e,this,t)}$_addRule(e){"string"==typeof e&&(e={name:e}),n(e&&"object"==typeof e,"Invalid options"),n(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)n("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const r=this._definition.rules[t.method],s=t.args;n(r,"Unknown rule",t.method);const i=this.clone();if(s){n(1===Object.keys(s).length||Object.keys(s).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in s){let a=s[e];if(r.argsByName){const o=r.argsByName.get(e);if(o.ref&&c.isResolvable(a))t._resolve.push(e),i.$_mutateRegister(a);else if(o.normalize&&(a=o.normalize(a),s[e]=a),o.assert){const t=c.validateArg(a,e,o);n(!t,t,"or reference")}}void 0!==a?s[e]=a:delete s[e]}}return r.multi||(i._ruleRemove(t.name,{clone:!1}),i._singleRules.set(t.name,t)),!1===i.$_temp.ruleset&&(i.$_temp.ruleset=null),r.priority?i._rules.unshift(t):i._rules.push(t),i}$_compile(e,t){return l.schema(this.$_root,e,t)}$_createError(e,t,r,n,s,i={}){const a=!1!==i.flags?this._flags:{},o=i.messages?h.merge(this._definition.messages,i.messages):this._definition.messages;return new u.Report(e,t,r,a,o,n,s)}$_getFlag(e){return this._flags[e]}$_getRule(e){return this._singleRules.get(e)}$_mapLabels(e){return e=Array.isArray(e)?e:e.split("."),this._ids.labels(e)}$_match(e,t,r,n){(r=Object.assign({},r)).abortEarly=!0,r._externals=!1,t.snapshot();const s=!y.validate(e,this,t,r,n).errors;return t.restore(),s}$_modify(e){return c.assertOptions(e,["each","once","ref","schema"]),f.schema(this,e)||this}$_mutateRebuild(){n(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset();return this.$_modify({each:(e,{source:t,name:r,path:n,key:s})=>{const i=this._definition[t][r]&&this._definition[t][r].register;!1!==i&&this.$_mutateRegister(e,{family:i,key:s})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e,{family:t,key:r}={}){this._refs.register(e,t),this._ids.register(e,{key:r})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t,r={}){n("_"===e[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const s=this._definition.flags[e]||{};if(i(t,s.default)&&(t=void 0),i(t,this._flags[e]))return this;const a=!1!==r.clone?this.clone():this;return void 0!==t?(a._flags[e]=t,a.$_mutateRegister(t)):delete a._flags[e],"_"!==e[0]&&(a.$_temp.ruleset=!1),a}$_parent(e,...t){return this[e][c.symbols.parent].call(this,...t)}$_validate(e,t,r){return y.validate(e,this,t,r)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=s(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_bare(){const e=this.clone();e._reset();const t=e._definition.terms;for(const r in t){const n=t[r];e.$_terms[r]=n.init}return e.$_mutateRebuild()}_default(e,t,r={}){c.assertOptions(r,"literal"),n(void 0!==t,"Missing",e,"value"),n("function"==typeof t||!r.literal,"Only function value supports literal option"),"function"==typeof t&&r.literal&&(t={[c.symbols.literal]:!0,literal:t});return this.$_setFlag(e,t)}_generate(e,t,r){if(!this.$_terms.whens)return{schema:this};const n=[],s=[];for(let i=0;il)break}const i=s.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",i),!i)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[i])return{schema:this.$_temp.whens[i],id:i};let a=this;this._definition.generate&&(a=this._definition.generate(this,e,t,r));for(const e of n)a=a.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(a,[this,...n]),this.$_temp.whens[i]=a,{schema:a,id:i}}_inner(e,t,r={}){n(!this._inRuleset(),`Cannot set ${e} inside a ruleset`);const s=this.clone();return s.$_terms[e]&&!r.override||(s.$_terms[e]=[]),r.single?s.$_terms[e].push(t):s.$_terms[e].push(...t),s.$_temp.ruleset=!1,s}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e,t={}){if(!this._singleRules.has(e))return this;const r=!1!==t.clone?this.clone():this;r._singleRules.delete(e);const n=[];for(let t=0;t{const n=r(40),s=r(112),i=r(120),a={};t.Ids=a.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new a.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,r]of e._byId.entries())n(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,r);for(const[t,r]of e._byKey.entries())n(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,r)}fork(e,t,r){const i=this._collect(e);i.push({schema:r});const o=i.shift();let c={id:o.id,schema:t(o.schema)};n(s.isSchema(c.schema),"adjuster function failed to return a joi schema type");for(const e of i)c={id:e.id,schema:a.fork(e.schema,c.id,c.schema)};return c.schema}labels(e,t=[]){const r=e[0],n=this._get(r);if(!n)return[...t,...e].join(".");const s=e.slice(1);return t=[...t,n.schema._flags.label||r],s.length?n.schema._ids.labels(s,t):t.join(".")}reach(e,t=[]){const r=e[0],s=this._get(r);n(s,"Schema does not contain path",[...t,...e].join("."));const i=e.slice(1);return i.length?s.schema._ids.reach(i,[...t,r]):s.schema}register(e,{key:t}={}){if(!e||!s.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const r=e._flags.id;if(r){const t=this._byId.get(r);n(!t||t.schema===e,"Cannot add different schemas with the same id:",r),n(!this._byKey.has(r),"Schema id conflicts with existing key:",r),this._byId.set(r,{schema:e,id:r})}t&&(n(!this._byKey.has(t),"Schema already contains key:",t),n(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,{schema:e,id:t}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e,t=[],r=[]){const s=e[0],i=this._get(s);n(i,"Schema does not contain path",[...t,...e].join(".")),r=[i,...r];const a=e.slice(1);return a.length?i.schema._ids._collect(a,[...t,s],r):r}_get(e){return this._byId.get(e)||this._byKey.get(e)}},a.fork=function(e,r,n){const s=t.schema(e,{each:(e,{key:t})=>{if(r===(e._flags.id||t))return n},ref:!1});return s?s.$_mutateRebuild():e},t.schema=function(e,t){let r;for(const n in e._flags){if("_"===n[0])continue;const s=a.scan(e._flags[n],{source:"flags",name:n},t);void 0!==s&&(r=r||e.clone(),r._flags[n]=s)}for(let n=0;n{const n=r(40),s=r(43),i=r(50),a=r(44),o=r(112),c=r(118),l=r(131),u={result:Symbol("result")};t.entry=function(e,t,r){let s=o.defaults;r&&(n(void 0===r.warnings,"Cannot override warnings preference in synchronous validation"),n(void 0===r.artifacts,"Cannot override artifacts preference in synchronous validation"),s=o.preferences(o.defaults,r));const i=u.entry(e,t,s);n(!i.mainstay.externals.length,"Schema with external rules must use validateAsync()");const a={value:i.value};return i.error&&(a.error=i.error),i.mainstay.warnings.length&&(a.warning=c.details(i.mainstay.warnings)),i.mainstay.debug&&(a.debug=i.mainstay.debug),i.mainstay.artifacts&&(a.artifacts=i.mainstay.artifacts),a},t.entryAsync=async function(e,t,r){let n=o.defaults;r&&(n=o.preferences(o.defaults,r));const s=u.entry(e,t,n),i=s.mainstay;if(s.error)throw i.debug&&(s.error.debug=i.debug),s.error;if(i.externals.length){let t=s.value;const l=[];for(const s of i.externals){const d=s.state.path,p="link"===s.schema.type?i.links.get(s.schema):null;let h,f,m=t;const g=d.length?[t]:[],y=d.length?a(e,d):e;if(d.length){h=d[d.length-1];let e=t;for(const t of d.slice(0,-1))e=e[t],g.unshift(e);f=g[0],m=f[h]}try{const e=(e,t)=>(p||s.schema).$_createError(e,m,t,s.state,n),a=await s.method(m,{schema:s.schema,linked:p,state:s.state,prefs:r,original:y,error:e,errorsArray:u.errorsArray,warn:(e,t)=>i.warnings.push((p||s.schema).$_createError(e,m,t,s.state,n)),message:(e,t)=>(p||s.schema).$_createError("external",m,t,s.state,n,{messages:e})});if(void 0===a||a===m)continue;if(a instanceof c.Report){if(i.tracer.log(s.schema,s.state,"rule","external","error"),l.push(a),n.abortEarly)break;continue}if(Array.isArray(a)&&a[o.symbols.errors]){if(i.tracer.log(s.schema,s.state,"rule","external","error"),l.push(...a),n.abortEarly)break;continue}f?(i.tracer.value(s.state,"rule",m,a,"external"),f[h]=a):(i.tracer.value(s.state,"rule",t,a,"external"),t=a)}catch(e){throw n.errors.label&&(e.message+=` (${s.label})`),e}}if(s.value=t,l.length)throw s.error=c.process(l,e,n),i.debug&&(s.error.debug=i.debug),s.error}if(!n.warnings&&!n.debug&&!n.artifacts)return s.value;const l={value:s.value};return i.warnings.length&&(l.warning=c.details(i.warnings)),i.debug&&(l.debug=i.debug),i.artifacts&&(l.artifacts=i.artifacts),l},u.Mainstay=class{constructor(e,t,r){this.externals=[],this.warnings=[],this.tracer=e,this.debug=t,this.links=r,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const e=this._snapshots.pop();this.externals=e.externals,this.warnings=e.warnings}commit(){this._snapshots.pop()}},u.entry=function(e,r,n){const{tracer:s,cleanup:i}=u.tracer(r,n),a=n.debug?[]:null,o=r._ids._schemaChain?new Map:null,d=new u.Mainstay(s,a,o),p=r._ids._schemaChain?[{schema:r}]:null,h=new l([],[],{mainstay:d,schemas:p}),f=t.validate(e,r,h,n);i&&r.$_root.untrace();const m=c.process(f.errors,e,n);return{value:f.value,error:m,mainstay:d}},u.tracer=function(e,t){return e.$_root._tracer?{tracer:e.$_root._tracer._register(e)}:t.debug?(n(e.$_root.trace,"Debug mode not supported"),{tracer:e.$_root.trace()._register(e),cleanup:!0}):{tracer:u.ignore}},t.validate=function(e,t,r,n,s={}){if(t.$_terms.whens&&(t=t._generate(e,r,n).schema),t._preferences&&(n=u.prefs(t,n)),t._cache&&n.cache){const n=t._cache.get(e);if(r.mainstay.tracer.debug(r,"validate","cached",!!n),n)return n}const i=(s,i,a)=>t.$_createError(s,e,i,a||r,n),a={original:e,prefs:n,schema:t,state:r,error:i,errorsArray:u.errorsArray,warn:(e,t,n)=>r.mainstay.warnings.push(i(e,t,n)),message:(s,i)=>t.$_createError("custom",e,i,r,n,{messages:s})};r.mainstay.tracer.entry(t,r);const c=t._definition;if(c.prepare&&void 0!==e&&n.convert){const t=c.prepare(e,a);if(t){if(r.mainstay.tracer.value(r,"prepare",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),a);e=t.value}}if(c.coerce&&void 0!==e&&n.convert&&(!c.coerce.from||c.coerce.from.includes(typeof e))){const t=c.coerce.method(e,a);if(t){if(r.mainstay.tracer.value(r,"coerced",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),a);e=t.value}}const l=t._flags.empty;l&&l.$_match(u.trim(e,t),r.nest(l),o.defaults)&&(r.mainstay.tracer.value(r,"empty",e,void 0),e=void 0);const d=s.presence||t._flags.presence||(t._flags._endedSwitch?null:n.presence);if(void 0===e){if("forbidden"===d)return u.finalize(e,null,a);if("required"===d)return u.finalize(e,[t.$_createError("any.required",e,null,r,n)],a);if("optional"===d){if(t._flags.default!==o.symbols.deepDefault)return u.finalize(e,null,a);r.mainstay.tracer.value(r,"default",e,{}),e={}}}else if("forbidden"===d)return u.finalize(e,[t.$_createError("any.unknown",e,null,r,n)],a);const p=[];if(t._valids){const s=t._valids.get(e,r,n,t._flags.insensitive);if(s)return n.convert&&(r.mainstay.tracer.value(r,"valids",e,s.value),e=s.value),r.mainstay.tracer.filter(t,r,"valid",s),u.finalize(e,null,a);if(t._flags.only){const s=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},r,n);if(n.abortEarly)return u.finalize(e,[s],a);p.push(s)}}if(t._invalids){const s=t._invalids.get(e,r,n,t._flags.insensitive);if(s){r.mainstay.tracer.filter(t,r,"invalid",s);const i=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,n);if(n.abortEarly)return u.finalize(e,[i],a);p.push(i)}}if(c.validate){const t=c.validate(e,a);if(t&&(r.mainstay.tracer.value(r,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return p.push(t.errors),u.finalize(e,p,a);if(t.errors.length)return p.push(...t.errors),u.finalize(e,p,a)}}return t._rules.length?u.rules(e,p,a):u.finalize(e,p,a)},u.rules=function(e,t,r){const{schema:n,state:s,prefs:i}=r;for(const a of n._rules){const c=n._definition.rules[a.method];if(c.convert&&i.convert){s.mainstay.tracer.log(n,s,"rule",a.name,"full");continue}let l,d=a.args;if(a._resolve.length){d=Object.assign({},d);for(const t of a._resolve){const r=c.argsByName.get(t),a=d[t].resolve(e,s,i),u=r.normalize?r.normalize(a):a,p=o.validateArg(u,null,r);if(p){l=n.$_createError("any.ref",a,{arg:t,ref:d[t],reason:p},s,i);break}d[t]=u}}l=l||c.validate(e,r,d,a);const p=u.rule(l,a);if(p.errors){if(s.mainstay.tracer.log(n,s,"rule",a.name,"error"),a.warn){s.mainstay.warnings.push(...p.errors);continue}if(i.abortEarly)return u.finalize(e,p.errors,r);t.push(...p.errors)}else s.mainstay.tracer.log(n,s,"rule",a.name,"pass"),s.mainstay.tracer.value(s,"rule",e,p.value,a.name),e=p.value}return u.finalize(e,t,r)},u.rule=function(e,t){return e instanceof c.Report?(u.error(e,t),{errors:[e],value:null}):Array.isArray(e)&&e[o.symbols.errors]?(e.forEach((e=>u.error(e,t))),{errors:e,value:null}):{errors:null,value:e}},u.error=function(e,t){return t.message&&e._setTemplate(t.message),e},u.finalize=function(e,t,r){t=t||[];const{schema:s,state:i,prefs:a}=r;if(t.length){const n=u.default("failover",void 0,t,r);void 0!==n&&(i.mainstay.tracer.value(i,"failover",e,n),e=n,t=[])}if(t.length&&s._flags.error)if("function"==typeof s._flags.error){t=s._flags.error(t),Array.isArray(t)||(t=[t]);for(const e of t)n(e instanceof Error||e instanceof c.Report,"error() must return an Error object")}else t=[s._flags.error];if(void 0===e){const n=u.default("default",e,t,r);i.mainstay.tracer.value(i,"default",e,n),e=n}if(s._flags.cast&&void 0!==e){const t=s._definition.cast[s._flags.cast];if(t.from(e)){const n=t.to(e,r);i.mainstay.tracer.value(i,"cast",e,n,s._flags.cast),e=n}}if(s.$_terms.externals&&a.externals&&!1!==a._externals)for(const{method:e}of s.$_terms.externals)i.mainstay.externals.push({method:e,schema:s,state:i,label:c.label(s._flags,i,a)});const o={value:e,errors:t.length?t:null};return s._flags.result&&(o.value="strip"===s._flags.result?void 0:r.original,i.mainstay.tracer.value(i,s._flags.result,e,o.value),i.shadow(e,s._flags.result)),s._cache&&!1!==a.cache&&!s._refs.length&&s._cache.set(r.original,o),void 0===e||o.errors||void 0===s._flags.artifact||(i.mainstay.artifacts=i.mainstay.artifacts||new Map,i.mainstay.artifacts.has(s._flags.artifact)||i.mainstay.artifacts.set(s._flags.artifact,[]),i.mainstay.artifacts.get(s._flags.artifact).push(i.path)),o},u.prefs=function(e,t){const r=t===o.defaults;return r&&e._preferences[o.symbols.prefs]?e._preferences[o.symbols.prefs]:(t=o.preferences(t,e._preferences),r&&(e._preferences[o.symbols.prefs]=t),t)},u.default=function(e,t,r,n){const{schema:i,state:a,prefs:c}=n,l=i._flags[e];if(c.noDefaults||void 0===l)return t;if(a.mainstay.tracer.log(i,a,"rule",e,"full"),!l)return l;if("function"==typeof l){const t=l.length?[s(a.ancestors[0]),n]:[];try{return l(...t)}catch(t){return void r.push(i.$_createError(`any.${e}`,null,{error:t},a,c))}}return"object"!=typeof l?l:l[o.symbols.literal]?l.literal:o.isResolvable(l)?l.resolve(t,a,c):s(l)},u.trim=function(e,t){if("string"!=typeof e)return e;const r=t.$_getRule("trim");return r&&r.args.enabled?e.trim():e},u.ignore={active:!1,debug:i,entry:i,filter:i,log:i,resolve:i,value:i},u.errorsArray=function(){const e=[];return e[o.symbols.errors]=!0,e}},(e,t,r)=>{const n=r(43),s=r(44),i=r(112),a={value:Symbol("value")};e.exports=a.State=class{constructor(e,t,r){this.path=e,this.ancestors=t,this.mainstay=r.mainstay,this.schemas=r.schemas,this.debug=null}localize(e,t=null,r=null){const n=new a.State(e,t,this);return r&&n.schemas&&(n.schemas=[a.schemas(r),...n.schemas]),n}nest(e,t){const r=new a.State(this.path,this.ancestors,this);return r.schemas=r.schemas&&[a.schemas(e),...r.schemas],r.debug=t,r}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new a.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=n(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},a.schemas=function(e){return i.isSchema(e)?{schema:e}:e},a.Shadow=class{constructor(){this._values=null}set(e,t,r){if(!e.length)return;if("strip"===r&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let n=this._values;for(let t=0;t{const n=r(40),s=r(52),i=r(112),a={};e.exports=a.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=a.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){i.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,r){if(e=e||new a.Values,t){if(t._override)return t.clone();for(const r of[...t._values,...t._refs])e.add(r)}if(r)for(const t of[...r._values,...r._refs])e.remove(t);return e.length?e:null}remove(e){i.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,r,n){return!!this.get(e,t,r,n)}get(e,t,r,n){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&n){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const t of this._values)if(s(t,e))return{value:t};if(t)for(const i of this._refs){const a=i.resolve(e,t,r,null,{in:!0});if(void 0===a)continue;const o=i.in&&"object"==typeof a?Array.isArray(a)?a:Object.keys(a):[a];for(const t of o)if(typeof t==typeof e)if(n&&e&&"string"==typeof e){if(t.toLowerCase()===e.toLowerCase())return{value:t,ref:i}}else if(s(t,e))return{value:t,ref:i}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new a.Values(this._values,this._refs);return e._override=this._override,e}concat(e){n(!e._override,"Cannot concat override set of values");const t=new a.Values([...this._values,...e._values],[...this._refs,...e._refs]);return t._override=this._override,t}describe(){const e=[];this._override&&e.push({override:!0});for(const t of this._values.values())e.push(t&&"object"==typeof t?{value:t}:t);for(const t of this._refs.values())e.push(t.describe());return e}},a.Values.prototype[i.symbols.values]=!0,a.Values.prototype.slice=a.Values.prototype.clone,a.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t}},(e,t,r)=>{const n=r(40),s=r(52),i=r(44),a=r(127),o=r(112),c=r(121),l={};e.exports=a.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,{schema:t,state:r,prefs:n}){if(!Array.isArray(e))return;const s=t.$_getRule("sort");return s?l.sort(t,e,s.args.options,r,n):void 0}},validate(e,{schema:t,error:r}){if(!Array.isArray(e)){if(t._flags.single){const t=[e];return t[o.symbols.arraySingle]=!0,{value:t}}return{errors:r("array.base")}}if(t.$_getRule("items")||t.$_terms.externals)return{value:e.slice()}},rules:{has:{method(e){e=this.$_compile(e,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:e}});return t.$_mutateRegister(e),t},validate(e,{state:t,prefs:r,error:n},{schema:s}){const i=[e,...t.ancestors];for(let n=0;nthis.$_compile(e[r])),r,{append:!0});t.$_terms.items.push(n)}return t.$_mutateRebuild()},validate(e,{schema:t,error:r,state:n,prefs:s,errorsArray:i}){const a=t.$_terms._requireds.slice(),c=t.$_terms.ordered.slice(),u=[...t.$_terms._inclusions,...a],d=!e[o.symbols.arraySingle];delete e[o.symbols.arraySingle];const p=i();let h=e.length;for(let i=0;i="})}},ordered:{method(...e){o.verifyFlat(e,"ordered");const t=this.$_addRule("items");for(let r=0;rthis.$_compile(e[r])),r,{append:!0});l.validateSingle(n,t),t.$_mutateRegister(n),t.$_terms.ordered.push(n)}return t.$_mutateRebuild()}},single:{method(e){const t=void 0===e||!!e;return n(!t||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",t)}},sort:{method(e={}){o.assertOptions(e,["by","order"]);const t={order:e.order||"ascending"};return e.by&&(t.by=c.ref(e.by,{ancestor:0}),n(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(e,{error:t,state:r,prefs:n,schema:s},{options:i}){const{value:a,errors:o}=l.sort(s,e,i,r,n);if(o)return o;for(let r=0;rnew Set(e)}},rebuild(e){e.$_terms._inclusions=[],e.$_terms._exclusions=[],e.$_terms._requireds=[];for(const t of e.$_terms.items)l.validateSingle(t,e),"required"===t._flags.presence?e.$_terms._requireds.push(t):"forbidden"===t._flags.presence?e.$_terms._exclusions.push(t):e.$_terms._inclusions.push(t);for(const t of e.$_terms.ordered)l.validateSingle(t,e)},manifest:{build:(e,t)=>(t.items&&(e=e.items(...t.items)),t.ordered&&(e=e.ordered(...t.ordered)),e)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),l.fillMissedErrors=function(e,t,r,n,s,i){const a=[];let o=0;for(const e of r){const t=e._flags.label;t?a.push(t):++o}a.length?o?t.push(e.$_createError("array.includesRequiredBoth",n,{knownMisses:a,unknownMisses:o},s,i)):t.push(e.$_createError("array.includesRequiredKnowns",n,{knownMisses:a},s,i)):t.push(e.$_createError("array.includesRequiredUnknowns",n,{unknownMisses:o},s,i))},l.fillOrderedErrors=function(e,t,r,n,s,i){const a=[];for(const e of r)"required"===e._flags.presence&&a.push(e);a.length&&l.fillMissedErrors(e,t,a,n,s,i)},l.fillDefault=function(e,t,r,n){const s=[];let i=!0;for(let a=e.length-1;a>=0;--a){const o=e[a],c=[t,...r.ancestors],l=o.$_validate(void 0,r.localize(r.path,c,o),n).value;if(i){if(void 0===l)continue;i=!1}s.unshift(l)}s.length&&t.push(...s)},l.fastSplice=function(e,t){let r=t;for(;r{let d=l.compare(c,u,a,o);if(null!==d)return d;if(r.by&&(c=r.by.resolve(c,n,s),u=r.by.resolve(u,n,s)),d=l.compare(c,u,a,o),null!==d)return d;const p=typeof c;if(p!==typeof u)throw e.$_createError("array.sort.mismatching",t,null,n,s);if("number"!==p&&"string"!==p)throw e.$_createError("array.sort.unsupported",t,{type:p},n,s);return"number"===p?(c-u)*i:c{const n=r(40),s=r(127),i=r(112),a=r(132),o={isBool:function(e){return"boolean"==typeof e}};e.exports=s.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(e,{schema:t}){if("boolean"!=typeof e){if("string"==typeof e){const r=t._flags.sensitive?e:e.toLowerCase();e="true"===r||"false"!==r&&e}return"boolean"!=typeof e&&(e=t.$_terms.truthy&&t.$_terms.truthy.has(e,null,null,!t._flags.sensitive)||(!t.$_terms.falsy||!t.$_terms.falsy.has(e,null,null,!t._flags.sensitive))&&e),{value:e}}},validate(e,{error:t}){if("boolean"!=typeof e)return{value:e,errors:t("boolean.base")}},rules:{truthy:{method(...e){i.verifyFlat(e,"truthy");const t=this.clone();t.$_terms.truthy=t.$_terms.truthy||new a;for(let r=0;re?1:0},string:{from:o.isBool,to:(e,t)=>e?"true":"false"}},manifest:{build:(e,t)=>(t.truthy&&(e=e.truthy(...t.truthy)),t.falsy&&(e=e.falsy(...t.falsy)),e)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},(e,t,r)=>{const n=r(40),s=r(127),i=r(112),a=r(116),o={isDate:function(e){return e instanceof Date}};e.exports=s.extend({type:"date",coerce:{from:["number","string"],method:(e,{schema:t})=>({value:o.parse(e,t._flags.format)||e})},validate(e,{schema:t,error:r,prefs:n}){if(e instanceof Date&&!isNaN(e.getTime()))return;const s=t._flags.format;return n.convert&&s&&"string"==typeof e?{value:e,errors:r("date.format",{format:s})}:{value:e,errors:r("date.base")}},rules:{compare:{method:!1,validate(e,t,{date:r},{name:n,operator:s,args:a}){const o="now"===r?Date.now():r.getTime();return i.compare(e.getTime(),o,s)?e:t.error("date."+n,{limit:a.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:o.parse(e),assert:e=>null!==e,message:"must have a valid date format"}]},format:{method(e){return n(["iso","javascript","unix"].includes(e),"Unknown date format",e),this.$_setFlag("format",e)}},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{date:e},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{date:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{date:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{date:e},operator:">="})}},timestamp:{method(e="javascript"){return n(["javascript","unix"].includes(e),'"type" must be one of "javascript, unix"'),this.format(e)}}},cast:{number:{from:o.isDate,to:(e,t)=>e.getTime()},string:{from:o.isDate,to:(e,{prefs:t})=>a.date(e,t)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),o.parse=function(e,t){if(e instanceof Date)return e;if("string"!=typeof e&&(isNaN(e)||!isFinite(e)))return null;if(/^\s*$/.test(e))return null;if("iso"===t)return i.isIsoDate(e)?o.date(e.toString()):null;const r=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return o.date(1*e);if("unix"===t)return o.date(1e3*e);if("string"==typeof r)return null}return o.date(e)},o.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t}},(e,t,r)=>{const n=r(40),s=r(137);e.exports=s.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(e){return n(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:e}})},validate:(e,t,{n:r})=>e.length===r?e:t.error("function.arity",{n:r})},class:{method(){return this.$_addRule("class")},validate:(e,t)=>/^\s*class\s/.test(e.toString())?e:t.error("function.class",{value:e})},minArity:{method(e){return n(Number.isSafeInteger(e)&&e>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:e}})},validate:(e,t,{n:r})=>e.length>=r?e:t.error("function.minArity",{n:r})},maxArity:{method(e){return n(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:e}})},validate:(e,t,{n:r})=>e.length<=r?e:t.error("function.maxArity",{n:r})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},(e,t,r)=>{const n=r(39),s=r(40),i=r(43),a=r(86),o=r(127),c=r(112),l=r(121),u=r(118),d=r(120),p=r(116),h={renameDefaults:{alias:!1,multiple:!1,override:!1}};e.exports=o.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:!1}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(e,t)=>e.keys(t),validate(e,{schema:t,error:r,state:n,prefs:s}){if(!e||typeof e!==t.$_property("typeof")||Array.isArray(e))return{value:e,errors:r("object.base",{type:t.$_property("typeof")})};if(!(t.$_terms.renames||t.$_terms.dependencies||t.$_terms.keys||t.$_terms.patterns||t.$_terms.externals))return;e=h.clone(e,s);const i=[];if(t.$_terms.renames&&!h.rename(t,e,n,s,i))return{value:e,errors:i};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:i};const a=new Set(Object.keys(e));if(t.$_terms.keys){const r=[e,...n.ancestors];for(const o of t.$_terms.keys){const t=o.key,c=e[t];a.delete(t);const l=n.localize([...n.path,t],r,o),u=o.schema.$_validate(c,l,s);if(u.errors){if(s.abortEarly)return{value:e,errors:u.errors};void 0!==u.value&&(e[t]=u.value),i.push(...u.errors)}else"strip"===o.schema._flags.result||void 0===u.value&&void 0!==c?delete e[t]:void 0!==u.value&&(e[t]=u.value)}}if(a.size||t._flags._hasPatternMatch){const r=h.unknown(t,e,a,i,n,s);if(r)return r}if(t.$_terms.dependencies)for(const r of t.$_terms.dependencies){if(null!==r.key&&!1===h.isPresent(r.options)(r.key.resolve(e,n,s,null,{shadow:!1})))continue;const a=h.dependencies[r.rel](t,r,e,n,s);if(a){const r=t.$_createError(a.code,e,a.context,n,s);if(s.abortEarly)return{value:e,errors:r};i.push(r)}}return{value:e,errors:i}},rules:{and:{method(...e){return c.verifyFlat(e,"and"),h.dependency(this,"and",null,e)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,t,r){p.isTemplate(e)||(e=l.ref(e)),s(void 0===r||"string"==typeof r,"Message must be a string"),t=this.$_compile(t,{appendPath:!0});const n=this.$_addRule({name:"assert",args:{subject:e,schema:t,message:r}});return n.$_mutateRegister(e),n.$_mutateRegister(t),n},validate(e,{error:t,prefs:r,state:n},{subject:s,schema:i,message:a}){const o=s.resolve(e,n,r),c=d.isRef(s)?s.absolute(n):[];return i.$_match(o,n.localize(c,[e,...n.ancestors],i),r)?e:t("object.assert",{subject:s,message:a})},args:["subject","schema","message"],multi:!0},instance:{method(e,t){return s("function"==typeof e,"constructor must be a function"),t=t||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:t}})},validate:(e,t,{constructor:r,name:n})=>e instanceof r?e:t.error("object.instance",{type:n,value:e}),args:["constructor","name"]},keys:{method(e){s(void 0===e||"object"==typeof e,"Object schema must be a valid object"),s(!c.isSchema(e),"Object schema cannot be a joi schema");const t=this.clone();if(e)if(Object.keys(e).length){t.$_terms.keys=t.$_terms.keys?t.$_terms.keys.filter((t=>!e.hasOwnProperty(t.key))):new h.Keys;for(const r in e)c.tryWithPath((()=>t.$_terms.keys.push({key:r,schema:this.$_compile(e[r])})),r)}else t.$_terms.keys=new h.Keys;else t.$_terms.keys=null;return t.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:n,operator:s,args:i})=>c.compare(Object.keys(e).length,r,s)?e:t.error("object."+n,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:c.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},nand:{method(...e){return c.verifyFlat(e,"nand"),h.dependency(this,"nand",null,e)}},or:{method(...e){return c.verifyFlat(e,"or"),h.dependency(this,"or",null,e)}},oxor:{method(...e){return h.dependency(this,"oxor",null,e)}},pattern:{method(e,t,r={}){const n=e instanceof RegExp;n||(e=this.$_compile(e,{appendPath:!0})),s(void 0!==t,"Invalid rule"),c.assertOptions(r,["fallthrough","matches"]),n&&s(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),t=this.$_compile(t,{appendPath:!0});const i=this.clone();i.$_terms.patterns=i.$_terms.patterns||[];const a={[n?"regex":"schema"]:e,rule:t};return r.matches&&(a.matches=this.$_compile(r.matches),"array"!==a.matches.type&&(a.matches=a.matches.$_root.array().items(a.matches)),i.$_mutateRegister(a.matches),i.$_setFlag("_hasPatternMatch",!0,{clone:!1})),r.fallthrough&&(a.fallthrough=!0),i.$_terms.patterns.push(a),i.$_mutateRegister(t),i}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>d.isRef(e)?e:t.error("object.refType",{value:e})},regex:{method(){return this.$_addRule("regex")},validate:(e,t)=>e instanceof RegExp?e:t.error("object.regex",{value:e})},rename:{method(e,t,r={}){s("string"==typeof e||e instanceof RegExp,"Rename missing the from argument"),s("string"==typeof t||t instanceof p,"Invalid rename to argument"),s(t!==e,"Cannot rename key to same name:",e),c.assertOptions(r,["alias","ignoreUndefined","override","multiple"]);const i=this.clone();i.$_terms.renames=i.$_terms.renames||[];for(const t of i.$_terms.renames)s(t.from!==e,"Cannot rename the same key multiple times");return t instanceof p&&i.$_mutateRegister(t),i.$_terms.renames.push({from:e,to:t,options:n(h.renameDefaults,r)}),i}},schema:{method(e="any"){return this.$_addRule({name:"schema",args:{type:e}})},validate:(e,t,{type:r})=>!c.isSchema(e)||"any"!==r&&e.type!==r?t.error("object.schema",{type:r}):e},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t,r={}){return h.dependency(this,"with",e,t,r)}},without:{method(e,t,r={}){return h.dependency(this,"without",e,t,r)}},xor:{method(...e){return c.verifyFlat(e,"xor"),h.dependency(this,"xor",null,e)}}},overrides:{default(e,t){return void 0===e&&(e=c.symbols.deepDefault),this.$_parent("default",e,t)}},rebuild(e){if(e.$_terms.keys){const t=new a.Sorter;for(const r of e.$_terms.keys)c.tryWithPath((()=>t.add(r,{after:r.schema.$_rootReferences(),group:r.key})),r.key);e.$_terms.keys=new h.Keys(...t.nodes)}},manifest:{build(e,t){if(t.keys&&(e=e.keys(t.keys)),t.dependencies)for(const{rel:r,key:n=null,peers:s,options:i}of t.dependencies)e=h.dependency(e,r,n,s,i);if(t.patterns)for(const{regex:r,schema:n,rule:s,fallthrough:i,matches:a}of t.patterns)e=e.pattern(r||n,s,{fallthrough:i,matches:a});if(t.renames)for(const{from:r,to:n,options:s}of t.renames)e=e.rename(r,n,s);return e}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),h.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return i(e,{shallow:!0});const r=Object.create(Object.getPrototypeOf(e));return Object.assign(r,e),r}const r=function(...t){return e.apply(this,t)};return r.prototype=i(e.prototype),Object.defineProperty(r,"name",{value:e.name,writable:!1}),Object.defineProperty(r,"length",{value:e.length,writable:!1}),Object.assign(r,e),r},h.dependency=function(e,t,r,n,i){s(null===r||"string"==typeof r,t,"key must be a strings"),i||(i=n.length>1&&"object"==typeof n[n.length-1]?n.pop():{}),c.assertOptions(i,["separator","isPresent"]),n=[].concat(n);const a=c.default(i.separator,"."),o=[];for(const e of n)s("string"==typeof e,t,"peers must be strings"),o.push(l.ref(e,{separator:a,ancestor:0,prefix:!1}));null!==r&&(r=l.ref(r,{separator:a,ancestor:0,prefix:!1}));const u=e.clone();return u.$_terms.dependencies=u.$_terms.dependencies||[],u.$_terms.dependencies.push(new h.Dependency(t,r,o,n,i)),u},h.dependencies={and(e,t,r,n,s){const i=[],a=[],o=t.peers.length,c=h.isPresent(t.options);for(const e of t.peers)!1===c(e.resolve(r,n,s,null,{shadow:!1}))?i.push(e.key):a.push(e.key);if(i.length!==o&&a.length!==o)return{code:"object.and",context:{present:a,presentWithLabels:h.keysToLabels(e,a),missing:i,missingWithLabels:h.keysToLabels(e,i)}}},nand(e,t,r,n,s){const i=[],a=h.isPresent(t.options);for(const e of t.peers)a(e.resolve(r,n,s,null,{shadow:!1}))&&i.push(e.key);if(i.length!==t.peers.length)return;const o=t.paths[0],c=t.paths.slice(1);return{code:"object.nand",context:{main:o,mainWithLabel:h.keysToLabels(e,o),peers:c,peersWithLabels:h.keysToLabels(e,c)}}},or(e,t,r,n,s){const i=h.isPresent(t.options);for(const e of t.peers)if(i(e.resolve(r,n,s,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:t.paths,peersWithLabels:h.keysToLabels(e,t.paths)}}},oxor(e,t,r,n,s){const i=[],a=h.isPresent(t.options);for(const e of t.peers)a(e.resolve(r,n,s,null,{shadow:!1}))&&i.push(e.key);if(!i.length||1===i.length)return;const o={peers:t.paths,peersWithLabels:h.keysToLabels(e,t.paths)};return o.present=i,o.presentWithLabels=h.keysToLabels(e,i),{code:"object.oxor",context:o}},with(e,t,r,n,s){const i=h.isPresent(t.options);for(const a of t.peers)if(!1===i(a.resolve(r,n,s,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:h.keysToLabels(e,t.key.key),peer:a.key,peerWithLabel:h.keysToLabels(e,a.key)}}},without(e,t,r,n,s){const i=h.isPresent(t.options);for(const a of t.peers)if(i(a.resolve(r,n,s,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:h.keysToLabels(e,t.key.key),peer:a.key,peerWithLabel:h.keysToLabels(e,a.key)}}},xor(e,t,r,n,s){const i=[],a=h.isPresent(t.options);for(const e of t.peers)a(e.resolve(r,n,s,null,{shadow:!1}))&&i.push(e.key);if(1===i.length)return;const o={peers:t.paths,peersWithLabels:h.keysToLabels(e,t.paths)};return 0===i.length?{code:"object.missing",context:o}:(o.present=i,o.presentWithLabels=h.keysToLabels(e,i),{code:"object.xor",context:o})}},h.keysToLabels=function(e,t){return Array.isArray(t)?t.map((t=>e.$_mapLabels(t))):e.$_mapLabels(t)},h.isPresent=function(e){return"function"==typeof e.isPresent?e.isPresent:e=>void 0!==e},h.rename=function(e,t,r,n,s){const i={};for(const a of e.$_terms.renames){const o=[],c="string"!=typeof a.from;if(c)for(const e in t){if(void 0===t[e]&&a.options.ignoreUndefined)continue;if(e===a.to)continue;const r=a.from.exec(e);r&&o.push({from:e,to:a.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,a.from)||void 0===t[a.from]&&a.options.ignoreUndefined||o.push(a);for(const l of o){const o=l.from;let u=l.to;if(u instanceof p&&(u=u.render(t,r,n,l.match)),o!==u){if(!a.options.multiple&&i[u]&&(s.push(e.$_createError("object.rename.multiple",t,{from:o,to:u,pattern:c},r,n)),n.abortEarly))return!1;if(Object.prototype.hasOwnProperty.call(t,u)&&!a.options.override&&!i[u]&&(s.push(e.$_createError("object.rename.override",t,{from:o,to:u,pattern:c},r,n)),n.abortEarly))return!1;void 0===t[o]?delete t[u]:t[u]=t[o],i[u]=!0,a.options.alias||delete t[o]}}}return!0},h.unknown=function(e,t,r,n,s,i){if(e.$_terms.patterns){let a=!1;const o=e.$_terms.patterns.map((e=>{if(e.matches)return a=!0,[]})),c=[t,...s.ancestors];for(const a of r){const l=t[a],u=[...s.path,a];for(let d=0;d{const n=r(40),s=r(127),i=r(112),a=r(121),o=r(118),c={};e.exports=s.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(e,t)=>e.ref(t),validate(e,{schema:t,state:r,prefs:s}){n(t.$_terms.link,"Uninitialized link schema");const i=c.generate(t,e,r,s),a=t.$_terms.link[0].ref;return i.$_validate(e,r.nest(i,`link:${a.display}:${i.type}`),s)},generate:(e,t,r,n)=>c.generate(e,t,r,n),rules:{ref:{method(e){n(!this.$_terms.link,"Cannot reinitialize schema"),e=a.ref(e),n("value"===e.type||"local"===e.type,"Invalid reference type:",e.type),n("local"===e.type||"root"===e.ancestor||e.ancestor>0,"Link cannot reference itself");const t=this.clone();return t.$_terms.link=[{ref:e}],t}},relative:{method(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(e){n(this.$_terms.link,"Uninitialized link schema"),n(i.isSchema(e),"Invalid schema object"),n("link"!==e.type,"Cannot merge type link with another link");const t=this.clone();return t.$_terms.whens||(t.$_terms.whens=[]),t.$_terms.whens.push({concat:e}),t.$_mutateRebuild()}},manifest:{build:(e,t)=>(n(t.link,"Invalid link description missing link"),e.ref(t.link))}}),c.generate=function(e,t,r,n){let s=r.mainstay.links.get(e);if(s)return s._generate(t,r,n).schema;const i=e.$_terms.link[0].ref,{perspective:a,path:o}=c.perspective(i,r);c.assert(a,"which is outside of schema boundaries",i,e,r,n);try{s=o.length?a.$_reach(o):a}catch(t){c.assert(!1,"to non-existing schema",i,e,r,n)}return c.assert("link"!==s.type,"which is another link",i,e,r,n),e._flags.relative||r.mainstay.links.set(e,s),s._generate(t,r,n).schema},c.perspective=function(e,t){if("local"===e.type){for(const{schema:r,key:n}of t.schemas){if((r._flags.id||n)===e.path[0])return{perspective:r,path:e.path.slice(1)};if(r.$_terms.shared)for(const t of r.$_terms.shared)if(t._flags.id===e.path[0])return{perspective:t,path:e.path.slice(1)}}return{perspective:null,path:null}}return"root"===e.ancestor?{perspective:t.schemas[t.schemas.length-1].schema,path:e.path}:{perspective:t.schemas[e.ancestor]&&t.schemas[e.ancestor].schema,path:e.path}},c.assert=function(e,t,r,s,i,a){e||n(!1,`"${o.label(s._flags,i,a)}" contains link reference "${r.display}" ${t}`)}},(e,t,r)=>{const n=r(40),s=r(127),i=r(112),a={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/,decimalPlaces(e){const t=e.toString(),r=t.indexOf("."),n=t.indexOf("e");return(r<0?0:(n<0?t.length:n)-r-1)+(n<0?0:Math.max(0,-parseInt(t.slice(n+1))))}};e.exports=s.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:r}){if(!e.match(a.numberRx))return;e=e.trim();const n={value:parseFloat(e)};if(0===n.value&&(n.value=0),!t._flags.unsafe)if(e.match(/e/i)){if(a.extractSignificantDigits(e)!==a.extractSignificantDigits(String(n.value)))return n.errors=r("number.unsafe"),n}else{const t=n.value.toString();if(t.match(/e/i))return n;if(t!==a.normalizeDecimal(e))return n.errors=r("number.unsafe"),n}return n}},validate(e,{schema:t,error:r,prefs:n}){if(e===1/0||e===-1/0)return{value:e,errors:r("number.infinity")};if(!i.isNumber(e))return{value:e,errors:r("number.base")};const s={value:e};if(n.convert){const e=t.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);s.value=Math.round(s.value*t)/t}}return 0===s.value&&(s.value=0),!t._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||ei.compare(e,r,s)?e:t.error("number."+n,{limit:a.limit,value:e}),args:[{name:"limit",ref:!0,assert:i.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){const t="number"==typeof e?a.decimalPlaces(e):null,r=Math.pow(10,t);return this.$_addRule({name:"multiple",args:{base:e,baseDecimalPlace:t,pfactor:r}})},validate:(e,t,{base:r,baseDecimalPlace:n,pfactor:s},i)=>a.decimalPlaces(e)>n?t.error("number.multiple",{multiple:i.args.base,value:e}):Math.round(s*e)%Math.round(s*r)==0?e:t.error("number.multiple",{multiple:i.args.base,value:e}),args:[{name:"base",ref:!0,assert:e=>"number"==typeof e&&isFinite(e)&&e>0,message:"must be a positive number"},"baseDecimalPlace","pfactor"],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,t)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:t.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(e){return n(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,t,{limit:r}){const n=e.toString().match(a.precisionRx);return Math.max((n[1]?n[1].length:0)-(n[2]?parseInt(n[2],10):0),0)<=r?e:t.error("number.precision",{limit:r,value:e})},convert:!0},sign:{method(e){return n(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate:(e,t,{sign:r})=>"negative"===r&&e<0||"positive"===r&&e>0?e:t.error(`number.${r}`)},unsafe:{method(e=!0){return n("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("unsafe",e)}}},cast:{string:{from:e=>"number"==typeof e,to:(e,t)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),a.extractSignificantDigits=function(e){return e.replace(a.exponentialPartRegex,"").replace(a.dotRegex,"").replace(a.trailingZerosRegex,"").replace(a.leadingSignAndZerosRegex,"")},a.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e}},(e,t,r)=>{const n=r(137);e.exports=n.extend({type:"object",cast:{map:{from:e=>e&&"object"==typeof e,to:(e,t)=>new Map(Object.entries(e))}}})},(e,t,r)=>{var n=r(21).Buffer;const s=r(40),i=r(142),a=r(144),o=r(145),c=r(53),l=r(147),u=r(146),d=r(127),p=r(112),h={tlds:l instanceof Set&&{tlds:{allow:l,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:{withPrefix:/^0x[0-9a-f]+$/i,withOptionalPrefix:/^(?:0x)?[0-9a-f]+$/i,withoutPrefix:/^[0-9a-f]+$/i},ipRegex:o.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};e.exports=d.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,{schema:t,state:r,prefs:n}){const s=t.$_getRule("normalize");s&&(e=e.normalize(s.args.form));const i=t.$_getRule("case");i&&(e="upper"===i.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const a=t.$_getRule("trim");if(a&&a.args.enabled&&(e=e.trim()),t.$_terms.replacements)for(const r of t.$_terms.replacements)e=e.replace(r.pattern,r.replacement);const o=t.$_getRule("hex");if(o&&o.args.options.byteAligned&&e.length%2!=0&&(e=`0${e}`),t.$_getRule("isoDate")){const t=h.isoDate(e);t&&(e=t)}if(t._flags.truncate){const s=t.$_getRule("max");if(s){let i=s.args.limit;if(p.isResolvable(i)&&(i=i.resolve(e,r,n),!p.limit(i)))return{value:e,errors:t.$_createError("any.ref",i,{ref:s.args.limit,arg:"limit",reason:"must be a positive integer"},r,n)};e=e.slice(0,i)}}return{value:e}}},validate(e,{schema:t,error:r}){if("string"!=typeof e)return{value:e,errors:r("string.base")};if(""===e){const n=t.$_getRule("min");if(n&&0===n.args.limit)return;return{value:e,errors:r("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(e,t)=>/^[a-zA-Z0-9]+$/.test(e)?e:t.error("string.alphanum")},base64:{method(e={}){return p.assertOptions(e,["paddingRequired","urlSafe"]),e={urlSafe:!1,paddingRequired:!0,...e},s("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),s("boolean"==typeof e.urlSafe,"urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:e}})},validate:(e,t,{options:r})=>h.base64Regex[r.paddingRequired][r.urlSafe].test(e)?e:t.error("string.base64")},case:{method(e){return s(["lower","upper"].includes(e),"Invalid case:",e),this.$_addRule({name:"case",args:{direction:e}})},validate:(e,t,{direction:r})=>"lower"===r&&e===e.toLocaleLowerCase()||"upper"===r&&e===e.toLocaleUpperCase()?e:t.error(`string.${r}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let r=e.length,n=0,s=1;for(;r--;){const t=e.charAt(r)*s;n+=t-9*(t>9),s^=3}return n>0&&n%10==0?e:t.error("string.creditCard")}},dataUri:{method(e={}){return p.assertOptions(e,["paddingRequired"]),e={paddingRequired:!0,...e},s("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:e}})},validate(e,t,{options:r}){const n=e.match(h.dataUriRegex);if(n){if(!n[2])return e;if("base64"!==n[2])return e;if(h.base64Regex[r.paddingRequired].false.test(n[3]))return e}return t.error("string.dataUri")}},domain:{method(e){e&&p.assertOptions(e,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const t=h.addressOptions(e);return this.$_addRule({name:"domain",args:{options:e},address:t})},validate:(e,t,r,{address:n})=>i.isValid(e,n)?e:t.error("string.domain")},email:{method(e={}){p.assertOptions(e,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),s(void 0===e.multiple||"boolean"==typeof e.multiple,"multiple option must be an boolean");const t=h.addressOptions(e),r=new RegExp(`\\s*[${e.separator?c(e.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:e},regex:r,address:t})},validate(e,t,{options:r},{regex:n,address:s}){const i=r.multiple?e.split(n):[e],o=[];for(const e of i)a.isValid(e,s)||o.push(e);return o.length?t.error("string.email",{value:e,invalids:o}):e}},guid:{alias:"uuid",method(e={}){p.assertOptions(e,["version","separator"]);let t="";if(e.version){const r=[].concat(e.version);s(r.length>=1,"version must have at least 1 valid version specified");const n=new Set;for(let e=0;e("optional"===r.prefix?h.hexRegex.withOptionalPrefix:!0===r.prefix?h.hexRegex.withPrefix:h.hexRegex.withoutPrefix).test(e)?r.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(e,t)=>i.isValid(e,{minDomainSegments:1})||h.ipRegex.test(e)?e:t.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(e={}){p.assertOptions(e,["cidr","version"]);const{cidr:t,versions:r,regex:n}=o.regex(e),s=e.version?r:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:t,version:s}},regex:n})},validate:(e,t,{options:r},{regex:n})=>n.test(e)?e:r.version?t.error("string.ipVersion",{value:e,cidr:r.cidr,version:r.version}):t.error("string.ip",{value:e,cidr:r.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(e,{error:t})=>h.isoDate(e)?e:t("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>h.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return h.length(this,"length",e,"=",t)},validate(e,t,{limit:r,encoding:s},{name:i,operator:a,args:o}){const c=s?n&&n.byteLength(e,s):e.length;return p.compare(c,r,a)?e:t.error("string."+i,{limit:o.limit,value:e,encoding:s})},args:[{name:"limit",ref:!0,assert:p.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return h.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return h.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(e="NFC"){return s(h.normalizationForms.includes(e),"normalization form must be one of "+h.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:e}})},validate:(e,{error:t},{form:r})=>e===e.normalize(r)?e:t("string.normalize",{value:e,form:r}),convert:!0},pattern:{alias:"regex",method(e,t={}){s(e instanceof RegExp,"regex must be a RegExp"),s(!e.flags.includes("g")&&!e.flags.includes("y"),"regex should not use global or sticky mode"),"string"==typeof t&&(t={name:t}),p.assertOptions(t,["invert","name"]);const r=["string.pattern",t.invert?".invert":"",t.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:e,options:t},errorCode:r})},validate:(e,t,{regex:r,options:n},{errorCode:s})=>r.test(e)^n.invert?e:t.error(s,{name:n.name,regex:r,value:e}),args:["regex","options"],multi:!0},replace:{method(e,t){"string"==typeof e&&(e=new RegExp(c(e),"g")),s(e instanceof RegExp,"pattern must be a RegExp"),s("string"==typeof t,"replacement must be a String");const r=this.clone();return r.$_terms.replacements||(r.$_terms.replacements=[]),r.$_terms.replacements.push({pattern:e,replacement:t}),r}},token:{method(){return this.$_addRule("token")},validate:(e,t)=>/^\w+$/.test(e)?e:t.error("string.token")},trim:{method(e=!0){return s("boolean"==typeof e,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:e}})},validate:(e,t,{enabled:r})=>r&&e!==e.trim()?t.error("string.trim"):e,convert:!0},truncate:{method(e=!0){return s("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("truncate",e)}},uppercase:{method(){return this.case("upper")}},uri:{method(e={}){p.assertOptions(e,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme"]),e.domain&&p.assertOptions(e.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:t,scheme:r}=u.regex(e),n=e.domain?h.addressOptions(e.domain):null;return this.$_addRule({name:"uri",args:{options:e},regex:t,domain:n,scheme:r})},validate(e,t,{options:r},{regex:n,domain:s,scheme:a}){if(["http:/","https:/"].includes(e))return t.error("string.uri");const o=n.exec(e);if(o){const n=o[1]||o[2];return!s||r.allowRelative&&!n||i.isValid(n,s)?e:t.error("string.domain",{value:n})}return r.relativeOnly?t.error("string.uriRelativeOnly"):r.scheme?t.error("string.uriCustomScheme",{scheme:a,value:e}):t.error("string.uri")}}},manifest:{build(e,t){if(t.replacements)for(const{pattern:r,replacement:n}of t.replacements)e=e.replace(r,n);return e}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),h.addressOptions=function(e){if(!e)return h.tlds||e;if(s(void 0===e.minDomainSegments||Number.isSafeInteger(e.minDomainSegments)&&e.minDomainSegments>0,"minDomainSegments must be a positive integer"),s(void 0===e.maxDomainSegments||Number.isSafeInteger(e.maxDomainSegments)&&e.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),!1===e.tlds)return e;if(!0===e.tlds||void 0===e.tlds)return s(h.tlds,"Built-in TLD list disabled"),Object.assign({},e,h.tlds);s("object"==typeof e.tlds,"tlds must be true, false, or an object");const t=e.tlds.deny;if(t)return Array.isArray(t)&&(e=Object.assign({},e,{tlds:{deny:new Set(t)}})),s(e.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),s(!e.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),h.validateTlds(e.tlds.deny,"tlds.deny"),e;const r=e.tlds.allow;return r?!0===r?(s(h.tlds,"Built-in TLD list disabled"),Object.assign({},e,h.tlds)):(Array.isArray(r)&&(e=Object.assign({},e,{tlds:{allow:new Set(r)}})),s(e.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),h.validateTlds(e.tlds.allow,"tlds.allow"),e):e},h.validateTlds=function(e,t){for(const r of e)s(i.isValid(r,{minDomainSegments:1,maxDomainSegments:1}),`${t} must contain valid top level domain names`)},h.isoDate=function(e){if(!p.isIsoDate(e))return null;/.*T.*[+-]\d\d$/.test(e)&&(e+="00");const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},h.length=function(e,t,r,i,a){return s(!a||n&&n.isEncoding(a),"Invalid encoding:",a),e.$_addRule({name:t,method:"length",args:{limit:r,encoding:a},operator:i})}},(e,t,r)=>{const n=r(8),s=r(143),i={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:n.URL||URL};t.analyze=function(e,t={}){if(!e)return s.code("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return s.code("DOMAIN_TOO_LONG");if(!!i.nonAsciiRx.test(e)){if(!1===t.allowUnicode)return s.code("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(i.domainControlRx.test(e))return s.code("DOMAIN_INVALID_CHARS");e=i.punycode(e),t.allowFullyQualified&&"."===e[e.length-1]&&(e=e.slice(0,-1));const r=t.minDomainSegments||i.minDomainSegments,n=e.split(".");if(n.lengtht.maxDomainSegments)return s.code("DOMAIN_SEGMENTS_COUNT_MAX");const a=t.tlds;if(a){const e=n[n.length-1].toLowerCase();if(a.deny&&a.deny.has(e)||a.allow&&!a.allow.has(e))return s.code("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e63)return s.code("DOMAIN_LONG_SEGMENT");if(e{t.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},t.code=function(e){return{code:e,error:t.codes[e]}}},(e,t,r)=>{const n=r(101),s=r(142),i=r(143),a={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(n.TextEncoder||TextEncoder)};t.analyze=function(e,t){return a.email(e,t)},t.isValid=function(e,t){return!a.email(e,t)},a.email=function(e,t={}){if("string"!=typeof e)throw new Error("Invalid input: email must be a string");if(!e)return i.code("EMPTY_STRING");const r=!a.nonAsciiRx.test(e);if(!r){if(!1===t.allowUnicode)return i.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const n=e.split("@");if(2!==n.length)return n.length>2?i.code("MULTIPLE_AT_CHAR"):i.code("MISSING_AT_CHAR");const[o,c]=n;if(!o)return i.code("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return i.code("ADDRESS_TOO_LONG");if(a.encoder.encode(o).length>64)return i.code("LOCAL_TOO_LONG")}return a.local(o,r)||s.analyze(c,t)},a.local=function(e,t){const r=e.split(".");for(const e of r){if(!e.length)return i.code("EMPTY_LOCAL_SEGMENT");if(t){if(!a.atextRx.test(e))return i.code("INVALID_LOCAL_CHARS")}else for(const t of e){if(a.atextRx.test(t))continue;const e=a.binary(t);if(!a.atomRx.test(e))return i.code("INVALID_LOCAL_CHARS")}}},a.binary=function(e){return Array.from(a.encoder.encode(e)).map((e=>String.fromCharCode(e))).join("")},a.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,a.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},(e,t,r)=>{const n=r(40),s=r(146);t.regex=function(e={}){n(void 0===e.cidr||"string"==typeof e.cidr,"options.cidr must be a string");const t=e.cidr?e.cidr.toLowerCase():"optional";n(["required","optional","forbidden"].includes(t),"options.cidr must be one of required, optional, forbidden"),n(void 0===e.version||"string"==typeof e.version||Array.isArray(e.version),"options.version must be a string or an array of string");let r=e.version||["ipv4","ipv6","ipvfuture"];Array.isArray(r)||(r=[r]),n(r.length>=1,"options.version must have at least 1 version specified");for(let e=0;e{if("forbidden"===t)return s.ip[e];const r=`\\/${"ipv4"===e?s.ip.v4Cidr:s.ip.v6Cidr}`;return"required"===t?`${s.ip[e]}${r}`:`${s.ip[e]}(?:${r})?`})).join("|")})`,a=new RegExp(`^${i}$`);return{cidr:t,versions:r,regex:a,raw:i}}},(e,t,r)=>{const n=r(40),s=r(53),i={generate:function(){const e={},t="\\dA-Fa-f",r="["+t+"]",n="\\w-\\.~",s="!\\$&'\\(\\)\\*\\+,;=",i="%"+t,a=n+i+s+":@",o="["+a+"]",c="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4address="(?:"+c+"\\.){3}"+c;const l=r+"{1,4}",u="(?:"+l+":"+l+"|"+e.ipv4address+")",d="(?:"+l+":){6}"+u,p="::(?:"+l+":){5}"+u,h="(?:"+l+")?::(?:"+l+":){4}"+u,f="(?:(?:"+l+":){0,1}"+l+")?::(?:"+l+":){3}"+u,m="(?:(?:"+l+":){0,2}"+l+")?::(?:"+l+":){2}"+u,g="(?:(?:"+l+":){0,3}"+l+")?::"+l+":"+u,y="(?:(?:"+l+":){0,4}"+l+")?::"+u,_="(?:(?:"+l+":){0,5}"+l+")?::"+l,v="(?:(?:"+l+":){0,6}"+l+")?::";e.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",e.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",e.ipv6address="(?:"+d+"|"+p+"|"+h+"|"+f+"|"+m+"|"+g+"|"+y+"|"+_+"|"+v+")",e.ipvFuture="v"+r+"+\\.["+n+s+":]+",e.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",e.schemeRegex=new RegExp(e.scheme);const b="["+n+i+s+":]*",w="["+n+i+s+"]{1,255}",E="(?:"+("\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]")+"|"+e.ipv4address+"|"+w+")",R="(?:"+b+"@)?"+E+"(?::\\d*)?",S="(?:"+b+"@)?("+E+")(?::\\d*)?",A=o+"*",O=o+"+",P="(?:\\/"+A+")*",T="\\/(?:"+O+P+")?",C=O+P,I="["+n+i+s+"@]+"+P,k="(?:\\/\\/\\/"+A+P+")";return e.hierPart="(?:(?:\\/\\/"+R+P+")|"+T+"|"+C+"|"+k+")",e.hierPartCapture="(?:(?:\\/\\/"+S+P+")|"+T+"|"+C+")",e.relativeRef="(?:(?:\\/\\/"+R+P+")|"+T+"|"+I+"|)",e.relativeRefCapture="(?:(?:\\/\\/"+S+P+")|"+T+"|"+I+"|)",e.query="["+a+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+a+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+a+"\\/\\?]*",e}};i.rfc3986=i.generate(),t.ip={v4Cidr:i.rfc3986.ipv4Cidr,v6Cidr:i.rfc3986.ipv6Cidr,ipv4:i.rfc3986.ipv4address,ipv6:i.rfc3986.ipv6address,ipvfuture:i.rfc3986.ipvFuture},i.createRegex=function(e){const t=i.rfc3986,r="(?:\\?"+(e.allowQuerySquareBrackets?t.queryWithSquareBrackets:t.query)+")?(?:#"+t.fragment+")?",a=e.domain?t.relativeRefCapture:t.relativeRef;if(e.relativeOnly)return i.wrap(a+r);let o="";if(e.scheme){n(e.scheme instanceof RegExp||"string"==typeof e.scheme||Array.isArray(e.scheme),"scheme must be a RegExp, String, or Array");const r=[].concat(e.scheme);n(r.length>=1,"scheme must have at least 1 scheme specified");const i=[];for(let e=0;e{const t={tlds:["AAA","AARP","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"]};e.exports=new Set(t.tlds.map((e=>e.toLowerCase())))},(e,t,r)=>{const n=r(40),s=r(127),i={};i.Map=class extends Map{slice(){return new i.Map(this)}},e.exports=s.extend({type:"symbol",terms:{map:{init:new i.Map}},coerce:{method(e,{schema:t,error:r}){const n=t.$_terms.map.get(e);return n&&(e=n),t._flags.only&&"symbol"!=typeof e?{value:e,errors:r("symbol.map",{map:t.$_terms.map})}:{value:e}}},validate(e,{error:t}){if("symbol"!=typeof e)return{value:e,errors:t("symbol.base")}},rules:{map:{method(e){e&&!e[Symbol.iterator]&&"object"==typeof e&&(e=Object.entries(e)),n(e&&e[Symbol.iterator],"Iterable must be an iterable or object");const t=this.clone(),r=[];for(const s of e){n(s&&s[Symbol.iterator],"Entry must be an iterable");const[e,i]=s;n("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),n("symbol"==typeof i,"Value must be a Symbol"),t.$_terms.map.set(e,i),r.push(i)}return t.valid(...r)}}},manifest:{build:(e,t)=>(t.map&&(e=e.map(t.map)),e)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},(e,t,r)=>{var n=r(21).Buffer;const s=r(40),i=r(127),a=r(112);e.exports=i.extend({type:"binary",coerce:{from:["string","object"],method(e,{schema:t}){if("string"==typeof e||null!==e&&"Buffer"===e.type)try{return{value:n.from(e,t._flags.encoding)}}catch(e){}}},validate(e,{error:t}){if(!n.isBuffer(e))return{value:e,errors:t("binary.base")}},rules:{encoding:{method(e){return s(n.isEncoding(e),"Invalid encoding:",e),this.$_setFlag("encoding",e)}},length:{method(e){return this.$_addRule({name:"length",method:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:n,operator:s,args:i})=>a.compare(e.length,r,s)?e:t.error("binary."+n,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:a.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}}},cast:{string:{from:e=>n.isBuffer(e),to:(e,t)=>e.toString()}},messages:{"binary.base":"{{#label}} must be a buffer or a string","binary.length":"{{#label}} must be {{#limit}} bytes","binary.max":"{{#label}} must be less than or equal to {{#limit}} bytes","binary.min":"{{#label}} must be at least {{#limit}} bytes"}})},(e,t,r)=>{const{authPlugin:n}=r(151),{assetsPlugin:s}=r(324),{handlersPlugin:i}=r(325),{htmlPlugin:a}=r(328),{routesPlugin:o}=r(331),{storagePlugin:c}=r(409),l=[n,s,i,a,o,c];e.exports=l},(e,t,r)=>{r.r(t),r.d(t,{authPlugin:()=>g});var n=r(101),s=r(2),i=r.n(s),a=r(100),o=r.n(a),c=r(152),l=r.n(c),u=r(153),d=r.n(u),p=r(4),h=r.n(p),f=r(154),m=r(322);const g={register:async e=>{e.auth.scheme("extension-secret",(()=>({authenticate:(e,t)=>{const r=e.headers["x-api-key"];return e.storage.getApiKey().then((e=>{if(r&&r===(e=>o().createHmac("sha256",`${e} + ${h()("AUTH0_CLIENT_SECRET")}`).update(h()("EXTENSION_SECRET")).digest("hex"))(e))return t.authenticated({credentials:{user:"rule"}});throw i().unauthorized("Invalid API Key")}))}}))),e.auth.strategy("extension-secret","extension-secret");const t={dashboardAdmin:{key:h()("EXTENSION_SECRET"),verifyOptions:{audience:"urn:api-authz",issuer:h()("PUBLIC_WT_URL"),algorithms:["HS256"]}},resourceServer:{key:l().hapiJwt2Key({cache:!0,rateLimit:!0,jwksRequestsPerMinute:2,jwksUri:`https://${h()("AUTH0_DOMAIN")}/.well-known/jwks.json`}),verifyOptions:{audience:"urn:auth0-authz-api",issuer:`https://${h()("AUTH0_DOMAIN")}/`,algorithms:["RS256"]}}};e.auth.strategy("jwt","jwt",{complete:!0,verify:async(e,r)=>{try{if(!e)return{isValid:!1};const s=r.headers.authorization;if(!s||0===!s.indexOf("Bearer "))return{isValid:!1};const i=s.split(" ")[1],a=e&&e.payload&&e.payload.iss===`https://${h()("AUTH0_DOMAIN")}/`,o=e&&e.payload&&e.payload.iss===h()("PUBLIC_WT_URL"),c=(0,n.promisify)(t.resourceServer.key),l=(0,n.promisify)(d().verify);if(a){if(e.payload.gty&&"client-credentials"!==e.payload.gty)return{isValid:!1};if(!e.payload.sub.endsWith("@clients"))return{isValid:!1};const r=await c(e);return r?(await l(i,r,t.resourceServer.verifyOptions),e.payload.scope&&"string"==typeof e.payload.scope&&(e.payload.scope=e.payload.scope.split(" ")),{credentials:e.payload,isValid:!0}):{isValid:!1}}if(o)return e.payload.access_token&&e.payload.access_token.length?(await l(i,t.dashboardAdmin.key,t.dashboardAdmin.verifyOptions),e.payload.scope=f.scopes.map((e=>e.value)),{credentials:e.payload,isValid:!0}):{isValid:!1}}catch(e){return{isValid:!1}}}}),e.auth.default("jwt");const r={plugin:m.plugin,options:{stateKey:"authz-state",nonceKey:"authz-nonce",sessionStorageKey:"authz:apiToken",rta:h()("AUTH0_RTA").replace("https://",""),domain:h()("AUTH0_DOMAIN"),scopes:"read:resource_servers create:resource_servers update:resource_servers delete:resource_servers read:clients read:connections read:rules create:rules update:rules update:rules_configs read:users read:configuration",baseUrl:h()("PUBLIC_WT_URL"),audience:"urn:api-authz",secret:h()("EXTENSION_SECRET"),clientName:"Authorization Extension",onLoginSuccess:(e,t)=>{if(e)return e.scope=f.scopes.map((e=>e.value)),e;throw i().unauthorized("Invalid token","Token")}}};e.register(r)},name:"auth"}},e=>{e.exports=require("jwks-rsa@3.0.1")},e=>{e.exports=require("jsonwebtoken@9.0.1")},(e,t,r)=>{r.r(t),r.d(t,{createApi:()=>h,deleteApi:()=>m,getApi:()=>p,scopes:()=>g,updateApi:()=>f});var n=r(3),s=r.n(n),i=r(155),a=r.n(i),o=r(4),c=r.n(o);const l="urn:auth0-authz-api",u=[{value:"read:users"},{value:"read:applications"},{value:"read:connections"},{value:"read:configuration"},{value:"update:configuration"},{value:"read:groups"},{value:"create:groups"},{value:"update:groups"},{value:"delete:groups"},{value:"read:roles"},{value:"create:roles"},{value:"update:roles"},{value:"delete:roles"},{value:"read:permissions"},{value:"create:permissions"},{value:"update:permissions"},{value:"delete:permissions"},{value:"read:resource-server"},{value:"create:resource-server"},{value:"update:resource-server"},{value:"delete:resource-server"}],d=(e,t,r,n)=>new Promise(((i,o)=>(e=>e.auth&&e.auth.credentials&&e.auth.credentials.access_token&&e.auth.credentials.access_token.length?Promise.resolve(e.auth.credentials.access_token):a().getAccessTokenCached(c()("AUTH0_DOMAIN"),c()("AUTH0_CLIENT_ID"),c()("AUTH0_CLIENT_SECRET")))(e).then((e=>{s()(r,`https://${c()("AUTH0_DOMAIN")}/api/v2/${t}`).send(n||{}).set("Content-Type","application/json").set("Authorization",`Bearer ${e}`).end(((e,t)=>e?o(e):i(t.body)))})))),p=e=>d(e,`resource-servers/${l}`,"GET").catch((()=>({}))),h=(e,t)=>d(e,"resource-servers","POST",{name:"auth0-authorization-extension-api",identifier:l,signing_alg:"RS256",scopes:u,token_lifetime:t}),f=(e,t)=>p(e).then((r=>r.id?d(e,`resource-servers/${r.id}`,"PATCH",{token_lifetime:t||86400}):h(e,t||86400))),m=(e,t)=>p(e).then((r=>r.id?d(e,`resource-servers/${r.id}`,"DELETE"):r.id||t?Promise.resolve():Promise.reject(new Error("Unable to disable resource-server. Is it enabled?")))),g=u},(e,t,r)=>{const n=r(153),s=r(156),i=r(321),a=r(3),o=r(13).ArgumentError,c=r(13).ManagementApiError,l=function(e,t,r){return new Promise((function(n,s){a.post("https://"+e+"/oauth/token").send({audience:"https://"+e+"/api/v2/",client_id:t,client_secret:r,grant_type:"client_credentials"}).set("Accept","application/json").end((function(e,r){return e&&401===e.status?s(new c("unauthorized","Invalid credentials for "+t,e.status)):e&&r&&r.body&&r.body.error?s(new c(r.body.error,r.body.error_description||r.body.error,e.status)):e?s(e):r.ok&&r.body.access_token?n(r.body.access_token):s(new c("unknown_error","Unknown error from Management Api or no access token was provided: "+(r.text||r.status)))}))}))},u=function(e,t,r){return new Promise((function(n,s){d(e,t,r,(function(e,t){return e?s(e):n(t)}))}))},d=i({load:function(e,t,r,n){l(e,t,r).then((function(e){return n(null,e)})).catch((function(e){return n(e)}))},hash:function(e,t,r){return e+"-"+t+"-"+r},itemMaxAge:function(e,t,r,s){try{const e=n.decode(s),t=new Date(0);t.setUTCSeconds(e.exp);const r=(new Date).valueOf();return t.valueOf()-r-1e4}catch(e){return 1e3}},max:100,maxAge:36e5});function p(e){return new Proxy(e,{get(e,t){const r=e[t];return r&&"object"==typeof r&&"options"!==t?new Proxy(r,{get(e,t){const r=e[t];return"function"==typeof r?function(...t){const n=r.apply(e,t);return n&&"function"==typeof n.then?n.then((function(e){return e&&void 0!==e.data?e.data:e})):n}:r}}):r}})}e.exports={getAccessToken:l,getAccessTokenCached:u,getClient:function(e){if(null==e)throw new o("An options object must be provided");if(null===e.domain||void 0===e.domain)throw new o("An options object must contain the domain");if("string"!=typeof e.domain||0===e.domain.length)throw new o("The provided domain is invalid: "+e.domain);if(e.accessToken){if("string"!=typeof e.accessToken||0===e.accessToken.length)throw new o("The provided accessToken is invalid");const t=new s.ManagementClient({domain:e.domain,token:e.accessToken,headers:e.headers});return Promise.resolve(p(t))}if(null===e.clientId||void 0===e.clientId)throw new o("An options object must contain the clientId");if("string"!=typeof e.clientId||0===e.clientId.length)throw new o("The provided clientId is invalid: "+e.clientId);if(null===e.clientSecret||void 0===e.clientSecret)throw new o("An options object must contain the clientSecret");if("string"!=typeof e.clientSecret||0===e.clientSecret.length)throw new o("The provided clientSecret is invalid");return u(e.domain,e.clientId,e.clientSecret).then((function(t){return p(new s.ManagementClient({domain:e.domain,token:t,headers:e.headers}))}))}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),s(r(157),t),s(r(203),t),s(r(319),t),s(r(165),t),s(r(166),t),s(r(320),t)},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),s(r(158),t),s(r(159),t),s(r(160),t)},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ManagementClient=t.ManagementApiError=void 0;const n=r(160),s=r(201),i=r(318),a=r(312);class o extends Error{constructor(e,t,r,n,s,i){super(i),this.errorCode=e,this.error=t,this.statusCode=r,this.body=n,this.headers=s,this.msg=i,this.name="ManagementApiError"}}async function c(e){const t=await e.text();let r;try{return r=JSON.parse(t),new o(r.errorCode,r.error,r.statusCode||e.status,t,e.headers,r.message)}catch(r){return new i.ResponseError(e.status,t,e.headers,"Response returned an error code")}}t.ManagementApiError=o;class l extends n.ManagementClientBase{constructor(e){super({...e,baseUrl:`https://${e.domain}/api/v2`,middleware:[new s.TokenProviderMiddleware(e),...!1!==e.telemetry?[new a.TelemetryMiddleware(e)]:[]],parseError:c})}}t.ManagementClient=l},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.ManagementClientBase=void 0,s(r(161),t),s(r(200),t);const i=r(161);t.ManagementClientBase=class{constructor(e){this.configuration=e,this.actions=new i.ActionsManager(this.configuration),this.anomaly=new i.AnomalyManager(this.configuration),this.attackProtection=new i.AttackProtectionManager(this.configuration),this.blacklists=new i.BlacklistsManager(this.configuration),this.branding=new i.BrandingManager(this.configuration),this.clientGrants=new i.ClientGrantsManager(this.configuration),this.clients=new i.ClientsManager(this.configuration),this.connections=new i.ConnectionsManager(this.configuration),this.customDomains=new i.CustomDomainsManager(this.configuration),this.deviceCredentials=new i.DeviceCredentialsManager(this.configuration),this.emailTemplates=new i.EmailTemplatesManager(this.configuration),this.emails=new i.EmailsManager(this.configuration),this.grants=new i.GrantsManager(this.configuration),this.guardian=new i.GuardianManager(this.configuration),this.hooks=new i.HooksManager(this.configuration),this.jobs=new i.JobsManager(this.configuration),this.keys=new i.KeysManager(this.configuration),this.logStreams=new i.LogStreamsManager(this.configuration),this.logs=new i.LogsManager(this.configuration),this.organizations=new i.OrganizationsManager(this.configuration),this.prompts=new i.PromptsManager(this.configuration),this.refreshTokens=new i.RefreshTokensManager(this.configuration),this.resourceServers=new i.ResourceServersManager(this.configuration),this.roles=new i.RolesManager(this.configuration),this.rules=new i.RulesManager(this.configuration),this.rulesConfigs=new i.RulesConfigsManager(this.configuration),this.selfServiceProfiles=new i.SelfServiceProfilesManager(this.configuration),this.sessions=new i.SessionsManager(this.configuration),this.stats=new i.StatsManager(this.configuration),this.tenants=new i.TenantsManager(this.configuration),this.tickets=new i.TicketsManager(this.configuration),this.userBlocks=new i.UserBlocksManager(this.configuration),this.users=new i.UsersManager(this.configuration),this.usersByEmail=new i.UsersByEmailManager(this.configuration)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),s(r(162),t),s(r(167),t),s(r(168),t),s(r(169),t),s(r(170),t),s(r(171),t),s(r(172),t),s(r(173),t),s(r(174),t),s(r(175),t),s(r(176),t),s(r(177),t),s(r(178),t),s(r(179),t),s(r(180),t),s(r(181),t),s(r(182),t),s(r(183),t),s(r(184),t),s(r(185),t),s(r(186),t),s(r(187),t),s(r(188),t),s(r(189),t),s(r(190),t),s(r(191),t),s(r(192),t),s(r(193),t),s(r(194),t),s(r(195),t),s(r(196),t),s(r(197),t),s(r(198),t),s(r(199),t)},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ActionsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.ActionsManager=class extends o{async delete(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"force",config:{}}]),n=await this.request({path:"/actions/actions/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",query:r},t);return a.VoidApiResponse.fromResponse(n)}async get(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/actions/actions/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async getVersion(e,t){a.validateRequiredRequestParams(e,["actionId","id"]);const r=await this.request({path:"/actions/actions/{actionId}/versions/{id}".replace("{actionId}",encodeURIComponent(String(e.actionId))).replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async getVersions(e,t){a.validateRequiredRequestParams(e,["actionId"]);const r=a.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}}]),n=await this.request({path:"/actions/actions/{actionId}/versions".replace("{actionId}",encodeURIComponent(String(e.actionId))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getAll(e={},t){const r=a.applyQueryParams(e,[{key:"triggerId",config:{}},{key:"actionName",config:{}},{key:"deployed",config:{}},{key:"page",config:{}},{key:"per_page",config:{}},{key:"installed",config:{}}]),n=await this.request({path:"/actions/actions",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getTriggerBindings(e,t){a.validateRequiredRequestParams(e,["triggerId"]);const r=a.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}}]),n=await this.request({path:"/actions/triggers/{triggerId}/bindings".replace("{triggerId}",encodeURIComponent(String(e.triggerId))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getExecution(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/actions/executions/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async getAllTriggers(e){const t=await this.request({path:"/actions/triggers",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async update(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/actions/actions/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async updateTriggerBindings(e,t,r){a.validateRequiredRequestParams(e,["triggerId"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/actions/triggers/{triggerId}/bindings".replace("{triggerId}",encodeURIComponent(String(e.triggerId))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/actions/actions",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async deploy(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/actions/actions/{id}/deploy".replace("{id}",encodeURIComponent(String(e.id))),method:"POST"},t);return a.JSONApiResponse.fromResponse(r)}async deployVersion(e,t,r){a.validateRequiredRequestParams(e,["id","actionId"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/actions/actions/{actionId}/versions/{id}/deploy".replace("{id}",encodeURIComponent(String(e.id))).replace("{actionId}",encodeURIComponent(String(e.actionId))),method:"POST",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async test(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/actions/actions/{id}/test".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.parseFormParam=t.applyQueryParams=t.validateRequiredRequestParams=t.COLLECTION_FORMATS=t.BaseAPI=void 0;const i=r(164),a=r(165);s(r(166),t);t.BaseAPI=class{constructor(e){if(this.configuration=e,this.fetchWithTimeout=async(e,t)=>{const r=new AbortController,n=setTimeout((()=>{r.abort()}),this.timeoutDuration);try{return await this.fetchApi(e,{signal:r.signal,...t})}catch(e){if("AbortError"===e.name)throw new a.TimeoutError;throw e}finally{clearTimeout(n)}},this.fetch=async(e,t)=>{var r;let n,s,o={url:e,init:t};for(const e of this.middleware)e.pre&&(o=await e.pre({fetch:this.fetchWithTimeout,...o})||o);try{n=!1!==(null===(r=this.configuration.retry)||void 0===r?void 0:r.enabled)?await(0,i.retry)((()=>this.fetchWithTimeout(o.url,o.init)),{...this.configuration.retry}):await this.fetchWithTimeout(o.url,o.init)}catch(e){s=e}if(s||!n.ok){for(const e of this.middleware)e.onError&&(n=await e.onError({fetch:this.fetchWithTimeout,...o,error:s,response:n?n.clone():void 0})||n);if(void 0===n)throw new a.FetchError(s,"The request failed and the interceptors did not return an alternative response")}else for(const e of this.middleware)e.post&&(n=await e.post({fetch:this.fetchApi,...o,response:n.clone()})||n);return n},null===e.baseUrl||void 0===e.baseUrl)throw new Error("Must provide a base URL for the API");if("string"!=typeof e.baseUrl||0===e.baseUrl.length)throw new Error("The provided base URL is invalid");this.middleware=e.middleware||[],this.fetchApi=e.fetch||fetch,this.parseError=e.parseError,this.timeoutDuration="number"==typeof e.timeoutDuration?e.timeoutDuration:1e4}async request(e,t){const{url:r,init:n}=await this.createFetchParams(e,t),s=await this.fetch(r,n);if(s&&s.status>=200&&s.status<300)return s;throw await this.parseError(s)}async createFetchParams(e,t){let r=this.configuration.baseUrl+e.path;var n;void 0!==e.query&&0!==Object.keys(e.query).length&&(r+=`?${n=e.query,Object.keys(n).map((e=>function(e,t){if(t instanceof Array){const r=t.map((e=>encodeURIComponent(String(e)))).join(`&${encodeURIComponent(e)}=`);return`${encodeURIComponent(e)}=${r}`}return`${encodeURIComponent(e)}=${encodeURIComponent(String(t))}`}(e,n[e]))).filter((e=>e.length>0)).join("&")}`);const s=Object.assign({},this.configuration.headers,e.headers);Object.keys(s).forEach((e=>void 0===s[e]?delete s[e]:{}));const i="function"==typeof t?t:async()=>t,a={method:e.method,headers:s,body:e.body,dispatcher:this.configuration.agent},o={...a,...await i({init:a,context:e})};return{url:r,init:{...o,body:o.body instanceof FormData||o.body instanceof URLSearchParams||o.body instanceof Blob?o.body:JSON.stringify(o.body)}}}},t.COLLECTION_FORMATS={csv:",",ssv:" ",tsv:"\t",pipes:"|"},t.validateRequiredRequestParams=function(e,t){t.forEach((t=>{if(null===e[t]||void 0===e[t])throw new a.RequiredError(t,`Required parameter requestParameters.${t} was null or undefined.`)}))},t.applyQueryParams=function(e,r){return r.reduce(((r,{key:n,config:s})=>{let i;return s.isArray?i=s.isCollectionFormatMulti?e[n]:e[n].join(t.COLLECTION_FORMATS[s.collectionFormat]):void 0!==e[n]&&(i=e[n]),void 0!==i?{...r,[n]:i}:r}),{})},t.parseFormParam=async function(e){let t=e;return t="number"==typeof t||"boolean"==typeof t?""+t:t,t}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.retry=void 0;t.retry=function(e,{maxRetries:t,retryWhen:r}){const n=Math.min(10,null!=t?t:3);let s=0;const i=async()=>{let t;if(t=await e(),(r||[429]).includes(t.status)&&ssetTimeout(t,e)))}(e),t=await i()}var a,o;return t};return i()}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RequiredError=t.FetchError=t.TimeoutError=t.ResponseError=void 0;class r extends Error{constructor(e,t,r,n){super(n),this.statusCode=e,this.body=t,this.headers=r,this.name="ResponseError"}}t.ResponseError=r;class n extends Error{constructor(){super("The request was timed out."),this.name="TimeoutError"}}t.TimeoutError=n;class s extends Error{constructor(e,t){super(t),this.cause=e,this.name="FetchError"}}t.FetchError=s;class i extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}t.RequiredError=i},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextApiResponse=t.VoidApiResponse=t.JSONApiResponse=void 0;class r{constructor(e,t,r,n){this.data=e,this.headers=t,this.status=r,this.statusText=n}static async fromResponse(e){const t=await e.json();return new r(t,e.headers,e.status,e.statusText)}}t.JSONApiResponse=r;class n{constructor(e,t,r){this.headers=e,this.status=t,this.statusText=r}static async fromResponse(e){return new n(e.headers,e.status,e.statusText)}}t.VoidApiResponse=n;class s{constructor(e,t,r,n){this.data=e,this.headers=t,this.status=r,this.statusText=n}static async fromResponse(e){const t=await e.text();return new s(t,e.headers,e.status,e.statusText)}}t.TextApiResponse=s},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.AnomalyManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.AnomalyManager=class extends o{async deleteBlockedIp(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/anomaly/blocks/ips/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async checkIfIpIsBlocked(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/anomaly/blocks/ips/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.VoidApiResponse.fromResponse(r)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.AttackProtectionManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.AttackProtectionManager=class extends o{async getBreachedPasswordDetectionConfig(e){const t=await this.request({path:"/attack-protection/breached-password-detection",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async getBruteForceConfig(e){const t=await this.request({path:"/attack-protection/brute-force-protection",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async getSuspiciousIpThrottlingConfig(e){const t=await this.request({path:"/attack-protection/suspicious-ip-throttling",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async updateBreachedPasswordDetectionConfig(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/attack-protection/breached-password-detection",method:"PATCH",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async updateBruteForceConfig(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/attack-protection/brute-force-protection",method:"PATCH",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async updateSuspiciousIpThrottlingConfig(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/attack-protection/suspicious-ip-throttling",method:"PATCH",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.BlacklistsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.BlacklistsManager=class extends o{async getAll(e={},t){const r=a.applyQueryParams(e,[{key:"aud",config:{}}]),n=await this.request({path:"/blacklists/tokens",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async add(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/blacklists/tokens",method:"POST",headers:r,body:e},t);return a.VoidApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.BrandingManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.BrandingManager=class extends o{async deleteTheme(e,t){a.validateRequiredRequestParams(e,["themeId"]);const r=await this.request({path:"/branding/themes/{themeId}".replace("{themeId}",encodeURIComponent(String(e.themeId))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async deleteUniversalLoginTemplate(e){const t=await this.request({path:"/branding/templates/universal-login",method:"DELETE"},e);return a.VoidApiResponse.fromResponse(t)}async getSettings(e){const t=await this.request({path:"/branding",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async getTheme(e,t){a.validateRequiredRequestParams(e,["themeId"]);const r=await this.request({path:"/branding/themes/{themeId}".replace("{themeId}",encodeURIComponent(String(e.themeId))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async getDefaultTheme(e){const t=await this.request({path:"/branding/themes/default",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async getUniversalLoginTemplate(e){const t=await this.request({path:"/branding/templates/universal-login",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async updateSettings(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/branding",method:"PATCH",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async updateTheme(e,t,r){a.validateRequiredRequestParams(e,["themeId"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/branding/themes/{themeId}".replace("{themeId}",encodeURIComponent(String(e.themeId))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async createTheme(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/branding/themes",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async setUniversalLoginTemplate(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/branding/templates/universal-login",method:"PUT",headers:r,body:e},t);return a.VoidApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientGrantsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.ClientGrantsManager=class extends o{async delete(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/client-grants/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async getAll(e={},t){const r=a.applyQueryParams(e,[{key:"per_page",config:{}},{key:"page",config:{}},{key:"include_totals",config:{}},{key:"audience",config:{}},{key:"client_id",config:{}}]),n=await this.request({path:"/client-grants",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async update(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/client-grants/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/client-grants",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.ClientsManager=class extends o{async delete(e,t){a.validateRequiredRequestParams(e,["client_id"]);const r=await this.request({path:"/clients/{client_id}".replace("{client_id}",encodeURIComponent(String(e.client_id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async deleteCredential(e,t){a.validateRequiredRequestParams(e,["client_id","credential_id"]);const r=await this.request({path:"/clients/{client_id}/credentials/{credential_id}".replace("{client_id}",encodeURIComponent(String(e.client_id))).replace("{credential_id}",encodeURIComponent(String(e.credential_id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async getAll(e={},t){const r=a.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}},{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"is_global",config:{}},{key:"is_first_party",config:{}},{key:"app_type",config:{}}]),n=await this.request({path:"/clients",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async get(e,t){a.validateRequiredRequestParams(e,["client_id"]);const r=a.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/clients/{client_id}".replace("{client_id}",encodeURIComponent(String(e.client_id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getCredentials(e,t){a.validateRequiredRequestParams(e,["client_id"]);const r=await this.request({path:"/clients/{client_id}/credentials".replace("{client_id}",encodeURIComponent(String(e.client_id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async getCredential(e,t){a.validateRequiredRequestParams(e,["client_id","credential_id"]);const r=await this.request({path:"/clients/{client_id}/credentials/{credential_id}".replace("{client_id}",encodeURIComponent(String(e.client_id))).replace("{credential_id}",encodeURIComponent(String(e.credential_id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async update(e,t,r){a.validateRequiredRequestParams(e,["client_id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/clients/{client_id}".replace("{client_id}",encodeURIComponent(String(e.client_id))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async updateCredential(e,t,r){a.validateRequiredRequestParams(e,["client_id","credential_id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/clients/{client_id}/credentials/{credential_id}".replace("{client_id}",encodeURIComponent(String(e.client_id))).replace("{credential_id}",encodeURIComponent(String(e.credential_id))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/clients",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async createCredential(e,t,r){a.validateRequiredRequestParams(e,["client_id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/clients/{client_id}/credentials".replace("{client_id}",encodeURIComponent(String(e.client_id))),method:"POST",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async rotateClientSecret(e,t){a.validateRequiredRequestParams(e,["client_id"]);const r=await this.request({path:"/clients/{client_id}/rotate-secret".replace("{client_id}",encodeURIComponent(String(e.client_id))),method:"POST"},t);return a.JSONApiResponse.fromResponse(r)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.ConnectionsManager=class extends o{async delete(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/connections/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async deleteScimConfiguration(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/connections/{id}/scim-configuration".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async deleteScimToken(e,t){a.validateRequiredRequestParams(e,["id","tokenId"]);const r=await this.request({path:"/connections/{id}/scim-configuration/tokens/{tokenId}".replace("{id}",encodeURIComponent(String(e.id))).replace("{tokenId}",encodeURIComponent(String(e.tokenId))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async deleteUserByEmail(e,t){a.validateRequiredRequestParams(e,["id","email"]);const r=a.applyQueryParams(e,[{key:"email",config:{}}]),n=await this.request({path:"/connections/{id}/users".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",query:r},t);return a.VoidApiResponse.fromResponse(n)}async getAll(e={},t){const r=a.applyQueryParams(e,[{key:"per_page",config:{}},{key:"page",config:{}},{key:"include_totals",config:{}},{key:"from",config:{}},{key:"take",config:{}},{key:"strategy",config:{isArray:!0,isCollectionFormatMulti:!0}},{key:"name",config:{}},{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/connections",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async get(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/connections/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getDefaultScimMapping(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/connections/{id}/scim-configuration/default-mapping".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async getScimConfiguration(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/connections/{id}/scim-configuration".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async getScimTokens(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/connections/{id}/scim-configuration/tokens".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async checkStatus(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/connections/{id}/status".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.VoidApiResponse.fromResponse(r)}async update(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/connections/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async updateScimConfiguration(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/connections/{id}/scim-configuration".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/connections",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async createScimConfiguration(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/connections/{id}/scim-configuration".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async createScimToken(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/connections/{id}/scim-configuration/tokens".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.CustomDomainsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.CustomDomainsManager=class extends o{async delete(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/custom-domains/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async getAll(e){const t=await this.request({path:"/custom-domains",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async get(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/custom-domains/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async update(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/custom-domains/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/custom-domains",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async verify(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/custom-domains/{id}/verify".replace("{id}",encodeURIComponent(String(e.id))),method:"POST"},t);return a.JSONApiResponse.fromResponse(r)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceCredentialsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.DeviceCredentialsManager=class extends o{async delete(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/device-credentials/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async getAll(e={},t){const r=a.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"fields",config:{}},{key:"include_fields",config:{}},{key:"user_id",config:{}},{key:"client_id",config:{}},{key:"type",config:{}}]),n=await this.request({path:"/device-credentials",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async createPublicKey(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/device-credentials",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.EmailTemplatesManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.EmailTemplatesManager=class extends o{async get(e,t){a.validateRequiredRequestParams(e,["templateName"]);const r=await this.request({path:"/email-templates/{templateName}".replace("{templateName}",encodeURIComponent(String(e.templateName))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async update(e,t,r){a.validateRequiredRequestParams(e,["templateName"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/email-templates/{templateName}".replace("{templateName}",encodeURIComponent(String(e.templateName))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/email-templates",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async put(e,t,r){a.validateRequiredRequestParams(e,["templateName"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/email-templates/{templateName}".replace("{templateName}",encodeURIComponent(String(e.templateName))),method:"PUT",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.EmailsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.EmailsManager=class extends o{async get(e={},t){const r=a.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/emails/provider",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async update(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/emails/provider",method:"PATCH",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async configure(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/emails/provider",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.GrantsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.GrantsManager=class extends o{async delete(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/grants/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async deleteByUserId(e,t){a.validateRequiredRequestParams(e,["user_id"]);const r=a.applyQueryParams(e,[{key:"user_id",config:{}}]),n=await this.request({path:"/grants",method:"DELETE",query:r},t);return a.VoidApiResponse.fromResponse(n)}async getAll(e={},t){const r=a.applyQueryParams(e,[{key:"per_page",config:{}},{key:"page",config:{}},{key:"include_totals",config:{}},{key:"user_id",config:{}},{key:"client_id",config:{}},{key:"audience",config:{}}]),n=await this.request({path:"/grants",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.GuardianManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.GuardianManager=class extends o{async deleteGuardianEnrollment(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/guardian/enrollments/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async getPushNotificationProviderAPNS(e){const t=await this.request({path:"/guardian/factors/push-notification/providers/apns",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async getGuardianEnrollment(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/guardian/enrollments/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async getPhoneFactorTemplates(e){const t=await this.request({path:"/guardian/factors/phone/templates",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async getSmsFactorTemplates(e){const t=await this.request({path:"/guardian/factors/sms/templates",method:"GET"},e);return 204===t.status?a.VoidApiResponse.fromResponse(t):a.JSONApiResponse.fromResponse(t)}async getFactors(e){const t=await this.request({path:"/guardian/factors",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async getPhoneFactorMessageTypes(e){const t=await this.request({path:"/guardian/factors/phone/message-types",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async getPhoneFactorSelectedProvider(e){const t=await this.request({path:"/guardian/factors/phone/selected-provider",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async getPhoneFactorProviderTwilio(e){const t=await this.request({path:"/guardian/factors/phone/providers/twilio",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async getPushNotificationSelectedProvider(e){const t=await this.request({path:"/guardian/factors/push-notification/selected-provider",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async getPolicies(e){const t=await this.request({path:"/guardian/policies",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async getSmsSelectedProvider(e){const t=await this.request({path:"/guardian/factors/sms/selected-provider",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async getSmsFactorProviderTwilio(e){const t=await this.request({path:"/guardian/factors/sms/providers/twilio",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async getPushNotificationProviderSNS(e){const t=await this.request({path:"/guardian/factors/push-notification/providers/sns",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async updatePushNotificationProviderAPNS(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/push-notification/providers/apns",method:"PATCH",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async updatePushNotificationProviderFCM(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/push-notification/providers/fcm",method:"PATCH",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async updatePushNotificationProviderSNS(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/push-notification/providers/sns",method:"PATCH",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async createEnrollmentTicket(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/enrollments/ticket",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async setPushNotificationProviderAPNS(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/push-notification/providers/apns",method:"PUT",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async setPhoneFactorTemplates(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/phone/templates",method:"PUT",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async setSmsFactorTemplates(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/sms/templates",method:"PUT",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async updateFactor(e,t,r){a.validateRequiredRequestParams(e,["name"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/guardian/factors/{name}".replace("{name}",encodeURIComponent(String(e.name))),method:"PUT",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async setPushNotificationProviderFCM(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/push-notification/providers/fcm",method:"PUT",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async updatePhoneFactorMessageTypes(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/phone/message-types",method:"PUT",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async updatePhoneFactorSelectedProvider(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/phone/selected-provider",method:"PUT",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async setPushNotificationSelectedProvider(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/push-notification/selected-provider",method:"PUT",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async updatePolicies(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/policies",method:"PUT",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async setSmsSelectedProvider(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/sms/selected-provider",method:"PUT",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async setSmsFactorProviderTwilio(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/sms/providers/twilio",method:"PUT",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async setPushNotificationProviderSNS(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/push-notification/providers/sns",method:"PUT",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async updatePhoneFactorProviderTwilio(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/phone/providers/twilio",method:"PUT",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.HooksManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.HooksManager=class extends o{async delete(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/hooks/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async deleteSecrets(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/hooks/{id}/secrets".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:n,body:t},r);return a.VoidApiResponse.fromResponse(s)}async getAll(e={},t){const r=a.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"enabled",config:{}},{key:"fields",config:{}},{key:"triggerId",config:{}}]),n=await this.request({path:"/hooks",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async get(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"fields",config:{}}]),n=await this.request({path:"/hooks/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getSecrets(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/hooks/{id}/secrets".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async update(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/hooks/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async updateSecrets(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/hooks/{id}/secrets".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return a.VoidApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/hooks",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async addSecrets(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/hooks/{id}/secrets".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return a.VoidApiResponse.fromResponse(s)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.JobsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.JobsManager=class extends o{async getErrors(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/jobs/{id}/errors".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return 204===r.status?a.VoidApiResponse.fromResponse(r):a.JSONApiResponse.fromResponse(r)}async get(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/jobs/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async exportUsers(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/jobs/users-exports",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async importUsers(e,t){const r=new FormData;void 0!==e.users&&r.append("users",await a.parseFormParam(e.users)),void 0!==e.connection_id&&r.append("connection_id",await a.parseFormParam(e.connection_id)),void 0!==e.upsert&&r.append("upsert",await a.parseFormParam(e.upsert)),void 0!==e.external_id&&r.append("external_id",await a.parseFormParam(e.external_id)),void 0!==e.send_completion_email&&r.append("send_completion_email",await a.parseFormParam(e.send_completion_email));const n=await this.request({path:"/jobs/users-imports",method:"POST",body:r},t);return a.JSONApiResponse.fromResponse(n)}async verifyEmail(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/jobs/verification-email",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.KeysManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.KeysManager=class extends o{async get(e,t){a.validateRequiredRequestParams(e,["kid"]);const r=await this.request({path:"/keys/signing/{kid}".replace("{kid}",encodeURIComponent(String(e.kid))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async getAll(e){const t=await this.request({path:"/keys/signing",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async rotate(e){const t=await this.request({path:"/keys/signing/rotate",method:"POST"},e);return a.JSONApiResponse.fromResponse(t)}async revoke(e,t){a.validateRequiredRequestParams(e,["kid"]);const r=await this.request({path:"/keys/signing/{kid}/revoke".replace("{kid}",encodeURIComponent(String(e.kid))),method:"PUT"},t);return a.JSONApiResponse.fromResponse(r)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.LogStreamsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.LogStreamsManager=class extends o{async delete(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/log-streams/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async getAll(e){const t=await this.request({path:"/log-streams",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async get(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/log-streams/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async update(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/log-streams/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/log-streams",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.LogsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.LogsManager=class extends o{async getAll(e={},t){const r=a.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"sort",config:{}},{key:"fields",config:{}},{key:"include_fields",config:{}},{key:"include_totals",config:{}},{key:"from",config:{}},{key:"take",config:{}},{key:"q",config:{}}]),n=await this.request({path:"/logs",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async get(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/logs/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.OrganizationsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.OrganizationsManager=class extends o{async deleteEnabledConnection(e,t){a.validateRequiredRequestParams(e,["id","connectionId"]);const r=await this.request({path:"/organizations/{id}/enabled_connections/{connectionId}".replace("{id}",encodeURIComponent(String(e.id))).replace("{connectionId}",encodeURIComponent(String(e.connectionId))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async deleteInvitation(e,t){a.validateRequiredRequestParams(e,["id","invitation_id"]);const r=await this.request({path:"/organizations/{id}/invitations/{invitation_id}".replace("{id}",encodeURIComponent(String(e.id))).replace("{invitation_id}",encodeURIComponent(String(e.invitation_id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async deleteMembers(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/organizations/{id}/members".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:n,body:t},r);return a.VoidApiResponse.fromResponse(s)}async deleteMemberRoles(e,t,r){a.validateRequiredRequestParams(e,["id","user_id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/organizations/{id}/members/{user_id}/roles".replace("{id}",encodeURIComponent(String(e.id))).replace("{user_id}",encodeURIComponent(String(e.user_id))),method:"DELETE",headers:n,body:t},r);return a.VoidApiResponse.fromResponse(s)}async delete(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/organizations/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async getEnabledConnections(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}}]),n=await this.request({path:"/organizations/{id}/enabled_connections".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getEnabledConnection(e,t){a.validateRequiredRequestParams(e,["id","connectionId"]);const r=await this.request({path:"/organizations/{id}/enabled_connections/{connectionId}".replace("{id}",encodeURIComponent(String(e.id))).replace("{connectionId}",encodeURIComponent(String(e.connectionId))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async getInvitations(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"fields",config:{}},{key:"include_fields",config:{}},{key:"sort",config:{}}]),n=await this.request({path:"/organizations/{id}/invitations".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getInvitation(e,t){a.validateRequiredRequestParams(e,["id","invitation_id"]);const r=a.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/organizations/{id}/invitations/{invitation_id}".replace("{id}",encodeURIComponent(String(e.id))).replace("{invitation_id}",encodeURIComponent(String(e.invitation_id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getMembers(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"from",config:{}},{key:"take",config:{}},{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/organizations/{id}/members".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getByName(e,t){a.validateRequiredRequestParams(e,["name"]);const r=await this.request({path:"/organizations/name/{name}".replace("{name}",encodeURIComponent(String(e.name))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async getMemberRoles(e,t){a.validateRequiredRequestParams(e,["id","user_id"]);const r=a.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}}]),n=await this.request({path:"/organizations/{id}/members/{user_id}/roles".replace("{id}",encodeURIComponent(String(e.id))).replace("{user_id}",encodeURIComponent(String(e.user_id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getAll(e={},t){const r=a.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"from",config:{}},{key:"take",config:{}},{key:"sort",config:{}}]),n=await this.request({path:"/organizations",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async get(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/organizations/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async updateEnabledConnection(e,t,r){a.validateRequiredRequestParams(e,["id","connectionId"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/organizations/{id}/enabled_connections/{connectionId}".replace("{id}",encodeURIComponent(String(e.id))).replace("{connectionId}",encodeURIComponent(String(e.connectionId))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async update(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/organizations/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async addEnabledConnection(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/organizations/{id}/enabled_connections".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async createInvitation(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/organizations/{id}/invitations".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async addMembers(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/organizations/{id}/members".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return a.VoidApiResponse.fromResponse(s)}async addMemberRoles(e,t,r){a.validateRequiredRequestParams(e,["id","user_id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/organizations/{id}/members/{user_id}/roles".replace("{id}",encodeURIComponent(String(e.id))).replace("{user_id}",encodeURIComponent(String(e.user_id))),method:"POST",headers:n,body:t},r);return a.VoidApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/organizations",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PromptsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.PromptsManager=class extends o{async getCustomTextByLanguage(e,t){a.validateRequiredRequestParams(e,["prompt","language"]);const r=await this.request({path:"/prompts/{prompt}/custom-text/{language}".replace("{prompt}",encodeURIComponent(String(e.prompt))).replace("{language}",encodeURIComponent(String(e.language))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async getPartials(e,t){a.validateRequiredRequestParams(e,["prompt"]);const r=await this.request({path:"/prompts/{prompt}/partials".replace("{prompt}",encodeURIComponent(String(e.prompt))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async get(e){const t=await this.request({path:"/prompts",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async update(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/prompts",method:"PATCH",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async updateCustomTextByLanguage(e,t,r){a.validateRequiredRequestParams(e,["prompt","language"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/prompts/{prompt}/custom-text/{language}".replace("{prompt}",encodeURIComponent(String(e.prompt))).replace("{language}",encodeURIComponent(String(e.language))),method:"PUT",headers:n,body:t},r);return a.VoidApiResponse.fromResponse(s)}async updatePartials(e,t,r){a.validateRequiredRequestParams(e,["prompt"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/prompts/{prompt}/partials".replace("{prompt}",encodeURIComponent(String(e.prompt))),method:"PUT",headers:n,body:t},r);return a.VoidApiResponse.fromResponse(s)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.RefreshTokensManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.RefreshTokensManager=class extends o{async delete(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/refresh-tokens/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async get(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/refresh-tokens/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ResourceServersManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.ResourceServersManager=class extends o{async delete(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/resource-servers/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async getAll(e={},t){const r=a.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/resource-servers",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async get(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"include_fields",config:{}}]),n=await this.request({path:"/resource-servers/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async update(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/resource-servers/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/resource-servers",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.RolesManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.RolesManager=class extends o{async deletePermissions(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/roles/{id}/permissions".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:n,body:t},r);return a.VoidApiResponse.fromResponse(s)}async delete(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/roles/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async getPermissions(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"per_page",config:{}},{key:"page",config:{}},{key:"include_totals",config:{}}]),n=await this.request({path:"/roles/{id}/permissions".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getUsers(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"per_page",config:{}},{key:"page",config:{}},{key:"include_totals",config:{}},{key:"from",config:{}},{key:"take",config:{}}]),n=await this.request({path:"/roles/{id}/users".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getAll(e={},t){const r=a.applyQueryParams(e,[{key:"per_page",config:{}},{key:"page",config:{}},{key:"include_totals",config:{}},{key:"name_filter",config:{}}]),n=await this.request({path:"/roles",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async get(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/roles/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async update(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/roles/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async addPermissions(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/roles/{id}/permissions".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return a.VoidApiResponse.fromResponse(s)}async assignUsers(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/roles/{id}/users".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return a.VoidApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/roles",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.RulesManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.RulesManager=class extends o{async delete(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/rules/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async getAll(e={},t){const r=a.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"enabled",config:{}},{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/rules",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async get(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/rules/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async update(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/rules/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/rules",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.RulesConfigsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.RulesConfigsManager=class extends o{async delete(e,t){a.validateRequiredRequestParams(e,["key"]);const r=await this.request({path:"/rules-configs/{key}".replace("{key}",encodeURIComponent(String(e.key))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async getAll(e){const t=await this.request({path:"/rules-configs",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async set(e,t,r){a.validateRequiredRequestParams(e,["key"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/rules-configs/{key}".replace("{key}",encodeURIComponent(String(e.key))),method:"PUT",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.SelfServiceProfilesManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.SelfServiceProfilesManager=class extends o{async deleteSelfServiceProfiles(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/self-service-profiles/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async getSelfServiceProfiles(e){const t=await this.request({path:"/self-service-profiles",method:"GET"},e);return a.JSONApiResponse.fromResponse(t)}async getSelfServiceProfilesById(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/self-service-profiles/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async patchSelfServiceProfiles(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/self-service-profiles/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async postSelfServiceProfiles(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/self-service-profiles",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async postSsoTicket(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/self-service-profiles/{id}/sso-ticket".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.SessionsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.SessionsManager=class extends o{async delete(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/sessions/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async get(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/sessions/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.StatsManager=class extends o{async getActiveUsersCount(e){const t=await this.request({path:"/stats/active-users",method:"GET"},e);return a.TextApiResponse.fromResponse(t)}async getDaily(e={},t){const r=a.applyQueryParams(e,[{key:"from",config:{}},{key:"to",config:{}}]),n=await this.request({path:"/stats/daily",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TenantsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.TenantsManager=class extends o{async updateSettings(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/tenants/settings",method:"PATCH",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async getSettings(e={},t){const r=a.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/tenants/settings",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TicketsManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.TicketsManager=class extends o{async verifyEmail(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/tickets/email-verification",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async changePassword(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/tickets/password-change",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.UserBlocksManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.UserBlocksManager=class extends o{async deleteAll(e,t){a.validateRequiredRequestParams(e,["identifier"]);const r=a.applyQueryParams(e,[{key:"identifier",config:{}}]),n=await this.request({path:"/user-blocks",method:"DELETE",query:r},t);return a.VoidApiResponse.fromResponse(n)}async delete(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/user-blocks/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async getAll(e,t){a.validateRequiredRequestParams(e,["identifier"]);const r=a.applyQueryParams(e,[{key:"identifier",config:{}},{key:"consider_brute_force_enablement",config:{}}]),n=await this.request({path:"/user-blocks",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async get(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"consider_brute_force_enablement",config:{}}]),n=await this.request({path:"/user-blocks/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.UsersManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.UsersManager=class extends o{async deleteAuthenticationMethods(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/users/{id}/authentication-methods".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async deleteAuthenticationMethod(e,t){a.validateRequiredRequestParams(e,["id","authentication_method_id"]);const r=await this.request({path:"/users/{id}/authentication-methods/{authentication_method_id}".replace("{id}",encodeURIComponent(String(e.id))).replace("{authentication_method_id}",encodeURIComponent(String(e.authentication_method_id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async deleteAllAuthenticators(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/users/{id}/authenticators".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async deleteMultifactorProvider(e,t){a.validateRequiredRequestParams(e,["id","provider"]);const r=await this.request({path:"/users/{id}/multifactor/{provider}".replace("{id}",encodeURIComponent(String(e.id))).replace("{provider}",encodeURIComponent(String(e.provider))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async deletePermissions(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}/permissions".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:n,body:t},r);return a.VoidApiResponse.fromResponse(s)}async deleteRefreshTokens(e,t){a.validateRequiredRequestParams(e,["user_id"]);const r=await this.request({path:"/users/{user_id}/refresh-tokens".replace("{user_id}",encodeURIComponent(String(e.user_id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async deleteSessions(e,t){a.validateRequiredRequestParams(e,["user_id"]);const r=await this.request({path:"/users/{user_id}/sessions".replace("{user_id}",encodeURIComponent(String(e.user_id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async unlink(e,t){a.validateRequiredRequestParams(e,["id","provider","user_id"]);const r=await this.request({path:"/users/{id}/identities/{provider}/{user_id}".replace("{id}",encodeURIComponent(String(e.id))).replace("{provider}",encodeURIComponent(String(e.provider))).replace("{user_id}",encodeURIComponent(String(e.user_id))),method:"DELETE"},t);return a.JSONApiResponse.fromResponse(r)}async deleteRoles(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}/roles".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:n,body:t},r);return a.VoidApiResponse.fromResponse(s)}async delete(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/users/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return a.VoidApiResponse.fromResponse(r)}async getAuthenticationMethods(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}}]),n=await this.request({path:"/users/{id}/authentication-methods".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getAuthenticationMethod(e,t){a.validateRequiredRequestParams(e,["id","authentication_method_id"]);const r=await this.request({path:"/users/{id}/authentication-methods/{authentication_method_id}".replace("{id}",encodeURIComponent(String(e.id))).replace("{authentication_method_id}",encodeURIComponent(String(e.authentication_method_id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async getEnrollments(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/users/{id}/enrollments".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return a.JSONApiResponse.fromResponse(r)}async getLogs(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"sort",config:{}},{key:"include_totals",config:{}}]),n=await this.request({path:"/users/{id}/logs".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getPermissions(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"per_page",config:{}},{key:"page",config:{}},{key:"include_totals",config:{}}]),n=await this.request({path:"/users/{id}/permissions".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getRefreshTokens(e,t){a.validateRequiredRequestParams(e,["user_id"]);const r=a.applyQueryParams(e,[{key:"include_totals",config:{}},{key:"from",config:{}},{key:"take",config:{}}]),n=await this.request({path:"/users/{user_id}/refresh-tokens".replace("{user_id}",encodeURIComponent(String(e.user_id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getSessions(e,t){a.validateRequiredRequestParams(e,["user_id"]);const r=a.applyQueryParams(e,[{key:"include_totals",config:{}},{key:"from",config:{}},{key:"take",config:{}}]),n=await this.request({path:"/users/{user_id}/sessions".replace("{user_id}",encodeURIComponent(String(e.user_id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getUserOrganizations(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}}]),n=await this.request({path:"/users/{id}/organizations".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getRoles(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"per_page",config:{}},{key:"page",config:{}},{key:"include_totals",config:{}}]),n=await this.request({path:"/users/{id}/roles".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async getAll(e={},t){const r=a.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"sort",config:{}},{key:"connection",config:{}},{key:"fields",config:{}},{key:"include_fields",config:{}},{key:"q",config:{}},{key:"search_engine",config:{}}]),n=await this.request({path:"/users",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async get(e,t){a.validateRequiredRequestParams(e,["id"]);const r=a.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/users/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}async updateAuthenticationMethod(e,t,r){a.validateRequiredRequestParams(e,["id","authentication_method_id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}/authentication-methods/{authentication_method_id}".replace("{id}",encodeURIComponent(String(e.id))).replace("{authentication_method_id}",encodeURIComponent(String(e.authentication_method_id))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async update(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async createAuthenticationMethod(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}/authentication-methods".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async link(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}/identities".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}async invalidateRememberBrowser(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/users/{id}/multifactor/actions/invalidate-remember-browser".replace("{id}",encodeURIComponent(String(e.id))),method:"POST"},t);return a.VoidApiResponse.fromResponse(r)}async assignPermissions(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}/permissions".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return a.VoidApiResponse.fromResponse(s)}async regenerateRecoveryCode(e,t){a.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/users/{id}/recovery-code-regeneration".replace("{id}",encodeURIComponent(String(e.id))),method:"POST"},t);return a.JSONApiResponse.fromResponse(r)}async assignRoles(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}/roles".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return a.VoidApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/users",method:"POST",headers:r,body:e},t);return a.JSONApiResponse.fromResponse(n)}async updateAuthenticationMethods(e,t,r){a.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}/authentication-methods".replace("{id}",encodeURIComponent(String(e.id))),method:"PUT",headers:n,body:t},r);return a.JSONApiResponse.fromResponse(s)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.UsersByEmailManager=void 0;const a=i(r(163)),{BaseAPI:o}=a;t.UsersByEmailManager=class extends o{async getByEmail(e,t){a.validateRequiredRequestParams(e,["email"]);const r=a.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}},{key:"email",config:{}}]),n=await this.request({path:"/users-by-email",method:"GET",query:r},t);return a.JSONApiResponse.fromResponse(n)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GetBreachedPasswordDetection200ResponseStagePreUserRegistrationShieldsEnum=t.GetBreachedPasswordDetection200ResponseMethodEnum=t.GetBreachedPasswordDetection200ResponseAdminNotificationFrequencyEnum=t.GetBreachedPasswordDetection200ResponseShieldsEnum=t.GetAuthenticationMethods200ResponseOneOfInnerAuthenticationMethodsInnerTypeEnum=t.GetAuthenticationMethods200ResponseOneOfInnerPreferredAuthenticationMethodEnum=t.GetAuthenticationMethods200ResponseOneOfInnerTypeEnum=t.GetActions200ResponseActionsInnerSupportedTriggersInnerIdAnyOf=t.GetActions200ResponseActionsInnerIntegrationCurrentReleaseRequiredSecretsInnerTypeEnum=t.GetActions200ResponseActionsInnerIntegrationFeatureTypeEnum=t.GetActions200ResponseActionsInnerStatusEnum=t.GetActionVersions200ResponseVersionsInnerStatusEnum=t.FactorNameEnum=t.EnrollmentStatusEnum=t.EmailTemplateUpdateTemplateEnum=t.EmailProviderUpdateNameEnum=t.EmailProviderCreateNameEnum=t.DeviceCredentialCreateTypeEnum=t.DeviceCredentialTypeEnum=t.CustomDomainTypeEnum=t.CustomDomainStatusEnum=t.ConnectionUpdateOptionsSetUserRootAttributesEnum=t.ConnectionUpdateOptionsPasswordPolicyEnum=t.ConnectionCreateOptionsPasskeyOptionsChallengeUiEnum=t.ConnectionCreateOptionsSetUserRootAttributesEnum=t.ConnectionCreateOptionsPasswordPolicyEnum=t.ConnectionCreateStrategyEnum=t.ClientUpdateJwtConfigurationAlgEnum=t.ClientUpdateComplianceLevelEnum=t.ClientUpdateOrganizationRequireBehaviorEnum=t.ClientUpdateOrganizationUsageEnum=t.ClientUpdateAppTypeEnum=t.ClientUpdateTokenEndpointAuthMethodEnum=t.ClientRefreshTokenExpirationTypeEnum=t.ClientRefreshTokenRotationTypeEnum=t.ClientJwtConfigurationAlgEnum=t.ClientCreateJwtConfigurationAlgEnum=t.ClientCreateClientAuthenticationMethodsTlsClientAuthCredentialsInnerCredentialTypeEnum=t.ClientCreateClientAuthenticationMethodsSelfSignedTlsClientAuthCredentialsInnerCredentialTypeEnum=t.ClientCreateClientAuthenticationMethodsPrivateKeyJwtCredentialsInnerAlgEnum=t.ClientCreateClientAuthenticationMethodsPrivateKeyJwtCredentialsInnerCredentialTypeEnum=t.ClientCreateComplianceLevelEnum=t.ClientCreateOrganizationRequireBehaviorEnum=t.ClientCreateOrganizationUsageEnum=t.ClientCreateAppTypeEnum=t.ClientCreateTokenEndpointAuthMethodEnum=t.ClientComplianceLevelEnum=t.ClientOrganizationRequireBehaviorEnum=t.ClientOrganizationUsageEnum=t.ClientTokenEndpointAuthMethodEnum=void 0,t.PostAuthenticationMethods201ResponseTypeEnum=t.PatchSuspiciousIpThrottlingRequestShieldsEnum=t.PatchLogStreamsByIdRequestSinkOneOf3MixpanelRegionEnum=t.PatchLogStreamsByIdRequestSinkOneOfDatadogRegionEnum=t.PatchLogStreamsByIdRequestStatusEnum=t.PatchEmailTemplatesByTemplateNameRequestTemplateEnum=t.PatchCustomDomainsByIdRequestCustomClientIpHeaderEnum=t.PatchCustomDomainsByIdRequestTlsPolicyEnum=t.PatchBruteForceProtectionRequestModeEnum=t.PatchBruteForceProtectionRequestShieldsEnum=t.PatchBreachedPasswordDetectionRequestStagePreUserRegistrationShieldsEnum=t.PatchBreachedPasswordDetectionRequestMethodEnum=t.PatchBreachedPasswordDetectionRequestAdminNotificationFrequencyEnum=t.PatchBreachedPasswordDetectionRequestShieldsEnum=t.PatchBindingsRequestBindingsInnerOneOfRefTypeEnum=t.PatchAuthenticationMethodsByAuthenticationMethodIdRequestPreferredAuthenticationMethodEnum=t.JobFormatEnum=t.HookCreateTriggerIdEnum=t.GetSuspiciousIpThrottling200ResponseShieldsEnum=t.GetPnProviders200ResponseProviderEnum=t.GetPhoneProviders200ResponseProviderEnum=t.GetMessageTypes200ResponseMessageTypesEnum=t.GetLogStreams200ResponseInnerOneOfSinkHttpContentFormatEnum=t.GetLogStreams200ResponseInnerOneOfFiltersInnerNameEnum=t.GetLogStreams200ResponseInnerOneOfFiltersInnerTypeEnum=t.GetLogStreams200ResponseInnerOneOf7SinkMixpanelRegionEnum=t.GetLogStreams200ResponseInnerOneOf7TypeEnum=t.GetLogStreams200ResponseInnerOneOf7StatusEnum=t.GetLogStreams200ResponseInnerOneOf6TypeEnum=t.GetLogStreams200ResponseInnerOneOf6StatusEnum=t.GetLogStreams200ResponseInnerOneOf5TypeEnum=t.GetLogStreams200ResponseInnerOneOf5StatusEnum=t.GetLogStreams200ResponseInnerOneOf4TypeEnum=t.GetLogStreams200ResponseInnerOneOf4StatusEnum=t.GetLogStreams200ResponseInnerOneOf3SinkDatadogRegionEnum=t.GetLogStreams200ResponseInnerOneOf3TypeEnum=t.GetLogStreams200ResponseInnerOneOf3StatusEnum=t.GetLogStreams200ResponseInnerOneOf2SinkAzureRegionEnum=t.GetLogStreams200ResponseInnerOneOf2TypeEnum=t.GetLogStreams200ResponseInnerOneOf2StatusEnum=t.GetLogStreams200ResponseInnerOneOf1SinkAwsRegionEnum=t.GetLogStreams200ResponseInnerOneOf1TypeEnum=t.GetLogStreams200ResponseInnerOneOf1StatusEnum=t.GetLogStreams200ResponseInnerOneOfTypeEnum=t.GetLogStreams200ResponseInnerOneOfStatusEnum=t.GetExecution200ResponseStatusEnum=t.GetEmailTemplatesByTemplateName200ResponseTemplateEnum=t.GetCredentials200ResponseInnerAlgEnum=t.GetBruteForceProtection200ResponseModeEnum=t.GetBruteForceProtection200ResponseShieldsEnum=void 0,t.ResourceServerProofOfPossessionMechanismEnum=t.ResourceServerCreateConsentPolicyEnum=t.ResourceServerCreateTokenDialectEnum=t.ResourceServerCreateSigningAlgEnum=t.ResourceServerConsentPolicyEnum=t.ResourceServerTokenDialectEnum=t.ResourceServerSigningAlgEnum=t.PutAuthenticationMethodsRequestInnerPreferredAuthenticationMethodEnum=t.PutAuthenticationMethodsRequestInnerTypeEnum=t.PutAuthenticationMethods200ResponseInnerAuthenticationMethodsInnerTypeEnum=t.PutAuthenticationMethods200ResponseInnerPreferredAuthenticationMethodEnum=t.PutAuthenticationMethods200ResponseInnerTypeEnum=t.PromptsSettingsUpdateUniversalLoginExperienceEnum=t.PromptsSettingsUniversalLoginExperienceEnum=t.PostVerify200ResponseTypeEnum=t.PostVerify200ResponseStatusEnum=t.PostVerificationEmailRequestIdentityProviderEnum=t.PostUsersExportsRequestFormatEnum=t.PostLogStreamsRequestOneOfFiltersInnerNameEnum=t.PostLogStreamsRequestOneOfFiltersInnerTypeEnum=t.PostLogStreamsRequestOneOf7TypeEnum=t.PostLogStreamsRequestOneOf6TypeEnum=t.PostLogStreamsRequestOneOf5TypeEnum=t.PostLogStreamsRequestOneOf4TypeEnum=t.PostLogStreamsRequestOneOf3TypeEnum=t.PostLogStreamsRequestOneOf2SinkAzureRegionEnum=t.PostLogStreamsRequestOneOf2TypeEnum=t.PostLogStreamsRequestOneOf1SinkAwsRegionEnum=t.PostLogStreamsRequestOneOf1TypeEnum=t.PostLogStreamsRequestOneOfTypeEnum=t.PostIdentitiesRequestProviderEnum=t.PostEmailTemplatesRequestTemplateEnum=t.PostCustomDomainsRequestCustomClientIpHeaderEnum=t.PostCustomDomainsRequestTlsPolicyEnum=t.PostCustomDomainsRequestVerificationMethodEnum=t.PostCustomDomainsRequestTypeEnum=t.PostCustomDomains201ResponseVerificationMethodsInnerNameEnum=t.PostCustomDomains201ResponseTypeEnum=t.PostCustomDomains201ResponseStatusEnum=t.PostCredentialsRequestCredentialTypeEnum=t.PostBrandingThemeRequestWidgetSocialButtonsLayoutEnum=t.PostBrandingThemeRequestWidgetLogoPositionEnum=t.PostBrandingThemeRequestWidgetHeaderTextAlignmentEnum=t.PostBrandingThemeRequestPageBackgroundPageLayoutEnum=t.PostBrandingThemeRequestFontsLinksStyleEnum=t.PostBrandingThemeRequestBordersInputsStyleEnum=t.PostBrandingThemeRequestBordersButtonsStyleEnum=t.PostAuthenticationMethodsRequestPreferredAuthenticationMethodEnum=t.PostAuthenticationMethodsRequestTypeEnum=t.PostAuthenticationMethods201ResponsePreferredAuthenticationMethodEnum=void 0,t.GetUsersSearchEngineEnum=t.DeleteUserIdentityByUserIdProviderEnum=t.DeleteMultifactorByProviderProviderEnum=t.PutPartialsPromptEnum=t.PutCustomTextByLanguageLanguageEnum=t.PutCustomTextByLanguagePromptEnum=t.GetPartialsPromptEnum=t.GetCustomTextByLanguageLanguageEnum=t.GetCustomTextByLanguagePromptEnum=t.GetHooksTriggerIdEnum=t.PutFactorsByNameOperationNameEnum=t.PutEmailTemplatesByTemplateNameTemplateNameEnum=t.PatchEmailTemplatesByTemplateNameOperationTemplateNameEnum=t.GetEmailTemplatesByTemplateNameTemplateNameEnum=t.GetDeviceCredentialsTypeEnum=t.GetConnectionsStrategyEnum=t.UserEnrollmentAuthMethodEnum=t.UserEnrollmentStatusEnum=t.TenantSettingsUpdateFlagsChangePwdFlowV1Enum=t.TenantSettingsUpdateDeviceFlowCharsetEnum=t.TenantSettingsUpdateEnabledLocalesEnum=t.TenantSettingsSessionCookieModeEnum=t.TenantSettingsDeviceFlowCharsetEnum=t.TenantSettingsEnabledLocalesEnum=t.ResourceServerUpdateConsentPolicyEnum=t.ResourceServerUpdateTokenDialectEnum=t.ResourceServerUpdateSigningAlgEnum=t.ResourceServerTokenEncryptionEncryptionKeyAlgEnum=t.ResourceServerTokenEncryptionFormatEnum=void 0,t.ClientTokenEndpointAuthMethodEnum={none:"none",client_secret_post:"client_secret_post",client_secret_basic:"client_secret_basic"},t.ClientOrganizationUsageEnum={deny:"deny",allow:"allow",require:"require"},t.ClientOrganizationRequireBehaviorEnum={no_prompt:"no_prompt",pre_login_prompt:"pre_login_prompt",post_login_prompt:"post_login_prompt"},t.ClientComplianceLevelEnum={none:"none",fapi1_adv_pkj_par:"fapi1_adv_pkj_par",fapi1_adv_mtls_par:"fapi1_adv_mtls_par",null:"null"},t.ClientCreateTokenEndpointAuthMethodEnum={none:"none",client_secret_post:"client_secret_post",client_secret_basic:"client_secret_basic"},t.ClientCreateAppTypeEnum={native:"native",spa:"spa",regular_web:"regular_web",non_interactive:"non_interactive",rms:"rms",box:"box",cloudbees:"cloudbees",concur:"concur",dropbox:"dropbox",mscrm:"mscrm",echosign:"echosign",egnyte:"egnyte",newrelic:"newrelic",office365:"office365",salesforce:"salesforce",sentry:"sentry",sharepoint:"sharepoint",slack:"slack",springcm:"springcm",zendesk:"zendesk",zoom:"zoom",sso_integration:"sso_integration",oag:"oag"},t.ClientCreateOrganizationUsageEnum={deny:"deny",allow:"allow",require:"require"},t.ClientCreateOrganizationRequireBehaviorEnum={no_prompt:"no_prompt",pre_login_prompt:"pre_login_prompt",post_login_prompt:"post_login_prompt"},t.ClientCreateComplianceLevelEnum={none:"none",fapi1_adv_pkj_par:"fapi1_adv_pkj_par",fapi1_adv_mtls_par:"fapi1_adv_mtls_par",null:"null"},t.ClientCreateClientAuthenticationMethodsPrivateKeyJwtCredentialsInnerCredentialTypeEnum={public_key:"public_key"},t.ClientCreateClientAuthenticationMethodsPrivateKeyJwtCredentialsInnerAlgEnum={RS256:"RS256",RS384:"RS384",PS256:"PS256"},t.ClientCreateClientAuthenticationMethodsSelfSignedTlsClientAuthCredentialsInnerCredentialTypeEnum={x509_cert:"x509_cert"},t.ClientCreateClientAuthenticationMethodsTlsClientAuthCredentialsInnerCredentialTypeEnum={cert_subject_dn:"cert_subject_dn"},t.ClientCreateJwtConfigurationAlgEnum={HS256:"HS256",RS256:"RS256",PS256:"PS256"},t.ClientJwtConfigurationAlgEnum={HS256:"HS256",RS256:"RS256",PS256:"PS256"},t.ClientRefreshTokenRotationTypeEnum={rotating:"rotating",non_rotating:"non-rotating"},t.ClientRefreshTokenExpirationTypeEnum={expiring:"expiring",non_expiring:"non-expiring"},t.ClientUpdateTokenEndpointAuthMethodEnum={none:"none",client_secret_post:"client_secret_post",client_secret_basic:"client_secret_basic",null:"null"},t.ClientUpdateAppTypeEnum={native:"native",spa:"spa",regular_web:"regular_web",non_interactive:"non_interactive",rms:"rms",box:"box",cloudbees:"cloudbees",concur:"concur",dropbox:"dropbox",mscrm:"mscrm",echosign:"echosign",egnyte:"egnyte",newrelic:"newrelic",office365:"office365",salesforce:"salesforce",sentry:"sentry",sharepoint:"sharepoint",slack:"slack",springcm:"springcm",zendesk:"zendesk",zoom:"zoom",sso_integration:"sso_integration",oag:"oag"},t.ClientUpdateOrganizationUsageEnum={deny:"deny",allow:"allow",require:"require"},t.ClientUpdateOrganizationRequireBehaviorEnum={no_prompt:"no_prompt",pre_login_prompt:"pre_login_prompt",post_login_prompt:"post_login_prompt"},t.ClientUpdateComplianceLevelEnum={none:"none",fapi1_adv_pkj_par:"fapi1_adv_pkj_par",fapi1_adv_mtls_par:"fapi1_adv_mtls_par",null:"null"},t.ClientUpdateJwtConfigurationAlgEnum={HS256:"HS256",RS256:"RS256",PS256:"PS256"},t.ConnectionCreateStrategyEnum={ad:"ad",adfs:"adfs",amazon:"amazon",apple:"apple",dropbox:"dropbox",bitbucket:"bitbucket",aol:"aol",auth0_oidc:"auth0-oidc",auth0:"auth0",baidu:"baidu",bitly:"bitly",box:"box",custom:"custom",daccount:"daccount",dwolla:"dwolla",email:"email",evernote_sandbox:"evernote-sandbox",evernote:"evernote",exact:"exact",facebook:"facebook",fitbit:"fitbit",flickr:"flickr",github:"github",google_apps:"google-apps",google_oauth2:"google-oauth2",instagram:"instagram",ip:"ip",line:"line",linkedin:"linkedin",miicard:"miicard",oauth1:"oauth1",oauth2:"oauth2",office365:"office365",oidc:"oidc",okta:"okta",paypal:"paypal",paypal_sandbox:"paypal-sandbox",pingfederate:"pingfederate",planningcenter:"planningcenter",renren:"renren",salesforce_community:"salesforce-community",salesforce_sandbox:"salesforce-sandbox",salesforce:"salesforce",samlp:"samlp",sharepoint:"sharepoint",shopify:"shopify",sms:"sms",soundcloud:"soundcloud",thecity_sandbox:"thecity-sandbox",thecity:"thecity",thirtysevensignals:"thirtysevensignals",twitter:"twitter",untappd:"untappd",vkontakte:"vkontakte",waad:"waad",weibo:"weibo",windowslive:"windowslive",wordpress:"wordpress",yahoo:"yahoo",yammer:"yammer",yandex:"yandex"},t.ConnectionCreateOptionsPasswordPolicyEnum={none:"none",low:"low",fair:"fair",good:"good",excellent:"excellent",null:"null"},t.ConnectionCreateOptionsSetUserRootAttributesEnum={each_login:"on_each_login",first_login:"on_first_login"},t.ConnectionCreateOptionsPasskeyOptionsChallengeUiEnum={both:"both",autofill:"autofill",button:"button"},t.ConnectionUpdateOptionsPasswordPolicyEnum={none:"none",low:"low",fair:"fair",good:"good",excellent:"excellent",null:"null"},t.ConnectionUpdateOptionsSetUserRootAttributesEnum={each_login:"on_each_login",first_login:"on_first_login"},t.CustomDomainStatusEnum={disabled:"disabled",pending:"pending",pending_verification:"pending_verification",ready:"ready"},t.CustomDomainTypeEnum={auth0_managed_certs:"auth0_managed_certs",self_managed_certs:"self_managed_certs"},t.DeviceCredentialTypeEnum={public_key:"public_key",refresh_token:"refresh_token",rotating_refresh_token:"rotating_refresh_token"},t.DeviceCredentialCreateTypeEnum={public_key:"public_key"},t.EmailProviderCreateNameEnum={mailgun:"mailgun",mandrill:"mandrill",sendgrid:"sendgrid",ses:"ses",sparkpost:"sparkpost",smtp:"smtp",azure_cs:"azure_cs",ms365:"ms365"},t.EmailProviderUpdateNameEnum={mailgun:"mailgun",mandrill:"mandrill",sendgrid:"sendgrid",ses:"ses",sparkpost:"sparkpost",smtp:"smtp",azure_cs:"azure_cs",ms365:"ms365"},t.EmailTemplateUpdateTemplateEnum={verify_email:"verify_email",verify_email_by_code:"verify_email_by_code",reset_email:"reset_email",welcome_email:"welcome_email",blocked_account:"blocked_account",stolen_credentials:"stolen_credentials",enrollment_email:"enrollment_email",mfa_oob_code:"mfa_oob_code",user_invitation:"user_invitation",change_password:"change_password",password_reset:"password_reset"},t.EnrollmentStatusEnum={pending:"pending",confirmed:"confirmed"},t.FactorNameEnum={push_notification:"push-notification",sms:"sms",email:"email",duo:"duo",otp:"otp",webauthn_roaming:"webauthn-roaming",webauthn_platform:"webauthn-platform",recovery_code:"recovery-code"},t.GetActionVersions200ResponseVersionsInnerStatusEnum={pending:"pending",building:"building",packaged:"packaged",built:"built",retrying:"retrying",failed:"failed"},t.GetActions200ResponseActionsInnerStatusEnum={pending:"pending",building:"building",packaged:"packaged",built:"built",retrying:"retrying",failed:"failed"},t.GetActions200ResponseActionsInnerIntegrationFeatureTypeEnum={unspecified:"unspecified",action:"action",social_connection:"social_connection",log_stream:"log_stream",sso_integration:"sso_integration",sms_provider:"sms_provider"},t.GetActions200ResponseActionsInnerIntegrationCurrentReleaseRequiredSecretsInnerTypeEnum={UNSPECIFIED:"UNSPECIFIED",STRING:"STRING"},t.GetActions200ResponseActionsInnerSupportedTriggersInnerIdAnyOf={post_login:"post-login",credentials_exchange:"credentials-exchange",pre_user_registration:"pre-user-registration",post_user_registration:"post-user-registration",post_change_password:"post-change-password",send_phone_message:"send-phone-message",iga_approval:"iga-approval",iga_certification:"iga-certification",iga_fulfillment_assignment:"iga-fulfillment-assignment",iga_fulfillment_execution:"iga-fulfillment-execution",password_reset_post_challenge:"password-reset-post-challenge"},t.GetAuthenticationMethods200ResponseOneOfInnerTypeEnum={recovery_code:"recovery-code",totp:"totp",push:"push",phone:"phone",email:"email",email_verification:"email-verification",webauthn_roaming:"webauthn-roaming",webauthn_platform:"webauthn-platform",guardian:"guardian",passkey:"passkey"},t.GetAuthenticationMethods200ResponseOneOfInnerPreferredAuthenticationMethodEnum={sms:"sms",voice:"voice"},t.GetAuthenticationMethods200ResponseOneOfInnerAuthenticationMethodsInnerTypeEnum={totp:"totp",push:"push",sms:"sms",voice:"voice"},t.GetBreachedPasswordDetection200ResponseShieldsEnum={block:"block",user_notification:"user_notification",admin_notification:"admin_notification"},t.GetBreachedPasswordDetection200ResponseAdminNotificationFrequencyEnum={immediately:"immediately",daily:"daily",weekly:"weekly",monthly:"monthly"},t.GetBreachedPasswordDetection200ResponseMethodEnum={standard:"standard",enhanced:"enhanced"},t.GetBreachedPasswordDetection200ResponseStagePreUserRegistrationShieldsEnum={block:"block",admin_notification:"admin_notification"},t.GetBruteForceProtection200ResponseShieldsEnum={block:"block",user_notification:"user_notification"},t.GetBruteForceProtection200ResponseModeEnum={identifier_and_ip:"count_per_identifier_and_ip",identifier:"count_per_identifier"},t.GetCredentials200ResponseInnerAlgEnum={RS256:"RS256",RS384:"RS384",PS256:"PS256"},t.GetEmailTemplatesByTemplateName200ResponseTemplateEnum={verify_email:"verify_email",verify_email_by_code:"verify_email_by_code",reset_email:"reset_email",welcome_email:"welcome_email",blocked_account:"blocked_account",stolen_credentials:"stolen_credentials",enrollment_email:"enrollment_email",mfa_oob_code:"mfa_oob_code",user_invitation:"user_invitation",change_password:"change_password",password_reset:"password_reset"},t.GetExecution200ResponseStatusEnum={unspecified:"unspecified",pending:"pending",final:"final",partial:"partial",canceled:"canceled",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOfStatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOfTypeEnum={http:"http"},t.GetLogStreams200ResponseInnerOneOf1StatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOf1TypeEnum={eventbridge:"eventbridge"},t.GetLogStreams200ResponseInnerOneOf1SinkAwsRegionEnum={ap_east_1:"ap-east-1",ap_northeast_1:"ap-northeast-1",ap_northeast_2:"ap-northeast-2",ap_northeast_3:"ap-northeast-3",ap_south_1:"ap-south-1",ap_southeast_1:"ap-southeast-1",ap_southeast_2:"ap-southeast-2",ca_central_1:"ca-central-1",cn_north_1:"cn-north-1",cn_northwest_1:"cn-northwest-1",eu_central_1:"eu-central-1",eu_north_1:"eu-north-1",eu_west_1:"eu-west-1",eu_west_2:"eu-west-2",eu_west_3:"eu-west-3",me_south_1:"me-south-1",sa_east_1:"sa-east-1",us_gov_east_1:"us-gov-east-1",us_gov_west_1:"us-gov-west-1",us_east_1:"us-east-1",us_east_2:"us-east-2",us_west_1:"us-west-1",us_west_2:"us-west-2"},t.GetLogStreams200ResponseInnerOneOf2StatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOf2TypeEnum={eventgrid:"eventgrid"},t.GetLogStreams200ResponseInnerOneOf2SinkAzureRegionEnum={australiacentral:"australiacentral",australiaeast:"australiaeast",australiasoutheast:"australiasoutheast",brazilsouth:"brazilsouth",canadacentral:"canadacentral",canadaeast:"canadaeast",centralindia:"centralindia",centralus:"centralus",eastasia:"eastasia",eastus:"eastus",eastus2:"eastus2",francecentral:"francecentral",germanywestcentral:"germanywestcentral",japaneast:"japaneast",japanwest:"japanwest",koreacentral:"koreacentral",koreasouth:"koreasouth",northcentralus:"northcentralus",northeurope:"northeurope",norwayeast:"norwayeast",southafricanorth:"southafricanorth",southcentralus:"southcentralus",southeastasia:"southeastasia",southindia:"southindia",switzerlandnorth:"switzerlandnorth",uaenorth:"uaenorth",uksouth:"uksouth",ukwest:"ukwest",westcentralus:"westcentralus",westeurope:"westeurope",westindia:"westindia",westus:"westus",westus2:"westus2"},t.GetLogStreams200ResponseInnerOneOf3StatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOf3TypeEnum={datadog:"datadog"},t.GetLogStreams200ResponseInnerOneOf3SinkDatadogRegionEnum={us:"us",eu:"eu",us3:"us3",us5:"us5"},t.GetLogStreams200ResponseInnerOneOf4StatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOf4TypeEnum={splunk:"splunk"},t.GetLogStreams200ResponseInnerOneOf5StatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOf5TypeEnum={sumo:"sumo"},t.GetLogStreams200ResponseInnerOneOf6StatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOf6TypeEnum={segment:"segment"},t.GetLogStreams200ResponseInnerOneOf7StatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOf7TypeEnum={mixpanel:"mixpanel"},t.GetLogStreams200ResponseInnerOneOf7SinkMixpanelRegionEnum={us:"us",eu:"eu"},t.GetLogStreams200ResponseInnerOneOfFiltersInnerTypeEnum={category:"category"},t.GetLogStreams200ResponseInnerOneOfFiltersInnerNameEnum={auth_ancillary_fail:"auth.ancillary.fail",auth_ancillary_success:"auth.ancillary.success",auth_login_fail:"auth.login.fail",auth_login_notification:"auth.login.notification",auth_login_success:"auth.login.success",auth_logout_fail:"auth.logout.fail",auth_logout_success:"auth.logout.success",auth_signup_fail:"auth.signup.fail",auth_signup_success:"auth.signup.success",auth_silent_auth_fail:"auth.silent_auth.fail",auth_silent_auth_success:"auth.silent_auth.success",auth_token_exchange_fail:"auth.token_exchange.fail",auth_token_exchange_success:"auth.token_exchange.success",management_fail:"management.fail",management_success:"management.success",system_notification:"system.notification",user_fail:"user.fail",user_notification:"user.notification",user_success:"user.success",other:"other"},t.GetLogStreams200ResponseInnerOneOfSinkHttpContentFormatEnum={JSONARRAY:"JSONARRAY",JSONLINES:"JSONLINES",JSONOBJECT:"JSONOBJECT"},t.GetMessageTypes200ResponseMessageTypesEnum={sms:"sms",voice:"voice"},t.GetPhoneProviders200ResponseProviderEnum={auth0:"auth0",twilio:"twilio",phone_message_hook:"phone-message-hook"},t.GetPnProviders200ResponseProviderEnum={guardian:"guardian",sns:"sns",direct:"direct"},t.GetSuspiciousIpThrottling200ResponseShieldsEnum={block:"block",admin_notification:"admin_notification"},t.HookCreateTriggerIdEnum={credentials_exchange:"credentials-exchange",pre_user_registration:"pre-user-registration",post_user_registration:"post-user-registration",post_change_password:"post-change-password",send_phone_message:"send-phone-message"},t.JobFormatEnum={json:"json",csv:"csv"},t.PatchAuthenticationMethodsByAuthenticationMethodIdRequestPreferredAuthenticationMethodEnum={voice:"voice",sms:"sms"},t.PatchBindingsRequestBindingsInnerOneOfRefTypeEnum={binding_id:"binding_id",action_id:"action_id",action_name:"action_name"},t.PatchBreachedPasswordDetectionRequestShieldsEnum={block:"block",user_notification:"user_notification",admin_notification:"admin_notification"},t.PatchBreachedPasswordDetectionRequestAdminNotificationFrequencyEnum={immediately:"immediately",daily:"daily",weekly:"weekly",monthly:"monthly"},t.PatchBreachedPasswordDetectionRequestMethodEnum={standard:"standard",enhanced:"enhanced"},t.PatchBreachedPasswordDetectionRequestStagePreUserRegistrationShieldsEnum={block:"block",admin_notification:"admin_notification"},t.PatchBruteForceProtectionRequestShieldsEnum={block:"block",user_notification:"user_notification"},t.PatchBruteForceProtectionRequestModeEnum={identifier_and_ip:"count_per_identifier_and_ip",identifier:"count_per_identifier"},t.PatchCustomDomainsByIdRequestTlsPolicyEnum={recommended:"recommended",compatible:"compatible"},t.PatchCustomDomainsByIdRequestCustomClientIpHeaderEnum={true_client_ip:"true-client-ip",cf_connecting_ip:"cf-connecting-ip",x_forwarded_for:"x-forwarded-for",x_azure_clientip:"x-azure-clientip",empty:""},t.PatchEmailTemplatesByTemplateNameRequestTemplateEnum={verify_email:"verify_email",verify_email_by_code:"verify_email_by_code",reset_email:"reset_email",welcome_email:"welcome_email",blocked_account:"blocked_account",stolen_credentials:"stolen_credentials",enrollment_email:"enrollment_email",mfa_oob_code:"mfa_oob_code",user_invitation:"user_invitation",change_password:"change_password",password_reset:"password_reset"},t.PatchLogStreamsByIdRequestStatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.PatchLogStreamsByIdRequestSinkOneOfDatadogRegionEnum={us:"us",eu:"eu",us3:"us3",us5:"us5"},t.PatchLogStreamsByIdRequestSinkOneOf3MixpanelRegionEnum={us:"us",eu:"eu"},t.PatchSuspiciousIpThrottlingRequestShieldsEnum={block:"block",admin_notification:"admin_notification"},t.PostAuthenticationMethods201ResponseTypeEnum={phone:"phone",email:"email",totp:"totp",webauthn_roaming:"webauthn-roaming"},t.PostAuthenticationMethods201ResponsePreferredAuthenticationMethodEnum={voice:"voice",sms:"sms"},t.PostAuthenticationMethodsRequestTypeEnum={phone:"phone",email:"email",totp:"totp",webauthn_roaming:"webauthn-roaming"},t.PostAuthenticationMethodsRequestPreferredAuthenticationMethodEnum={voice:"voice",sms:"sms"},t.PostBrandingThemeRequestBordersButtonsStyleEnum={pill:"pill",rounded:"rounded",sharp:"sharp"},t.PostBrandingThemeRequestBordersInputsStyleEnum={pill:"pill",rounded:"rounded",sharp:"sharp"},t.PostBrandingThemeRequestFontsLinksStyleEnum={normal:"normal",underlined:"underlined"},t.PostBrandingThemeRequestPageBackgroundPageLayoutEnum={center:"center",left:"left",right:"right"},t.PostBrandingThemeRequestWidgetHeaderTextAlignmentEnum={center:"center",left:"left",right:"right"},t.PostBrandingThemeRequestWidgetLogoPositionEnum={center:"center",left:"left",none:"none",right:"right"},t.PostBrandingThemeRequestWidgetSocialButtonsLayoutEnum={bottom:"bottom",top:"top"},t.PostCredentialsRequestCredentialTypeEnum={public_key:"public_key",cert_subject_dn:"cert_subject_dn",x509_cert:"x509_cert"},t.PostCustomDomains201ResponseStatusEnum={disabled:"disabled",pending:"pending",pending_verification:"pending_verification",ready:"ready"},t.PostCustomDomains201ResponseTypeEnum={auth0_managed_certs:"auth0_managed_certs",self_managed_certs:"self_managed_certs"},t.PostCustomDomains201ResponseVerificationMethodsInnerNameEnum={cname:"cname",txt:"txt"},t.PostCustomDomainsRequestTypeEnum={auth0_managed_certs:"auth0_managed_certs",self_managed_certs:"self_managed_certs"},t.PostCustomDomainsRequestVerificationMethodEnum={txt:"txt"},t.PostCustomDomainsRequestTlsPolicyEnum={recommended:"recommended",compatible:"compatible"},t.PostCustomDomainsRequestCustomClientIpHeaderEnum={true_client_ip:"true-client-ip",cf_connecting_ip:"cf-connecting-ip",x_forwarded_for:"x-forwarded-for",x_azure_clientip:"x-azure-clientip",null:"null"},t.PostEmailTemplatesRequestTemplateEnum={verify_email:"verify_email",verify_email_by_code:"verify_email_by_code",reset_email:"reset_email",welcome_email:"welcome_email",blocked_account:"blocked_account",stolen_credentials:"stolen_credentials",enrollment_email:"enrollment_email",mfa_oob_code:"mfa_oob_code",user_invitation:"user_invitation",change_password:"change_password",password_reset:"password_reset"},t.PostIdentitiesRequestProviderEnum={ad:"ad",adfs:"adfs",amazon:"amazon",apple:"apple",dropbox:"dropbox",bitbucket:"bitbucket",aol:"aol",auth0_oidc:"auth0-oidc",auth0:"auth0",baidu:"baidu",bitly:"bitly",box:"box",custom:"custom",daccount:"daccount",dwolla:"dwolla",email:"email",evernote_sandbox:"evernote-sandbox",evernote:"evernote",exact:"exact",facebook:"facebook",fitbit:"fitbit",flickr:"flickr",github:"github",google_apps:"google-apps",google_oauth2:"google-oauth2",instagram:"instagram",ip:"ip",line:"line",linkedin:"linkedin",miicard:"miicard",oauth1:"oauth1",oauth2:"oauth2",office365:"office365",oidc:"oidc",okta:"okta",paypal:"paypal",paypal_sandbox:"paypal-sandbox",pingfederate:"pingfederate",planningcenter:"planningcenter",renren:"renren",salesforce_community:"salesforce-community",salesforce_sandbox:"salesforce-sandbox",salesforce:"salesforce",samlp:"samlp",sharepoint:"sharepoint",shopify:"shopify",sms:"sms",soundcloud:"soundcloud",thecity_sandbox:"thecity-sandbox",thecity:"thecity",thirtysevensignals:"thirtysevensignals",twitter:"twitter",untappd:"untappd",vkontakte:"vkontakte",waad:"waad",weibo:"weibo",windowslive:"windowslive",wordpress:"wordpress",yahoo:"yahoo",yammer:"yammer",yandex:"yandex"},t.PostLogStreamsRequestOneOfTypeEnum={http:"http"},t.PostLogStreamsRequestOneOf1TypeEnum={eventbridge:"eventbridge"},t.PostLogStreamsRequestOneOf1SinkAwsRegionEnum={ap_east_1:"ap-east-1",ap_northeast_1:"ap-northeast-1",ap_northeast_2:"ap-northeast-2",ap_northeast_3:"ap-northeast-3",ap_south_1:"ap-south-1",ap_southeast_1:"ap-southeast-1",ap_southeast_2:"ap-southeast-2",ca_central_1:"ca-central-1",cn_north_1:"cn-north-1",cn_northwest_1:"cn-northwest-1",eu_central_1:"eu-central-1",eu_north_1:"eu-north-1",eu_west_1:"eu-west-1",eu_west_2:"eu-west-2",eu_west_3:"eu-west-3",me_south_1:"me-south-1",sa_east_1:"sa-east-1",us_gov_east_1:"us-gov-east-1",us_gov_west_1:"us-gov-west-1",us_east_1:"us-east-1",us_east_2:"us-east-2",us_west_1:"us-west-1",us_west_2:"us-west-2"},t.PostLogStreamsRequestOneOf2TypeEnum={eventgrid:"eventgrid"},t.PostLogStreamsRequestOneOf2SinkAzureRegionEnum={australiacentral:"australiacentral",australiaeast:"australiaeast",australiasoutheast:"australiasoutheast",brazilsouth:"brazilsouth",canadacentral:"canadacentral",canadaeast:"canadaeast",centralindia:"centralindia",centralus:"centralus",eastasia:"eastasia",eastus:"eastus",eastus2:"eastus2",francecentral:"francecentral",germanywestcentral:"germanywestcentral",japaneast:"japaneast",japanwest:"japanwest",koreacentral:"koreacentral",koreasouth:"koreasouth",northcentralus:"northcentralus",northeurope:"northeurope",norwayeast:"norwayeast",southafricanorth:"southafricanorth",southcentralus:"southcentralus",southeastasia:"southeastasia",southindia:"southindia",switzerlandnorth:"switzerlandnorth",uaenorth:"uaenorth",uksouth:"uksouth",ukwest:"ukwest",westcentralus:"westcentralus",westeurope:"westeurope",westindia:"westindia",westus:"westus",westus2:"westus2"},t.PostLogStreamsRequestOneOf3TypeEnum={datadog:"datadog"},t.PostLogStreamsRequestOneOf4TypeEnum={splunk:"splunk"},t.PostLogStreamsRequestOneOf5TypeEnum={sumo:"sumo"},t.PostLogStreamsRequestOneOf6TypeEnum={segment:"segment"},t.PostLogStreamsRequestOneOf7TypeEnum={mixpanel:"mixpanel"},t.PostLogStreamsRequestOneOfFiltersInnerTypeEnum={category:"category"},t.PostLogStreamsRequestOneOfFiltersInnerNameEnum={auth_ancillary_fail:"auth.ancillary.fail",auth_ancillary_success:"auth.ancillary.success",auth_login_fail:"auth.login.fail",auth_login_notification:"auth.login.notification",auth_login_success:"auth.login.success",auth_logout_fail:"auth.logout.fail",auth_logout_success:"auth.logout.success",auth_signup_fail:"auth.signup.fail",auth_signup_success:"auth.signup.success",auth_silent_auth_fail:"auth.silent_auth.fail",auth_silent_auth_success:"auth.silent_auth.success",auth_token_exchange_fail:"auth.token_exchange.fail",auth_token_exchange_success:"auth.token_exchange.success",management_fail:"management.fail",management_success:"management.success",system_notification:"system.notification",user_fail:"user.fail",user_notification:"user.notification",user_success:"user.success",other:"other"},t.PostUsersExportsRequestFormatEnum={json:"json",csv:"csv"},t.PostVerificationEmailRequestIdentityProviderEnum={ad:"ad",adfs:"adfs",amazon:"amazon",apple:"apple",dropbox:"dropbox",bitbucket:"bitbucket",aol:"aol",auth0_oidc:"auth0-oidc",auth0:"auth0",baidu:"baidu",bitly:"bitly",box:"box",custom:"custom",daccount:"daccount",dwolla:"dwolla",email:"email",evernote_sandbox:"evernote-sandbox",evernote:"evernote",exact:"exact",facebook:"facebook",fitbit:"fitbit",flickr:"flickr",github:"github",google_apps:"google-apps",google_oauth2:"google-oauth2",instagram:"instagram",ip:"ip",line:"line",linkedin:"linkedin",miicard:"miicard",oauth1:"oauth1",oauth2:"oauth2",office365:"office365",oidc:"oidc",okta:"okta",paypal:"paypal",paypal_sandbox:"paypal-sandbox",pingfederate:"pingfederate",planningcenter:"planningcenter",renren:"renren",salesforce_community:"salesforce-community",salesforce_sandbox:"salesforce-sandbox",salesforce:"salesforce",samlp:"samlp",sharepoint:"sharepoint",shopify:"shopify",sms:"sms",soundcloud:"soundcloud",thecity_sandbox:"thecity-sandbox",thecity:"thecity",thirtysevensignals:"thirtysevensignals",twitter:"twitter",untappd:"untappd",vkontakte:"vkontakte",waad:"waad",weibo:"weibo",windowslive:"windowslive",wordpress:"wordpress",yahoo:"yahoo",yammer:"yammer",yandex:"yandex"},t.PostVerify200ResponseStatusEnum={disabled:"disabled",pending:"pending",pending_verification:"pending_verification",ready:"ready"},t.PostVerify200ResponseTypeEnum={auth0_managed_certs:"auth0_managed_certs",self_managed_certs:"self_managed_certs"},t.PromptsSettingsUniversalLoginExperienceEnum={new:"new",classic:"classic"},t.PromptsSettingsUpdateUniversalLoginExperienceEnum={new:"new",classic:"classic"},t.PutAuthenticationMethods200ResponseInnerTypeEnum={phone:"phone",email:"email",totp:"totp",webauthn_roaming:"webauthn-roaming"},t.PutAuthenticationMethods200ResponseInnerPreferredAuthenticationMethodEnum={voice:"voice",sms:"sms"},t.PutAuthenticationMethods200ResponseInnerAuthenticationMethodsInnerTypeEnum={totp:"totp",push:"push",sms:"sms",voice:"voice"},t.PutAuthenticationMethodsRequestInnerTypeEnum={phone:"phone",email:"email",totp:"totp"},t.PutAuthenticationMethodsRequestInnerPreferredAuthenticationMethodEnum={voice:"voice",sms:"sms"},t.ResourceServerSigningAlgEnum={HS256:"HS256",RS256:"RS256",PS256:"PS256"},t.ResourceServerTokenDialectEnum={access_token:"access_token",access_token_authz:"access_token_authz",rfc9068_profile:"rfc9068_profile",rfc9068_profile_authz:"rfc9068_profile_authz"},t.ResourceServerConsentPolicyEnum={transactional_authorization_with_mfa:"transactional-authorization-with-mfa",null:"null"},t.ResourceServerCreateSigningAlgEnum={HS256:"HS256",RS256:"RS256",PS256:"PS256"},t.ResourceServerCreateTokenDialectEnum={access_token:"access_token",access_token_authz:"access_token_authz",rfc9068_profile:"rfc9068_profile",rfc9068_profile_authz:"rfc9068_profile_authz"},t.ResourceServerCreateConsentPolicyEnum={transactional_authorization_with_mfa:"transactional-authorization-with-mfa",null:"null"},t.ResourceServerProofOfPossessionMechanismEnum={mtls:"mtls"},t.ResourceServerTokenEncryptionFormatEnum={compact_nested_jwe:"compact-nested-jwe"},t.ResourceServerTokenEncryptionEncryptionKeyAlgEnum={_256:"RSA-OAEP-256",_384:"RSA-OAEP-384",_512:"RSA-OAEP-512"},t.ResourceServerUpdateSigningAlgEnum={HS256:"HS256",RS256:"RS256",PS256:"PS256"},t.ResourceServerUpdateTokenDialectEnum={access_token:"access_token",access_token_authz:"access_token_authz",rfc9068_profile:"rfc9068_profile",rfc9068_profile_authz:"rfc9068_profile_authz"},t.ResourceServerUpdateConsentPolicyEnum={transactional_authorization_with_mfa:"transactional-authorization-with-mfa",null:"null"},t.TenantSettingsEnabledLocalesEnum={ar:"ar",bg:"bg",bs:"bs",ca_ES:"ca-ES",cs:"cs",cy:"cy",da:"da",de:"de",el:"el",en:"en",es:"es",et:"et",eu_ES:"eu-ES",fi:"fi",fr:"fr",fr_CA:"fr-CA",fr_FR:"fr-FR",gl_ES:"gl-ES",he:"he",hi:"hi",hr:"hr",hu:"hu",id:"id",is:"is",it:"it",ja:"ja",ko:"ko",lt:"lt",lv:"lv",nb:"nb",nl:"nl",nn:"nn",no:"no",pl:"pl",pt:"pt",pt_BR:"pt-BR",pt_PT:"pt-PT",ro:"ro",ru:"ru",sk:"sk",sl:"sl",sr:"sr",sv:"sv",th:"th",tr:"tr",uk:"uk",vi:"vi",zh_CN:"zh-CN",zh_TW:"zh-TW"},t.TenantSettingsDeviceFlowCharsetEnum={base20:"base20",digits:"digits"},t.TenantSettingsSessionCookieModeEnum={persistent:"persistent",non_persistent:"non-persistent"},t.TenantSettingsUpdateEnabledLocalesEnum={ar:"ar",bg:"bg",bs:"bs",ca_ES:"ca-ES",cs:"cs",cy:"cy",da:"da",de:"de",el:"el",en:"en",es:"es",et:"et",eu_ES:"eu-ES",fi:"fi",fr:"fr",fr_CA:"fr-CA",fr_FR:"fr-FR",gl_ES:"gl-ES",he:"he",hi:"hi",hr:"hr",hu:"hu",id:"id",is:"is",it:"it",ja:"ja",ko:"ko",lt:"lt",lv:"lv",nb:"nb",nl:"nl",nn:"nn",no:"no",pl:"pl",pt:"pt",pt_BR:"pt-BR",pt_PT:"pt-PT",ro:"ro",ru:"ru",sk:"sk",sl:"sl",sr:"sr",sv:"sv",th:"th",tr:"tr",uk:"uk",vi:"vi",zh_CN:"zh-CN",zh_TW:"zh-TW"},t.TenantSettingsUpdateDeviceFlowCharsetEnum={base20:"base20",digits:"digits"},t.TenantSettingsUpdateFlagsChangePwdFlowV1Enum={false:!1},t.UserEnrollmentStatusEnum={pending:"pending",confirmed:"confirmed"},t.UserEnrollmentAuthMethodEnum={authenticator:"authenticator",guardian:"guardian",sms:"sms",webauthn_platform:"webauthn-platform",webauthn_roaming:"webauthn-roaming"},t.GetConnectionsStrategyEnum={ad:"ad",adfs:"adfs",amazon:"amazon",apple:"apple",dropbox:"dropbox",bitbucket:"bitbucket",aol:"aol",auth0_oidc:"auth0-oidc",auth0:"auth0",baidu:"baidu",bitly:"bitly",box:"box",custom:"custom",daccount:"daccount",dwolla:"dwolla",email:"email",evernote_sandbox:"evernote-sandbox",evernote:"evernote",exact:"exact",facebook:"facebook",fitbit:"fitbit",flickr:"flickr",github:"github",google_apps:"google-apps",google_oauth2:"google-oauth2",instagram:"instagram",ip:"ip",line:"line",linkedin:"linkedin",miicard:"miicard",oauth1:"oauth1",oauth2:"oauth2",office365:"office365",oidc:"oidc",okta:"okta",paypal:"paypal",paypal_sandbox:"paypal-sandbox",pingfederate:"pingfederate",planningcenter:"planningcenter",renren:"renren",salesforce_community:"salesforce-community",salesforce_sandbox:"salesforce-sandbox",salesforce:"salesforce",samlp:"samlp",sharepoint:"sharepoint",shopify:"shopify",sms:"sms",soundcloud:"soundcloud",thecity_sandbox:"thecity-sandbox",thecity:"thecity",thirtysevensignals:"thirtysevensignals",twitter:"twitter",untappd:"untappd",vkontakte:"vkontakte",waad:"waad",weibo:"weibo",windowslive:"windowslive",wordpress:"wordpress",yahoo:"yahoo",yammer:"yammer",yandex:"yandex",auth0_adldap:"auth0-adldap"},t.GetDeviceCredentialsTypeEnum={public_key:"public_key",refresh_token:"refresh_token",rotating_refresh_token:"rotating_refresh_token"},t.GetEmailTemplatesByTemplateNameTemplateNameEnum={verify_email:"verify_email",verify_email_by_code:"verify_email_by_code",reset_email:"reset_email",welcome_email:"welcome_email",blocked_account:"blocked_account",stolen_credentials:"stolen_credentials",enrollment_email:"enrollment_email",mfa_oob_code:"mfa_oob_code",user_invitation:"user_invitation",change_password:"change_password",password_reset:"password_reset"},t.PatchEmailTemplatesByTemplateNameOperationTemplateNameEnum={verify_email:"verify_email",verify_email_by_code:"verify_email_by_code",reset_email:"reset_email",welcome_email:"welcome_email",blocked_account:"blocked_account",stolen_credentials:"stolen_credentials",enrollment_email:"enrollment_email",mfa_oob_code:"mfa_oob_code",user_invitation:"user_invitation",change_password:"change_password",password_reset:"password_reset"},t.PutEmailTemplatesByTemplateNameTemplateNameEnum={verify_email:"verify_email",verify_email_by_code:"verify_email_by_code",reset_email:"reset_email",welcome_email:"welcome_email",blocked_account:"blocked_account",stolen_credentials:"stolen_credentials",enrollment_email:"enrollment_email",mfa_oob_code:"mfa_oob_code",user_invitation:"user_invitation",change_password:"change_password",password_reset:"password_reset"},t.PutFactorsByNameOperationNameEnum={push_notification:"push-notification",sms:"sms",email:"email",duo:"duo",otp:"otp",webauthn_roaming:"webauthn-roaming",webauthn_platform:"webauthn-platform",recovery_code:"recovery-code"},t.GetHooksTriggerIdEnum={credentials_exchange:"credentials-exchange",pre_user_registration:"pre-user-registration",post_user_registration:"post-user-registration",post_change_password:"post-change-password",send_phone_message:"send-phone-message"},t.GetCustomTextByLanguagePromptEnum={login:"login",login_id:"login-id",login_password:"login-password",login_passwordless:"login-passwordless",login_email_verification:"login-email-verification",signup:"signup",signup_id:"signup-id",signup_password:"signup-password",phone_identifier_enrollment:"phone-identifier-enrollment",phone_identifier_challenge:"phone-identifier-challenge",reset_password:"reset-password",consent:"consent",logout:"logout",mfa_push:"mfa-push",mfa_otp:"mfa-otp",mfa_voice:"mfa-voice",mfa_phone:"mfa-phone",mfa_webauthn:"mfa-webauthn",mfa_sms:"mfa-sms",mfa_email:"mfa-email",mfa_recovery_code:"mfa-recovery-code",mfa:"mfa",status:"status",device_flow:"device-flow",email_verification:"email-verification",email_otp_challenge:"email-otp-challenge",organizations:"organizations",invitation:"invitation",common:"common",passkeys:"passkeys"},t.GetCustomTextByLanguageLanguageEnum={ar:"ar",bg:"bg",bs:"bs",ca_ES:"ca-ES",cs:"cs",cy:"cy",da:"da",de:"de",el:"el",en:"en",es:"es",et:"et",eu_ES:"eu-ES",fi:"fi",fr:"fr",fr_CA:"fr-CA",fr_FR:"fr-FR",gl_ES:"gl-ES",he:"he",hi:"hi",hr:"hr",hu:"hu",id:"id",is:"is",it:"it",ja:"ja",ko:"ko",lt:"lt",lv:"lv",nb:"nb",nl:"nl",nn:"nn",no:"no",pl:"pl",pt:"pt",pt_BR:"pt-BR",pt_PT:"pt-PT",ro:"ro",ru:"ru",sk:"sk",sl:"sl",sr:"sr",sv:"sv",th:"th",tr:"tr",uk:"uk",vi:"vi",zh_CN:"zh-CN",zh_TW:"zh-TW"},t.GetPartialsPromptEnum={login:"login",login_id:"login-id",login_password:"login-password",signup:"signup",signup_id:"signup-id",signup_password:"signup-password",customized_consent:"customized-consent"},t.PutCustomTextByLanguagePromptEnum={login:"login",login_id:"login-id",login_password:"login-password",login_passwordless:"login-passwordless",login_email_verification:"login-email-verification",signup:"signup",signup_id:"signup-id",signup_password:"signup-password",phone_identifier_enrollment:"phone-identifier-enrollment",phone_identifier_challenge:"phone-identifier-challenge",reset_password:"reset-password",consent:"consent",logout:"logout",mfa_push:"mfa-push",mfa_otp:"mfa-otp",mfa_voice:"mfa-voice",mfa_phone:"mfa-phone",mfa_webauthn:"mfa-webauthn",mfa_sms:"mfa-sms",mfa_email:"mfa-email",mfa_recovery_code:"mfa-recovery-code",mfa:"mfa",status:"status",device_flow:"device-flow",email_verification:"email-verification",email_otp_challenge:"email-otp-challenge",organizations:"organizations",invitation:"invitation",common:"common",passkeys:"passkeys"},t.PutCustomTextByLanguageLanguageEnum={ar:"ar",bg:"bg",bs:"bs",ca_ES:"ca-ES",cs:"cs",cy:"cy",da:"da",de:"de",el:"el",en:"en",es:"es",et:"et",eu_ES:"eu-ES",fi:"fi",fr:"fr",fr_CA:"fr-CA",fr_FR:"fr-FR",gl_ES:"gl-ES",he:"he",hi:"hi",hr:"hr",hu:"hu",id:"id",is:"is",it:"it",ja:"ja",ko:"ko",lt:"lt",lv:"lv",nb:"nb",nl:"nl",nn:"nn",no:"no",pl:"pl",pt:"pt",pt_BR:"pt-BR",pt_PT:"pt-PT",ro:"ro",ru:"ru",sk:"sk",sl:"sl",sr:"sr",sv:"sv",th:"th",tr:"tr",uk:"uk",vi:"vi",zh_CN:"zh-CN",zh_TW:"zh-TW"},t.PutPartialsPromptEnum={login:"login",login_id:"login-id",login_password:"login-password",signup:"signup",signup_id:"signup-id",signup_password:"signup-password",customized_consent:"customized-consent"},t.DeleteMultifactorByProviderProviderEnum={duo:"duo",google_authenticator:"google-authenticator"},t.DeleteUserIdentityByUserIdProviderEnum={ad:"ad",adfs:"adfs",amazon:"amazon",apple:"apple",dropbox:"dropbox",bitbucket:"bitbucket",aol:"aol",auth0_oidc:"auth0-oidc",auth0:"auth0",baidu:"baidu",bitly:"bitly",box:"box",custom:"custom",daccount:"daccount",dwolla:"dwolla",email:"email",evernote_sandbox:"evernote-sandbox",evernote:"evernote",exact:"exact",facebook:"facebook",fitbit:"fitbit",flickr:"flickr",github:"github",google_apps:"google-apps",google_oauth2:"google-oauth2",instagram:"instagram",ip:"ip",line:"line",linkedin:"linkedin",miicard:"miicard",oauth1:"oauth1",oauth2:"oauth2",office365:"office365",oidc:"oidc",okta:"okta",paypal:"paypal",paypal_sandbox:"paypal-sandbox",pingfederate:"pingfederate",planningcenter:"planningcenter",renren:"renren",salesforce_community:"salesforce-community",salesforce_sandbox:"salesforce-sandbox",salesforce:"salesforce",samlp:"samlp",sharepoint:"sharepoint",shopify:"shopify",sms:"sms",soundcloud:"soundcloud",thecity_sandbox:"thecity-sandbox",thecity:"thecity",thirtysevensignals:"thirtysevensignals",twitter:"twitter",untappd:"untappd",vkontakte:"vkontakte",waad:"waad",weibo:"weibo",windowslive:"windowslive",wordpress:"wordpress",yahoo:"yahoo",yammer:"yammer",yandex:"yandex"},t.GetUsersSearchEngineEnum={v1:"v1",v2:"v2",v3:"v3"}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TokenProviderMiddleware=void 0;const n=r(202);t.TokenProviderMiddleware=class{constructor(e){var t;this.tokenProvider="token"in e?{getAccessToken:()=>Promise.resolve(e.token)}:new n.TokenProvider({...e,audience:null!==(t=e.audience)&&void 0!==t?t:`https://${e.domain}/api/v2/`,clientSecret:e.clientSecret,clientAssertionSigningKey:e.clientAssertionSigningKey})}async pre(e){const t=await this.tokenProvider.getAccessToken();return e.init.headers={...e.init.headers,Authorization:`Bearer ${t}`},{url:e.url,init:e.init}}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TokenProvider=void 0;const n=r(203);t.TokenProvider=class{constructor(e){this.options=e,this.expiresAt=0,this.accessToken="",this.authenticationClient=new n.AuthenticationClient(e)}async getAccessToken(){if(!this.accessToken||Date.now()>this.expiresAt-1e4){this.pending=this.pending||this.authenticationClient.oauth.clientCredentialsGrant({audience:this.options.audience});const{data:{access_token:e,expires_in:t}}=await this.pending.finally((()=>{delete this.pending}));this.expiresAt=Date.now()+1e3*t,this.accessToken=e}return this.accessToken}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.AuthenticationClient=t.AuthApiError=t.IdTokenValidatorError=void 0;const i=r(204),a=r(315),o=r(317);s(r(204),t),s(r(315),t),s(r(317),t);var c=r(316);Object.defineProperty(t,"IdTokenValidatorError",{enumerable:!0,get:function(){return c.IdTokenValidatorError}});var l=r(205);Object.defineProperty(t,"AuthApiError",{enumerable:!0,get:function(){return l.AuthApiError}});t.AuthenticationClient=class{constructor(e){this.database=new i.Database(e),this.oauth=new a.OAuth(e),this.passwordless=new o.Passwordless(e)}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Database=void 0;const n=r(166),s=r(163),i=r(205);class a extends i.BaseAuthAPI{async signUp(e,t){(0,s.validateRequiredRequestParams)(e,["email","password","connection"]);const r=await this.request({path:"/dbconnections/signup",method:"POST",headers:{"Content-Type":"application/json"},body:{client_id:this.clientId,...e}},t);return n.JSONApiResponse.fromResponse(r)}async changePassword(e,t){(0,s.validateRequiredRequestParams)(e,["email","connection"]);const r=await this.request({path:"/dbconnections/change_password",method:"POST",headers:{"Content-Type":"application/json"},body:{client_id:this.clientId,...e}},t);return n.TextApiResponse.fromResponse(r)}}t.Database=a},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.grant=t.BaseAuthAPI=t.AuthApiError=void 0;const n=r(165),s=r(163),i=r(206),a=r(312);class o extends Error{constructor(e,t,r,n,s){super(t||e),this.error=e,this.error_description=t,this.statusCode=r,this.body=n,this.headers=s,this.name="AuthApiError"}}async function c(e){const t=await e.text();try{const r=function(e){const t=JSON.parse(e);let r;return r=t.error?t:{error:t.code,error_description:t.description},r}(t);return new o(r.error,r.error_description,e.status,t,e.headers)}catch(r){return new n.ResponseError(e.status,t,e.headers,"Response returned an error code")}}t.AuthApiError=o;class l extends s.BaseAPI{constructor(e){super({...e,baseUrl:`https://${e.domain}`,middleware:!1!==e.telemetry?[new a.TelemetryMiddleware(e)]:[],parseError:c,retry:{enabled:!1,...e.retry}}),this.domain=e.domain,this.clientId=e.clientId,this.clientSecret=e.clientSecret,this.clientAssertionSigningKey=e.clientAssertionSigningKey,this.clientAssertionSigningAlg=e.clientAssertionSigningAlg,this.useMTLS=e.useMTLS}async addClientAuthentication(e){return(0,i.addClientAuthentication)({payload:e,domain:this.domain,clientId:this.clientId,clientSecret:this.clientSecret,clientAssertionSigningKey:this.clientAssertionSigningKey,clientAssertionSigningAlg:this.clientAssertionSigningAlg,useMTLS:this.useMTLS})}}t.BaseAuthAPI=l,t.grant=async function(e,t,{idTokenValidateOptions:r,initOverrides:n}={},i,a,o){const c=await o({path:"/oauth/token",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:i,...t,grant_type:e})},n),l=await s.JSONApiResponse.fromResponse(c);return l.data.id_token&&await a.validate(l.data.id_token,r),l}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.addClientAuthentication=void 0;const a=i(r(207)),o=r(296);t.addClientAuthentication=async({payload:e,domain:t,clientId:r,clientAssertionSigningKey:n,clientAssertionSigningAlg:s,clientSecret:i,useMTLS:c})=>{const l=e.client_id||r;if(n&&!e.client_assertion){const r=s||"RS256",i=await a.importPKCS8(n,r);e.client_assertion=await new a.SignJWT({}).setProtectedHeader({alg:r}).setIssuedAt().setSubject(l).setJti((0,o.v4)()).setIssuer(l).setAudience(`https://${t}/`).setExpirationTime("2mins").sign(i),e.client_assertion_type="urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}else i&&!e.client_secret&&(e.client_secret=i);if(!(e.client_secret&&0!==e.client_secret.trim().length||e.client_assertion&&0!==e.client_assertion.trim().length||c))throw new Error("The client_secret or client_assertion field is required, or it should be mTLS request.");return e}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.cryptoRuntime=t.base64url=t.generateSecret=t.generateKeyPair=t.errors=t.decodeJwt=t.decodeProtectedHeader=t.importJWK=t.importX509=t.importPKCS8=t.importSPKI=t.exportJWK=t.exportSPKI=t.exportPKCS8=t.UnsecuredJWT=t.createRemoteJWKSet=t.createLocalJWKSet=t.EmbeddedJWK=t.calculateJwkThumbprintUri=t.calculateJwkThumbprint=t.EncryptJWT=t.SignJWT=t.GeneralSign=t.FlattenedSign=t.CompactSign=t.FlattenedEncrypt=t.CompactEncrypt=t.jwtDecrypt=t.jwtVerify=t.generalVerify=t.flattenedVerify=t.compactVerify=t.GeneralEncrypt=t.generalDecrypt=t.flattenedDecrypt=t.compactDecrypt=void 0;var n=r(208);Object.defineProperty(t,"compactDecrypt",{enumerable:!0,get:function(){return n.compactDecrypt}});var s=r(209);Object.defineProperty(t,"flattenedDecrypt",{enumerable:!0,get:function(){return s.flattenedDecrypt}});var i=r(251);Object.defineProperty(t,"generalDecrypt",{enumerable:!0,get:function(){return i.generalDecrypt}});var a=r(252);Object.defineProperty(t,"GeneralEncrypt",{enumerable:!0,get:function(){return a.GeneralEncrypt}});var o=r(258);Object.defineProperty(t,"compactVerify",{enumerable:!0,get:function(){return o.compactVerify}});var c=r(259);Object.defineProperty(t,"flattenedVerify",{enumerable:!0,get:function(){return c.flattenedVerify}});var l=r(266);Object.defineProperty(t,"generalVerify",{enumerable:!0,get:function(){return l.generalVerify}});var u=r(267);Object.defineProperty(t,"jwtVerify",{enumerable:!0,get:function(){return u.jwtVerify}});var d=r(271);Object.defineProperty(t,"jwtDecrypt",{enumerable:!0,get:function(){return d.jwtDecrypt}});var p=r(272);Object.defineProperty(t,"CompactEncrypt",{enumerable:!0,get:function(){return p.CompactEncrypt}});var h=r(253);Object.defineProperty(t,"FlattenedEncrypt",{enumerable:!0,get:function(){return h.FlattenedEncrypt}});var f=r(273);Object.defineProperty(t,"CompactSign",{enumerable:!0,get:function(){return f.CompactSign}});var m=r(274);Object.defineProperty(t,"FlattenedSign",{enumerable:!0,get:function(){return m.FlattenedSign}});var g=r(275);Object.defineProperty(t,"GeneralSign",{enumerable:!0,get:function(){return g.GeneralSign}});var y=r(276);Object.defineProperty(t,"SignJWT",{enumerable:!0,get:function(){return y.SignJWT}});var _=r(278);Object.defineProperty(t,"EncryptJWT",{enumerable:!0,get:function(){return _.EncryptJWT}});var v=r(279);Object.defineProperty(t,"calculateJwkThumbprint",{enumerable:!0,get:function(){return v.calculateJwkThumbprint}}),Object.defineProperty(t,"calculateJwkThumbprintUri",{enumerable:!0,get:function(){return v.calculateJwkThumbprintUri}});var b=r(280);Object.defineProperty(t,"EmbeddedJWK",{enumerable:!0,get:function(){return b.EmbeddedJWK}});var w=r(281);Object.defineProperty(t,"createLocalJWKSet",{enumerable:!0,get:function(){return w.createLocalJWKSet}});var E=r(282);Object.defineProperty(t,"createRemoteJWKSet",{enumerable:!0,get:function(){return E.createRemoteJWKSet}});var R=r(287);Object.defineProperty(t,"UnsecuredJWT",{enumerable:!0,get:function(){return R.UnsecuredJWT}});var S=r(255);Object.defineProperty(t,"exportPKCS8",{enumerable:!0,get:function(){return S.exportPKCS8}}),Object.defineProperty(t,"exportSPKI",{enumerable:!0,get:function(){return S.exportSPKI}}),Object.defineProperty(t,"exportJWK",{enumerable:!0,get:function(){return S.exportJWK}});var A=r(241);Object.defineProperty(t,"importSPKI",{enumerable:!0,get:function(){return A.importSPKI}}),Object.defineProperty(t,"importPKCS8",{enumerable:!0,get:function(){return A.importPKCS8}}),Object.defineProperty(t,"importX509",{enumerable:!0,get:function(){return A.importX509}}),Object.defineProperty(t,"importJWK",{enumerable:!0,get:function(){return A.importJWK}});var O=r(288);Object.defineProperty(t,"decodeProtectedHeader",{enumerable:!0,get:function(){return O.decodeProtectedHeader}});var P=r(290);Object.defineProperty(t,"decodeJwt",{enumerable:!0,get:function(){return P.decodeJwt}}),t.errors=r(216);var T=r(291);Object.defineProperty(t,"generateKeyPair",{enumerable:!0,get:function(){return T.generateKeyPair}});var C=r(293);Object.defineProperty(t,"generateSecret",{enumerable:!0,get:function(){return C.generateSecret}}),t.base64url=r(289);var I=r(294);Object.defineProperty(t,"cryptoRuntime",{enumerable:!0,get:function(){return I.default}})},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.compactDecrypt=void 0;const n=r(209),s=r(216),i=r(212);t.compactDecrypt=async function(e,t,r){if(e instanceof Uint8Array&&(e=i.decoder.decode(e)),"string"!=typeof e)throw new s.JWEInvalid("Compact JWE must be a string or Uint8Array");const{0:a,1:o,2:c,3:l,4:u,length:d}=e.split(".");if(5!==d)throw new s.JWEInvalid("Invalid Compact JWE");const p=await(0,n.flattenedDecrypt)({ciphertext:l,iv:c||void 0,protected:a||void 0,tag:u||void 0,encrypted_key:o||void 0},t,r),h={plaintext:p.plaintext,protectedHeader:p.protectedHeader};return"function"==typeof t?{...h,key:p.key}:h}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.flattenedDecrypt=void 0;const n=r(210),s=r(214),i=r(228),a=r(216),o=r(230),c=r(231),l=r(232),u=r(212),d=r(240),p=r(249),h=r(250);t.flattenedDecrypt=async function(e,t,r){var f;if(!(0,c.default)(e))throw new a.JWEInvalid("Flattened JWE must be an object");if(void 0===e.protected&&void 0===e.header&&void 0===e.unprotected)throw new a.JWEInvalid("JOSE Header missing");if("string"!=typeof e.iv)throw new a.JWEInvalid("JWE Initialization Vector missing or incorrect type");if("string"!=typeof e.ciphertext)throw new a.JWEInvalid("JWE Ciphertext missing or incorrect type");if("string"!=typeof e.tag)throw new a.JWEInvalid("JWE Authentication Tag missing or incorrect type");if(void 0!==e.protected&&"string"!=typeof e.protected)throw new a.JWEInvalid("JWE Protected Header incorrect type");if(void 0!==e.encrypted_key&&"string"!=typeof e.encrypted_key)throw new a.JWEInvalid("JWE Encrypted Key incorrect type");if(void 0!==e.aad&&"string"!=typeof e.aad)throw new a.JWEInvalid("JWE AAD incorrect type");if(void 0!==e.header&&!(0,c.default)(e.header))throw new a.JWEInvalid("JWE Shared Unprotected Header incorrect type");if(void 0!==e.unprotected&&!(0,c.default)(e.unprotected))throw new a.JWEInvalid("JWE Per-Recipient Unprotected Header incorrect type");let m;if(e.protected)try{const t=(0,n.decode)(e.protected);m=JSON.parse(u.decoder.decode(t))}catch{throw new a.JWEInvalid("JWE Protected Header is invalid")}if(!(0,o.default)(m,e.header,e.unprotected))throw new a.JWEInvalid("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");const g={...m,...e.header,...e.unprotected};if((0,p.default)(a.JWEInvalid,new Map,null==r?void 0:r.crit,m,g),void 0!==g.zip){if(!m||!m.zip)throw new a.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if("DEF"!==g.zip)throw new a.JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}const{alg:y,enc:_}=g;if("string"!=typeof y||!y)throw new a.JWEInvalid("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof _||!_)throw new a.JWEInvalid("missing JWE Encryption Algorithm (enc) in JWE Header");const v=r&&(0,h.default)("keyManagementAlgorithms",r.keyManagementAlgorithms),b=r&&(0,h.default)("contentEncryptionAlgorithms",r.contentEncryptionAlgorithms);if(v&&!v.has(y))throw new a.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');if(b&&!b.has(_))throw new a.JOSEAlgNotAllowed('"enc" (Encryption Algorithm) Header Parameter not allowed');let w;if(void 0!==e.encrypted_key)try{w=(0,n.decode)(e.encrypted_key)}catch{throw new a.JWEInvalid("Failed to base64url decode the encrypted_key")}let E,R,S,A=!1;"function"==typeof t&&(t=await t(m,e),A=!0);try{E=await(0,l.default)(y,t,w,g,r)}catch(e){if(e instanceof TypeError||e instanceof a.JWEInvalid||e instanceof a.JOSENotSupported)throw e;E=(0,d.default)(_)}try{R=(0,n.decode)(e.iv)}catch{throw new a.JWEInvalid("Failed to base64url decode the iv")}try{S=(0,n.decode)(e.tag)}catch{throw new a.JWEInvalid("Failed to base64url decode the tag")}const O=u.encoder.encode(null!==(f=e.protected)&&void 0!==f?f:"");let P,T;P=void 0!==e.aad?(0,u.concat)(O,u.encoder.encode("."),u.encoder.encode(e.aad)):O;try{T=(0,n.decode)(e.ciphertext)}catch{throw new a.JWEInvalid("Failed to base64url decode the ciphertext")}let C=await(0,s.default)(_,E,T,R,S,P);"DEF"===g.zip&&(C=await((null==r?void 0:r.inflateRaw)||i.inflate)(C));const I={plaintext:C};if(void 0!==e.protected&&(I.protectedHeader=m),void 0!==e.aad)try{I.additionalAuthenticatedData=(0,n.decode)(e.aad)}catch{throw new a.JWEInvalid("Failed to base64url decode the aad")}return void 0!==e.unprotected&&(I.sharedUnprotectedHeader=e.unprotected),void 0!==e.header&&(I.unprotectedHeader=e.header),A?{...I,key:t}:I}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=t.encodeBase64=t.decodeBase64=void 0;const n=r(211),s=r(212);let i;n.Buffer.isEncoding("base64url")?t.encode=i=e=>n.Buffer.from(e).toString("base64url"):t.encode=i=e=>n.Buffer.from(e).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");t.decodeBase64=e=>n.Buffer.from(e,"base64");t.encodeBase64=e=>n.Buffer.from(e).toString("base64");t.decode=e=>n.Buffer.from(function(e){let t=e;return t instanceof Uint8Array&&(t=s.decoder.decode(t)),t}(e),"base64")},e=>{e.exports=require("buffer")},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concatKdf=t.lengthAndInput=t.uint32be=t.uint64be=t.p2s=t.concat=t.decoder=t.encoder=void 0;const n=r(213);t.encoder=new TextEncoder,t.decoder=new TextDecoder;const s=2**32;function i(...e){const t=e.reduce(((e,{length:t})=>e+t),0),r=new Uint8Array(t);let n=0;return e.forEach((e=>{r.set(e,n),n+=e.length})),r}function a(e,t,r){if(t<0||t>=s)throw new RangeError(`value must be >= 0 and <= ${s-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,255&t],r)}function o(e){const t=new Uint8Array(4);return a(t,e),t}t.concat=i,t.p2s=function(e,r){return i(t.encoder.encode(e),new Uint8Array([0]),r)},t.uint64be=function(e){const t=Math.floor(e/s),r=e%s,n=new Uint8Array(8);return a(n,t,0),a(n,r,4),n},t.uint32be=o,t.lengthAndInput=function(e){return i(o(e.length),e)},t.concatKdf=async function(e,t,r){const s=Math.ceil((t>>3)/32),i=new Uint8Array(32*s);for(let t=0;t>3)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100);t.default=(e,t)=>(0,n.createHash)(e).update(t).digest()},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(215),i=r(219),a=r(212),o=r(216),c=r(221),l=r(222),u=r(223),d=r(224),p=r(220),h=r(225),f=r(226),m=r(227);t.default=(e,t,r,g,y,_)=>{let v;if((0,u.isCryptoKey)(t))(0,d.checkEncCryptoKey)(t,e,"decrypt"),v=n.KeyObject.from(t);else{if(!(t instanceof Uint8Array||(0,p.default)(t)))throw new TypeError((0,h.default)(t,...m.types,"Uint8Array"));v=t}switch((0,i.default)(e,v),(0,s.default)(e,g),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return function(e,t,r,s,i,u){const d=parseInt(e.slice(1,4),10);(0,p.default)(t)&&(t=t.export());const h=t.subarray(d>>3),m=t.subarray(0,d>>3),g=parseInt(e.slice(-3),10),y=`aes-${d}-cbc`;if(!(0,f.default)(y))throw new o.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);const _=(0,l.default)(u,s,r,g,m,d);let v,b;try{v=(0,c.default)(i,_)}catch{}if(!v)throw new o.JWEDecryptionFailed;try{const e=(0,n.createDecipheriv)(y,h,s);b=(0,a.concat)(e.update(r),e.final())}catch{}if(!b)throw new o.JWEDecryptionFailed;return b}(e,v,r,g,y,_);case"A128GCM":case"A192GCM":case"A256GCM":return function(e,t,r,s,i,a){const c=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!(0,f.default)(c))throw new o.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);try{const e=(0,n.createDecipheriv)(c,t,s,{authTagLength:16});e.setAuthTag(i),a.byteLength&&e.setAAD(a,{plaintextLength:r.length});const o=e.update(r);return e.final(),o}catch{throw new o.JWEDecryptionFailed}}(e,v,r,g,y,_);default:throw new o.JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(216),s=r(217);t.default=(e,t)=>{if(t.length<<3!==(0,s.bitLength)(e))throw new n.JWEInvalid("Invalid Initialization Vector length")}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JWSSignatureVerificationFailed=t.JWKSTimeout=t.JWKSMultipleMatchingKeys=t.JWKSNoMatchingKey=t.JWKSInvalid=t.JWKInvalid=t.JWTInvalid=t.JWSInvalid=t.JWEInvalid=t.JWEDecompressionFailed=t.JWEDecryptionFailed=t.JOSENotSupported=t.JOSEAlgNotAllowed=t.JWTExpired=t.JWTClaimValidationFailed=t.JOSEError=void 0;class r extends Error{static get code(){return"ERR_JOSE_GENERIC"}constructor(e){var t;super(e),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,this.constructor)}}t.JOSEError=r;t.JWTClaimValidationFailed=class extends r{static get code(){return"ERR_JWT_CLAIM_VALIDATION_FAILED"}constructor(e,t="unspecified",r="unspecified"){super(e),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=t,this.reason=r}};t.JWTExpired=class extends r{static get code(){return"ERR_JWT_EXPIRED"}constructor(e,t="unspecified",r="unspecified"){super(e),this.code="ERR_JWT_EXPIRED",this.claim=t,this.reason=r}};t.JOSEAlgNotAllowed=class extends r{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}static get code(){return"ERR_JOSE_ALG_NOT_ALLOWED"}};t.JOSENotSupported=class extends r{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}static get code(){return"ERR_JOSE_NOT_SUPPORTED"}};t.JWEDecryptionFailed=class extends r{constructor(){super(...arguments),this.code="ERR_JWE_DECRYPTION_FAILED",this.message="decryption operation failed"}static get code(){return"ERR_JWE_DECRYPTION_FAILED"}};t.JWEDecompressionFailed=class extends r{constructor(){super(...arguments),this.code="ERR_JWE_DECOMPRESSION_FAILED",this.message="decompression operation failed"}static get code(){return"ERR_JWE_DECOMPRESSION_FAILED"}};t.JWEInvalid=class extends r{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}static get code(){return"ERR_JWE_INVALID"}};t.JWSInvalid=class extends r{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}static get code(){return"ERR_JWS_INVALID"}};t.JWTInvalid=class extends r{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}static get code(){return"ERR_JWT_INVALID"}};t.JWKInvalid=class extends r{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}static get code(){return"ERR_JWK_INVALID"}};t.JWKSInvalid=class extends r{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}static get code(){return"ERR_JWKS_INVALID"}};t.JWKSNoMatchingKey=class extends r{constructor(){super(...arguments),this.code="ERR_JWKS_NO_MATCHING_KEY",this.message="no applicable key found in the JSON Web Key Set"}static get code(){return"ERR_JWKS_NO_MATCHING_KEY"}};t.JWKSMultipleMatchingKeys=class extends r{constructor(){super(...arguments),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS",this.message="multiple matching keys found in the JSON Web Key Set"}static get code(){return"ERR_JWKS_MULTIPLE_MATCHING_KEYS"}},Symbol.asyncIterator;t.JWKSTimeout=class extends r{constructor(){super(...arguments),this.code="ERR_JWKS_TIMEOUT",this.message="request timed out"}static get code(){return"ERR_JWKS_TIMEOUT"}};t.JWSSignatureVerificationFailed=class extends r{constructor(){super(...arguments),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED",this.message="signature verification failed"}static get code(){return"ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bitLength=void 0;const n=r(216),s=r(218);function i(e){switch(e){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new n.JOSENotSupported(`Unsupported JWE Algorithm: ${e}`)}}t.bitLength=i,t.default=e=>(0,s.default)(new Uint8Array(i(e)>>3))},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=r(100);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n.randomFillSync}})},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(216),s=r(220);t.default=(e,t)=>{let r;switch(e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":r=parseInt(e.slice(-3),10);break;case"A128GCM":case"A192GCM":case"A256GCM":r=parseInt(e.slice(1,4),10);break;default:throw new n.JOSENotSupported(`Content Encryption Algorithm ${e} is not supported either by JOSE or your javascript runtime`)}if(t instanceof Uint8Array){const e=t.byteLength<<3;if(e!==r)throw new n.JWEInvalid(`Invalid Content Encryption Key length. Expected ${r} bits, got ${e} bits`)}else{if(!(0,s.default)(t)||"secret"!==t.type)throw new TypeError("Invalid Content Encryption Key type");{const e=t.symmetricKeySize<<3;if(e!==r)throw new n.JWEInvalid(`Invalid Content Encryption Key length. Expected ${r} bits, got ${e} bits`)}}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(101);t.default=s.types.isKeyObject?e=>s.types.isKeyObject(e):e=>null!=e&&e instanceof n.KeyObject},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100).timingSafeEqual;t.default=n},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(212);t.default=function(e,t,r,i,a,o){const c=(0,s.concat)(e,t,r,(0,s.uint64be)(e.length<<3)),l=(0,n.createHmac)(`sha${i}`,a);return l.update(c),l.digest().slice(0,o>>3)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isCryptoKey=void 0;const n=r(100),s=r(101),i=n.webcrypto;t.default=i,t.isCryptoKey=s.types.isCryptoKey?e=>s.types.isCryptoKey(e):e=>!1},(e,t)=>{function r(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function n(e,t){return e.name===t}function s(e){return parseInt(e.name.slice(4),10)}function i(e,t){if(t.length&&!t.some((t=>e.usages.includes(t)))){let e="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const r=t.pop();e+=`one of ${t.join(", ")}, or ${r}.`}else 2===t.length?e+=`one of ${t[0]} or ${t[1]}.`:e+=`${t[0]}.`;throw new TypeError(e)}}Object.defineProperty(t,"__esModule",{value:!0}),t.checkEncCryptoKey=t.checkSigCryptoKey=void 0,t.checkSigCryptoKey=function(e,t,...a){switch(t){case"HS256":case"HS384":case"HS512":{if(!n(e.algorithm,"HMAC"))throw r("HMAC");const i=parseInt(t.slice(2),10);if(s(e.algorithm.hash)!==i)throw r(`SHA-${i}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!n(e.algorithm,"RSASSA-PKCS1-v1_5"))throw r("RSASSA-PKCS1-v1_5");const i=parseInt(t.slice(2),10);if(s(e.algorithm.hash)!==i)throw r(`SHA-${i}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!n(e.algorithm,"RSA-PSS"))throw r("RSA-PSS");const i=parseInt(t.slice(2),10);if(s(e.algorithm.hash)!==i)throw r(`SHA-${i}`,"algorithm.hash");break}case"EdDSA":if("Ed25519"!==e.algorithm.name&&"Ed448"!==e.algorithm.name)throw r("Ed25519 or Ed448");break;case"ES256":case"ES384":case"ES512":{if(!n(e.algorithm,"ECDSA"))throw r("ECDSA");const s=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}(t);if(e.algorithm.namedCurve!==s)throw r(s,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}i(e,a)},t.checkEncCryptoKey=function(e,t,...a){switch(t){case"A128GCM":case"A192GCM":case"A256GCM":{if(!n(e.algorithm,"AES-GCM"))throw r("AES-GCM");const s=parseInt(t.slice(1,4),10);if(e.algorithm.length!==s)throw r(s,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!n(e.algorithm,"AES-KW"))throw r("AES-KW");const s=parseInt(t.slice(1,4),10);if(e.algorithm.length!==s)throw r(s,"algorithm.length");break}case"ECDH":switch(e.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw r("ECDH, X25519, or X448")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!n(e.algorithm,"PBKDF2"))throw r("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!n(e.algorithm,"RSA-OAEP"))throw r("RSA-OAEP");const i=parseInt(t.slice(9),10)||1;if(s(e.algorithm.hash)!==i)throw r(`SHA-${i}`,"algorithm.hash");break}default:throw new TypeError("CryptoKey does not support this operation")}i(e,a)}},(e,t)=>{function r(e,t,...r){if(r.length>2){const t=r.pop();e+=`one of type ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor&&t.constructor.name&&(e+=` Received an instance of ${t.constructor.name}`),e}Object.defineProperty(t,"__esModule",{value:!0}),t.withAlg=void 0,t.default=(e,...t)=>r("Key must be ",e,...t),t.withAlg=function(e,t,...n){return r(`Key for the ${e} algorithm must be `,t,...n)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100);let s;t.default=e=>(s||(s=new Set((0,n.getCiphers)())),s.has(e))},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.types=void 0;const n=r(223),s=r(220);t.default=e=>(0,s.default)(e)||(0,n.isCryptoKey)(e);const i=["KeyObject"];t.types=i,(globalThis.CryptoKey||(null===n.default||void 0===n.default?void 0:n.default.CryptoKey))&&i.push("CryptoKey")},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.deflate=t.inflate=void 0;const n=r(101),s=r(229),i=r(216),a=(0,n.promisify)(s.inflateRaw),o=(0,n.promisify)(s.deflateRaw);t.inflate=e=>a(e,{maxOutputLength:25e4}).catch((()=>{throw new i.JWEDecompressionFailed}));t.deflate=e=>o(e)},e=>{e.exports=require("zlib")},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=(...e)=>{const t=e.filter(Boolean);if(0===t.length||1===t.length)return!0;let r;for(const e of t){const t=Object.keys(e);if(r&&0!==r.size)for(const e of t){if(r.has(e))return!1;r.add(e)}else r=new Set(t)}return!0}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if("object"!=typeof(t=e)||null===t||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t;if(null===Object.getPrototypeOf(e))return!0;let r=e;for(;null!==Object.getPrototypeOf(r);)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(233),s=r(234),i=r(236),a=r(238),o=r(210),c=r(216),l=r(240),u=r(241),d=r(246),p=r(231),h=r(247);t.default=async function(e,t,r,f,m){switch((0,d.default)(e,t,"decrypt"),e){case"dir":if(void 0!==r)throw new c.JWEInvalid("Encountered unexpected JWE Encrypted Key");return t;case"ECDH-ES":if(void 0!==r)throw new c.JWEInvalid("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!(0,p.default)(f.epk))throw new c.JWEInvalid('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!s.ecdhAllowed(t))throw new c.JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");const i=await(0,u.importJWK)(f.epk,e);let a,d;if(void 0!==f.apu){if("string"!=typeof f.apu)throw new c.JWEInvalid('JOSE Header "apu" (Agreement PartyUInfo) invalid');try{a=(0,o.decode)(f.apu)}catch{throw new c.JWEInvalid("Failed to base64url decode the apu")}}if(void 0!==f.apv){if("string"!=typeof f.apv)throw new c.JWEInvalid('JOSE Header "apv" (Agreement PartyVInfo) invalid');try{d=(0,o.decode)(f.apv)}catch{throw new c.JWEInvalid("Failed to base64url decode the apv")}}const h=await s.deriveKey(i,t,"ECDH-ES"===e?f.enc:e,"ECDH-ES"===e?(0,l.bitLength)(f.enc):parseInt(e.slice(-5,-2),10),a,d);if("ECDH-ES"===e)return h;if(void 0===r)throw new c.JWEInvalid("JWE Encrypted Key missing");return(0,n.unwrap)(e.slice(-6),h,r)}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if(void 0===r)throw new c.JWEInvalid("JWE Encrypted Key missing");return(0,a.decrypt)(e,t,r);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{if(void 0===r)throw new c.JWEInvalid("JWE Encrypted Key missing");if("number"!=typeof f.p2c)throw new c.JWEInvalid('JOSE Header "p2c" (PBES2 Count) missing or invalid');const n=(null==m?void 0:m.maxPBES2Count)||1e4;if(f.p2c>n)throw new c.JWEInvalid('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof f.p2s)throw new c.JWEInvalid('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let s;try{s=(0,o.decode)(f.p2s)}catch{throw new c.JWEInvalid("Failed to base64url decode the p2s")}return(0,i.decrypt)(e,t,r,f.p2c,s)}case"A128KW":case"A192KW":case"A256KW":if(void 0===r)throw new c.JWEInvalid("JWE Encrypted Key missing");return(0,n.unwrap)(e,t,r);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{if(void 0===r)throw new c.JWEInvalid("JWE Encrypted Key missing");if("string"!=typeof f.iv)throw new c.JWEInvalid('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof f.tag)throw new c.JWEInvalid('JOSE Header "tag" (Authentication Tag) missing or invalid');let n,s;try{n=(0,o.decode)(f.iv)}catch{throw new c.JWEInvalid("Failed to base64url decode the iv")}try{s=(0,o.decode)(f.tag)}catch{throw new c.JWEInvalid("Failed to base64url decode the tag")}return(0,h.unwrap)(e,t,r,n,s)}default:throw new c.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.unwrap=t.wrap=void 0;const n=r(211),s=r(100),i=r(216),a=r(212),o=r(223),c=r(224),l=r(220),u=r(225),d=r(226),p=r(227);function h(e,t){if(e.symmetricKeySize<<3!==parseInt(t.slice(1,4),10))throw new TypeError(`Invalid key size for alg: ${t}`)}function f(e,t,r){if((0,l.default)(e))return e;if(e instanceof Uint8Array)return(0,s.createSecretKey)(e);if((0,o.isCryptoKey)(e))return(0,c.checkEncCryptoKey)(e,t,r),s.KeyObject.from(e);throw new TypeError((0,u.default)(e,...p.types,"Uint8Array"))}t.wrap=(e,t,r)=>{const o=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!(0,d.default)(o))throw new i.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`);const c=f(t,e,"wrapKey");h(c,e);const l=(0,s.createCipheriv)(o,c,n.Buffer.alloc(8,166));return(0,a.concat)(l.update(r),l.final())};t.unwrap=(e,t,r)=>{const o=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!(0,d.default)(o))throw new i.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`);const c=f(t,e,"unwrapKey");h(c,e);const l=(0,s.createDecipheriv)(o,c,n.Buffer.alloc(8,166));return(0,a.concat)(l.update(r),l.final())}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ecdhAllowed=t.generateEpk=t.deriveKey=void 0;const n=r(100),s=r(101),i=r(235),a=r(212),o=r(216),c=r(223),l=r(224),u=r(220),d=r(225),p=r(227),h=(0,s.promisify)(n.generateKeyPair);t.deriveKey=async function(e,t,r,s,i=new Uint8Array(0),o=new Uint8Array(0)){let h,f;if((0,c.isCryptoKey)(e))(0,l.checkEncCryptoKey)(e,"ECDH"),h=n.KeyObject.from(e);else{if(!(0,u.default)(e))throw new TypeError((0,d.default)(e,...p.types));h=e}if((0,c.isCryptoKey)(t))(0,l.checkEncCryptoKey)(t,"ECDH","deriveBits"),f=n.KeyObject.from(t);else{if(!(0,u.default)(t))throw new TypeError((0,d.default)(t,...p.types));f=t}const m=(0,a.concat)((0,a.lengthAndInput)(a.encoder.encode(r)),(0,a.lengthAndInput)(i),(0,a.lengthAndInput)(o),(0,a.uint32be)(s)),g=(0,n.diffieHellman)({privateKey:f,publicKey:h});return(0,a.concatKdf)(g,s,m)},t.generateEpk=async function(e){let t;if((0,c.isCryptoKey)(e))t=n.KeyObject.from(e);else{if(!(0,u.default)(e))throw new TypeError((0,d.default)(e,...p.types));t=e}switch(t.asymmetricKeyType){case"x25519":return h("x25519");case"x448":return h("x448");case"ec":{const e=(0,i.default)(t);return h("ec",{namedCurve:e})}default:throw new o.JOSENotSupported("Invalid or unsupported EPK")}};t.ecdhAllowed=e=>["P-256","P-384","P-521","X25519","X448"].includes((0,i.default)(e))},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setCurve=t.weakMap=void 0;const n=r(211),s=r(100),i=r(216),a=r(223),o=r(220),c=r(225),l=r(227),u=n.Buffer.from([42,134,72,206,61,3,1,7]),d=n.Buffer.from([43,129,4,0,34]),p=n.Buffer.from([43,129,4,0,35]),h=n.Buffer.from([43,129,4,0,10]);t.weakMap=new WeakMap;const f=(e,r)=>{var n;let m;if((0,a.isCryptoKey)(e))m=s.KeyObject.from(e);else{if(!(0,o.default)(e))throw new TypeError((0,c.default)(e,...l.types));m=e}if("secret"===m.type)throw new TypeError('only "private" or "public" type keys can be used for this operation');switch(m.asymmetricKeyType){case"ed25519":case"ed448":return`Ed${m.asymmetricKeyType.slice(2)}`;case"x25519":case"x448":return`X${m.asymmetricKeyType.slice(1)}`;case"ec":{if(t.weakMap.has(m))return t.weakMap.get(m);let e=null===(n=m.asymmetricKeyDetails)||void 0===n?void 0:n.namedCurve;if(e||"private"!==m.type){if(!e){const t=m.export({format:"der",type:"spki"}),r=t[1]<128?14:15,n=t[r],s=t.slice(r+1,r+1+n);if(s.equals(u))e="prime256v1";else if(s.equals(d))e="secp384r1";else if(s.equals(p))e="secp521r1";else{if(!s.equals(h))throw new i.JOSENotSupported("Unsupported key curve for this operation");e="secp256k1"}}}else e=f((0,s.createPublicKey)(m),!0);if(r)return e;const a=(e=>{switch(e){case"prime256v1":return"P-256";case"secp384r1":return"P-384";case"secp521r1":return"P-521";case"secp256k1":return"secp256k1";default:throw new i.JOSENotSupported("Unsupported key curve for this operation")}})(e);return t.weakMap.set(m,a),a}default:throw new TypeError("Invalid asymmetric key type for this operation")}};t.setCurve=function(e,r){t.weakMap.set(e,r)},t.default=f},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=void 0;const n=r(101),s=r(100),i=r(218),a=r(212),o=r(210),c=r(233),l=r(237),u=r(223),d=r(224),p=r(220),h=r(225),f=r(227),m=(0,n.promisify)(s.pbkdf2);function g(e,t){if((0,p.default)(e))return e.export();if(e instanceof Uint8Array)return e;if((0,u.isCryptoKey)(e))return(0,d.checkEncCryptoKey)(e,t,"deriveBits","deriveKey"),s.KeyObject.from(e).export();throw new TypeError((0,h.default)(e,...f.types,"Uint8Array"))}t.encrypt=async(e,t,r,n=2048,s=(0,i.default)(new Uint8Array(16)))=>{(0,l.default)(s);const u=(0,a.p2s)(e,s),d=parseInt(e.slice(13,16),10)>>3,p=g(t,e),h=await m(p,u,n,d,`sha${e.slice(8,11)}`);return{encryptedKey:await(0,c.wrap)(e.slice(-6),h,r),p2c:n,p2s:(0,o.encode)(s)}};t.decrypt=async(e,t,r,n,s)=>{(0,l.default)(s);const i=(0,a.p2s)(e,s),o=parseInt(e.slice(13,16),10)>>3,u=g(t,e),d=await m(u,i,n,o,`sha${e.slice(8,11)}`);return(0,c.unwrap)(e.slice(-6),d,r)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(216);t.default=function(e){if(!(e instanceof Uint8Array)||e.length<8)throw new n.JWEInvalid("PBES2 Salt Input must be 8 or more octets")}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=void 0;const n=r(100),s=r(239),i=r(223),a=r(224),o=r(220),c=r(225),l=r(227),u=(e,t)=>{if("rsa"!==e.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");(0,s.default)(e,t)},d=e=>{switch(e){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return n.constants.RSA_PKCS1_OAEP_PADDING;case"RSA1_5":return n.constants.RSA_PKCS1_PADDING;default:return}},p=e=>{switch(e){case"RSA-OAEP":return"sha1";case"RSA-OAEP-256":return"sha256";case"RSA-OAEP-384":return"sha384";case"RSA-OAEP-512":return"sha512";default:return}};function h(e,t,...r){if((0,o.default)(e))return e;if((0,i.isCryptoKey)(e))return(0,a.checkEncCryptoKey)(e,t,...r),n.KeyObject.from(e);throw new TypeError((0,c.default)(e,...l.types))}t.encrypt=(e,t,r)=>{const s=d(e),i=p(e),a=h(t,e,"wrapKey","encrypt");return u(a,e),(0,n.publicEncrypt)({key:a,oaepHash:i,padding:s},r)};t.decrypt=(e,t,r)=>{const s=d(e),i=p(e),a=h(t,e,"unwrapKey","decrypt");return u(a,e),(0,n.privateDecrypt)({key:a,oaepHash:i,padding:s},r)}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setModulusLength=t.weakMap=void 0,t.weakMap=new WeakMap;const r=(e,t)=>{let n=e.readUInt8(1);if(0==(128&n))return 0===t?n:r(e.subarray(2+n),t-1);const s=127&n;n=0;for(let t=0;t{var n,s;if(t.weakMap.has(e))return t.weakMap.get(e);const i=null!==(s=null===(n=e.asymmetricKeyDetails)||void 0===n?void 0:n.modulusLength)&&void 0!==s?s:((e,t)=>{const n=e.readUInt8(1);if(0==(128&n))return r(e.subarray(2),t);const s=127&n;return r(e.subarray(2+s),t)})(e.export({format:"der",type:"pkcs1"}),"private"===e.type?1:0)-1<<3;return t.weakMap.set(e,i),i};t.setModulusLength=(e,r)=>{t.weakMap.set(e,r)},t.default=(e,t)=>{if(n(e)<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bitLength=void 0;const n=r(216),s=r(218);function i(e){switch(e){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new n.JOSENotSupported(`Unsupported JWE Algorithm: ${e}`)}}t.bitLength=i,t.default=e=>(0,s.default)(new Uint8Array(i(e)>>3))},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.importJWK=t.importPKCS8=t.importX509=t.importSPKI=void 0;const n=r(210),s=r(242),i=r(243),a=r(216),o=r(231);t.importSPKI=async function(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PUBLIC KEY-----"))throw new TypeError('"spki" must be SPKI formatted string');return(0,s.fromSPKI)(e,t,r)},t.importX509=async function(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN CERTIFICATE-----"))throw new TypeError('"x509" must be X.509 formatted string');return(0,s.fromX509)(e,t,r)},t.importPKCS8=async function(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return(0,s.fromPKCS8)(e,t,r)},t.importJWK=async function(e,t,r){var s;if(!(0,o.default)(e))throw new TypeError("JWK must be an object");switch(t||(t=e.alg),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return null!=r||(r=!0!==e.ext),r?(0,i.default)({...e,alg:t,ext:null!==(s=e.ext)&&void 0!==s&&s}):(0,n.decode)(e.k);case"RSA":if(void 0!==e.oth)throw new a.JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return(0,i.default)({...e,alg:t});default:throw new a.JOSENotSupported('Unsupported "kty" (Key Type) Parameter value')}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fromX509=t.fromSPKI=t.fromPKCS8=t.toPKCS8=t.toSPKI=void 0;const n=r(100),s=r(211),i=r(223),a=r(220),o=r(225),c=r(227),l=(e,t,r)=>{let s;if((0,i.isCryptoKey)(r)){if(!r.extractable)throw new TypeError("CryptoKey is not extractable");s=n.KeyObject.from(r)}else{if(!(0,a.default)(r))throw new TypeError((0,o.default)(r,...c.types));s=r}if(s.type!==e)throw new TypeError(`key is not a ${e} key`);return s.export({format:"pem",type:t})};t.toSPKI=e=>l("public","spki",e);t.toPKCS8=e=>l("private","pkcs8",e);t.fromPKCS8=e=>(0,n.createPrivateKey)({key:s.Buffer.from(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,""),"base64"),type:"pkcs8",format:"der"});t.fromSPKI=e=>(0,n.createPublicKey)({key:s.Buffer.from(e.replace(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,""),"base64"),type:"spki",format:"der"});t.fromX509=e=>(0,n.createPublicKey)({key:e,type:"spki",format:"pem"})},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(211),s=r(100),i=r(210),a=r(216),o=r(235),c=r(239),l=r(244),u=r(245);t.default=e=>{if(u.jwkImport&&"oct"!==e.kty)return e.d?(0,s.createPrivateKey)({format:"jwk",key:e}):(0,s.createPublicKey)({format:"jwk",key:e});switch(e.kty){case"oct":return(0,s.createSecretKey)((0,i.decode)(e.k));case"RSA":{const t=new l.default,r=void 0!==e.d,i=n.Buffer.from(e.n,"base64"),a=n.Buffer.from(e.e,"base64");r?(t.zero(),t.unsignedInteger(i),t.unsignedInteger(a),t.unsignedInteger(n.Buffer.from(e.d,"base64")),t.unsignedInteger(n.Buffer.from(e.p,"base64")),t.unsignedInteger(n.Buffer.from(e.q,"base64")),t.unsignedInteger(n.Buffer.from(e.dp,"base64")),t.unsignedInteger(n.Buffer.from(e.dq,"base64")),t.unsignedInteger(n.Buffer.from(e.qi,"base64"))):(t.unsignedInteger(i),t.unsignedInteger(a));const o={key:t.end(),format:"der",type:"pkcs1"},u=r?(0,s.createPrivateKey)(o):(0,s.createPublicKey)(o);return(0,c.setModulusLength)(u,i.length<<3),u}case"EC":{const t=new l.default,r=void 0!==e.d,i=n.Buffer.concat([n.Buffer.alloc(1,4),n.Buffer.from(e.x,"base64"),n.Buffer.from(e.y,"base64")]);if(r){t.zero();const r=new l.default;r.oidFor("ecPublicKey"),r.oidFor(e.crv),t.add(r.end());const a=new l.default;a.one(),a.octStr(n.Buffer.from(e.d,"base64"));const c=new l.default;c.bitStr(i);const u=c.end(n.Buffer.from([161]));a.add(u);const d=a.end(),p=new l.default;p.add(d);const h=p.end(n.Buffer.from([4]));t.add(h);const f=t.end(),m=(0,s.createPrivateKey)({key:f,format:"der",type:"pkcs8"});return(0,o.setCurve)(m,e.crv),m}const a=new l.default;a.oidFor("ecPublicKey"),a.oidFor(e.crv),t.add(a.end()),t.bitStr(i);const c=t.end(),u=(0,s.createPublicKey)({key:c,format:"der",type:"spki"});return(0,o.setCurve)(u,e.crv),u}case"OKP":{const t=new l.default;if(void 0!==e.d){t.zero();const r=new l.default;r.oidFor(e.crv),t.add(r.end());const i=new l.default;i.octStr(n.Buffer.from(e.d,"base64"));const a=i.end(n.Buffer.from([4]));t.add(a);const o=t.end();return(0,s.createPrivateKey)({key:o,format:"der",type:"pkcs8"})}const r=new l.default;r.oidFor(e.crv),t.add(r.end()),t.bitStr(n.Buffer.from(e.x,"base64"));const i=t.end();return(0,s.createPublicKey)({key:i,format:"der",type:"spki"})}default:throw new a.JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(211),s=r(216),i=n.Buffer.from([0]),a=n.Buffer.from([2]),o=n.Buffer.from([3]),c=n.Buffer.from([48]),l=n.Buffer.from([4]),u=e=>{if(e<128)return n.Buffer.from([e]);const t=n.Buffer.alloc(5);t.writeUInt32BE(e,1);let r=1;for(;0===t[r];)r++;return t[r-1]=128|5-r,t.slice(r-1)},d=new Map([["P-256",n.Buffer.from("06 08 2A 86 48 CE 3D 03 01 07".replace(/ /g,""),"hex")],["secp256k1",n.Buffer.from("06 05 2B 81 04 00 0A".replace(/ /g,""),"hex")],["P-384",n.Buffer.from("06 05 2B 81 04 00 22".replace(/ /g,""),"hex")],["P-521",n.Buffer.from("06 05 2B 81 04 00 23".replace(/ /g,""),"hex")],["ecPublicKey",n.Buffer.from("06 07 2A 86 48 CE 3D 02 01".replace(/ /g,""),"hex")],["X25519",n.Buffer.from("06 03 2B 65 6E".replace(/ /g,""),"hex")],["X448",n.Buffer.from("06 03 2B 65 6F".replace(/ /g,""),"hex")],["Ed25519",n.Buffer.from("06 03 2B 65 70".replace(/ /g,""),"hex")],["Ed448",n.Buffer.from("06 03 2B 65 71".replace(/ /g,""),"hex")]]);t.default=class{constructor(){this.length=0,this.elements=[]}oidFor(e){const t=d.get(e);if(!t)throw new s.JOSENotSupported("Invalid or unsupported OID");this.elements.push(t),this.length+=t.length}zero(){this.elements.push(a,n.Buffer.from([1]),i),this.length+=3}one(){this.elements.push(a,n.Buffer.from([1]),n.Buffer.from([1])),this.length+=3}unsignedInteger(e){if(128&e[0]){const t=u(e.length+1);this.elements.push(a,t,i,e),this.length+=2+t.length+e.length}else{let t=0;for(;0===e[t]&&0==(128&e[t+1]);)t++;const r=u(e.length-t);this.elements.push(a,u(e.length-t),e.slice(t)),this.length+=1+r.length+e.length-t}}octStr(e){const t=u(e.length);this.elements.push(l,u(e.length),e),this.length+=1+t.length+e.length}bitStr(e){const t=u(e.length+1);this.elements.push(o,u(e.length+1),i,e),this.length+=1+t.length+e.length+1}add(e){this.elements.push(e),this.length+=e.length}end(e=c){const t=u(this.length);return n.Buffer.concat([e,t,...this.elements],1+t.length+this.length)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.jwkImport=t.jwkExport=t.rsaPssParams=t.oneShotCallback=void 0;const[r,n]=process.versions.node.split(".").map((e=>parseInt(e,10)));t.oneShotCallback=r>=16||15===r&&n>=13,t.rsaPssParams=!("electron"in process.versions)&&(r>=17||16===r&&n>=9),t.jwkExport=r>=16||15===r&&n>=9,t.jwkImport=r>=16||15===r&&n>=12},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(225),s=r(227);t.default=(e,t,r)=>{e.startsWith("HS")||"dir"===e||e.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(e)?((e,t)=>{if(!(t instanceof Uint8Array)){if(!(0,s.default)(t))throw new TypeError((0,n.withAlg)(e,t,...s.types,"Uint8Array"));if("secret"!==t.type)throw new TypeError(`${s.types.join(" or ")} instances for symmetric algorithms must be of type "secret"`)}})(e,t):((e,t,r)=>{if(!(0,s.default)(t))throw new TypeError((0,n.withAlg)(e,t,...s.types));if("secret"===t.type)throw new TypeError(`${s.types.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);if("sign"===r&&"public"===t.type)throw new TypeError(`${s.types.join(" or ")} instances for asymmetric algorithm signing must be of type "private"`);if("decrypt"===r&&"public"===t.type)throw new TypeError(`${s.types.join(" or ")} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&"verify"===r&&"private"===t.type)throw new TypeError(`${s.types.join(" or ")} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&"encrypt"===r&&"private"===t.type)throw new TypeError(`${s.types.join(" or ")} instances for asymmetric algorithm encryption must be of type "public"`)})(e,t,r)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.unwrap=t.wrap=void 0;const n=r(248),s=r(214),i=r(217),a=r(210);t.wrap=async function(e,t,r,s){const o=e.slice(0,7);s||(s=(0,i.default)(o));const{ciphertext:c,tag:l}=await(0,n.default)(o,r,t,s,new Uint8Array(0));return{encryptedKey:c,iv:(0,a.encode)(s),tag:(0,a.encode)(l)}},t.unwrap=async function(e,t,r,n,i){const a=e.slice(0,7);return(0,s.default)(a,t,r,n,i,new Uint8Array(0))}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(215),i=r(219),a=r(212),o=r(222),c=r(223),l=r(224),u=r(220),d=r(225),p=r(216),h=r(226),f=r(227);t.default=(e,t,r,m,g)=>{let y;if((0,c.isCryptoKey)(r))(0,l.checkEncCryptoKey)(r,e,"encrypt"),y=n.KeyObject.from(r);else{if(!(r instanceof Uint8Array||(0,u.default)(r)))throw new TypeError((0,d.default)(r,...f.types,"Uint8Array"));y=r}switch((0,i.default)(e,y),(0,s.default)(e,m),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return function(e,t,r,s,i){const c=parseInt(e.slice(1,4),10);(0,u.default)(r)&&(r=r.export());const l=r.subarray(c>>3),d=r.subarray(0,c>>3),f=`aes-${c}-cbc`;if(!(0,h.default)(f))throw new p.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);const m=(0,n.createCipheriv)(f,l,s),g=(0,a.concat)(m.update(t),m.final()),y=parseInt(e.slice(-3),10);return{ciphertext:g,tag:(0,o.default)(i,s,g,y,d,c)}}(e,t,y,m,g);case"A128GCM":case"A192GCM":case"A256GCM":return function(e,t,r,s,i){const a=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!(0,h.default)(a))throw new p.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);const o=(0,n.createCipheriv)(a,r,s,{authTagLength:16});i.byteLength&&o.setAAD(i,{plaintextLength:t.length});const c=o.update(t);return o.final(),{ciphertext:c,tag:o.getAuthTag()}}(e,t,y,m,g);default:throw new p.JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(216);t.default=function(e,t,r,s,i){if(void 0!==i.crit&&void 0===s.crit)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!s||void 0===s.crit)return new Set;if(!Array.isArray(s.crit)||0===s.crit.length||s.crit.some((e=>"string"!=typeof e||0===e.length)))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let a;a=void 0!==r?new Map([...Object.entries(r),...t.entries()]):t;for(const t of s.crit){if(!a.has(t))throw new n.JOSENotSupported(`Extension Header Parameter "${t}" is not recognized`);if(void 0===i[t])throw new e(`Extension Header Parameter "${t}" is missing`);if(a.get(t)&&void 0===s[t])throw new e(`Extension Header Parameter "${t}" MUST be integrity protected`)}return new Set(s.crit)}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=(e,t)=>{if(void 0!==t&&(!Array.isArray(t)||t.some((e=>"string"!=typeof e))))throw new TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generalDecrypt=void 0;const n=r(209),s=r(216),i=r(231);t.generalDecrypt=async function(e,t,r){if(!(0,i.default)(e))throw new s.JWEInvalid("General JWE must be an object");if(!Array.isArray(e.recipients)||!e.recipients.every(i.default))throw new s.JWEInvalid("JWE Recipients missing or incorrect type");if(!e.recipients.length)throw new s.JWEInvalid("JWE Recipients has no members");for(const s of e.recipients)try{return await(0,n.flattenedDecrypt)({aad:e.aad,ciphertext:e.ciphertext,encrypted_key:s.encrypted_key,header:s.header,iv:e.iv,protected:e.protected,tag:e.tag,unprotected:e.unprotected},t,r)}catch{}throw new s.JWEDecryptionFailed}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GeneralEncrypt=void 0;const n=r(253),s=r(216),i=r(240),a=r(230),o=r(254),c=r(210),l=r(249);class u{constructor(e,t,r){this.parent=e,this.key=t,this.options=r}setUnprotectedHeader(e){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=e,this}addRecipient(...e){return this.parent.addRecipient(...e)}encrypt(...e){return this.parent.encrypt(...e)}done(){return this.parent}}t.GeneralEncrypt=class{constructor(e){this._recipients=[],this._plaintext=e}addRecipient(e,t){const r=new u(this,e,{crit:null==t?void 0:t.crit});return this._recipients.push(r),r}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}async encrypt(e){var t,r,u;if(!this._recipients.length)throw new s.JWEInvalid("at least one recipient must be added");if(e={deflateRaw:null==e?void 0:e.deflateRaw},1===this._recipients.length){const[t]=this._recipients,r=await new n.FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(t.unprotectedHeader).encrypt(t.key,{...t.options,...e});let s={ciphertext:r.ciphertext,iv:r.iv,recipients:[{}],tag:r.tag};return r.aad&&(s.aad=r.aad),r.protected&&(s.protected=r.protected),r.unprotected&&(s.unprotected=r.unprotected),r.encrypted_key&&(s.recipients[0].encrypted_key=r.encrypted_key),r.header&&(s.recipients[0].header=r.header),s}let d;for(let e=0;e{Object.defineProperty(t,"__esModule",{value:!0}),t.FlattenedEncrypt=t.unprotected=void 0;const n=r(210),s=r(248),i=r(228),a=r(217),o=r(254),c=r(216),l=r(230),u=r(212),d=r(249);t.unprotected=Symbol();t.FlattenedEncrypt=class{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("plaintext must be an instance of Uint8Array");this._plaintext=e}setKeyManagementParameters(e){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._sharedUnprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}setContentEncryptionKey(e){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=e,this}async encrypt(e,r){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new c.JWEInvalid("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!(0,l.default)(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new c.JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");const p={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if((0,d.default)(c.JWEInvalid,new Map,null==r?void 0:r.crit,this._protectedHeader,p),void 0!==p.zip){if(!this._protectedHeader||!this._protectedHeader.zip)throw new c.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if("DEF"!==p.zip)throw new c.JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}const{alg:h,enc:f}=p;if("string"!=typeof h||!h)throw new c.JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof f||!f)throw new c.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let m,g,y,_,v,b,w;if("dir"===h){if(this._cek)throw new TypeError("setContentEncryptionKey cannot be called when using Direct Encryption")}else if("ECDH-ES"===h&&this._cek)throw new TypeError("setContentEncryptionKey cannot be called when using Direct Key Agreement");{let n;({cek:g,encryptedKey:m,parameters:n}=await(0,o.default)(h,f,e,this._cek,this._keyManagementParameters)),n&&(r&&t.unprotected in r?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...n}:this.setUnprotectedHeader(n):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...n}:this.setProtectedHeader(n))}if(this._iv||(this._iv=(0,a.default)(f)),_=this._protectedHeader?u.encoder.encode((0,n.encode)(JSON.stringify(this._protectedHeader))):u.encoder.encode(""),this._aad?(v=(0,n.encode)(this._aad),y=(0,u.concat)(_,u.encoder.encode("."),u.encoder.encode(v))):y=_,"DEF"===p.zip){const e=await((null==r?void 0:r.deflateRaw)||i.deflate)(this._plaintext);({ciphertext:b,tag:w}=await(0,s.default)(f,e,g,this._iv,y))}else({ciphertext:b,tag:w}=await(0,s.default)(f,this._plaintext,g,this._iv,y));const E={ciphertext:(0,n.encode)(b),iv:(0,n.encode)(this._iv),tag:(0,n.encode)(w)};return m&&(E.encrypted_key=(0,n.encode)(m)),v&&(E.aad=v),this._protectedHeader&&(E.protected=u.decoder.decode(_)),this._sharedUnprotectedHeader&&(E.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(E.header=this._unprotectedHeader),E}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(233),s=r(234),i=r(236),a=r(238),o=r(210),c=r(240),l=r(216),u=r(255),d=r(246),p=r(247);t.default=async function(e,t,r,h,f={}){let m,g,y;switch((0,d.default)(e,r,"encrypt"),e){case"dir":y=r;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!s.ecdhAllowed(r))throw new l.JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");const{apu:i,apv:a}=f;let{epk:d}=f;d||(d=(await s.generateEpk(r)).privateKey);const{x:p,y:_,crv:v,kty:b}=await(0,u.exportJWK)(d),w=await s.deriveKey(r,d,"ECDH-ES"===e?t:e,"ECDH-ES"===e?(0,c.bitLength)(t):parseInt(e.slice(-5,-2),10),i,a);if(g={epk:{x:p,crv:v,kty:b}},"EC"===b&&(g.epk.y=_),i&&(g.apu=(0,o.encode)(i)),a&&(g.apv=(0,o.encode)(a)),"ECDH-ES"===e){y=w;break}y=h||(0,c.default)(t);const E=e.slice(-6);m=await(0,n.wrap)(E,w,y);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":y=h||(0,c.default)(t),m=await(0,a.encrypt)(e,r,y);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{y=h||(0,c.default)(t);const{p2c:n,p2s:s}=f;({encryptedKey:m,...g}=await(0,i.encrypt)(e,r,y,n,s));break}case"A128KW":case"A192KW":case"A256KW":y=h||(0,c.default)(t),m=await(0,n.wrap)(e,r,y);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{y=h||(0,c.default)(t);const{iv:n}=f;({encryptedKey:m,...g}=await(0,p.wrap)(e,r,y,n));break}default:throw new l.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek:y,encryptedKey:m,parameters:g}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.exportJWK=t.exportPKCS8=t.exportSPKI=void 0;const n=r(242),s=r(242),i=r(256);t.exportSPKI=async function(e){return(0,n.toSPKI)(e)},t.exportPKCS8=async function(e){return(0,s.toPKCS8)(e)},t.exportJWK=async function(e){return(0,i.default)(e)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(210),i=r(257),a=r(216),o=r(235),c=r(223),l=r(220),u=r(225),d=r(227),p=r(245),h=e=>{let t;if((0,c.isCryptoKey)(e)){if(!e.extractable)throw new TypeError("CryptoKey is not extractable");t=n.KeyObject.from(e)}else{if(!(0,l.default)(e)){if(e instanceof Uint8Array)return{kty:"oct",k:(0,s.encode)(e)};throw new TypeError((0,u.default)(e,...d.types,"Uint8Array"))}t=e}if(p.jwkExport){if("secret"!==t.type&&!["rsa","ec","ed25519","x25519","ed448","x448"].includes(t.asymmetricKeyType))throw new a.JOSENotSupported("Unsupported key asymmetricKeyType");return t.export({format:"jwk"})}switch(t.type){case"secret":return{kty:"oct",k:(0,s.encode)(t.export())};case"private":case"public":switch(t.asymmetricKeyType){case"rsa":{const e=t.export({format:"der",type:"pkcs1"}),r=new i.default(e);"private"===t.type&&r.unsignedInteger();const n=(0,s.encode)(r.unsignedInteger()),a=(0,s.encode)(r.unsignedInteger());let o;return"private"===t.type&&(o={d:(0,s.encode)(r.unsignedInteger()),p:(0,s.encode)(r.unsignedInteger()),q:(0,s.encode)(r.unsignedInteger()),dp:(0,s.encode)(r.unsignedInteger()),dq:(0,s.encode)(r.unsignedInteger()),qi:(0,s.encode)(r.unsignedInteger())}),r.end(),{kty:"RSA",n,e:a,...o}}case"ec":{const e=(0,o.default)(t);let r,i,c;switch(e){case"secp256k1":r=64,i=33,c=-1;break;case"P-256":r=64,i=36,c=-1;break;case"P-384":r=96,i=35,c=-3;break;case"P-521":r=132,i=35,c=-3;break;default:throw new a.JOSENotSupported("Unsupported curve")}if("public"===t.type){const n=t.export({type:"spki",format:"der"});return{kty:"EC",crv:e,x:(0,s.encode)(n.subarray(-r,-r/2)),y:(0,s.encode)(n.subarray(-r/2))}}const l=t.export({type:"pkcs8",format:"der"});return l.length<100&&(i+=c),{...h((0,n.createPublicKey)(t)),d:(0,s.encode)(l.subarray(i,i+r/2))}}case"ed25519":case"x25519":{const e=(0,o.default)(t);if("public"===t.type){const r=t.export({type:"spki",format:"der"});return{kty:"OKP",crv:e,x:(0,s.encode)(r.subarray(-32))}}const r=t.export({type:"pkcs8",format:"der"});return{...h((0,n.createPublicKey)(t)),d:(0,s.encode)(r.subarray(-32))}}case"ed448":case"x448":{const e=(0,o.default)(t);if("public"===t.type){const r=t.export({type:"spki",format:"der"});return{kty:"OKP",crv:e,x:(0,s.encode)(r.subarray("Ed448"===e?-57:-56))}}const r=t.export({type:"pkcs8",format:"der"});return{...h((0,n.createPublicKey)(t)),d:(0,s.encode)(r.subarray("Ed448"===e?-57:-56))}}default:throw new a.JOSENotSupported("Unsupported key asymmetricKeyType")}default:throw new a.JOSENotSupported("Unsupported key type")}};t.default=h},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e){if(48!==e[0])throw new TypeError;this.buffer=e,this.offset=1;if(this.decodeLength()!==e.length-this.offset)throw new TypeError}decodeLength(){let e=this.buffer[this.offset++];if(128&e){const t=-129&e;e=0;for(let r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.compactVerify=void 0;const n=r(259),s=r(216),i=r(212);t.compactVerify=async function(e,t,r){if(e instanceof Uint8Array&&(e=i.decoder.decode(e)),"string"!=typeof e)throw new s.JWSInvalid("Compact JWS must be a string or Uint8Array");const{0:a,1:o,2:c,length:l}=e.split(".");if(3!==l)throw new s.JWSInvalid("Invalid Compact JWS");const u=await(0,n.flattenedVerify)({payload:o,protected:a,signature:c},t,r),d={payload:u.payload,protectedHeader:u.protectedHeader};return"function"==typeof t?{...d,key:u.key}:d}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.flattenedVerify=void 0;const n=r(210),s=r(260),i=r(216),a=r(212),o=r(230),c=r(231),l=r(246),u=r(249),d=r(250);t.flattenedVerify=async function(e,t,r){var p;if(!(0,c.default)(e))throw new i.JWSInvalid("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new i.JWSInvalid('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new i.JWSInvalid("JWS Protected Header incorrect type");if(void 0===e.payload)throw new i.JWSInvalid("JWS Payload missing");if("string"!=typeof e.signature)throw new i.JWSInvalid("JWS Signature missing or incorrect type");if(void 0!==e.header&&!(0,c.default)(e.header))throw new i.JWSInvalid("JWS Unprotected Header incorrect type");let h={};if(e.protected)try{const t=(0,n.decode)(e.protected);h=JSON.parse(a.decoder.decode(t))}catch{throw new i.JWSInvalid("JWS Protected Header is invalid")}if(!(0,o.default)(h,e.header))throw new i.JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const f={...h,...e.header};let m=!0;if((0,u.default)(i.JWSInvalid,new Map([["b64",!0]]),null==r?void 0:r.crit,h,f).has("b64")&&(m=h.b64,"boolean"!=typeof m))throw new i.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:g}=f;if("string"!=typeof g||!g)throw new i.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');const y=r&&(0,d.default)("algorithms",r.algorithms);if(y&&!y.has(g))throw new i.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');if(m){if("string"!=typeof e.payload)throw new i.JWSInvalid("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new i.JWSInvalid("JWS Payload must be a string or an Uint8Array instance");let _=!1;"function"==typeof t&&(t=await t(h,e),_=!0),(0,l.default)(g,t,"verify");const v=(0,a.concat)(a.encoder.encode(null!==(p=e.protected)&&void 0!==p?p:""),a.encoder.encode("."),"string"==typeof e.payload?a.encoder.encode(e.payload):e.payload);let b,w;try{b=(0,n.decode)(e.signature)}catch{throw new i.JWSInvalid("Failed to base64url decode the signature")}if(!await(0,s.default)(g,t,b,v))throw new i.JWSSignatureVerificationFailed;if(m)try{w=(0,n.decode)(e.payload)}catch{throw new i.JWSInvalid("Failed to base64url decode the payload")}else w="string"==typeof e.payload?a.encoder.encode(e.payload):e.payload;const E={payload:w};return void 0!==e.protected&&(E.protectedHeader=h),void 0!==e.header&&(E.unprotectedHeader=e.header),_?{...E,key:t}:E}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(101),i=r(261),a=r(262),o=r(263),c=r(265),l=r(245);let u;u=n.verify.length>4&&l.oneShotCallback?(0,s.promisify)(n.verify):n.verify;t.default=async(e,t,r,s)=>{const l=(0,c.default)(e,t,"verify");if(e.startsWith("HS")){const t=await(0,o.default)(e,l,s),i=r;try{return n.timingSafeEqual(i,t)}catch{return!1}}const d=(0,i.default)(e),p=(0,a.default)(e,l);try{return await u(d,s,p,r)}catch{return!1}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(216);t.default=function(e){switch(e){case"PS256":case"RS256":case"ES256":case"ES256K":return"sha256";case"PS384":case"RS384":case"ES384":return"sha384";case"PS512":case"RS512":case"ES512":return"sha512";case"EdDSA":return;default:throw new n.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(235),i=r(216),a=r(239),o=r(245),c={padding:n.constants.RSA_PKCS1_PSS_PADDING,saltLength:n.constants.RSA_PSS_SALTLEN_DIGEST},l=new Map([["ES256","P-256"],["ES256K","secp256k1"],["ES384","P-384"],["ES512","P-521"]]);t.default=function(e,t){switch(e){case"EdDSA":if(!["ed25519","ed448"].includes(t.asymmetricKeyType))throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be ed25519 or ed448");return t;case"RS256":case"RS384":case"RS512":if("rsa"!==t.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");return(0,a.default)(t,e),t;case o.rsaPssParams&&"PS256":case o.rsaPssParams&&"PS384":case o.rsaPssParams&&"PS512":if("rsa-pss"===t.asymmetricKeyType){const{hashAlgorithm:r,mgf1HashAlgorithm:n,saltLength:s}=t.asymmetricKeyDetails,i=parseInt(e.slice(-3),10);if(void 0!==r&&(r!==`sha${i}`||n!==r))throw new TypeError(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}`);if(void 0!==s&&s>i>>3)throw new TypeError(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}`)}else if("rsa"!==t.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa or rsa-pss");return(0,a.default)(t,e),{key:t,...c};case!o.rsaPssParams&&"PS256":case!o.rsaPssParams&&"PS384":case!o.rsaPssParams&&"PS512":if("rsa"!==t.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");return(0,a.default)(t,e),{key:t,...c};case"ES256":case"ES256K":case"ES384":case"ES512":{if("ec"!==t.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be ec");const r=(0,s.default)(t),n=l.get(e);if(r!==n)throw new TypeError(`Invalid key curve for the algorithm, its curve must be ${n}, got ${r}`);return{dsaEncoding:"ieee-p1363",key:t}}default:throw new i.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(101),i=r(261),a=r(264),o=r(262),c=r(265);let l;l=n.sign.length>3?(0,s.promisify)(n.sign):n.sign;t.default=async(e,t,r)=>{const s=(0,c.default)(e,t,"sign");if(e.startsWith("HS")){const t=n.createHmac((0,a.default)(e),s);return t.update(r),t.digest()}return l((0,i.default)(e),r,(0,o.default)(e,s))}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(216);t.default=function(e){switch(e){case"HS256":return"sha256";case"HS384":return"sha384";case"HS512":return"sha512";default:throw new n.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(223),i=r(224),a=r(225),o=r(227);t.default=function(e,t,r){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError((0,a.default)(t,...o.types));return(0,n.createSecretKey)(t)}if(t instanceof n.KeyObject)return t;if((0,s.isCryptoKey)(t))return(0,i.checkSigCryptoKey)(t,e,r),n.KeyObject.from(t);throw new TypeError((0,a.default)(t,...o.types,"Uint8Array"))}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generalVerify=void 0;const n=r(259),s=r(216),i=r(231);t.generalVerify=async function(e,t,r){if(!(0,i.default)(e))throw new s.JWSInvalid("General JWS must be an object");if(!Array.isArray(e.signatures)||!e.signatures.every(i.default))throw new s.JWSInvalid("JWS Signatures missing or incorrect type");for(const s of e.signatures)try{return await(0,n.flattenedVerify)({header:s.header,payload:e.payload,protected:s.protected,signature:s.signature},t,r)}catch{}throw new s.JWSSignatureVerificationFailed}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.jwtVerify=void 0;const n=r(258),s=r(268),i=r(216);t.jwtVerify=async function(e,t,r){var a;const o=await(0,n.compactVerify)(e,t,r);if((null===(a=o.protectedHeader.crit)||void 0===a?void 0:a.includes("b64"))&&!1===o.protectedHeader.b64)throw new i.JWTInvalid("JWTs MUST NOT use unencoded payload");const c={payload:(0,s.default)(o.protectedHeader,o.payload,r),protectedHeader:o.protectedHeader};return"function"==typeof t?{...c,key:o.key}:c}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(216),s=r(212),i=r(269),a=r(270),o=r(231),c=e=>e.toLowerCase().replace(/^application\//,"");t.default=(e,t,r={})=>{const{typ:l}=r;if(l&&("string"!=typeof e.typ||c(e.typ)!==c(l)))throw new n.JWTClaimValidationFailed('unexpected "typ" JWT header value',"typ","check_failed");let u;try{u=JSON.parse(s.decoder.decode(t))}catch{}if(!(0,o.default)(u))throw new n.JWTInvalid("JWT Claims Set must be a top-level JSON object");const{requiredClaims:d=[],issuer:p,subject:h,audience:f,maxTokenAge:m}=r;void 0!==m&&d.push("iat"),void 0!==f&&d.push("aud"),void 0!==h&&d.push("sub"),void 0!==p&&d.push("iss");for(const e of new Set(d.reverse()))if(!(e in u))throw new n.JWTClaimValidationFailed(`missing required "${e}" claim`,e,"missing");if(p&&!(Array.isArray(p)?p:[p]).includes(u.iss))throw new n.JWTClaimValidationFailed('unexpected "iss" claim value',"iss","check_failed");if(h&&u.sub!==h)throw new n.JWTClaimValidationFailed('unexpected "sub" claim value',"sub","check_failed");if(f&&(g=u.aud,y="string"==typeof f?[f]:f,!("string"==typeof g?y.includes(g):Array.isArray(g)&&y.some(Set.prototype.has.bind(new Set(g))))))throw new n.JWTClaimValidationFailed('unexpected "aud" claim value',"aud","check_failed");var g,y;let _;switch(typeof r.clockTolerance){case"string":_=(0,a.default)(r.clockTolerance);break;case"number":_=r.clockTolerance;break;case"undefined":_=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:v}=r,b=(0,i.default)(v||new Date);if((void 0!==u.iat||m)&&"number"!=typeof u.iat)throw new n.JWTClaimValidationFailed('"iat" claim must be a number',"iat","invalid");if(void 0!==u.nbf){if("number"!=typeof u.nbf)throw new n.JWTClaimValidationFailed('"nbf" claim must be a number',"nbf","invalid");if(u.nbf>b+_)throw new n.JWTClaimValidationFailed('"nbf" claim timestamp check failed',"nbf","check_failed")}if(void 0!==u.exp){if("number"!=typeof u.exp)throw new n.JWTClaimValidationFailed('"exp" claim must be a number',"exp","invalid");if(u.exp<=b-_)throw new n.JWTExpired('"exp" claim timestamp check failed',"exp","check_failed")}if(m){const e=b-u.iat;if(e-_>("number"==typeof m?m:(0,a.default)(m)))throw new n.JWTExpired('"iat" claim timestamp check failed (too far in the past)',"iat","check_failed");if(e<0-_)throw new n.JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)',"iat","check_failed")}return u}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=e=>Math.floor(e.getTime()/1e3)},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});const r=86400,n=/^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i;t.default=e=>{const t=n.exec(e);if(!t)throw new TypeError("Invalid time period format");const s=parseFloat(t[1]);switch(t[2].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":return Math.round(s);case"minute":case"minutes":case"min":case"mins":case"m":return Math.round(60*s);case"hour":case"hours":case"hr":case"hrs":case"h":return Math.round(3600*s);case"day":case"days":case"d":return Math.round(s*r);case"week":case"weeks":case"w":return Math.round(604800*s);default:return Math.round(31557600*s)}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.jwtDecrypt=void 0;const n=r(208),s=r(268),i=r(216);t.jwtDecrypt=async function(e,t,r){const a=await(0,n.compactDecrypt)(e,t,r),o=(0,s.default)(a.protectedHeader,a.plaintext,r),{protectedHeader:c}=a;if(void 0!==c.iss&&c.iss!==o.iss)throw new i.JWTClaimValidationFailed('replicated "iss" claim header parameter mismatch',"iss","mismatch");if(void 0!==c.sub&&c.sub!==o.sub)throw new i.JWTClaimValidationFailed('replicated "sub" claim header parameter mismatch',"sub","mismatch");if(void 0!==c.aud&&JSON.stringify(c.aud)!==JSON.stringify(o.aud))throw new i.JWTClaimValidationFailed('replicated "aud" claim header parameter mismatch',"aud","mismatch");const l={payload:o,protectedHeader:c};return"function"==typeof t?{...l,key:a.key}:l}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CompactEncrypt=void 0;const n=r(253);t.CompactEncrypt=class{constructor(e){this._flattened=new n.FlattenedEncrypt(e)}setContentEncryptionKey(e){return this._flattened.setContentEncryptionKey(e),this}setInitializationVector(e){return this._flattened.setInitializationVector(e),this}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}setKeyManagementParameters(e){return this._flattened.setKeyManagementParameters(e),this}async encrypt(e,t){const r=await this._flattened.encrypt(e,t);return[r.protected,r.encrypted_key,r.iv,r.ciphertext,r.tag].join(".")}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CompactSign=void 0;const n=r(274);t.CompactSign=class{constructor(e){this._flattened=new n.FlattenedSign(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,t){const r=await this._flattened.sign(e,t);if(void 0===r.payload)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FlattenedSign=void 0;const n=r(210),s=r(263),i=r(230),a=r(216),o=r(212),c=r(246),l=r(249);t.FlattenedSign=class{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}async sign(e,t){if(!this._protectedHeader&&!this._unprotectedHeader)throw new a.JWSInvalid("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!(0,i.default)(this._protectedHeader,this._unprotectedHeader))throw new a.JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const r={...this._protectedHeader,...this._unprotectedHeader};let u=!0;if((0,l.default)(a.JWSInvalid,new Map([["b64",!0]]),null==t?void 0:t.crit,this._protectedHeader,r).has("b64")&&(u=this._protectedHeader.b64,"boolean"!=typeof u))throw new a.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:d}=r;if("string"!=typeof d||!d)throw new a.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');(0,c.default)(d,e,"sign");let p,h=this._payload;u&&(h=o.encoder.encode((0,n.encode)(h))),p=this._protectedHeader?o.encoder.encode((0,n.encode)(JSON.stringify(this._protectedHeader))):o.encoder.encode("");const f=(0,o.concat)(p,o.encoder.encode("."),h),m=await(0,s.default)(d,e,f),g={signature:(0,n.encode)(m),payload:""};return u&&(g.payload=o.decoder.decode(h)),this._unprotectedHeader&&(g.header=this._unprotectedHeader),this._protectedHeader&&(g.protected=o.decoder.decode(p)),g}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GeneralSign=void 0;const n=r(274),s=r(216);class i{constructor(e,t,r){this.parent=e,this.key=t,this.options=r}setProtectedHeader(e){if(this.protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this.protectedHeader=e,this}setUnprotectedHeader(e){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=e,this}addSignature(...e){return this.parent.addSignature(...e)}sign(...e){return this.parent.sign(...e)}done(){return this.parent}}t.GeneralSign=class{constructor(e){this._signatures=[],this._payload=e}addSignature(e,t){const r=new i(this,e,t);return this._signatures.push(r),r}async sign(){if(!this._signatures.length)throw new s.JWSInvalid("at least one signature must be added");const e={signatures:[],payload:""};for(let t=0;t{Object.defineProperty(t,"__esModule",{value:!0}),t.SignJWT=void 0;const n=r(273),s=r(216),i=r(212),a=r(277);class o extends a.ProduceJWT{setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,t){var r;const a=new n.CompactSign(i.encoder.encode(JSON.stringify(this._payload)));if(a.setProtectedHeader(this._protectedHeader),Array.isArray(null===(r=this._protectedHeader)||void 0===r?void 0:r.crit)&&this._protectedHeader.crit.includes("b64")&&!1===this._protectedHeader.b64)throw new s.JWTInvalid("JWTs MUST NOT use unencoded payload");return a.sign(e,t)}}t.SignJWT=o},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ProduceJWT=void 0;const n=r(269),s=r(231),i=r(270);t.ProduceJWT=class{constructor(e){if(!(0,s.default)(e))throw new TypeError("JWT Claims Set MUST be an object");this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return this._payload="number"==typeof e?{...this._payload,nbf:e}:{...this._payload,nbf:(0,n.default)(new Date)+(0,i.default)(e)},this}setExpirationTime(e){return this._payload="number"==typeof e?{...this._payload,exp:e}:{...this._payload,exp:(0,n.default)(new Date)+(0,i.default)(e)},this}setIssuedAt(e){return this._payload=void 0===e?{...this._payload,iat:(0,n.default)(new Date)}:{...this._payload,iat:e},this}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EncryptJWT=void 0;const n=r(272),s=r(212),i=r(277);class a extends i.ProduceJWT{setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setKeyManagementParameters(e){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setContentEncryptionKey(e){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=e,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(e,t){const r=new n.CompactEncrypt(s.encoder.encode(JSON.stringify(this._payload)));return this._replicateIssuerAsHeader&&(this._protectedHeader={...this._protectedHeader,iss:this._payload.iss}),this._replicateSubjectAsHeader&&(this._protectedHeader={...this._protectedHeader,sub:this._payload.sub}),this._replicateAudienceAsHeader&&(this._protectedHeader={...this._protectedHeader,aud:this._payload.aud}),r.setProtectedHeader(this._protectedHeader),this._iv&&r.setInitializationVector(this._iv),this._cek&&r.setContentEncryptionKey(this._cek),this._keyManagementParameters&&r.setKeyManagementParameters(this._keyManagementParameters),r.encrypt(e,t)}}t.EncryptJWT=a},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.calculateJwkThumbprintUri=t.calculateJwkThumbprint=void 0;const n=r(213),s=r(210),i=r(216),a=r(212),o=r(231),c=(e,t)=>{if("string"!=typeof e||!e)throw new i.JWKInvalid(`${t} missing or invalid`)};async function l(e,t){if(!(0,o.default)(e))throw new TypeError("JWK must be an object");if(null!=t||(t="sha256"),"sha256"!==t&&"sha384"!==t&&"sha512"!==t)throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let r;switch(e.kty){case"EC":c(e.crv,'"crv" (Curve) Parameter'),c(e.x,'"x" (X Coordinate) Parameter'),c(e.y,'"y" (Y Coordinate) Parameter'),r={crv:e.crv,kty:e.kty,x:e.x,y:e.y};break;case"OKP":c(e.crv,'"crv" (Subtype of Key Pair) Parameter'),c(e.x,'"x" (Public Key) Parameter'),r={crv:e.crv,kty:e.kty,x:e.x};break;case"RSA":c(e.e,'"e" (Exponent) Parameter'),c(e.n,'"n" (Modulus) Parameter'),r={e:e.e,kty:e.kty,n:e.n};break;case"oct":c(e.k,'"k" (Key Value) Parameter'),r={k:e.k,kty:e.kty};break;default:throw new i.JOSENotSupported('"kty" (Key Type) Parameter missing or unsupported')}const l=a.encoder.encode(JSON.stringify(r));return(0,s.encode)(await(0,n.default)(t,l))}t.calculateJwkThumbprint=l,t.calculateJwkThumbprintUri=async function(e,t){null!=t||(t="sha256");const r=await l(e,t);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${t.slice(-3)}:${r}`}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EmbeddedJWK=void 0;const n=r(241),s=r(231),i=r(216);t.EmbeddedJWK=async function(e,t){const r={...e,...null==t?void 0:t.header};if(!(0,s.default)(r.jwk))throw new i.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a JSON object');const a=await(0,n.importJWK)({...r.jwk,ext:!0},r.alg,!0);if(a instanceof Uint8Array||"public"!==a.type)throw new i.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a public key');return a}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createLocalJWKSet=t.LocalJWKSet=t.isJWKSLike=void 0;const n=r(241),s=r(216),i=r(231);function a(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(o)}function o(e){return(0,i.default)(e)}t.isJWKSLike=a;class c{constructor(e){if(this._cached=new WeakMap,!a(e))throw new s.JWKSInvalid("JSON Web Key Set malformed");var t;this._jwks=(t=e,"function"==typeof structuredClone?structuredClone(t):JSON.parse(JSON.stringify(t)))}async getKey(e,t){const{alg:r,kid:n}={...e,...null==t?void 0:t.header},i=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new s.JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set')}}(r),a=this._jwks.keys.filter((e=>{let t=i===e.kty;if(t&&"string"==typeof n&&(t=n===e.kid),t&&"string"==typeof e.alg&&(t=r===e.alg),t&&"string"==typeof e.use&&(t="sig"===e.use),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes("verify")),t&&"EdDSA"===r&&(t="Ed25519"===e.crv||"Ed448"===e.crv),t)switch(r){case"ES256":t="P-256"===e.crv;break;case"ES256K":t="secp256k1"===e.crv;break;case"ES384":t="P-384"===e.crv;break;case"ES512":t="P-521"===e.crv}return t})),{0:o,length:c}=a;if(0===c)throw new s.JWKSNoMatchingKey;if(1!==c){const e=new s.JWKSMultipleMatchingKeys,{_cached:t}=this;throw e[Symbol.asyncIterator]=async function*(){for(const e of a)try{yield await l(t,e,r)}catch{continue}},e}return l(this._cached,o,r)}}async function l(e,t,r){const i=e.get(t)||e.set(t,{}).get(t);if(void 0===i[r]){const e=await(0,n.importJWK)({...t,ext:!0},r);if(e instanceof Uint8Array||"public"!==e.type)throw new s.JWKSInvalid("JSON Web Key Set members must be public keys");i[r]=e}return i[r]}t.LocalJWKSet=c,t.createLocalJWKSet=function(e){const t=new c(e);return async function(e,r){return t.getKey(e,r)}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createRemoteJWKSet=void 0;const n=r(283),s=r(216),i=r(281);class a extends i.LocalJWKSet{constructor(e,t){if(super({keys:[]}),this._jwks=void 0,!(e instanceof URL))throw new TypeError("url must be an instance of URL");this._url=new URL(e.href),this._options={agent:null==t?void 0:t.agent,headers:null==t?void 0:t.headers},this._timeoutDuration="number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3,this._cooldownDuration="number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4,this._cacheMaxAge="number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5}coolingDown(){return"number"==typeof this._jwksTimestamp&&Date.now(){if(!(0,i.isJWKSLike)(e))throw new s.JWKSInvalid("JSON Web Key Set malformed");this._jwks={keys:e.keys},this._jwksTimestamp=Date.now(),this._pendingFetch=void 0})).catch((e=>{throw this._pendingFetch=void 0,e}))),await this._pendingFetch}}t.createRemoteJWKSet=function(e,t){const r=new a(e,t);return async function(e,t){return r.getKey(e,t)}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(284),s=r(285),i=r(286),a=r(216),o=r(212);t.default=async(e,t,r)=>{let c;switch(e.protocol){case"https:":c=s.get;break;case"http:":c=n.get;break;default:throw new TypeError("Unsupported URL protocol.")}const{agent:l,headers:u}=r,d=c(e.href,{agent:l,timeout:t,headers:u}),[p]=await Promise.race([(0,i.once)(d,"response"),(0,i.once)(d,"timeout")]);if(!p)throw d.destroy(),new a.JWKSTimeout;if(200!==p.statusCode)throw new a.JOSEError("Expected 200 OK from the JSON Web Key Set HTTP response");const h=[];for await(const e of p)h.push(e);try{return JSON.parse(o.decoder.decode((0,o.concat)(...h)))}catch{throw new a.JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON")}}},e=>{e.exports=require("http")},e=>{e.exports=require("https")},e=>{e.exports=require("events")},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnsecuredJWT=void 0;const n=r(210),s=r(212),i=r(216),a=r(268),o=r(277);class c extends o.ProduceJWT{encode(){return`${n.encode(JSON.stringify({alg:"none"}))}.${n.encode(JSON.stringify(this._payload))}.`}static decode(e,t){if("string"!=typeof e)throw new i.JWTInvalid("Unsecured JWT must be a string");const{0:r,1:o,2:c,length:l}=e.split(".");if(3!==l||""!==c)throw new i.JWTInvalid("Invalid Unsecured JWT");let u;try{if(u=JSON.parse(s.decoder.decode(n.decode(r))),"none"!==u.alg)throw new Error}catch{throw new i.JWTInvalid("Invalid Unsecured JWT")}return{payload:(0,a.default)(u,n.decode(o),t),header:u}}}t.UnsecuredJWT=c},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decodeProtectedHeader=void 0;const n=r(289),s=r(212),i=r(231);t.decodeProtectedHeader=function(e){let t;if("string"==typeof e){const r=e.split(".");3!==r.length&&5!==r.length||([t]=r)}else if("object"==typeof e&&e){if(!("protected"in e))throw new TypeError("Token does not contain a Protected Header");t=e.protected}try{if("string"!=typeof t||!t)throw new Error;const e=JSON.parse(s.decoder.decode((0,n.decode)(t)));if(!(0,i.default)(e))throw new Error;return e}catch{throw new TypeError("Invalid Token or Protected Header formatting")}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=void 0;const n=r(210);t.encode=n.encode,t.decode=n.decode},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decodeJwt=void 0;const n=r(289),s=r(212),i=r(231),a=r(216);t.decodeJwt=function(e){if("string"!=typeof e)throw new a.JWTInvalid("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:r}=e.split(".");if(5===r)throw new a.JWTInvalid("Only JWTs using Compact JWS serialization can be decoded");if(3!==r)throw new a.JWTInvalid("Invalid JWT");if(!t)throw new a.JWTInvalid("JWTs must contain a payload");let o,c;try{o=(0,n.decode)(t)}catch{throw new a.JWTInvalid("Failed to base64url decode the payload")}try{c=JSON.parse(s.decoder.decode(o))}catch{throw new a.JWTInvalid("Failed to parse the decoded payload as JSON")}if(!(0,i.default)(c))throw new a.JWTInvalid("Invalid JWT Claims Set");return c}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generateKeyPair=void 0;const n=r(292);t.generateKeyPair=async function(e,t){return(0,n.generateKeyPair)(e,t)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generateKeyPair=t.generateSecret=void 0;const n=r(100),s=r(101),i=r(218),a=r(239),o=r(216),c=(0,s.promisify)(n.generateKeyPair);t.generateSecret=async function(e,t){let r;switch(e){case"HS256":case"HS384":case"HS512":case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":r=parseInt(e.slice(-3),10);break;case"A128KW":case"A192KW":case"A256KW":case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":r=parseInt(e.slice(1,4),10);break;default:throw new o.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return(0,n.createSecretKey)((0,i.default)(new Uint8Array(r>>3)))},t.generateKeyPair=async function(e,t){var r,n;switch(e){case"RS256":case"RS384":case"RS512":case"PS256":case"PS384":case"PS512":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":case"RSA1_5":{const e=null!==(r=null==t?void 0:t.modulusLength)&&void 0!==r?r:2048;if("number"!=typeof e||e<2048)throw new o.JOSENotSupported("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");const n=await c("rsa",{modulusLength:e,publicExponent:65537});return(0,a.setModulusLength)(n.privateKey,e),(0,a.setModulusLength)(n.publicKey,e),n}case"ES256":return c("ec",{namedCurve:"P-256"});case"ES256K":return c("ec",{namedCurve:"secp256k1"});case"ES384":return c("ec",{namedCurve:"P-384"});case"ES512":return c("ec",{namedCurve:"P-521"});case"EdDSA":switch(null==t?void 0:t.crv){case void 0:case"Ed25519":return c("ed25519");case"Ed448":return c("ed448");default:throw new o.JOSENotSupported("Invalid or unsupported crv option provided, supported values are Ed25519 and Ed448")}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":const e=null!==(n=null==t?void 0:t.crv)&&void 0!==n?n:"P-256";switch(e){case void 0:case"P-256":case"P-384":case"P-521":return c("ec",{namedCurve:e});case"X25519":return c("x25519");case"X448":return c("x448");default:throw new o.JOSENotSupported("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448")}default:throw new o.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generateSecret=void 0;const n=r(292);t.generateSecret=async function(e,t){return(0,n.generateSecret)(e,t)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(295);t.default=n.default},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default="node:crypto"},(e,t,r)=>{r.r(t),r.d(t,{NIL:()=>o.default,parse:()=>d.default,stringify:()=>u.default,v1:()=>n.default,v3:()=>s.default,v4:()=>i.default,v5:()=>a.default,validate:()=>l.default,version:()=>c.default});var n=r(297),s=r(302),i=r(306),a=r(308),o=r(310),c=r(311),l=r(300),u=r(299),d=r(304)},(e,t,r)=>{r.r(t),r.d(t,{default:()=>l});var n=r(298),s=r(299);let i,a,o=0,c=0;const l=function(e,t,r){let l=t&&r||0;const u=t||new Array(16);let d=(e=e||{}).node||i,p=void 0!==e.clockseq?e.clockseq:a;if(null==d||null==p){const t=e.random||(e.rng||n.default)();null==d&&(d=i=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==p&&(p=a=16383&(t[6]<<8|t[7]))}let h=void 0!==e.msecs?e.msecs:Date.now(),f=void 0!==e.nsecs?e.nsecs:c+1;const m=h-o+(f-c)/1e4;if(m<0&&void 0===e.clockseq&&(p=p+1&16383),(m<0||h>o)&&void 0===e.nsecs&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");o=h,c=f,a=p,h+=122192928e5;const g=(1e4*(268435455&h)+f)%4294967296;u[l++]=g>>>24&255,u[l++]=g>>>16&255,u[l++]=g>>>8&255,u[l++]=255&g;const y=h/4294967296*1e4&268435455;u[l++]=y>>>8&255,u[l++]=255&y,u[l++]=y>>>24&15|16,u[l++]=y>>>16&255,u[l++]=p>>>8|128,u[l++]=255&p;for(let e=0;e<6;++e)u[l+e]=d[e];return t||(0,s.unsafeStringify)(u)}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>o});var n=r(100),s=r.n(n);const i=new Uint8Array(256);let a=i.length;function o(){return a>i.length-16&&(s().randomFillSync(i),a=0),i.slice(a,a+=16)}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a,unsafeStringify:()=>i});var n=r(300);const s=[];for(let e=0;e<256;++e)s.push((e+256).toString(16).slice(1));function i(e,t=0){return s[e[t+0]]+s[e[t+1]]+s[e[t+2]]+s[e[t+3]]+"-"+s[e[t+4]]+s[e[t+5]]+"-"+s[e[t+6]]+s[e[t+7]]+"-"+s[e[t+8]]+s[e[t+9]]+"-"+s[e[t+10]]+s[e[t+11]]+s[e[t+12]]+s[e[t+13]]+s[e[t+14]]+s[e[t+15]]}const a=function(e,t=0){const r=i(e,t);if(!(0,n.default)(r))throw TypeError("Stringified UUID is invalid");return r}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>s});var n=r(301);const s=function(e){return"string"==typeof e&&n.default.test(e)}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});const n=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var n=r(303),s=r(305);const i=(0,n.default)("v3",48,s.default)},(e,t,r)=>{r.r(t),r.d(t,{DNS:()=>i,URL:()=>a,default:()=>o});var n=r(299),s=r(304);const i="6ba7b810-9dad-11d1-80b4-00c04fd430c8",a="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function o(e,t,r){function o(e,i,a,o){var c;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let r=0;r{r.r(t),r.d(t,{default:()=>s});var n=r(300);const s=function(e){if(!(0,n.default)(e))throw TypeError("Invalid UUID");let t;const r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var n=r(100),s=r.n(n),i=r(21).Buffer;const a=function(e){return Array.isArray(e)?e=i.from(e):"string"==typeof e&&(e=i.from(e,"utf8")),s().createHash("md5").update(e).digest()}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var n=r(307),s=r(298),i=r(299);const a=function(e,t,r){if(n.default.randomUUID&&!t&&!e)return n.default.randomUUID();const a=(e=e||{}).random||(e.rng||s.default)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=a[e];return t}return(0,i.unsafeStringify)(a)}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>s});var n=r(100);const s={randomUUID:r.n(n)().randomUUID}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var n=r(303),s=r(309);const i=(0,n.default)("v5",80,s.default)},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var n=r(100),s=r.n(n),i=r(21).Buffer;const a=function(e){return Array.isArray(e)?e=i.from(e):"string"==typeof e&&(e=i.from(e,"utf8")),s().createHash("sha1").update(e).digest()}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});const n="00000000-0000-0000-0000-000000000000"},(e,t,r)=>{r.r(t),r.d(t,{default:()=>s});var n=r(300);const s=function(e){if(!(0,n.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TelemetryMiddleware=void 0;const n=r(313),s=r(207);t.TelemetryMiddleware=class{constructor(e){this.clientInfo=e.clientInfo||(0,n.generateClientInfo)()}async pre(e){return"string"==typeof this.clientInfo.name&&this.clientInfo.name.length>0&&(e.init.headers={...e.init.headers,"Auth0-Client":s.base64url.encode(JSON.stringify(this.clientInfo))}),{url:e.url,init:e.init}}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mtlsPrefix=t.generateClientInfo=void 0;const n=r(314);t.generateClientInfo=()=>({name:"node-auth0",version:n.version,env:{node:process.version.replace("v","")}}),t.mtlsPrefix="mtls"},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="4.9.0"},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OAuth=void 0;const n=r(163),s=r(205),i=r(316),a=r(313);class o extends s.BaseAuthAPI{constructor(e){super({...e,domain:e.useMTLS?`${a.mtlsPrefix}.${e.domain}`:e.domain}),this.idTokenValidator=new i.IDTokenValidator(e)}async authorizationCodeGrant(e,t={}){return(0,n.validateRequiredRequestParams)(e,["code"]),(0,s.grant)("authorization_code",await this.addClientAuthentication(e),t,this.clientId,this.idTokenValidator,this.request.bind(this))}async authorizationCodeGrantWithPKCE(e,t={}){return(0,n.validateRequiredRequestParams)(e,["code","code_verifier"]),(0,s.grant)("authorization_code",await this.addClientAuthentication(e),t,this.clientId,this.idTokenValidator,this.request.bind(this))}async clientCredentialsGrant(e,t={}){return(0,n.validateRequiredRequestParams)(e,["audience"]),(0,s.grant)("client_credentials",await this.addClientAuthentication(e),t,this.clientId,this.idTokenValidator,this.request.bind(this))}async pushedAuthorization(e,t={}){(0,n.validateRequiredRequestParams)(e,["client_id","response_type","redirect_uri"]);const r=await this.addClientAuthentication(e),s=await this.request({path:"/oauth/par",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:this.clientId,...r})},t.initOverrides);return n.JSONApiResponse.fromResponse(s)}async passwordGrant(e,t={}){return(0,n.validateRequiredRequestParams)(e,["username","password"]),(0,s.grant)(e.realm?"http://auth0.com/oauth/grant-type/password-realm":"password",await this.addClientAuthentication(e),t,this.clientId,this.idTokenValidator,this.request.bind(this))}async refreshTokenGrant(e,t={}){return(0,n.validateRequiredRequestParams)(e,["refresh_token"]),(0,s.grant)("refresh_token",await this.addClientAuthentication(e),t,this.clientId,this.idTokenValidator,this.request.bind(this))}async revokeRefreshToken(e,t={}){(0,n.validateRequiredRequestParams)(e,["token"]);const r=await this.request({path:"/oauth/revoke",method:"POST",headers:{"Content-Type":"application/json"},body:await this.addClientAuthentication({client_id:this.clientId,...e})},t.initOverrides);return n.VoidApiResponse.fromResponse(r)}}t.OAuth=o},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.IDTokenValidator=t.IdTokenValidatorError=void 0;const a=i(r(207));class o extends Error{}t.IdTokenValidatorError=o;t.IDTokenValidator=class{constructor({domain:e,clientId:t,clientSecret:r,agent:n,headers:s,timeoutDuration:i,idTokenSigningAlg:o="RS256",clockTolerance:c=60}){this.jwks=a.createRemoteJWKSet(new URL(`https://${e}/.well-known/jwks.json`),{timeoutDuration:i,agent:n,headers:s}),this.alg=o,this.audience=t,this.secret=(new TextEncoder).encode(r),this.issuer=`https://${e}/`,this.clockTolerance=c}async validate(e,{nonce:t,maxAge:r,organization:n}={}){const s="HS256"===this.alg?this.secret:this.jwks,i=a.decodeProtectedHeader(e),c=a.decodeJwt(e);if("RS256"!==i.alg&&"HS256"!==i.alg)throw new Error(`Signature algorithm of "${i.alg}" is not supported. Expected the ID token to be signed with "RS256" or "HS256".`);if(!c.iss||"string"!=typeof c.iss)throw new o("Issuer (iss) claim must be a string present in the ID token");if(c.iss!==this.issuer)throw new o(`Issuer (iss) claim mismatch in the ID token; expected "${this.issuer}", found "${c.iss}"`);if(!c.sub||"string"!=typeof c.sub)throw new o("Subject (sub) claim must be a string present in the ID token");if(!c.aud||"string"!=typeof c.aud&&!Array.isArray(c.aud))throw new o("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(c.aud)&&!c.aud.includes(this.audience))throw new o(`Audience (aud) claim mismatch in the ID token; expected "${this.audience}" but was not one of "${c.aud.join(", ")}"`);if("string"==typeof c.aud&&c.aud!==this.audience)throw new o(`Audience (aud) claim mismatch in the ID token; expected "${this.audience}" but found "${c.aud}"`);if(n)if(0===n.indexOf("org_")){if(!c.org_id||"string"!=typeof c.org_id)throw new Error("Organization Id (org_id) claim must be a string present in the ID token");if(c.org_id!==n)throw new Error(`Organization Id (org_id) claim value mismatch in the ID token; expected "${n}", found "${c.org_id}"'`)}else{if(!c.org_name||"string"!=typeof c.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(c.org_name!==n.toLowerCase())throw new Error(`Organization Name (org_name) claim value mismatch in the ID token; expected "${n}", found "${c.org_name}"'`)}const l=Math.floor(Date.now()/1e3);if(!c.exp||"number"!=typeof c.exp)throw new o("Expiration Time (exp) claim must be a number present in the ID token");const u=c.exp+this.clockTolerance;if(l>u)throw new o(`Expiration Time (exp) claim error in the ID token; current time (${l}) is after expiration time (${u})`);if(!c.iat||"number"!=typeof c.iat)throw new o("Issued At (iat) claim must be a number present in the ID token");if(t||c.nonce){if(!c.nonce||"string"!=typeof c.nonce)throw new o("Nonce (nonce) claim must be a string present in the ID token");if(c.nonce!==t)throw new o(`Nonce (nonce) claim mismatch in the ID token; expected "${t}", found "${c.nonce}"`)}if(Array.isArray(c.aud)&&c.aud.length>1){if(!c.azp||"string"!=typeof c.azp)throw new o("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(c.azp!==this.audience)throw new o(`Authorized Party (azp) claim mismatch in the ID token; expected "${this.audience}", found "${c.azp}"`)}if(r){if(!c.auth_time||"number"!=typeof c.auth_time)throw new o("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");const e=c.auth_time+r+this.clockTolerance;if(l>e)throw new o(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Currrent time (${l}) is after last auth at ${e}`)}await a.jwtVerify(e,s,{issuer:this.issuer,audience:this.audience,clockTolerance:this.clockTolerance,maxTokenAge:r,algorithms:["HS256","RS256"]})}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Passwordless=void 0;const n=r(163),s=r(205),i=r(316);class a extends s.BaseAuthAPI{constructor(e){super(e),this.idTokenValidator=new i.IDTokenValidator(e)}async sendEmail(e,t){(0,n.validateRequiredRequestParams)(e,["email"]);const r=await this.request({path:"/passwordless/start",method:"POST",headers:{"Content-Type":"application/json"},body:await this.addClientAuthentication({client_id:this.clientId,connection:"email",...e})},t);return n.VoidApiResponse.fromResponse(r)}async sendSMS(e,t){(0,n.validateRequiredRequestParams)(e,["phone_number"]);const r=await this.request({path:"/passwordless/start",method:"POST",headers:{"Content-Type":"application/json"},body:await this.addClientAuthentication({client_id:this.clientId,connection:"sms",...e})},t);return n.VoidApiResponse.fromResponse(r)}async loginWithEmail(e,t={}){(0,n.validateRequiredRequestParams)(e,["email","code"]);const{email:r,code:i,...a}=e;return(0,s.grant)("http://auth0.com/oauth/grant-type/passwordless/otp",await this.addClientAuthentication({username:r,otp:i,realm:"email",...a}),t,this.clientId,this.idTokenValidator,this.request.bind(this))}async loginWithSMS(e,t={}){(0,n.validateRequiredRequestParams)(e,["phone_number","code"]);const{phone_number:r,code:i,...a}=e;return(0,s.grant)("http://auth0.com/oauth/grant-type/passwordless/otp",await this.addClientAuthentication({username:r,otp:i,realm:"sms",...a}),t,this.clientId,this.idTokenValidator,this.request.bind(this))}}t.Passwordless=a},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),s(r(165),t),s(r(166),t)},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UserInfoClient=t.parseError=t.UserInfoError=void 0;const n=r(165),s=r(312),i=r(166),a=r(163);class o extends Error{constructor(e,t,r,n,s){super(t||e),this.error=e,this.error_description=t,this.statusCode=r,this.body=n,this.headers=s,this.name="UserInfoError"}}async function c(e){const t=await e.text();let r;try{return r=JSON.parse(t),new o(r.error,r.error_description,e.status,t,e.headers)}catch(r){return new n.ResponseError(e.status,t,e.headers,"Response returned an error code")}}t.UserInfoError=o,t.parseError=c;class l extends a.BaseAPI{constructor(e){super({...e,baseUrl:`https://${e.domain}`,middleware:!1!==e.telemetry?[new s.TelemetryMiddleware(e)]:[],parseError:c})}async getUserInfo(e,t){const r=await this.request({path:"/userinfo",method:"GET",headers:{Authorization:`Bearer ${e}`}},t);return i.JSONApiResponse.fromResponse(r)}}t.UserInfoClient=l},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PostProviderRequestNameEnum=t.PatchProviderRequestNameEnum=void 0;const n=r(200);t.PatchProviderRequestNameEnum=n.EmailProviderUpdateNameEnum,t.PostProviderRequestNameEnum=n.EmailProviderCreateNameEnum},e=>{e.exports=require("lru-memoizer@2.2.0")},(e,t,r)=>{r.r(t),r.d(t,{plugin:()=>g});const{promisify:n}=r(101),s=r(2),i=r(26),a=r(100),o=r(153),{ArgumentError:c}=r(13),l=r(323),u=r(152),{getBasePath:d,getBaseUrl:p}=r(7),h=r(4),f=function(e){return i.join.apply(null,e).replace(/\\/g,"/").replace("http:/","http://").replace("https:/","https://")},m=function(e,t){return Array.isArray(e)?-1===e.indexOf(t):e!==t},g={register:async function(e,t){if(!t||"object"!=typeof t)return new c("Must provide the options");if(null===t.onLoginSuccess||void 0===t.onLoginSuccess)return new c("Must provide a valid login callback");if(null===t.secret||void 0===t.secret)return new c("Must provide a valid secret");if("string"!=typeof t.secret||0===t.secret.length)return new c("The provided secret is invalid: "+t.secret);if(null===t.audience||void 0===t.audience)return new c("Must provide a valid audience");if("string"!=typeof t.audience||0===t.audience.length)return new c("The provided audience is invalid: "+t.audience);if(null===t.rta||void 0===t.rta)return new c("Must provide a valid rta");if("string"!=typeof t.rta||0===t.rta.length)return new c("The provided rta is invalid: "+t.rta);if(null===t.domain||void 0===t.domain)return new c("Must provide a valid domain");if("string"!=typeof t.domain||0===t.domain.length)return new c("The provided domain is invalid: "+t.domain);if(null===t.baseUrl||void 0===t.baseUrl)return new c("Must provide a valid base URL");if("string"!=typeof t.baseUrl||0===t.baseUrl.length)return new c("The provided base URL is invalid: "+t.baseUrl);if(null===t.clientName||void 0===t.clientName)return new c("Must provide a valid client name");if("string"!=typeof t.clientName||0===t.clientName.length)return new c("The provided client name is invalid: "+t.clientName);const r=t.stateKey||"state",i=t.nonceKey||"nonce",g=t.urlPrefix||"",y=t.sessionStorageKey||"apiToken",_=t.sessionManager||new l(t.rta,t.domain,t.baseUrl),v={isHttpOnly:!0};e.state(i,Object.assign({},v,{isSameSite:"None",isSecure:!0})),e.state(r,Object.assign({},v,{isSameSite:"None",isSecure:!0})),e.state(i+"_compat",v),e.state(r+"_compat",v),e.route({method:"GET",path:g+"/login",options:{auth:!1},handler:function(e,n){const s=a.randomBytes(16).toString("hex"),o=a.randomBytes(16).toString("hex"),c=_.createAuthorizeUrl({redirectUri:f([p(e),g,"/login/callback"]),scopes:t.scopes,expiration:t.expiration,nonce:o,state:s});return n.redirect(c).state(i,o,{path:d(e)}).state(r,s,{path:d(e)}).state(i+"_compat",o,{path:d(e)}).state(r+"_compat",s,{path:d(e)})}}),e.route({method:"POST",path:g+"/login/callback",options:{auth:!1},handler:async function(a,c){var l;const g=n(o.verify),v=a.payload.id_token;try{l=o.decode(v,{complete:!0});const e=u.hapiJwt2Key({cache:!0,rateLimit:!0,jwksRequestsPerMinute:2,jwksUri:`${h("AUTH0_RTA")}/.well-known/jwks.json`}),t=n(e),r=await t(l);if(!r)return s.unauthorized("Invalid token");const i={audience:h("PUBLIC_WT_URL"),issuer:`${h("AUTH0_RTA")}/`,algorithms:["RS256"]};await g(v,r,i)}catch(e){l=null}if(!l)return s.unauthorized("Invalid token");if(a.state&&a.state[i]&&m(a.state[i],l.payload.nonce)||a.state&&a.state[i+"_compat"]&&m(a.state[i+"_compat"],l.payload.nonce))return s.badRequest("Nonce mismatch");if(a.state&&a.state[r]&&m(a.state[r],a.payload.state)||a.state&&a.state[r+"_compat"]&&m(a.state[r+"_compat"],a.payload.state))return s.badRequest("State mismatch");let b;try{b=await _.create(a.payload.id_token,a.payload.access_token,{secret:t.secret,issuer:t.baseUrl,audience:t.audience})}catch(t){return e.log(["error"],"Login callback failed",t),s.boomify(t)}return c.response('<% } %> <% if (assets.app) { %><% } %> <% if (assets.version) { %> - - + + <% } %> `; diff --git a/tests/unit/server/lib/users.tests.js b/tests/unit/server/lib/users.tests.js new file mode 100644 index 00000000..a5f5690b --- /dev/null +++ b/tests/unit/server/lib/users.tests.js @@ -0,0 +1,129 @@ +import { expect } from 'chai'; +import { getUsersById } from '../../../../server/lib/users'; + +describe('getUsersById', () => { + const makeClient = (getUserFn) => ({ + users: { + get: getUserFn + } + }); + + const successClient = (ids) => + makeClient(({ id }) => + Promise.resolve({ + data: { user_id: id, name: 'Test User', email: `${id}@example.com`, identities: [ { connection: 'test' } ] } + }) + ); + + it('should return users and total for the requested page', async () => { + const ids = [ 'auth0|user1', 'auth0|user2' ]; + const result = await getUsersById(successClient(ids), ids, 1, 10); + + expect(result.total).to.equal(2); + expect(result.users).to.have.length(2); + }); + + it('should return the full id list total even when paged', async () => { + const ids = [ 'auth0|user1', 'auth0|user2', 'auth0|user3' ]; + const result = await getUsersById(successClient(ids), ids, 1, 2); + + expect(result.total).to.equal(3); + expect(result.users).to.have.length(2); + }); + + it('should return the correct page of users', async () => { + const ids = [ 'auth0|user1', 'auth0|user2', 'auth0|user3' ]; + const result = await getUsersById(successClient(ids), ids, 2, 2); + + expect(result.total).to.equal(3); + expect(result.users).to.have.length(1); + expect(result.users[0].user_id).to.equal('auth0|user3'); + }); + + it('should treat page 0 the same as page 1', async () => { + const ids = [ 'auth0|user1', 'auth0|user2' ]; + + const page0 = await getUsersById(successClient(ids), ids, 0, 10); + const page1 = await getUsersById(successClient(ids), ids, 1, 10); + + expect(page0.users.map((u) => u.user_id)).to.deep.equal(page1.users.map((u) => u.user_id)); + }); + + it('should return users sorted by user_id', async () => { + const ids = [ 'auth0|user_b', 'auth0|user_a', 'auth0|user_c' ]; + const result = await getUsersById(successClient(ids), ids, 1, 10); + + expect(result.users.map((u) => u.user_id)).to.deep.equal([ + 'auth0|user_a', + 'auth0|user_b', + 'auth0|user_c' + ]); + }); + + it('should return a placeholder when a user fetch fails', async () => { + const ids = [ 'auth0|valid', 'auth0|missing' ]; + const client = makeClient(({ id }) => { + if (id === 'auth0|missing') { + const err = new Error('Not Found'); + err.name = 'NotFoundError'; + return Promise.reject(err); + } + return Promise.resolve({ + data: { user_id: id, name: 'Valid User', email: `${id}@example.com`, identities: [ { connection: 'test' } ] } + }); + }); + + const result = await getUsersById(client, ids, 1, 10); + + expect(result.total).to.equal(2); + expect(result.users).to.have.length(2); + + const placeholder = result.users.find((u) => u.user_id === 'auth0|missing'); + expect(placeholder).to.exist; + expect(placeholder.name).to.equal(''); + expect(placeholder.email).to.equal('auth0|missing'); + expect(placeholder.identities).to.deep.equal([ { connection: 'N/A' } ]); + }); + + it('should use statusCode in placeholder when error has no name', async () => { + const ids = [ 'auth0|user1' ]; + const client = makeClient(() => { + const err = new Error('Server Error'); + err.name = undefined; + err.statusCode = 500; + return Promise.reject(err); + }); + + const result = await getUsersById(client, ids, 1, 10); + + expect(result.users[0].name).to.equal(''); + }); + + it('should process more than 10 ids across multiple batches', async () => { + const count = 25; + const ids = Array.from({ length: count }, (_, i) => `auth0|user${String(i).padStart(2, '0')}`); + + let callCount = 0; + const client = makeClient(({ id }) => { + callCount++; + return Promise.resolve({ + data: { user_id: id, name: 'Test', email: `${id}@example.com`, identities: [] } + }); + }); + + const result = await getUsersById(client, ids, 1, 100); + + expect(result.total).to.equal(count); + expect(result.users).to.have.length(count); + expect(callCount).to.equal(count); + }); + + it('should not mutate the input ids array', async () => { + const ids = [ 'auth0|user1', 'auth0|user2', 'auth0|user3' ]; + const original = [ ...ids ]; + + await getUsersById(successClient(ids), ids, 1, 2); + + expect(ids).to.deep.equal(original); + }); +}); From 8d9d7e874714c42094a6b39bacfcf2dd88a52819 Mon Sep 17 00:00:00 2001 From: Tim Saunders Date: Tue, 14 Apr 2026 18:45:25 +0100 Subject: [PATCH 29/29] update version number in heading --- dist/auth0-authz.extension.2.13.3.js | 2 +- server/plugins/html.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/auth0-authz.extension.2.13.3.js b/dist/auth0-authz.extension.2.13.3.js index e6b3feaa..c446c8bb 100644 --- a/dist/auth0-authz.extension.2.13.3.js +++ b/dist/auth0-authz.extension.2.13.3.js @@ -1,2 +1,2 @@ /*! For license information please see auth0-authz.extension.2.13.3.js.LICENSE.txt */ -"use strict";var __webpack_modules__=[(e,t,r)=>{const n=r(1),s=r(4),a=r(5),{getWebtaskUrl:i}=r(7),o=(e,t)=>{a.info("Starting Authorization Extension - Version:","2.13.3"),a.info(" > WT_URL:",e("WT_URL")),a.info(" > PUBLIC_WT_URL:",e("PUBLIC_WT_URL"));return(0,r(9).default)(e,t)};e.exports=(e,t,r)=>{((e,t,r)=>{setImmediate((()=>{t.x_wt&&t.x_wt.ectx&&t.x_wt.ectx.PUBLIC_WT_URL||s.setValue("PUBLIC_WT_URL",i(t)),n.createServer(o)(e,t,r)}))})(e,t,r)}},(e,t,r)=>{const n=r(2),s=r(3);e.exports.createServer=function(e){return t=function(e){return t=>e((e=>t?.secrets?.[e]??null),t?.storage??null)}(e),async function(e,u,d){if(l=function(e){return e.read=e.secrets.EXT_STORAGE_URL?r:t,e.write=e.secrets.EXT_STORAGE_URL?i:a,e;function t(e,t,r){"function"==typeof t&&(r=t,t={}),r(n.preconditionFailed("Storage is not available in this context"))}function r(t,r,a){"function"==typeof r&&(a=r,r={}),s.get(e.secrets.EXT_STORAGE_URL).set(r.headers||{}).query({path:t}).then((e=>404===e.statusCode&&Object.hasOwnProperty.call(r,"defaultValue")?a(null,r.defaultValue):e.statusCode>=400?a(n.create(e.statusCode,e.body&&e.body.message)):a(null,e.body))).catch((e=>a(n.boomify(e,502))))}function a(e,t,r,s){"function"==typeof r&&(s=r,r={}),s(n.preconditionFailed("Storage is not available in this context"))}function i(t,r,a,i){"function"==typeof a&&(i=a,a={}),s.put(e.secrets.EXT_STORAGE_URL).set(a.headers||{}).query({path:t}).send(r).then((e=>e.statusCode>=400?i(n.create(e.statusCode,e.body&&e.body.message)):i(null))).catch((e=>i(n.boomify(e,502))))}}(e),null==r){if(!(r=await t(l)))throw new Error("Server factory did not return a server instance");r.ext("onRequest",(function(e,t){const r=function(e){if(!e.container)return null;const t=e.container.replace(a,"\\$&"),r=e.jtn?e.jtn.replace(a,"\\$&"):"";if(e.url_format===c)return new RegExp("^/api/run/"+t+"/(?:"+r+"/?)?");if(e.url_format===o)return new RegExp("^/"+t+"/(?:"+r+"/?)?");if(e.url_format===i)return new RegExp("^/(?:"+r+"/?)?");throw new Error("Unsupported webtask URL format.")}(e.raw.req.x_wt);return r&&(e.originalUrl=e.path,e.setUrl(`${e.path}${e.url.search}`.replace(r,"/"))),e.headers["x-forwarded-proto"]&&(e.headers["x-forwarded-proto"]=e.headers["x-forwarded-proto"].split(",").shift()),e.webtaskContext=l,t.continue}))}r.listener.emit("request",u,d)};var t,r,l};const a=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;const i=3,o=2,c=1},e=>{e.exports=require("@hapi/boom@10.0.1")},e=>{e.exports=require("superagent@10.2.3")},e=>{e.exports=function(){const e={};let t=null;const r=function(r){if(e&&e[r])return e[r];if(!t)throw new Error("A configuration provider has not been set");return t(r)};return r.setProvider=function(e){t=e},r.setValue=function(t,r){e[t]=r},r}()},(e,t,r)=>{const n=r(6),s=new n.createLogger({format:n.format.json(),transports:[new n.transports.Console({level:"debug",json:!1})],exitOnError:!1});e.exports=s},e=>{e.exports=require("winston@3.10.0")},(e,t,r)=>{const n=r(8);e.exports.getBasePath=function(e){return t=e.originalUrl||"",r=e.path,(s=(s=n.parse(t).pathname||"").replace(r,"").replace(/^\/|\/$/g,"")).startsWith("/")||(s="/"+s),s.endsWith("/")||(s+="/"),s;var t,r,s},e.exports.getBaseUrl=function(e,t){const r=n.parse(e.originalUrl||"").pathname||"";return n.format({protocol:t||"https",host:e.headers.host,pathname:r.replace(e.path,"").replace(/\/$/g,"")})};const s=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports.getWebtaskUrl=function(e){const t=function(e){if(!e.container)return null;const t=e.container.replace(s,"\\$&"),r=e.jtn?e.jtn.replace(s,"\\$&"):"";if(1===e.url_format)return new RegExp("^/api/run/"+t+"/(?:"+r+"/?)?");if(2===e.url_format)return new RegExp("^/"+t+"/(?:"+r+"/?)?");if(3===e.url_format)return new RegExp("^/(?:"+r+"/?)?");throw new Error("Unsupported webtask URL format.")}(e.x_wt),r=e.url,a=e.url.replace(t,"/"),i=n.parse(a||"").pathname,o=n.parse(r||"").pathname||"";var c=n.format({protocol:"https",host:e.headers.host,pathname:o.replace(i,"").replace(/\/$/g,"")});if(e.x_wt){const t=".it.auth0.com/api/run/"+e.x_wt.container+"/",r=function(e,t){if(!e)return null;const r=e.indexOf("sandbox8")>=0?"8":"";return"https://"+t+"."+(e.split(".it.auth0.com")[0].split("-")[1]||"us")+r+".webtask.io/"}(c,e.x_wt.container);c.indexOf(t)>=0&&(c=c.replace("https://"+e.headers.host+"/api/run/"+e.x_wt.container+"/",r))}return c}},e=>{e.exports=require("url")},(e,t,r)=>{r.r(t),r.d(t,{default:()=>p});var n=r(10),s=r(4),a=r.n(s),i=r(11),o=r(24),c=r(25),l=r(35),u=r(5),d=r.n(u);const p=(e,t,r)=>{null==r&&(r=e=>{if(e){d().error("Hapi initialization failed.");const{stack:t,details:r,message:n}=e;d().error({stack:t,details:r,message:n}),d().error(e)}else d().info("Hapi initialization completed.")}),a().setProvider((t=>e(t)||{WARN_DB_SIZE:409600,MAX_MULTISELECT_USERS:5,MULTISELECT_DEBOUNCE_MS:250,PER_PAGE:10,NODE_ENV:"production",CLIENT_VERSION:"2.13.3"}[t]));const s=a()("PUBLIC_WT_URL"),u="auth0c.com"===new n.URL(s).hostname.split(".").slice(-2).join(".");a().setValue("IS_LAYER0_TEST_SPACE",u);const p=(0,c.createProvider)(t),h=new i.default({provider:p});return(0,o.init)(h),(0,l.default)(r)}},e=>{e.exports=require("node:url")},(e,t,r)=>{r.r(t),r.d(t,{default:()=>u});var n=r(12),s=r.n(n),a=r(13),i=r(4),o=r.n(i),c=r(21).Buffer;const l=(e=[],t="Record with that identifier is already exists.",r)=>0===e.length||r&&1===e.length&&e[0]._id===r?null:Promise.reject(new a.ValidationError(t));class u{constructor(e={}){if(!e.provider)throw new a.ArgumentError("The 'provider' has to be set when initializing the database.");this.provider=e.provider}getStatus(){return o()("STORAGE_TYPE")&&"webtask"!==o()("STORAGE_TYPE")?Promise.resolve({size:null,type:o()("STORAGE_TYPE")}):this.provider.storageContext.read().then((e=>({size:c.byteLength(JSON.stringify(e),"utf8"),type:"default"})))}canChange(e,t,r){return this.provider.getAll(e).then((e=>s().filter(e,(e=>e[t]&&s().includes(e[t],r))))).then((r=>{if(r.length){const n=r.map((e=>e.name)).join(", "),s=`Unable to touch ${t} while used in ${e}: ${n}`;return Promise.reject(new a.ValidationError(s))}return Promise.resolve()}))}getApiKey(){return this.provider.getAll("configuration").then((e=>e.length?e[0].apikey:null))}updateApiKey(e){return this.provider.getAll("configuration").then((e=>e.length?e[0]:{})).then((t=>this.provider.update("configuration","v1",{...t,apikey:e},!0)))}getConfiguration(){return this.provider.getAll("configuration").then((e=>e.length?e[0]:null))}updateConfiguration(e){return this.provider.update("configuration","v1",e,!0)}getRules(){return this.provider.getAll("rules")}createRule(e){return this.provider.create("rules",e)}getPermissions(){return this.provider.getAll("permissions")}getPermission(e){return this.provider.get("permissions",e)}createPermission(e){return this.getPermissions().then((t=>l(t.filter((t=>t.name.toLowerCase()===e.name.toLowerCase()&&t.applicationId===e.applicationId)),`Permission with name "${e.name}" already exists for this application`))).then((()=>this.provider.create("permissions",e)))}updatePermission(e,t){return this.getPermissions().then((r=>l(r.filter((e=>e.name.toLowerCase()===t.name.toLowerCase()&&e.applicationId===t.applicationId)),`Permission with name "${t.name}" already exists for this application`,e))).then((()=>this.canChange("roles","permissions",e))).then((()=>this.canChange("groups","permissions",e))).then((()=>this.provider.update("permissions",e,t)))}deletePermission(e){return this.canChange("roles","permissions",e).then((()=>this.provider.delete("permissions",e)))}getRoles(){return this.provider.getAll("roles")}getRole(e){return this.provider.get("roles",e)}createRole(e){return this.getRoles().then((t=>l(t.filter((t=>t.name.toLowerCase()===e.name.toLowerCase()&&t.applicationId===e.applicationId)),`Role with name "${e.name}" already exists for this application`))).then((()=>this.provider.create("roles",e)))}updateRole(e,t){return this.getRoles().then((r=>l(r.filter((e=>e.name.toLowerCase()===t.name.toLowerCase()&&e.applicationId===t.applicationId)),`Role with name "${t.name}" already exists for this application`,e))).then((()=>this.provider.update("roles",e,t)))}deleteRole(e){return this.canChange("groups","roles",e).then((()=>this.provider.delete("roles",e)))}getGroups(){return this.provider.getAll("groups")}getGroup(e){return this.provider.get("groups",e)}createGroup(e){return this.getGroups().then((t=>l(t.filter((t=>t.name.toLowerCase()===e.name.toLowerCase())),`Group with name "${e.name}" already exists`))).then((()=>this.provider.create("groups",e)))}updateGroup(e,t){return this.getGroups().then((r=>l(r.filter((e=>e.name.toLowerCase()===t.name.toLowerCase())),`Group with name "${t.name}" already exists`,e))).then((()=>this.provider.update("groups",e,t)))}deleteGroup(e){return this.canChange("groups","nested",e).then((()=>this.provider.delete("groups",e)))}getApplications(){return this.provider.getAll("applications")}getApplication(e){return this.provider.get("applications",e)}updateApplication(e,t){return this.provider.update("applications",e,t,!0)}}},e=>{e.exports=require("lodash@4.17.21")},(e,t,r)=>{const n=r(14),s=r(15),a=r(16),i=r(17),o=r(18),c=r(19),l=r(20);e.exports={ArgumentError:n,ValidationError:s,HookTokenError:a,NotFoundError:i,ManagementApiError:o,UnauthorizedError:c,ForbiddenError:l},e.exports.ArgumentError=n,e.exports.ValidationError=s,e.exports.HookTokenError=a,e.exports.NotFoundError=i,e.exports.ManagementApiError=o,e.exports.UnauthorizedError=c,e.exports.ForbiddenError=l},e=>{class t extends Error{constructor(e){super(e),this.name="ArgumentError",this.status=400,this.statusCode=400,Error.captureStackTrace(this,this.constructor)}}e.exports=t},e=>{class t extends Error{constructor(e){super(e),this.name="ValidationError",this.status=400,this.statusCode=400,Error.captureStackTrace(this,this.constructor)}}e.exports=t},e=>{class t extends Error{constructor(e,t){super(e),this.name="HookTokenError",this.status=401,this.statusCode=401,this.innerError=t,Error.captureStackTrace(this,this.constructor)}}e.exports=t},e=>{class t extends Error{constructor(e){super(e),this.name="NotFoundError",this.status=404,this.statusCode=404,Error.captureStackTrace(this,this.constructor)}}e.exports=t},e=>{class t extends Error{constructor(e,t,r){super(t),this.name="ManagementApiError",this.code=e,this.status=r||500,this.statusCode=r||500,Error.captureStackTrace(this,this.constructor)}}e.exports=t},e=>{class t extends Error{constructor(e){super(e),this.name="UnauthorizedError",this.status=401,this.statusCode=401,Error.captureStackTrace(this,this.constructor)}}e.exports=t},e=>{class t extends Error{constructor(e){super(e),this.name="ForbiddenError",this.status=403,this.statusCode=403,Error.captureStackTrace(this,this.constructor)}}e.exports=t},(e,t,r)=>{var n=r(22),s=r(23),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50;var i=2147483647;function o(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|m(e,t),n=o(r),s=n.write(e,t);s!==r&&(n=n.slice(0,s));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(B(e,Uint8Array)){var t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(B(e,ArrayBuffer)||e&&B(e.buffer,ArrayBuffer))return h(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(B(e,SharedArrayBuffer)||e&&B(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);var s=function(e){if(c.isBuffer(e)){var t=0|f(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||J(e.length)?o(0):p(e);if("Buffer"===e.type&&Array.isArray(e.data))return p(e.data)}(e);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return u(e),o(e<0?0:0|f(e))}function p(e){for(var t=e.length<0?0:0|f(e.length),r=o(t),n=0;n=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function m(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||B(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var s=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return D(e).length;default:if(s)return n?-1:U(e).length;t=(""+t).toLowerCase(),s=!0}}function g(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,r);case"utf8":case"utf-8":return O(this,t,r);case"ascii":return T(this,t,r);case"latin1":case"binary":return C(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function _(e,t,r,n,s){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=s?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(s)return-1;r=e.length-1}else if(r<0){if(!s)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,s);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,s){var a,i=1,o=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;i=2,o/=2,c/=2,r/=2}function l(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(s){var u=-1;for(a=r;ao&&(r=o-c),a=r;a>=0;a--){for(var d=!0,p=0;ps&&(n=s):n=s;var a=t.length;n>a/2&&(n=a/2);for(var i=0;i>8,s=r%256,a.push(s),a.push(n);return a}(t,e.length-r),e,r,n)}function A(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function O(e,t,r){r=Math.min(e.length,r);for(var n=[],s=t;s239?4:l>223?3:l>191?2:1;if(s+d<=r)switch(d){case 1:l<128&&(u=l);break;case 2:128==(192&(a=e[s+1]))&&(c=(31&l)<<6|63&a)>127&&(u=c);break;case 3:a=e[s+1],i=e[s+2],128==(192&a)&&128==(192&i)&&(c=(15&l)<<12|(63&a)<<6|63&i)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:a=e[s+1],i=e[s+2],o=e[s+3],128==(192&a)&&128==(192&i)&&128==(192&o)&&(c=(15&l)<<18|(63&a)<<12|(63&i)<<6|63&o)>65535&&c<1114112&&(u=c)}null===u?(u=65533,d=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),s+=d}return function(e){var t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nn.length?c.from(a).copy(n,s):Uint8Array.prototype.set.call(n,a,s);else{if(!c.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,s)}s+=a.length}return n},c.byteLength=m,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},a&&(c.prototype[a]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,s){if(B(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),t<0||r>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=r)return 0;if(n>=s)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(s>>>=0)-(n>>>=0),i=(r>>>=0)-(t>>>=0),o=Math.min(a,i),l=this.slice(n,s),u=e.slice(t,r),d=0;d>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var s=this.length-t;if((void 0===r||r>s)&&(r=s),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return E(this,e,t,r);case"base64":return R(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var P=4096;function T(e,t,r){var n="";r=Math.min(e.length,r);for(var s=t;sn)&&(r=n);for(var s="",a=t;ar)throw new RangeError("Trying to access beyond buffer length")}function j(e,t,r,n,s,a){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||te.length)throw new RangeError("Index out of range")}function N(e,t,r,n,s,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function $(e,t,r,n,a){return t=+t,r>>>=0,a||N(e,0,r,4),s.write(e,t,r,n,23,4),r+4}function M(e,t,r,n,a){return t=+t,r>>>=0,a||N(e,0,r,8),s.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e],s=1,a=0;++a>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e+--t],s=1;t>0&&(s*=256);)n+=this[e+--t]*s;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e],s=1,a=0;++a=(s*=128)&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||x(e,t,this.length);for(var n=t,s=1,a=this[e+--n];n>0&&(s*=256);)a+=this[e+--n]*s;return a>=(s*=128)&&(a-=Math.pow(2,8*t)),a},c.prototype.readInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||x(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||x(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return e>>>=0,t||x(e,4,this.length),s.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||x(e,4,this.length),s.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||x(e,8,this.length),s.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||x(e,8,this.length),s.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||j(this,e,t,r,Math.pow(2,8*r)-1,0);var s=1,a=0;for(this[t]=255&e;++a>>=0,r>>>=0,n)||j(this,e,t,r,Math.pow(2,8*r)-1,0);var s=r-1,a=1;for(this[t+s]=255&e;--s>=0&&(a*=256);)this[t+s]=e/a&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var s=Math.pow(2,8*r-1);j(this,e,t,r,s-1,-s)}var a=0,i=1,o=0;for(this[t]=255&e;++a>0)-o&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var s=Math.pow(2,8*r-1);j(this,e,t,r,s-1,-s)}var a=r-1,i=1,o=0;for(this[t+a]=255&e;--a>=0&&(i*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/i>>0)-o&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeFloatLE=function(e,t,r){return $(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return $(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return M(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return M(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&r<57344){if(!s){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(i+1===n){(t-=3)>-1&&a.push(239,191,189);continue}s=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),s=r;continue}r=65536+(s-55296<<10|r-56320)}else s&&(t-=3)>-1&&a.push(239,191,189);if(s=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function D(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function L(e,t,r,n){for(var s=0;s=t.length||s>=e.length);++s)t[s+r]=e[s];return s}function B(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}var G=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,s=0;s<16;++s)t[n+s]=e[r]+e[s];return t}()},(e,t)=>{t.byteLength=function(e){var t=o(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,a=o(e),i=a[0],c=a[1],l=new s(function(e,t,r){return 3*(t+r)/4-r}(0,i,c)),u=0,d=c>0?i-4:i;for(r=0;r>16&255,l[u++]=t>>8&255,l[u++]=255&t;2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,l[u++]=255&t);1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t);return l},t.fromByteArray=function(e){for(var t,n=e.length,s=n%3,a=[],i=16383,o=0,l=n-s;ol?l:o+i));1===s?(t=e[n-1],a.push(r[t>>2]+r[t<<4&63]+"==")):2===s&&(t=(e[n-2]<<8)+e[n-1],a.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return a.join("")};for(var r=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)r[i]=a[i],n[a.charCodeAt(i)]=i;function o(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,n){for(var s,a,i=[],o=t;o>18&63]+r[a>>12&63]+r[a>>6&63]+r[63&a]);return i.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},(e,t)=>{t.read=function(e,t,r,n,s){var a,i,o=8*s-n-1,c=(1<>1,u=-7,d=r?s-1:0,p=r?-1:1,h=e[t+d];for(d+=p,a=h&(1<<-u)-1,h>>=-u,u+=o;u>0;a=256*a+e[t+d],d+=p,u-=8);for(i=a&(1<<-u)-1,a>>=-u,u+=n;u>0;i=256*i+e[t+d],d+=p,u-=8);if(0===a)a=1-l;else{if(a===c)return i?NaN:1/0*(h?-1:1);i+=Math.pow(2,n),a-=l}return(h?-1:1)*i*Math.pow(2,a-n)},t.write=function(e,t,r,n,s,a){var i,o,c,l=8*a-s-1,u=(1<>1,p=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,f=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,i=u):(i=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-i))<1&&(i--,c*=2),(t+=i+d>=1?p/c:p*Math.pow(2,1-d))*c>=2&&(i++,c/=2),i+d>=u?(o=0,i=u):i+d>=1?(o=(t*c-1)*Math.pow(2,s),i+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,s),i=0));s>=8;e[r+h]=255&o,h+=f,o/=256,s-=8);for(i=i<0;e[r+h]=255&i,h+=f,i/=256,l-=8);e[r+h-f]|=128*m}},e=>{let t=null;e.exports.init=e=>{t=e},e.exports.getDb=()=>{if(!t)throw new Error("The database has not been initialized.");return t}},(e,t,r)=>{const n=r(26),s=r(27),a=r(29),i=r(30),{S3StorageContext:o}=r(33),c=r(4),l=r(5);e.exports={createProvider:function(e){if("s3"===c("STORAGE_TYPE")){l.info("Initializing the S3 Storage Context.");const e=new o({path:c("S3_PATH"),bucket:c("S3_BUCKET"),keyId:c("S3_KEY"),keySecret:c("S3_SECRET"),defaultData:{}});return new i(e,{concurrentWrites:!1})}{l.info("Initializing the Webtask Storage Context.");const t=e?new a(e,{force:0}):new s(n.join(__dirname,"../../data.json"),{mergeWrites:!0});return new i(t,{concurrentWrites:!1})}}}},e=>{e.exports=require("path")},(e,t,r)=>{const n=r(28),s=r(13).ArgumentError;function a(e,t){if(null==e)throw new s("Must provide the path to the file");if("string"!=typeof e||0===e.length)throw new s("The provided path is invalid: "+e);t=t||{mergeWrites:!0},this.path=e,this.mergeWrites=t.mergeWrites,this.defaultData=t.defaultData||{}}a.prototype.read=function(){const e=this;return new Promise((function(t,r){n.readFile(e.path,"utf8",(function(n,s){if(n)return"ENOENT"===n.code?t(e.defaultData):r(n);try{return s&&s.length?t(JSON.parse(s)):t(e.defaultData)}catch(e){return r(e)}}))}))},a.prototype.write=function(e){const t=this;let r=Promise.resolve(e);return t.mergeWrites&&(r=r.then((function(e){return t.read().then((function(t){return Object.assign({},t,e)}))}))),r.then((function(e){return new Promise((function(r,s){try{return n.writeFile(t.path,JSON.stringify(e,null,2),"utf8",(function(e){return e?s(e):r()}))}catch(e){return s(e)}}))}))},e.exports=a},e=>{e.exports=require("fs")},(e,t,r)=>{const n=r(13).ArgumentError;function s(e,t){if(null==e)throw new n("Must provide the Webtask storage object");t=t||{force:1},this.storage=e,this.options=t,this.defaultData=t.defaultData||{}}s.prototype.read=function(){const e=this;return new Promise((function(t,r){e.storage.get((function(n,s){return n?r(n):t(s||e.defaultData)}))}))},s.prototype.write=function(e){const t=this;return new Promise((function(r,n){t.storage.set(e,t.options,(function(e){return e?n(e):r()}))}))},s.prototype.writeRetryCondition=function(e){return 409===e.code},e.exports=s},(e,t,r)=>{const n=r(31),s=r(32),a=r(13).ArgumentError,i=r(13).NotFoundError,o=r(13).ValidationError,c=function(e,t){return e.read().then((function(e){return e[t]=e[t]||[],e}))},l=function(e,t){const r={retries:10,factor:2,minTimeout:100,maxTimeout:1/0,randomize:!1};return function(){return function(e,t){let r=0;const n=t.retries||10,s=t.factor||2,a=t.minTimeout||100,i=t.maxTimeout||1/0,o=function(t){if(r++,r>n)return Promise.reject(t);const c=Math.min(a*Math.pow(s,r-1),i);return new Promise((function(e){setTimeout(e,c)})).then((function(){return e(o)}))};return e(o)}((function(r){return t().catch((function(t){if((e.writeRetryCondition||function(){return!1})(t))return r(t);throw t}))}),r)}};function u(e,t){if(null==e)throw new a("Must provide a storage context");this.storageContext=e,this.queue=s(),this.options=t||{concurrentWrites:!0}}u.prototype.write=function(e,t){const r=l(e,t);if(this.options.concurrentWrites)return r();const n=this.queue;return new Promise((function(e,t){n(r,(function(r,n){return r?t(r):e(n)}))}))},u.prototype.getAll=function(e){return c(this.storageContext,e).then((function(t){return t[e]}))},u.prototype.get=function(e,t){return this.getAll(e).then((function(r){const n=r.find((function(e){return e._id===t}));return n||Promise.reject(new i("The record "+t+" in "+e+" does not exist."))}))},u.prototype.create=function(e,t){const r=this.storageContext;return this.write(r,(function(){return c(r,e).then((function(s){t._id||(t._id=n.v4());return s[e].findIndex((function(e){return e._id===t._id}))>-1?Promise.reject(new o("The record "+t._id+" in "+e+" already exists.")):(s[e].push(t),r.write(s).then((function(){return t})))}))}))},u.prototype.update=function(e,t,r,n){const s=this.storageContext;return this.write(s,(function(){return c(s,e).then((function(a){const o=a[e].findIndex((function(e){return e._id===t}));if(o<0&&!n)throw new i("The record "+t+" in "+e+" does not exist.");const c=Object.assign({_id:t},o<0?{}:a[e][o],r);return o<0?a[e].push(c):a[e][o]=c,s.write(a).then((function(){return c}))}))}))},u.prototype.delete=function(e,t){const r=this.storageContext;return this.write(r,(function(){return c(r,e).then((function(n){const s=n[e].findIndex((function(e){return e._id===t}));return!(s<0)&&(n[e].splice(s,1),r.write(n).then((function(){return!0})))}))}))},e.exports=u},e=>{e.exports=require("node-uuid@1.4.8")},e=>{e.exports=function(){const e=[];let t=!1;const r=function(){if(0===e.length)return void(t=!1);t=!0;const n=e.shift(),s=n.action((function(e,t){n.callback(e,t),r()}));s&&"function"==typeof s.then&&s.then((function(e){n.callback(null,e),r()})).catch((function(e){n.callback(e),r()}))};return function(n,s){e.push({action:n,callback:s}),t||r()}}},(e,t,r)=>{r.r(t),r.d(t,{S3StorageContext:()=>i});var n=r(34),s=r(13);const a=r(5);class i{#e=["AuthorizationHeaderMalformed","BadRequest","PermanentRedirect",301];constructor(e){if(null==e)throw new s.ArgumentError("The 'options' object is required when configuring the S3StorageContext.");if(!e.path||0===e.path.length)throw new s.ArgumentError("The 'path' property is required when configuring the S3StorageContext.");if(!e.bucket||0===e.bucket.length)throw new s.ArgumentError("The 'bucket' property is required when configuring the S3StorageContext.");if(!e.keyId||0===e.keyId.length)throw new s.ArgumentError("The 'keyId' property is required when configuring the S3StorageContext.");if(!e.keySecret||0===e.keySecret.length)throw new s.ArgumentError("The 'keySecret' property is required when configuring the S3StorageContext.");this.options=e,this.defaultData=e.defaultData||{},this.#t()}async read(){return this.#r((async()=>{const e={Key:this.options.path,Bucket:this.options.bucket};try{const t=await this.s3Client.send(new n.GetObjectCommand(e)),r=await(t?.Body?.transformToString());return r?JSON.parse(r):this.defaultData}catch(e){if("NoSuchKey"===e.Code)return this.defaultData;throw e}}))}async write(e){return this.#r((async()=>{const t={Key:this.options.path,Bucket:this.options.bucket,Body:JSON.stringify(e,null,2),ContentType:"application/json"};await this.s3Client.send(new n.PutObjectCommand(t))}))}async#r(e){try{return await e()}catch(t){a.info("Trying to resolve s3 bucket region...");const r=t.$response?.headers["x-amz-bucket-region"]||null,n=await this.s3Client.config.region();if(-1!==this.#e.indexOf(t.Code)&&r&&r!==n)return a.info(`Resolved following s3 bucket region: ${r}.`),this.#t(r),await e();throw t}}#t(e="us-east-1"){this.s3Client=new n.S3Client({credentials:{accessKeyId:this.options.keyId,secretAccessKey:this.options.keySecret},region:e})}}},e=>{e.exports=require("@aws-sdk/client-s3@3.738.0")},(e,t,r)=>{r.r(t),r.d(t,{default:()=>b});var n=r(36),s=r.n(n),a=r(37),i=r(107),o=r.n(i),c=r(108),l=r.n(c),u=r(109),d=r.n(u),p=r(110),h=r.n(p),f=r(4),m=r.n(f),g=r(5),y=r.n(g),_=r(150),v=r.n(_);const b=async()=>{const e={plugin:{...r(409).plugin,name:"@hapi/good"},options:{ops:{interval:3e4},reporters:{console:[]}}};e.options.reporters.console.push(new(d())({color:!!m()("LOG_COLOR")})),e.options.reporters.console.push("stdout");const t=new(s().Server)({host:"localhost",port:3e3,routes:{cors:!0}});t.validator(h());const n=[e,{plugin:{...a,name:"inert"}},{plugin:{...o(),name:"blipp"}},{plugin:{...l(),name:"jwt"}}];return await t.register([...n,...v()]),y().debug=(...e)=>{t.log(["debug"],e.join(" "))},y().info=(...e)=>{t.log(["info"],e.join(" "))},y().error=(...e)=>{t.log(["error"],e.join(" "))},t.ext("onPreResponse",((e,r)=>{const n=e.response?.statusCode??e.response?.status;if(n>=400){e.response.output.statusCode=n;let t=e.response.name;t&&["ValidationError","NotFoundError","ArgumentError"].includes(t)||(400===n?t="Bad Request":401===n?t="Unauthorized":403===n?t="Forbidden":404===n?t="Not Found":429===n&&(t="Too Many Requests")),e.response.output.payload={statusCode:n,error:t,message:e.response.message}}return e.response&&e.response.isBoom&&(t.log(["error"],`Request: ${e.method.toUpperCase()} ${e.path}`),t.log(["error"],`Response: ${JSON.stringify(e.response,null,2)}`)),r.continue})),t}},e=>{e.exports=require("@hapi/hapi@21.3.3")},(e,t,r)=>{const n=r(38),s=r(63),a=r(93),i=r(99),o=r(96),c={schema:s.object({etagsCacheMaxSize:s.number().integer().min(0).default(1e3)}).required(),fileMethod:function(e,t={}){return void 0!==t.confine&&!0!==t.confine||(t.confine="."),n.assert(void 0===t.end||+t.start<=+t.end,"options.start must be less than or equal to options.end"),this.response(o.response(e,t,this.request))}};t.plugin={pkg:r(106),once:!0,requirements:{hapi:">=20.0.0"},register(e,t){n.assert(0===Object.keys(t).length,"Inert does not support registration options");const r=s.attempt(e.settings.plugins?.inert??{},c.schema,'Invalid "inert" server options');e.expose("_etags",r.etagsCacheMaxSize>0?new i.Cache({max:r.etagsCacheMaxSize}):null),e.decorate("handler","file",o.handler),e.decorate("handler","directory",a.handler),e.decorate("toolkit","file",c.fileMethod)}}},(e,t,r)=>{t.applyToDefaults=r(39),t.assert=r(40),t.Bench=r(48),t.block=r(49),t.clone=r(43),t.contain=r(51),t.deepEqual=r(52),t.Error=r(41),t.escapeHeaderAttribute=r(54),t.escapeHtml=r(55),t.escapeJson=r(56),t.escapeRegex=r(53),t.flatten=r(57),t.ignore=r(50),t.intersect=r(58),t.isPromise=r(59),t.merge=r(47),t.once=r(60),t.reach=r(44),t.reachTemplate=r(61),t.stringify=r(42),t.wait=r(62)},(e,t,r)=>{const n=r(40),s=r(43),a=r(47),i=r(44),o={};e.exports=function(e,t,r={}){if(n(e&&"object"==typeof e,"Invalid defaults value: must be an object"),n(!t||!0===t||"object"==typeof t,"Invalid source value: must be true, falsy or an object"),n("object"==typeof r,"Invalid options: must be an object"),!t)return null;if(r.shallow)return o.applyToDefaultsWithShallow(e,t,r);const i=s(e);if(!0===t)return i;const c=void 0!==r.nullOverride&&r.nullOverride;return a(i,t,{nullOverride:c,mergeArrays:!1})},o.applyToDefaultsWithShallow=function(e,t,r){const c=r.shallow;n(Array.isArray(c),"Invalid keys");const l=new Map,u=!0===t?null:new Set;for(let r of c){r=Array.isArray(r)?r:r.split(".");const n=i(e,r);n&&"object"==typeof n?l.set(n,u&&i(t,r)||n):u&&u.add(r)}const d=s(e,{},l);if(!u)return d;for(const e of u)o.reachCopy(d,t,e);const p=void 0!==r.nullOverride&&r.nullOverride;return a(d,t,{nullOverride:p,mergeArrays:!1})},o.reachCopy=function(e,t,r){for(const e of r){if(!(e in t))return;const r=t[e];if("object"!=typeof r||null===r)return;t=r}const n=t;let s=e;for(let e=0;e{const n=r(41);e.exports=function(e,...t){if(!e){if(1===t.length&&t[0]instanceof Error)throw t[0];throw new n(t)}}},(e,t,r)=>{const n=r(42);e.exports=class extends Error{constructor(e){super(e.filter((e=>""!==e)).map((e=>"string"==typeof e?e:e instanceof Error?e.message:n(e))).join(" ")||"Unknown error"),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t.assert)}}},e=>{e.exports=function(...e){try{return JSON.stringify(...e)}catch(e){return"[Cannot display object: "+e.message+"]"}}},(e,t,r)=>{var n=r(21).Buffer;const s=r(44),a=r(45),i=r(46),o={needsProtoHack:new Set([a.set,a.map,a.weakSet,a.weakMap])};e.exports=o.clone=function(e,t={},r=null){if("object"!=typeof e||null===e)return e;let s=o.clone,c=r;if(t.shallow){if(!0!==t.shallow)return o.cloneWithShallow(e,t);s=e=>e}else if(c){const t=c.get(e);if(t)return t}else c=new Map;const l=a.getInternalProto(e);if(l===a.buffer)return n&&n.from(e);if(l===a.date)return new Date(e.getTime());if(l===a.regex)return new RegExp(e);const u=o.base(e,l,t);if(u===e)return e;if(c&&c.set(e,u),l===a.set)for(const r of e)u.add(s(r,t,c));else if(l===a.map)for(const[r,n]of e)u.set(r,s(n,t,c));const d=i.keys(e,t);for(const r of d){if("__proto__"===r)continue;if(l===a.array&&"length"===r){u.length=e.length;continue}const n=Object.getOwnPropertyDescriptor(e,r);n?n.get||n.set?Object.defineProperty(u,r,n):n.enumerable?u[r]=s(e[r],t,c):Object.defineProperty(u,r,{enumerable:!1,writable:!0,configurable:!0,value:s(e[r],t,c)}):Object.defineProperty(u,r,{enumerable:!0,writable:!0,configurable:!0,value:s(e[r],t,c)})}return u},o.cloneWithShallow=function(e,t){const r=t.shallow;(t=Object.assign({},t)).shallow=!1;const n=new Map;for(const t of r){const r=s(e,t);"object"!=typeof r&&"function"!=typeof r||n.set(r,r)}return o.clone(e,t,n)},o.base=function(e,t,r){if(!1===r.prototype)return o.needsProtoHack.has(t)?new t.constructor:t===a.array?[]:{};const n=Object.getPrototypeOf(e);if(n&&n.isImmutable)return e;if(t===a.array){const e=[];return n!==t&&Object.setPrototypeOf(e,n),e}if(o.needsProtoHack.has(t)){const e=new n.constructor;return n!==t&&Object.setPrototypeOf(e,n),e}return Object.create(n)}},(e,t,r)=>{const n=r(40),s={};e.exports=function(e,t,r){if(!1===t||null==t)return e;"string"==typeof(r=r||{})&&(r={separator:r});const a=Array.isArray(t);n(!a||!r.separator,"Separator option is not valid for array-based chain");const i=a?t:t.split(r.separator||".");let o=e;for(let e=0;e{var n=r(21).Buffer;const s={};t=e.exports={array:Array.prototype,buffer:n&&n.prototype,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},s.typeMap=new Map([["[object Error]",t.error],["[object Map]",t.map],["[object Promise]",t.promise],["[object Set]",t.set],["[object WeakMap]",t.weakMap],["[object WeakSet]",t.weakSet]]),t.getInternalProto=function(e){if(Array.isArray(e))return t.array;if(n&&e instanceof n)return t.buffer;if(e instanceof Date)return t.date;if(e instanceof RegExp)return t.regex;if(e instanceof Error)return t.error;const r=Object.prototype.toString.call(e);return s.typeMap.get(r)||t.generic}},(e,t)=>{t.keys=function(e,t={}){return!1!==t.symbols?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}},(e,t,r)=>{var n=r(21).Buffer;const s=r(40),a=r(43),i=r(46),o={};e.exports=o.merge=function(e,t,r){if(s(e&&"object"==typeof e,"Invalid target value: must be an object"),s(null==t||"object"==typeof t,"Invalid source value: must be null, undefined, or an object"),!t)return e;if(r=Object.assign({nullOverride:!0,mergeArrays:!0},r),Array.isArray(t)){s(Array.isArray(e),"Cannot merge array onto an object"),r.mergeArrays||(e.length=0);for(let n=0;n{const t={};e.exports=t.Bench=class{constructor(){this.ts=0,this.reset()}reset(){this.ts=t.Bench.now()}elapsed(){return t.Bench.now()-this.ts}static now(){const e=process.hrtime();return 1e3*e[0]+e[1]/1e6}}},(e,t,r)=>{const n=r(50);e.exports=function(){return new Promise(n)}},e=>{e.exports=function(){}},(e,t,r)=>{const n=r(40),s=r(52),a=r(53),i=r(46),o={};e.exports=function(e,t,r={}){return"object"!=typeof t&&(t=[t]),n(!Array.isArray(t)||t.length,"Values array cannot be empty"),"string"==typeof e?o.string(e,t,r):Array.isArray(e)?o.array(e,t,r):(n("object"==typeof e,"Reference must be string or an object"),o.object(e,t,r))},o.array=function(e,t,r){if(Array.isArray(t)||(t=[t]),!e.length)return!1;if(r.only&&r.once&&e.length!==t.length)return!1;let n;const s=new Map;for(const e of t)if(r.deep&&e&&"object"==typeof e){n=n||o.compare(r);let t=!1;for(const[r,a]of s.entries())if(n(r,e)){++a.allowed,t=!0;break}t||s.set(e,{allowed:1,hits:0})}else{const t=s.get(e);t?++t.allowed:s.set(e,{allowed:1,hits:0})}let a=0;for(const t of e){let e;if(r.deep&&t&&"object"==typeof t){n=n||o.compare(r);for(const[r,a]of s.entries())if(n(r,t)){e=a;break}}else e=s.get(t);if(e&&(++e.hits,++a,r.once&&e.hits>e.allowed))return!1}if(r.only&&a!==e.length)return!1;for(const e of s.values())if(e.hits!==e.allowed&&e.hitst.propertyIsEnumerable(e))),c=[...Object.keys(t),...a],l=o.compare(r),u=new Set(c);for(const n of s)if(u.has(n)){if(!l(t[n],e[n]))return!1;u.delete(n)}else if(r.only)return!1;return!u.size||!!r.part&&u.size""!==e));const s=new Map,i=[];for(const e of t)if(n("string"==typeof e,"Cannot compare string reference to non-string value"),e){const t=s.get(e);t?++t.allowed:(s.set(e,{allowed:1,hits:0}),i.push(a(e)))}else if(r.once||r.only)return!1;if(!i.length)return!0;const o=new RegExp(`(${i.join("|")})`,"g"),c=e.replace(o,((e,t)=>(++s.get(t).hits,"")));if(r.only&&c)return!1;let l=!1;for(const e of s.values())if(e.hits&&(l=!0),e.hits!==e.allowed){if(e.hitss(e,t,n)},o.shallow=function(e,t){return e===t}},(e,t,r)=>{var n=r(21).Buffer;const s=r(45),a={mismatched:null};e.exports=function(e,t,r){return r=Object.assign({prototype:!0},r),!!a.isDeepEqual(e,t,r,[])},a.isDeepEqual=function(e,t,r,i){if(e===t)return 0!==e||1/e==1/t;const o=typeof e;if(o!==typeof t)return!1;if(null===e||null===t)return!1;if("function"===o){if(!r.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==o)return e!=e&&t!=t;const c=a.getSharedType(e,t,!!r.prototype);switch(c){case s.buffer:return n&&n.prototype.equals.call(e,t);case s.promise:return e===t;case s.regex:return e.toString()===t.toString();case a.mismatched:return!1}for(let r=i.length-1;r>=0;--r)if(i[r].isSame(e,t))return!0;i.push(new a.SeenEntry(e,t));try{return!!a.isDeepEqualObj(c,e,t,r,i)}finally{i.pop()}},a.getSharedType=function(e,t,r){if(r)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?a.mismatched:s.getInternalProto(e);const n=s.getInternalProto(e);return n!==s.getInternalProto(t)?a.mismatched:n},a.valueOf=function(e){const t=e.valueOf;if(void 0===t)return e;try{return t.call(e)}catch(e){return e}},a.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)},a.isSetSimpleEqual=function(e,t){for(const r of Set.prototype.values.call(e))if(!Set.prototype.has.call(t,r))return!1;return!0},a.isDeepEqualObj=function(e,t,r,n,i){const{isDeepEqual:o,valueOf:c,hasOwnEnumerableProperty:l}=a,{keys:u,getOwnPropertySymbols:d}=Object;if(e===s.array){if(!n.part){if(t.length!==r.length)return!1;for(let e=0;e{e.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},(e,t,r)=>{const n=r(40);e.exports=function(e){return n(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(e),"Bad attribute value ("+e+")"),e.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')}},e=>{const t={};e.exports=function(e){if(!e)return"";let r="";for(let n=0;n=256)return"&#"+e+";";return`&#x${e.toString(16).padStart(2,"0")};`},t.isSafe=function(e){return t.safeCharCodes.has(e)},t.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]),t.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&e.add(t);return e}()},e=>{const t={};e.exports=function(e){return e?e.replace(/[<>&\u2028\u2029]/g,t.escape):""},t.escape=function(e){return t.replacements.get(e)},t.replacements=new Map([["<","\\u003c"],[">","\\u003e"],["&","\\u0026"],["\u2028","\\u2028"],["\u2029","\\u2029"]])},e=>{const t={};e.exports=t.flatten=function(e,r){const n=r||[];for(const r of e)Array.isArray(r)?t.flatten(r,n):n.push(r);return n}},e=>{const t={};e.exports=function(e,r,n={}){if(!e||!r)return n.first?null:[];const s=[],a=Array.isArray(e)?new Set(e):e,i=new Set;for(const e of r)if(t.has(a,e)&&!i.has(e)){if(n.first)return e;s.push(e),i.add(e)}return n.first?null:s},t.has=function(e,t){return"function"==typeof e.has?e.has(t):void 0!==e[t]}},e=>{e.exports=function(e){return!!e&&"function"==typeof e.then}},e=>{const t=Symbol("wrapped");e.exports=function(e){if(e[t])return e;let r=!1;const n=function(...t){r||(r=!0,e(...t))};return n[t]=!0,n}},(e,t,r)=>{const n=r(44);e.exports=function(e,t,r){return t.replace(/{([^{}]+)}/g,((t,s)=>{const a=n(e,s,r);return null==a?"":a}))}},e=>{const t=2**31-1;e.exports=function(e,r,n){if("bigint"==typeof e&&(e=Number(e)),e>=Number.MAX_SAFE_INTEGER&&(e=1/0),"number"!=typeof e&&void 0!==e)throw new TypeError("Timeout must be a number or bigint");return new Promise((s=>{const a=n?n.setTimeout:setTimeout,i=()=>{const n=Math.min(e,t);e-=n,a((()=>e>0?i():s(r)),n)};e!==1/0&&i()}))}},(e,t,r)=>{var n=r(21).Buffer;const s=r(40),a=r(43),i=r(64),o=r(70),c=r(71),l=r(69),u={types:{alternatives:r(73),any:r(74),array:r(81),boolean:r(82),date:r(83),function:r(84),link:r(87),number:r(88),object:r(89),string:r(90),symbol:r(91)},aliases:{alt:"alternatives",bool:"boolean",func:"function"}};n&&(u.types.binary=r(92)),u.root=function(){const e={_types:new Set(Object.keys(u.types))};for(const t of e._types)e[t]=function(...e){return s(!e.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),u.generate(this,u.types[t],e)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(...e){return this.any()[t](...e)};Object.assign(e,u.methods);for(const t in u.aliases){const r=u.aliases[t];e[t]=e[r]}return e},u.methods={ValidationError:c.ValidationError,version:i.version,assert(e,t,...r){u.assert(e,t,!0,r)},attempt:(e,t,...r)=>u.assert(e,t,!1,r),checkPreferences(e){i.checkPreferences(e)},compile(e,t){return o.compile(this,e,t)},isError:c.ValidationError.isError,isRef:l.isRef,isSchema:i.isSchema,in:(...e)=>l.in(...e),override:i.symbols.override,ref:(...e)=>l.create(...e)},u.assert=function(e,t,r,n){const s=n[0]instanceof Error||"string"==typeof n[0]?n[0]:null,o=s?n[1]:n[0],l=t.validate(e,i.preferences({errors:{stack:!0}},o||{}));let u=l.error;if(!u)return l.value;if(s instanceof Error)throw s;const d=r&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof c.ValidationError==!1&&(u=a(u)),u.message=s?`${s} ${d}`:d,u},u.generate=function(e,t,r){return s(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&r.length?t._definition.args(t,...r):t},e.exports=u.root()},(e,t,r)=>{const n=r(40),s=r(41),a=r(65);let i,o;const c={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};t.version=a.version,t.defaults={abortEarly:!0,allowUnknown:!1,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1},t.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},t.assertOptions=function(e,t,r="Options"){n(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const s=Object.keys(e).filter((e=>!t.includes(e)));n(0===s.length,`${r} contain unknown keys: ${s}`)},t.checkPreferences=function(e){o=o||r(66);const t=o.preferences.validate(e);if(t.error)throw new s([t.error.details[0].message])},t.compare=function(e,t,r){switch(r){case"=":return e===t;case">":return e>t;case"<":return e=":return e>=t;case"<=":return e<=t}},t.default=function(e,t){return void 0===e?t:e},t.isIsoDate=function(e){return c.isoDate.test(e)},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.isResolvable=function(e){return!!e&&(e[t.symbols.ref]||e[t.symbols.template])},t.isSchema=function(e,r={}){return!(!e||!e[t.symbols.any])},t.limit=function(e){return Number.isSafeInteger(e)&&e>=0},t.preferences=function(e,n){i=i||r(67),e=e||{},n=n||{};const s=Object.assign({},e,n);return n.errors&&e.errors&&(s.errors=Object.assign({},e.errors,n.errors),s.errors.wrap=Object.assign({},e.errors.wrap,n.errors.wrap)),n.messages&&(s.messages=i.compile(n.messages,e.messages)),delete s[t.symbols.prefs],s},t.tryWithPath=function(e,t,r={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,r.append&&(e.message=`${e.message} (${e.path})`),e}},t.validateArg=function(e,r,{assert:n,message:s}){if(t.isSchema(n)){const t=n.validate(e);if(!t.error)return;return t.error.message}if(!n(e))return r?`${r} ${s}`:s},t.verifyFlat=function(e,t){for(const r of e)n(!Array.isArray(r),"Method no longer accepts array arguments:",t)}},e=>{e.exports=JSON.parse('{"name":"@hapi/validate","description":"Object schema validation","version":"1.1.3","repository":"git://github.com/hapijs/validate","main":"lib/index.js","files":["lib/**/*"],"dependencies":{"@hapi/hoek":"^9.0.0","@hapi/topo":"^5.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/lab":"24.x.x"},"scripts":{"test":"lab -t 100 -a @hapi/code -L","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause"}')},(e,t,r)=>{const n=r(63),s={};s.wrap=n.string().min(1).max(2).allow(!1),t.preferences=n.object({allowUnknown:n.boolean(),abortEarly:n.boolean(),context:n.object(),convert:n.boolean(),dateFormat:n.valid("date","iso","string","time","utc"),errors:{escapeHtml:n.boolean(),label:n.valid("path","key",!1),language:[n.string(),n.object().ref()],render:n.boolean(),stack:n.boolean(),wrap:{label:s.wrap,array:s.wrap}},messages:n.object(),noDefaults:n.boolean(),nonEnumerables:n.boolean(),presence:n.valid("required","optional","forbidden"),skipFunctions:n.boolean(),stripUnknown:n.object({arrays:n.boolean(),objects:n.boolean()}).or("arrays","objects").allow(!0,!1)}).strict()},(e,t,r)=>{const n=r(40),s=r(43),a=r(68);t.compile=function(e,t){if("string"==typeof e)return n(!t,"Cannot set single message string"),new a(e);if(a.isTemplate(e))return n(!t,"Cannot set single message template"),e;n("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?s(t):{};for(let r in e){const s=e[r];if("root"===r||a.isTemplate(s)){t[r]=s;continue}if("string"==typeof s){t[r]=new a(s);continue}n("object"==typeof s&&!Array.isArray(s),"Invalid message for",r);const i=r;for(r in t[i]=t[i]||{},s){const e=s[r];"root"===r||a.isTemplate(e)?t[i][r]=e:(n("string"==typeof e,"Invalid message for",r,"in",i),t[i][r]=new a(e))}}return t},t.merge=function(e,r){if(!e)return t.compile(r);if(!r)return e;if("string"==typeof r)return new a(r);if(a.isTemplate(r))return r;const i=s(e);for(let e in r){const t=r[e];if("root"===e||a.isTemplate(t)){i[e]=t;continue}if("string"==typeof t){i[e]=new a(t);continue}n("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const s=e;for(e in i[s]=i[s]||{},t){const r=t[e];"root"===e||a.isTemplate(r)?i[s][e]=r:(n("string"==typeof r,"Invalid message for",e,"in",s),i[s][e]=new a(r))}}return i}},(e,t,r)=>{const n=r(40),s=r(43),a=r(55),i=r(64),o=r(69),c={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};e.exports=c.Template=class{constructor(e,t){n("string"==typeof e,"Template source must be a string"),n(!e.includes("\0")&&!e.includes(""),"Template source cannot contain reserved control characters"),this.source=e,this.rendered=e,this._template=null,this._settings=s(t),this._parse()}_parse(){if(!this.source.includes("{"))return;const e=c.encode(this.source),t=c.split(e),r=[],n=t.shift();n&&r.push(n);for(const e of t){const t="{"!==e[0],n=t?"}":"}}",s=e.indexOf(n);let a=e.slice(t?0:1,s);const i=":"===a[0];i&&(a=a.slice(1));const o=this._ref(c.decode(a),{raw:t,wrapped:i});r.push(o);const l=e.slice(s+n.length);l&&r.push(c.decode(l))}this._template=r}static date(e,t){return c.dateFormat[t.dateFormat].call(e)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[i.symbols.template]}render(e,t,r,n,s={}){if(!this.isDynamic())return this.rendered;const i=[];for(const o of this._template)if("string"==typeof o)i.push(o);else{const l=o.ref.resolve(e,t,r,n,s),u=c.stringify(l,r,s.errors),d=o.raw||!1===(s.errors&&s.errors.escapeHtml)?u:a(u);i.push(c.wrap(d,o.wrapped&&r.errors.wrap.label))}return i.join("")}_ref(e,{raw:t,wrapped:r}){const n=o.create(e,this._settings);return{ref:n,raw:t,wrapped:r||"local"===n.type&&"label"===n.key}}toString(){return this.source}},c.Template.prototype[i.symbols.template]=!0,c.Template.prototype.isImmutable=!0,c.encode=function(e){return e.replace(/\\(\{+)/g,((e,t)=>c.opens.slice(0,t.length))).replace(/\\(\}+)/g,((e,t)=>c.closes.slice(0,t.length)))},c.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},c.split=function(e){const t=[];let r="";for(let n=0;n ${n.toString()}`);e=t}if(!Array.isArray(e))return e.toString();let s="";for(const n of e)s=s+(s.length?", ":"")+c.stringify(n,t,r);return c.wrap(s,t.errors.wrap.array)}},(e,t,r)=>{const n=r(40),s=r(43),a=r(44),i=r(64),o={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e,t={}){n("string"==typeof e,"Invalid reference key:",e),i.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","separator"]),n(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const r=Object.assign({},o.defaults,t);delete r.prefix;const s=r.separator,a=o.context(e,s,t.prefix);if(r.type=a.type,e=a.key,"value"===r.type)if(a.root&&(n(!s||e[0]!==s,"Cannot specify relative path with root prefix"),r.ancestor="root",e||(e=null)),s&&s===e)e=null,r.ancestor=0;else if(void 0!==r.ancestor)n(!s||!e||e[0]!==s,"Cannot combine prefix with ancestor option");else{const[t,n]=o.ancestor(e,s);n&&""===(e=e.slice(n))&&(e=null),r.ancestor=t}return r.path=s?null===e?[]:e.split(s):[e],new o.Ref(r)},t.in=function(e,r={}){return t.create(e,Object.assign({},r,{in:!0}))},t.isRef=function(e){return!!e&&!!e[i.symbols.ref]},o.Ref=class{constructor(e){n("object"==typeof e,"Invalid reference construction"),i.assertOptions(e,["adjust","ancestor","in","iterables","map","path","separator","type","depth","key","root","display"]),n([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),n(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),n(!e.map||Array.isArray(e.map),"options.map must be an array"),n(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,o.defaults,e),n("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,t,r,s,a={}){return n(!this.in||a.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(r.context,t,a):"local"===this.type?this._resolve(s,t,a):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,a):(n(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,a)):this._resolve(e,t,a)}_resolve(e,t,r){let n;if("value"===this.type&&t.mainstay.shadow&&!1!==r.shadow&&(n=t.mainstay.shadow.get(this.absolute(t))),void 0===n&&(n=a(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(n=this.adjust(n)),this.map){const e=this.map.get(n);void 0!==e&&(n=e)}return n}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new o.Ref(this)}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display=`ref:${this.type}:${e}`);if(!this.separator)return void(this.display=`ref:${e}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${e}`);if("root"===this.ancestor)return void(this.display=`ref:root:${e}`);if(1===this.ancestor)return void(this.display=`ref:${e||".."}`);const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${t}${e||""}`}},o.Ref.prototype[i.symbols.ref]=!0,o.context=function(e,t,r={}){if(e=e.trim(),r){const n=void 0===r.global?"$":r.global;if(n!==t&&e.startsWith(n))return{key:e.slice(n.length),type:"global"};const s=void 0===r.local?"#":r.local;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"local"};const a=void 0===r.root?"/":r.root;if(a!==t&&e.startsWith(a))return{key:e.slice(a.length),type:"value",root:!0}}return{key:e,type:"value"}},o.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let r=2;for(;e[r]===t;)++r;return[r-1,r]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,r){if(e)if(r=void 0===r?t.toParent:r,Array.isArray(e))for(const t of e)this.register(t,r);else if(i.isSchema(e))for(const t of e._refs.refs)t.ancestor-r>=0&&this.refs.push({ancestor:t.ancestor-r,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-r>=0&&this.refs.push({ancestor:e.ancestor-r,root:e.root})}clone(){const e=new t.Manager;return e.refs=s(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter((e=>!e.ancestor)).map((e=>e.root))}}},(e,t,r)=>{const n=r(40),s=r(64),a=r(69),i={};t.schema=function(e,t,r={}){s.assertOptions(r,["appendPath","override"]);try{return i.schema(e,t,r)}catch(e){throw r.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},i.schema=function(e,t,r){n(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(n(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const a=(t,...n)=>!1!==r.override?t.valid(e.override,...n):t.valid(...n);if(i.simple(t))return a(e,t);if("function"==typeof t)return e.custom(t);if(n("object"==typeof t,"Invalid schema content:",typeof t),s.isResolvable(t))return a(e,t);if(s.isSchema(t))return t;if(Array.isArray(t)){for(const r of t)if(!i.simple(r))return e.alternatives().try(...t);return a(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?a(e.date(),t):(n(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return a.isRef(e)?e:a.create(e,t)},t.compile=function(e,r){const a=r&&r[s.symbols.any];return a?(n(a.version===s.version,"Cannot mix different versions of joi schemas:",a.version,s.version),r):t.schema(e,r,{appendPath:!0})},i.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,r,o){if(void 0===o&&(n(r&&"object"==typeof r,"Missing options"),o=r,r=a.create(".")),Array.isArray(o)&&(o={switch:o}),s.assertOptions(o,["is","not","then","otherwise","switch","break"]),s.isSchema(r))return n(void 0===o.is,'"is" can not be used with a schema condition'),n(void 0===o.not,'"not" can not be used with a schema condition'),n(void 0===o.switch,'"switch" can not be used with a schema condition'),i.condition(e,{is:r,then:o.then,otherwise:o.otherwise,break:o.break});if(n(a.isRef(r)||"string"==typeof r,"Invalid condition:",r),n(void 0===o.not||void 0===o.is,'Cannot combine "is" with "not"'),void 0===o.switch){let c=o;void 0!==o.not&&(c={is:o.not,then:o.otherwise,otherwise:o.then,break:o.break});let l=void 0!==c.is?e.$_compile(c.is):e.$_root.invalid(null,!1,0,"").required();return n(void 0!==c.then||void 0!==c.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),n(void 0===c.break||void 0===c.then||void 0===c.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===o.is||a.isRef(o.is)||s.isSchema(o.is)||(l=l.required()),i.condition(e,{ref:t.ref(r),is:l,then:c.then,otherwise:c.otherwise,break:c.break})}n(Array.isArray(o.switch),'"switch" must be an array'),n(void 0===o.is,'Cannot combine "switch" with "is"'),n(void 0===o.not,'Cannot combine "switch" with "not"'),n(void 0===o.then,'Cannot combine "switch" with "then"');const c={ref:t.ref(r),switch:[],break:o.break};for(let t=0;t{const n=r(72),s=r(64),a=r(68);t.Report=class{constructor(e,r,n,s,a,i,o){if(this.code=e,this.flags=s,this.messages=a,this.path=i.path,this.prefs=o,this.state=i,this.value=r,this.message=null,this.local=n||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?`Error code "${e}" is not defined, your custom type is missing the correct messages definition`:(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(e){return t.template(this.value,e,this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const r of e)"object"!=typeof r&&("string"==typeof r?(t&&(t+="."),t+=r):t+=`[${r}]`);return t},t.template=function(e,t,r,n,i){if(a.isTemplate(t))return"root"!==r?t:null;let o=i.errors.language;return s.isResolvable(o)&&(o=o.resolve(e,n,i)),o&&t[o]&&void 0!==t[o][r]?t[o][r]:t[r]},t.label=function(e,r,n,s){if(!n.errors.label)return"";let a=r.path;"key"===n.errors.label&&r.path.length>1&&(a=r.path.slice(-1));const i=t.path(a);return i||(t.template(null,n.messages,"root",r,n)||t.template(null,s,"root",r,n)||"value")},t.process=function(e,r,n){if(!e)return null;const{override:s,message:a,details:i}=t.details(e);if(s)return s;if(n.errors.stack)return new t.ValidationError(a,i,r);const o=Error.stackTraceLimit;Error.stackTraceLimit=0;const c=new t.ValidationError(a,i,r);return Error.stackTraceLimit=o,c},t.details=function(e,t={}){let r=[];const n=[];for(const s of e){if(s instanceof Error){if(!1!==t.override)return{override:s};const e=s.toString();r.push(e),n.push({message:e,type:"override",context:{error:s}});continue}const e=s.toString();r.push(e),n.push({message:e,path:s.path.filter((e=>"object"!=typeof e)),type:s.code,context:s.local})}return r.length>1&&(r=[...new Set(r)]),{message:r.join(". "),details:n}},t.ValidationError=class extends Error{constructor(e,t,r){super(e),this._original=r,this.details=t}static isError(e){return e instanceof t.ValidationError}},t.ValidationError.prototype.isJoi=!0,t.ValidationError.prototype.name="ValidationError",t.ValidationError.prototype.annotate=n.error},(e,t,r)=>{const n=r(43),s=r(64),a={annotations:Symbol("annotations")};t.error=function(e){if(!this._original||"object"!=typeof this._original)return this.details[0].message;const t=e?"":"",r=e?"":"",i=e?"":"",o=n(this._original);for(let e=this.details.length-1;e>=0;--e){const t=e+1,r=this.details[e],n=r.path;let i=o;for(let e=0;;++e){const o=n[e];if(s.isSchema(i)&&(i=i.clone()),!(e+1`" ${t}[${r}]${i}`)).replace(l,((e,n,s)=>`${r}"${n}"${i}${t} [${s}]: -- missing --${i}`)).replace(u,((e,r,n)=>`\n${n} ${t}[${r}]${i}`)).replace(d,((e,t)=>t));p=`${p}\n${t}`;for(let e=0;et[0]===n?"[Circular ~]":"[Circular ~."+e.slice(0,t.indexOf(n)).join(".")+"]";return function(n,s){if(t.length>0){const a=t.indexOf(this);~a?(t.length=a+1,e.length=a+1,e[a]=n):(t.push(this),e.push(n)),~t.indexOf(s)&&(s=r.call(this,n,s))}else t.push(s);if(s){const e=s[a.annotations];if(e){if(Array.isArray(s)){const t=[];for(let r=0;r{const n=r(40),s=r(74),a=r(64),i=r(70),o=r(71),c=r(69),l={};e.exports=s._extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:c.toSibling}},args:(e,...t)=>1===t.length&&Array.isArray(t[0])?e.try(...t[0]):e.try(...t),validate(e,t){const{schema:r,error:n,state:s,prefs:a}=t;if(r._flags.match){let t,i=0;for(let n=0;n{a.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),l.errors=function(e,{error:t,state:r}){if(!e.length)return{errors:t("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const n=new Set,s=[];for(const{reports:a,schema:i}of e){if(a.length>1)return l.unmatched(e,t);const c=a[0];if(c instanceof o.Report==!1)return l.unmatched(e,t);if(c.state.path.length!==r.path.length){s.push({type:i.type,report:c});continue}if("any.only"===c.code){for(const e of c.local.valids)n.add(e);continue}const[u,d]=c.code.split(".");"base"===d?n.add(u):s.push({type:i.type,report:c})}return s.length?1===s.length?{errors:s[0].report}:l.unmatched(e,t):{errors:t("alternatives.types",{types:[...n]})}},l.unmatched=function(e,t){const r=[];for(const t of e)r.push(...t.reports);return{errors:t("alternatives.match",o.details(r,{override:!1}))}}},(e,t,r)=>{const n=r(40),s=r(75),a=r(64);e.exports=s._extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(e,t){return n("function"==typeof e,"Method must be a function"),n(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:e,description:t}})},validate(e,t,{method:r}){try{return r(e,t)}catch(e){return t.error("any.custom",{error:e})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(e){n(a.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const t=this.clone();return t.$_terms.shared=t.$_terms.shared||[],t.$_terms.shared.push(e),t.$_mutateRegister(e),t}}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":"{{#label}} must be one of {{#valids}}","any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},(e,t,r)=>{const n=r(40),s=r(43),a=r(52),i=r(47),o=r(64),c=r(70),l=r(71),u=r(76),d=r(67),p=r(77),h=r(69),f=r(78),m=r(80),g={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._ids=new p.Ids,this._preferences=null,this._refs=new h.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={whens:{}}}allow(...e){return o.verifyFlat(e,"allow"),this._values(e,"_valids")}cast(e){return n(!1===e||"string"==typeof e,"Invalid to value"),n(!1===e||this._definition.cast[e],"Type",this.type,"does not support casting to",e),this.$_setFlag("cast",!1===e?void 0:e)}default(e,t){return this._default("default",e,t)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(e){return n(e,"Missing error"),n(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(e){return e?(n("string"==typeof e,"id must be a non-empty string"),n(/^[^\.]+$/.test(e),"id cannot contain period character"),this.$_setFlag("id",e)):this.$_setFlag("id",void 0)}invalid(...e){return this._values(e,"_invalids")}only(e=!0){return n("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){n(e,"Missing preferences"),n(void 0===e.context,"Cannot override context"),o.checkPreferences(e);const t=this.clone();return t._preferences=o.preferences(t._preferences,e),t}presence(e){return n(["optional","required","forbidden"].includes(e),"Unknown presence mode",e),this.$_setFlag("presence",e)}raw(e=!0){return this.$_setFlag("result",e?"raw":void 0)}required(){return this.presence("required")}strict(e){const t=this.clone(),r=void 0!==e&&!e;return t._preferences=o.preferences(t._preferences,{convert:r}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}valid(...e){o.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(e,t){const r=this.clone();r.$_terms.whens||(r.$_terms.whens=[]);const s=c.when(r,e,t);if(!["any","link"].includes(r.type)){const e=s.is?[s]:s.switch;for(const t of e)n(!t.then||"any"===t.then.type||t.then.type===r.type,"Cannot combine",r.type,"with",t.then&&t.then.type),n(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===r.type,"Cannot combine",r.type,"with",t.otherwise&&t.otherwise.type)}return r.$_terms.whens.push(s),r.$_mutateRebuild()}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){n(o.isSchema(e),"Invalid schema object"),n("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type);let t=this.clone();if("any"===this.type&&"any"!==e.type){const r=e.clone();for(const e of Object.keys(t))"type"!==e&&(r[e]=t[e]);t=r}t._ids.concat(e._ids),t._refs.register(e,h.toSibling),t._preferences=t._preferences?o.preferences(t._preferences,e._preferences):e._preferences,t._valids=m.merge(t._valids,e._valids,e._invalids),t._invalids=m.merge(t._invalids,e._invalids,e._valids);for(const r of e._singleRules.keys())t._singleRules.has(r)&&(t._rules=t._rules.filter((e=>e.name!==r)),t._singleRules.delete(r));for(const r of e._rules)e._definition.rules[r.method].multi||t._singleRules.set(r.name,r),t._rules.push(r);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const r=Object.assign({},e._flags);delete r.empty,i(t._flags,r)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const r=Object.assign({},e._flags);delete r.empty,i(t._flags,r)}else i(t._flags,e._flags);for(const r in e.$_terms){const n=e.$_terms[r];n?t.$_terms[r]?t.$_terms[r]=t.$_terms[r].concat(n):t.$_terms[r]=n.slice():t.$_terms[r]||(t.$_terms[r]=n)}return t.$_mutateRebuild()}validate(e,t){return f.entry(e,this,t)}validateAsync(e,t){const r=this.validate(e,t);if(r.error)throw r.error;return r.value}$_addRule(e){"string"==typeof e&&(e={name:e}),n(e&&"object"==typeof e,"Invalid options"),n(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)n("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const r=this._definition.rules[t.method],s=t.args;n(r,"Unknown rule",t.method);const a=this.clone();if(s){n(1===Object.keys(s).length||Object.keys(s).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in s){let i=s[e];if(void 0!==i){if(r.argsByName){const c=r.argsByName.get(e);if(c.ref&&o.isResolvable(i))t._resolve.push(e),a.$_mutateRegister(i);else if(c.normalize&&(i=c.normalize(i),s[e]=i),c.assert){const t=o.validateArg(i,e,c);n(!t,t,"or reference")}}s[e]=i}else delete s[e]}}return r.multi||(a._ruleRemove(t.name),a._singleRules.set(t.name,t)),r.priority?a._rules.unshift(t):a._rules.push(t),a}$_compile(e,t){return c.schema(this.$_root,e,t)}$_createError(e,t,r,n,s,a={}){const i=!1!==a.flags?this._flags:{},o=a.messages?d.merge(this._definition.messages,a.messages):this._definition.messages;return new l.Report(e,t,r,i,o,n,s)}$_getRule(e){return this._singleRules.get(e)}$_match(e,t,r,n){(r=Object.assign({},r)).abortEarly=!0,r._externals=!1,t.snapshot();const s=!f.validate(e,this,t,r,n).errors;return t.restore(),s}$_modify(e){return o.assertOptions(e,["each","once","ref","schema"]),p.schema(this,e)||this}$_mutateRebuild(){this._refs.reset(),this._ids.reset();return this.$_modify({each:(e,{source:t,name:r,path:n,key:s})=>{const a=this._definition[t][r]&&this._definition[t][r].register;!1!==a&&this.$_mutateRegister(e,{family:a,key:s})}}),this._definition.rebuild&&this._definition.rebuild(this),this}$_mutateRegister(e,{family:t,key:r}={}){this._refs.register(e,t),this._ids.register(e,{key:r})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t,r={}){const n=this._definition.flags[e]||{};if(a(t,n.default)&&(t=void 0),a(t,this._flags[e]))return this;const s=!1!==r.clone?this.clone():this;return void 0!==t?(s._flags[e]=t,s.$_mutateRegister(t)):delete s._flags[e],s}$_parent(e,...t){return this[e][o.symbols.parent].call(this,...t)}$_validate(e,t,r){return f.validate(e,this,t,r)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=s(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_default(e,t,r={}){o.assertOptions(r,"literal"),n(void 0!==t,"Missing",e,"value"),n("function"==typeof t||!r.literal,"Only function value supports literal option"),"function"==typeof t&&r.literal&&(t={[o.symbols.literal]:!0,literal:t});return this.$_setFlag(e,t)}_extend(e){return n(!e.base,"Cannot extend type with another base"),u.type(this,e)}_generate(e,t,r){if(!this.$_terms.whens)return{schema:this};const n=[],s=[];for(let a=0;al)break}const a=s.join(", ");if(!a)return{schema:this};if(this.$_temp.whens[a])return{schema:this.$_temp.whens[a],id:a};let i=this;this._definition.generate&&(i=this._definition.generate(this,e,t,r));for(const e of n)i=i.concat(e);return this.$_temp.whens[a]=i,{schema:i,id:a}}_ruleRemove(e){if(!this._singleRules.has(e))return this;this._singleRules.delete(e);const t=[];for(let r=0;r{const n=r(40),s=r(43),a=r(64),i=r(67);t.type=function(e,t){const r=Object.getPrototypeOf(e),o=s(r),c=e._assign(Object.create(o)),l=Object.assign({},t);delete l.base,o._definition=l;const u=r._definition||{};l.messages=i.merge(u.messages,l.messages),l.properties=Object.assign({},u.properties,l.properties),c.type=l.type,l.flags=Object.assign({},u.flags,l.flags);const d=Object.assign({},u.terms);if(l.terms)for(const e in l.terms){const t=l.terms[e];n(void 0===c.$_terms[e],"Invalid term override for",l.type,e),c.$_terms[e]=t.init,d[e]=t}l.terms=d,l.args||(l.args=u.args),l.coerce&&("function"==typeof l.coerce&&(l.coerce={method:l.coerce}),l.coerce.from&&!Array.isArray(l.coerce.from)&&(l.coerce={method:l.coerce.method,from:[].concat(l.coerce.from)})),l.coerce=l.coerce||u.coerce,l.validate=l.validate||u.validate;const p=Object.assign({},u.rules);if(l.rules)for(const e in l.rules){const t=l.rules[e];n("object"==typeof t,"Invalid rule definition for",l.type,e);const r=t.method;if(r&&(n(!o[e],"Rule conflict in",l.type,e),o[e]=r),n(!p[e],"Rule conflict in",l.type,e),p[e]=t,t.alias){const e=[].concat(t.alias);for(const r of e)o[r]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map((e=>("string"==typeof e&&(e={name:e}),n(!t.argsByName.has(e.name),"Duplicated argument name",e.name),t.argsByName.set(e.name,e),e))))}if(l.rules=p,l.overrides){o._super=r,c.$_super={};for(const e in l.overrides)n(r[e],"Cannot override missing",e),l.overrides[e][a.symbols.parent]=r[e],c.$_super[e]=r[e].bind(c);Object.assign(o,l.overrides)}return l.cast=Object.assign({},u.cast,l.cast),l.rebuild=l.rebuild||u.rebuild,c}},(e,t,r)=>{const n=r(40),s=r(64),a=r(69),i={};t.Ids=i.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new i.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,r]of e._byId.entries())n(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,r);for(const[t,r]of e._byKey.entries())n(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,r)}reach(e,t=[]){const r=e[0],s=this._get(r);n(s,"Schema does not contain path",[...t,...e].join("."));const a=e.slice(1);return a.length?s.schema._ids.reach(a,[...t,r]):s.schema}register(e,{key:t}={}){if(!e||!s.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const r=e._flags.id;if(r){const t=this._byId.get(r);n(!t||t.schema===e,"Cannot add different schemas with the same id:",r),n(!this._byKey.has(r),"Schema id conflicts with existing key:",r),this._byId.set(r,{schema:e,id:r})}t&&(n(!this._byKey.has(t),"Schema already contains key:",t),n(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,{schema:e,id:t}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_get(e){return this._byId.get(e)||this._byKey.get(e)}},t.schema=function(e,t){let r;for(const n in e._flags){if("_"===n[0])continue;const s=i.scan(e._flags[n],{source:"flags",name:n},t);void 0!==s&&(r=r||e.clone(),r._flags[n]=s)}for(let n=0;n{const n=r(40),s=r(43),a=r(64),i=r(71),o=r(79),c={result:Symbol("result")};t.entry=function(e,t,r){let n=a.defaults;r&&(n=a.preferences(a.defaults,r));const s=c.entry(e,t,n),i={value:s.value};return s.error&&(i.error=s.error),i},c.entry=function(e,r,n){const s={links:r._ids._schemaChain?new Map:null},a=r._ids._schemaChain?[{schema:r}]:null,c=new o([],[],{mainstay:s,schemas:a}),l=t.validate(e,r,c,n),u=i.process(l.errors,e,n);return{value:l.value,error:u,mainstay:s}},t.validate=function(e,t,r,n,s={}){t.$_terms.whens&&(t=t._generate(e,r,n).schema),t._preferences&&(n=c.prefs(t,n));const i={original:e,prefs:n,schema:t,state:r,error:(s,a,i)=>t.$_createError(s,e,a,i||r,n),errorsArray:c.errorsArray,message:(s,a)=>t.$_createError("custom",e,a,r,n,{messages:s})},o=t._definition;if(o.coerce&&void 0!==e&&n.convert&&(!o.coerce.from||o.coerce.from.includes(typeof e))){const t=o.coerce.method(e,i);if(t){if(t.errors)return c.finalize(t.value,[].concat(t.errors),i);e=t.value}}const l=t._flags.empty;l&&l.$_match(c.trim(e,t),r.nest(l),a.defaults)&&(e=void 0);const u=s.presence||t._flags.presence||(t._flags._endedSwitch?null:n.presence);if(void 0===e){if("forbidden"===u)return c.finalize(e,null,i);if("required"===u)return c.finalize(e,[t.$_createError("any.required",e,null,r,n)],i);if("optional"===u){if(t._flags.default!==a.symbols.deepDefault)return c.finalize(e,null,i);e={}}}else if("forbidden"===u)return c.finalize(e,[t.$_createError("any.unknown",e,null,r,n)],i);const d=[];if(t._valids){const s=t._valids.get(e,r,n,t._flags.insensitive);if(s)return n.convert&&(e=s.value),c.finalize(e,null,i);if(t._flags.only){const s=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},r,n);if(n.abortEarly)return c.finalize(e,[s],i);d.push(s)}}if(t._invalids){if(t._invalids.get(e,r,n,t._flags.insensitive)){const s=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,n);if(n.abortEarly)return c.finalize(e,[s],i);d.push(s)}}if(o.validate){const t=o.validate(e,i);if(t&&(e=t.value,t.errors)){if(!Array.isArray(t.errors))return d.push(t.errors),c.finalize(e,d,i);if(t.errors.length)return d.push(...t.errors),c.finalize(e,d,i)}}return t._rules.length?c.rules(e,d,i):c.finalize(e,d,i)},c.rules=function(e,t,r){const{schema:n,state:s,prefs:i}=r;for(const o of n._rules){const l=n._definition.rules[o.method];if(l.convert&&i.convert)continue;let u,d=o.args;if(o._resolve.length){d=Object.assign({},d);for(const t of o._resolve){const r=l.argsByName.get(t),o=d[t].resolve(e,s,i),c=r.normalize?r.normalize(o):o,p=a.validateArg(c,null,r);if(p){u=n.$_createError("any.ref",o,{arg:t,ref:d[t],reason:p},s,i);break}d[t]=c}}u=u||l.validate(e,r,d,o);const p=c.rule(u,o);if(p.errors){if(i.abortEarly)return c.finalize(e,p.errors,r);t.push(...p.errors)}else e=p.value}return c.finalize(e,t,r)},c.rule=function(e,t){return e instanceof i.Report?{errors:[e],value:null}:Array.isArray(e)&&e[a.symbols.errors]?{errors:e,value:null}:{errors:null,value:e}},c.finalize=function(e,t,r){t=t||[];const{schema:s,state:a}=r;if(t.length){const n=c.default("failover",void 0,t,r);void 0!==n&&(e=n,t=[])}if(t.length&&s._flags.error)if("function"==typeof s._flags.error){t=s._flags.error(t),Array.isArray(t)||(t=[t]);for(const e of t)n(e instanceof Error||e instanceof i.Report,"error() must return an Error object")}else t=[s._flags.error];if(void 0===e){e=c.default("default",e,t,r)}if(s._flags.cast&&void 0!==e){const t=s._definition.cast[s._flags.cast];if(t.from(e)){e=t.to(e,r)}}const o={value:e,errors:t.length?t:null};return s._flags.result&&(o.value="strip"===s._flags.result?void 0:r.original,a.shadow(e,s._flags.result)),o},c.prefs=function(e,t){const r=t===a.defaults;return r&&e._preferences[a.symbols.prefs]?e._preferences[a.symbols.prefs]:(t=a.preferences(t,e._preferences),r&&(e._preferences[a.symbols.prefs]=t),t)},c.default=function(e,t,r,n){const{schema:i,state:o,prefs:c}=n,l=i._flags[e];if(c.noDefaults||void 0===l)return t;if(!l)return l;if("function"==typeof l){const t=l.length?[s(o.ancestors[0]),n]:[];try{return l(...t)}catch(t){return void r.push(i.$_createError(`any.${e}`,null,{error:t},o,c))}}return"object"!=typeof l?l:l[a.symbols.literal]?l.literal:a.isResolvable(l)?l.resolve(t,o,c):s(l)},c.trim=function(e,t){if("string"!=typeof e)return e;const r=t.$_getRule("trim");return r&&r.args.enabled?e.trim():e},c.errorsArray=function(){const e=[];return e[a.symbols.errors]=!0,e}},(e,t,r)=>{const n=r(43),s=r(44),a=r(64),i={value:Symbol("value")};e.exports=i.State=class{constructor(e,t,r){this.path=e,this.ancestors=t,this.mainstay=r.mainstay,this.schemas=r.schemas}localize(e,t=null,r=null){const n=new i.State(e,t,this);return r&&n.schemas&&(n.schemas=[i.schemas(r),...n.schemas]),n}nest(e){const t=new i.State(this.path,this.ancestors,this);return t.schemas=t.schemas&&[i.schemas(e),...t.schemas],t}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new i.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=n(this.mainstay.shadow.node(this.path)))}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0)}},i.schemas=function(e){return a.isSchema(e)?{schema:e}:e},i.Shadow=class{constructor(){this._values=null}set(e,t,r){if(!e.length)return;if("strip"===r&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let n=this._values;for(let t=0;t{const n=r(40),s=r(52),a=r(64),i={};e.exports=i.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=i.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){a.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,r){if(e=e||new i.Values,t){if(t._override)return t.clone();for(const r of[...t._values,...t._refs])e.add(r)}if(r)for(const t of[...r._values,...r._refs])e.remove(t);return e.length?e:null}remove(e){a.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,r,n){return!!this.get(e,t,r,n)}get(e,t,r,n){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&n){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const t of this._values)if(s(t,e))return{value:t};if(t)for(const a of this._refs){const i=a.resolve(e,t,r,null,{in:!0});if(void 0===i)continue;const o=a.in&&"object"==typeof i?Array.isArray(i)?i:Object.keys(i):[i];for(const t of o)if(typeof t==typeof e)if(n&&e&&"string"==typeof e){if(t.toLowerCase()===e.toLowerCase())return{value:t,ref:a}}else if(s(t,e))return{value:t,ref:a}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new i.Values(this._values,this._refs);return e._override=this._override,e}concat(e){n(!e._override,"Cannot concat override set of values");const t=new i.Values([...this._values,...e._values],[...this._refs,...e._refs]);return t._override=this._override,t}},i.Values.prototype[a.symbols.values]=!0,i.Values.prototype.slice=i.Values.prototype.clone,i.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t}},(e,t,r)=>{const n=r(40),s=r(52),a=r(44),i=r(74),o=r(64),c=r(70),l={};e.exports=i._extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[]},ordered:{init:[]},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,{schema:t,state:r,prefs:n}){if(!Array.isArray(e))return;const s=t.$_getRule("sort");return s?l.sort(t,e,s.args.options,r,n):void 0}},validate(e,{schema:t,error:r}){if(!Array.isArray(e)){if(t._flags.single){const t=[e];return t[o.symbols.arraySingle]=!0,{value:t}}return{errors:r("array.base")}}if(t.$_getRule("items"))return{value:e.slice()}},rules:{has:{method(e){e=this.$_compile(e,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:e}});return t.$_mutateRegister(e),t},validate(e,{state:t,prefs:r,error:n},{schema:s}){const a=[e,...t.ancestors];for(let n=0;nthis.$_compile(e[r])),r,{append:!0});t.$_terms.items.push(n)}return t.$_mutateRebuild()},validate(e,{schema:t,error:r,state:n,prefs:s,errorsArray:a}){const i=t.$_terms._requireds.slice(),c=t.$_terms.ordered.slice(),u=[...t.$_terms._inclusions,...i],d=!e[o.symbols.arraySingle];delete e[o.symbols.arraySingle];const p=a();let h=e.length;for(let a=0;a="})}},ordered:{method(...e){o.verifyFlat(e,"ordered");const t=this.$_addRule("items");for(let r=0;rthis.$_compile(e[r])),r,{append:!0});l.validateSingle(n,t),t.$_mutateRegister(n),t.$_terms.ordered.push(n)}return t.$_mutateRebuild()}},single:{method(e){const t=void 0===e||!!e;return n(!t||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",t)}},sort:{method(e={}){o.assertOptions(e,["by","order"]);const t={order:e.order||"ascending"};return e.by&&(t.by=c.ref(e.by,{ancestor:0}),n(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(e,{error:t,state:r,prefs:n,schema:s},{options:a}){const{value:i,errors:o}=l.sort(s,e,a,r,n);if(o)return o;for(let r=0;rnew Set(e)}},rebuild(e){e.$_terms._inclusions=[],e.$_terms._exclusions=[],e.$_terms._requireds=[];for(const t of e.$_terms.items)l.validateSingle(t,e),"required"===t._flags.presence?e.$_terms._requireds.push(t):"forbidden"===t._flags.presence?e.$_terms._exclusions.push(t):e.$_terms._inclusions.push(t);for(const t of e.$_terms.ordered)l.validateSingle(t,e)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),l.fillMissedErrors=function(e,t,r,n,s,a){let i=0;for(let e=0;e{let d=l.compare(c,u,i,o);if(null!==d)return d;if(r.by&&(c=r.by.resolve(c,n,s),u=r.by.resolve(u,n,s)),d=l.compare(c,u,i,o),null!==d)return d;const p=typeof c;if(p!==typeof u)throw e.$_createError("array.sort.mismatching",t,null,n,s);if("number"!==p&&"string"!==p)throw e.$_createError("array.sort.unsupported",t,{type:p},n,s);return"number"===p?(c-u)*a:c{const n=r(40),s=r(74),a=r(64),i=r(80),o={isBool:function(e){return"boolean"==typeof e}};e.exports=s._extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null},truthy:{init:null}},coerce(e,{schema:t}){if("boolean"!=typeof e){if("string"==typeof e){const r=t._flags.sensitive?e:e.toLowerCase();e="true"===r||"false"!==r&&e}return"boolean"!=typeof e&&(e=t.$_terms.truthy&&t.$_terms.truthy.has(e,null,null,!t._flags.sensitive)||(!t.$_terms.falsy||!t.$_terms.falsy.has(e,null,null,!t._flags.sensitive))&&e),{value:e}}},validate(e,{error:t}){if("boolean"!=typeof e)return{value:e,errors:t("boolean.base")}},rules:{truthy:{method(...e){a.verifyFlat(e,"truthy");const t=this.clone();t.$_terms.truthy=t.$_terms.truthy||new i;for(let r=0;re?1:0},string:{from:o.isBool,to:(e,t)=>e?"true":"false"}},messages:{"boolean.base":"{{#label}} must be a boolean"}})},(e,t,r)=>{const n=r(40),s=r(74),a=r(64),i=r(68),o={isDate:function(e){return e instanceof Date}};e.exports=s._extend({type:"date",coerce:{from:["number","string"],method:(e,{schema:t})=>({value:o.parse(e,t._flags.format)||e})},validate(e,{schema:t,error:r,prefs:n}){if(e instanceof Date&&!isNaN(e.getTime()))return;const s=t._flags.format;return n.convert&&s&&"string"==typeof e?{value:e,errors:r("date.format",{format:s})}:{value:e,errors:r("date.base")}},rules:{compare:{method:!1,validate(e,t,{date:r},{name:n,operator:s,args:i}){const o="now"===r?Date.now():r.getTime();return a.compare(e.getTime(),o,s)?e:t.error("date."+n,{limit:i.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:o.parse(e),assert:e=>null!==e,message:"must have a valid date format"}]},format:{method(e){return n(["iso","javascript","unix"].includes(e),"Unknown date format",e),this.$_setFlag("format",e)}},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{date:e},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{date:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{date:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{date:e},operator:">="})}},timestamp:{method(e="javascript"){return n(["javascript","unix"].includes(e),'"type" must be one of "javascript, unix"'),this.format(e)}}},cast:{number:{from:o.isDate,to:(e,t)=>e.getTime()},string:{from:o.isDate,to:(e,{prefs:t})=>i.date(e,t)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":"{{#label}} must be in {{#format}} format","date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}"}}),o.parse=function(e,t){if(e instanceof Date)return e;if("string"!=typeof e&&(isNaN(e)||!isFinite(e)))return null;if(/^\s*$/.test(e))return null;if("iso"===t)return a.isIsoDate(e)?o.date(e.toString()):null;const r=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return o.date(1*e);if("unix"===t)return o.date(1e3*e);if("string"==typeof r)return null}return o.date(e)},o.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t}},(e,t,r)=>{const n=r(40),s=r(85);e.exports=s._extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(e){return n(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:e}})},validate:(e,t,{n:r})=>e.length===r?e:t.error("function.arity",{n:r})},class:{method(){return this.$_addRule("class")},validate:(e,t)=>/^\s*class\s/.test(e.toString())?e:t.error("function.class",{value:e})},minArity:{method(e){return n(Number.isSafeInteger(e)&&e>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:e}})},validate:(e,t,{n:r})=>e.length>=r?e:t.error("function.minArity",{n:r})},maxArity:{method(e){return n(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:e}})},validate:(e,t,{n:r})=>e.length<=r?e:t.error("function.maxArity",{n:r})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},(e,t,r)=>{const n=r(39),s=r(40),a=r(43),i=r(86),o=r(74),c=r(64),l=r(70),u=r(71),d=r(69),p={renameDefaults:{alias:!1,multiple:!1,override:!1}};e.exports=o._extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:!1}},terms:{dependencies:{init:null},keys:{init:null},patterns:{init:null},renames:{init:null}},args:(e,t)=>e.keys(t),validate(e,{schema:t,error:r,state:n,prefs:s}){if(!e||typeof e!==t.$_property("typeof")||Array.isArray(e))return{value:e,errors:r("object.base",{type:t.$_property("typeof")})};if(!(t.$_terms.renames||t.$_terms.dependencies||t.$_terms.keys||t.$_terms.patterns))return;e=p.clone(e,s);const a=[];if(t.$_terms.renames&&!p.rename(t,e,n,s,a))return{value:e,errors:a};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:a};const i=new Set(Object.keys(e));if(t.$_terms.keys){const r=[e,...n.ancestors];for(const o of t.$_terms.keys){const t=o.key,c=e[t];i.delete(t);const l=n.localize([...n.path,t],r,o),u=o.schema.$_validate(c,l,s);if(u.errors){if(s.abortEarly)return{value:e,errors:u.errors};a.push(...u.errors)}else"strip"===o.schema._flags.result||void 0===u.value&&void 0!==c?delete e[t]:void 0!==u.value&&(e[t]=u.value)}}if(i.size||t._flags._hasPatternMatch){const r=p.unknown(t,e,i,a,n,s);if(r)return r}if(t.$_terms.dependencies)for(const r of t.$_terms.dependencies){if(r.key&&void 0===r.key.resolve(e,n,s,null,{shadow:!1}))continue;const i=p.dependencies[r.rel](t,r,e,n,s);if(i){const r=t.$_createError(i.code,e,i.context,n,s);if(s.abortEarly)return{value:e,errors:r};a.push(r)}}return{value:e,errors:a}},rules:{and:{method(...e){return c.verifyFlat(e,"and"),p.dependency(this,"and",null,e)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,t,r){e=l.ref(e),s(void 0===r||"string"==typeof r,"Message must be a string"),t=this.$_compile(t,{appendPath:!0});const n=this.$_addRule({name:"assert",args:{subject:e,schema:t,message:r}});return n.$_mutateRegister(e),n.$_mutateRegister(t),n},validate(e,{error:t,prefs:r,state:n},{subject:s,schema:a,message:i}){const o=s.resolve(e,n,r),c=s.absolute(n);return a.$_match(o,n.localize(c,[e,...n.ancestors],a),r)?e:t("object.assert",{subject:s,message:i})},args:["subject","schema","message"],multi:!0},instance:{method(e,t){return s("function"==typeof e,"constructor must be a function"),t=t||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:t}})},validate:(e,t,{constructor:r,name:n})=>e instanceof r?e:t.error("object.instance",{type:n,value:e}),args:["constructor","name"]},keys:{method(e){s(void 0===e||"object"==typeof e,"Object schema must be a valid object"),s(!c.isSchema(e),"Object schema cannot be a joi schema");const t=this.clone();if(e)if(Object.keys(e).length){t.$_terms.keys=t.$_terms.keys?t.$_terms.keys.filter((t=>!e.hasOwnProperty(t.key))):new p.Keys;for(const r in e)c.tryWithPath((()=>t.$_terms.keys.push({key:r,schema:this.$_compile(e[r])})),r)}else t.$_terms.keys=new p.Keys;else t.$_terms.keys=null;return t.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:n,operator:s,args:a})=>c.compare(Object.keys(e).length,r,s)?e:t.error("object."+n,{limit:a.limit,value:e}),args:[{name:"limit",ref:!0,assert:c.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},nand:{method(...e){return c.verifyFlat(e,"nand"),p.dependency(this,"nand",null,e)}},or:{method(...e){return c.verifyFlat(e,"or"),p.dependency(this,"or",null,e)}},oxor:{method(...e){return p.dependency(this,"oxor",null,e)}},pattern:{method(e,t,r={}){const n=e instanceof RegExp;n||(e=this.$_compile(e,{appendPath:!0})),s(void 0!==t,"Invalid rule"),c.assertOptions(r,["fallthrough","matches"]),n&&s(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),t=this.$_compile(t,{appendPath:!0});const a=this.clone();a.$_terms.patterns=a.$_terms.patterns||[];const i={[n?"regex":"schema"]:e,rule:t};return r.matches&&(i.matches=this.$_compile(r.matches),"array"!==i.matches.type&&(i.matches=i.matches.$_root.array().items(i.matches)),a.$_mutateRegister(i.matches),a.$_setFlag("_hasPatternMatch",!0,{clone:!1})),r.fallthrough&&(i.fallthrough=!0),a.$_terms.patterns.push(i),a.$_mutateRegister(t),a}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>d.isRef(e)?e:t.error("object.refType",{value:e})},regex:{method(){return this.$_addRule("regex")},validate:(e,t)=>e instanceof RegExp?e:t.error("object.regex",{value:e})},rename:{method(e,t,r={}){s("string"==typeof e||e instanceof RegExp,"Rename missing the from argument"),s("string"==typeof t,"Invalid rename to argument"),s(t!==e,"Cannot rename key to same name:",e),c.assertOptions(r,["alias","ignoreUndefined","override","multiple"]);const a=this.clone();a.$_terms.renames=a.$_terms.renames||[];for(const t of a.$_terms.renames)s(t.from!==e,"Cannot rename the same key multiple times");return a.$_terms.renames.push({from:e,to:t,options:n(p.renameDefaults,r)}),a}},schema:{method(e="any"){return this.$_addRule({name:"schema",args:{type:e}})},validate:(e,t,{type:r})=>!c.isSchema(e)||"any"!==r&&e.type!==r?t.error("object.schema",{type:r}):e},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t,r={}){return p.dependency(this,"with",e,t,r)}},without:{method(e,t,r={}){return p.dependency(this,"without",e,t,r)}},xor:{method(...e){return c.verifyFlat(e,"xor"),p.dependency(this,"xor",null,e)}}},overrides:{default(e,t){return void 0===e&&(e=c.symbols.deepDefault),this.$_parent("default",e,t)}},rebuild(e){if(e.$_terms.keys){const t=new i.Sorter;for(const r of e.$_terms.keys)c.tryWithPath((()=>t.add(r,{after:r.schema.$_rootReferences(),group:r.key})),r.key);e.$_terms.keys=new p.Keys(...t.nodes)}},messages:{"object.and":"{{#label}} contains {{#present}} without its required peers {{#missing}}","object.assert":"{{#label}} is invalid because it failed to pass the assertion test","object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":"{{#label}} must have {{#limit}} keys","object.max":"{{#label}} must have less than or equal to {{#limit}} keys","object.min":"{{#label}} must have at least {{#limit}} keys","object.missing":"{{#label}} must contain at least one of {{#peers}}","object.nand":"{{:#main}} must not exist simultaneously with {{#peers}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peers}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#main}} missing required peer {{:#peer}}","object.without":"{{:#main}} conflict with forbidden peer {{:#peer}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peers}}"}}),p.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return a(e,{shallow:!0});const r=Object.create(Object.getPrototypeOf(e));return Object.assign(r,e),r}const r=function(...t){return e.apply(this,t)};return r.prototype=a(e.prototype),Object.defineProperty(r,"name",{value:e.name,writable:!1}),Object.defineProperty(r,"length",{value:e.length,writable:!1}),Object.assign(r,e),r},p.dependency=function(e,t,r,n,a){s(null===r||"string"==typeof r,t,"key must be a strings"),a||(a=n.length>1&&"object"==typeof n[n.length-1]?n.pop():{}),c.assertOptions(a,["separator"]),n=[].concat(n);const i=c.default(a.separator,"."),o=[];for(const e of n)s("string"==typeof e,t,"peers must be a string or a reference"),o.push(l.ref(e,{separator:i,ancestor:0,prefix:!1}));null!==r&&(r=l.ref(r,{separator:i,ancestor:0,prefix:!1}));const u=e.clone();return u.$_terms.dependencies=u.$_terms.dependencies||[],u.$_terms.dependencies.push(new p.Dependency(t,r,o,n)),u},p.dependencies={and(e,t,r,n,s){const a=[],i=[],o=t.peers.length;for(const e of t.peers)void 0===e.resolve(r,n,s,null,{shadow:!1})?a.push(e.key):i.push(e.key);if(a.length!==o&&i.length!==o)return{code:"object.and",context:{present:i,missing:a}}},nand(e,t,r,n,s){const a=[];for(const e of t.peers)void 0!==e.resolve(r,n,s,null,{shadow:!1})&&a.push(e.key);if(a.length!==t.peers.length)return;return{code:"object.nand",context:{main:t.paths[0],peers:t.paths.slice(1)}}},or(e,t,r,n,s){for(const e of t.peers)if(void 0!==e.resolve(r,n,s,null,{shadow:!1}))return;return{code:"object.missing",context:{peers:t.paths}}},oxor(e,t,r,n,s){const a=[];for(const e of t.peers)void 0!==e.resolve(r,n,s,null,{shadow:!1})&&a.push(e.key);if(!a.length||1===a.length)return;const i={peers:t.paths};return i.present=a,{code:"object.oxor",context:i}},with(e,t,r,n,s){for(const e of t.peers)if(void 0===e.resolve(r,n,s,null,{shadow:!1}))return{code:"object.with",context:{main:t.key.key,peer:e.key}}},without(e,t,r,n,s){for(const e of t.peers)if(void 0!==e.resolve(r,n,s,null,{shadow:!1}))return{code:"object.without",context:{main:t.key.key,peer:e.key}}},xor(e,t,r,n,s){const a=[];for(const e of t.peers)void 0!==e.resolve(r,n,s,null,{shadow:!1})&&a.push(e.key);if(1===a.length)return;const i={peers:t.paths};return 0===a.length?{code:"object.missing",context:i}:(i.present=a,{code:"object.xor",context:i})}},p.rename=function(e,t,r,n,s){const a={};for(const i of e.$_terms.renames){const o=[],c="string"!=typeof i.from;if(c)for(const e in t){if(void 0===t[e]&&i.options.ignoreUndefined)continue;if(e===i.to)continue;const r=i.from.exec(e);r&&o.push({from:e,to:i.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,i.from)||void 0===t[i.from]&&i.options.ignoreUndefined||o.push(i);for(const l of o){const o=l.from,u=l.to;if(!i.options.multiple&&a[u]&&(s.push(e.$_createError("object.rename.multiple",t,{from:o,to:u,pattern:c},r,n)),n.abortEarly))return!1;if(Object.prototype.hasOwnProperty.call(t,u)&&!i.options.override&&!a[u]&&(s.push(e.$_createError("object.rename.override",t,{from:o,to:u,pattern:c},r,n)),n.abortEarly))return!1;void 0===t[o]?delete t[u]:t[u]=t[o],a[u]=!0,i.options.alias||delete t[o]}}return!0},p.unknown=function(e,t,r,n,s,a){if(e.$_terms.patterns){let i=!1;const o=e.$_terms.patterns.map((e=>{if(e.matches)return i=!0,[]})),c=[t,...s.ancestors];for(const i of r){const l=t[i],u=[...s.path,i];for(let d=0;d{const{assert:n}=r(38),s={};t.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(e,t){const r=[].concat((t=t??{}).before??[]),s=[].concat(t.after??[]),a=t.group??"?",i=t.sort??0;n(!r.includes(a),`Item cannot come before itself: ${a}`),n(!r.includes("?"),"Item cannot come before unassociated items"),n(!s.includes(a),`Item cannot come after itself: ${a}`),n(!s.includes("?"),"Item cannot come after unassociated items"),Array.isArray(e)||(e=[e]);for(const t of e){const e={seq:this._items.length,sort:i,before:r,after:s,group:a,node:t};this._items.push(e)}if(!t.manual){const e=this._sort();n(e,"item","?"!==a?`added into group ${a}`:"","created a dependencies error")}return this.nodes}merge(e){Array.isArray(e)||(e=[e]);for(const t of e)if(t)for(const e of t._items)this._items.push(Object.assign({},e));this._items.sort(s.mergeSort);for(let e=0;ee.sort===t.sort?0:e.sort{const n=r(40),s=r(74),a=r(64),i=r(70),o=r(71),c={};e.exports=s._extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,register:!1}},args:(e,t)=>e.ref(t),validate(e,{schema:t,state:r,prefs:s}){n(t.$_terms.link,"Uninitialized link schema");const a=c.generate(t,e,r,s),i=t.$_terms.link[0].ref;return a.$_validate(e,r.nest(a,`link:${i.display}:${a.type}`),s)},generate:(e,t,r,n)=>c.generate(e,t,r,n),rules:{ref:{method(e){n(!this.$_terms.link,"Cannot reinitialize schema"),e=i.ref(e),n("value"===e.type||"local"===e.type,"Invalid reference type:",e.type),n("local"===e.type||"root"===e.ancestor||e.ancestor>0,"Link cannot reference itself");const t=this.clone();return t.$_terms.link=[{ref:e}],t}},relative:{method(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(e){n(this.$_terms.link,"Uninitialized link schema"),n(a.isSchema(e),"Invalid schema object"),n("link"!==e.type,"Cannot merge type link with another link");const t=this.clone();return t.$_terms.whens||(t.$_terms.whens=[]),t.$_terms.whens.push({concat:e}),t.$_mutateRebuild()}}}),c.generate=function(e,t,r,n){let s=r.mainstay.links.get(e);if(s)return s._generate(t,r,n).schema;const a=e.$_terms.link[0].ref,{perspective:i,path:o}=c.perspective(a,r);c.assert(i,"which is outside of schema boundaries",a,e,r,n);try{s=o.length?i.$_reach(o):i}catch(t){c.assert(!1,"to non-existing schema",a,e,r,n)}return c.assert("link"!==s.type,"which is another link",a,e,r,n),e._flags.relative||r.mainstay.links.set(e,s),s._generate(t,r,n).schema},c.perspective=function(e,t){if("local"===e.type){for(const{schema:r,key:n}of t.schemas){if((r._flags.id||n)===e.path[0])return{perspective:r,path:e.path.slice(1)};if(r.$_terms.shared)for(const t of r.$_terms.shared)if(t._flags.id===e.path[0])return{perspective:t,path:e.path.slice(1)}}return{perspective:null,path:null}}return"root"===e.ancestor?{perspective:t.schemas[t.schemas.length-1].schema,path:e.path}:{perspective:t.schemas[e.ancestor]&&t.schemas[e.ancestor].schema,path:e.path}},c.assert=function(e,t,r,s,a,i){e||n(!1,`"${o.label(s._flags,a,i)}" contains link reference "${r.display}" ${t}`)}},(e,t,r)=>{const n=r(40),s=r(74),a=r(64),i={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/};e.exports=s._extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:r}){const n=e.match(i.numberRx);if(!n)return;e=e.trim();const s={value:parseFloat(e)};if(0===s.value&&(s.value=0),!t._flags.unsafe)if(e.match(/e/i)){if(i.normalizeExponent(`${s.value/Math.pow(10,n[1])}e${n[1]}`)!==i.normalizeExponent(e))return s.errors=r("number.unsafe"),s}else{const t=s.value.toString();if(t.match(/e/i))return s;if(t!==i.normalizeDecimal(e))return s.errors=r("number.unsafe"),s}return s}},validate(e,{schema:t,error:r,prefs:n}){if(e===1/0||e===-1/0)return{value:e,errors:r("number.infinity")};if(!a.isNumber(e))return{value:e,errors:r("number.base")};const s={value:e};if(n.convert){const e=t.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);s.value=Math.round(s.value*t)/t}}return 0===s.value&&(s.value=0),!t._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||ea.compare(e,r,s)?e:t.error("number."+n,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:a.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){return this.$_addRule({name:"multiple",args:{base:e}})},validate:(e,t,{base:r},n)=>e%r==0?e:t.error("number.multiple",{multiple:n.args.base,value:e}),args:[{name:"base",ref:!0,assert:e=>"number"==typeof e&&isFinite(e)&&e>0,message:"must be a positive number"}],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,t)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:t.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(e){return n(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,t,{limit:r}){const n=e.toString().match(i.precisionRx);return Math.max((n[1]?n[1].length:0)-(n[2]?parseInt(n[2],10):0),0)<=r?e:t.error("number.precision",{limit:r,value:e})},convert:!0},sign:{method(e){return n(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate:(e,t,{sign:r})=>"negative"===r&&e<0||"positive"===r&&e>0?e:t.error(`number.${r}`)},unsafe:{method(e=!0){return n("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("unsafe",e)}}},cast:{string:{from:e=>"number"==typeof e,to:(e,t)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),i.normalizeExponent=function(e){return e.replace(/E/,"e").replace(/\.(\d*[1-9])?0+e/,".$1e").replace(/\.e/,"e").replace(/e\+/,"e").replace(/^\+/,"").replace(/^(-?)0+([1-9])/,"$1$2")},i.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0+$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([1-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e}},(e,t,r)=>{const n=r(85);e.exports=n._extend({type:"object",cast:{map:{from:e=>e&&"object"==typeof e,to:(e,t)=>new Map(Object.entries(e))}}})},(e,t,r)=>{var n=r(21).Buffer;const s=r(8),a=r(40),i=r(53),o=r(74),c=r(64),l={base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:/^[a-f0-9]+$/i,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"],domainControlRx:/[\x00-\x20@\:\/]/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,finalSegmentAdditionalRx:/[^0-9]/};e.exports=o._extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,{schema:t,state:r,prefs:n}){const s=t.$_getRule("normalize");s&&(e=e.normalize(s.args.form));const a=t.$_getRule("case");a&&(e="upper"===a.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const i=t.$_getRule("trim");if(i&&i.args.enabled&&(e=e.trim()),t.$_terms.replacements)for(const r of t.$_terms.replacements)e=e.replace(r.pattern,r.replacement);const o=t.$_getRule("hex");if(o&&o.args.options.byteAligned&&e.length%2!=0&&(e=`0${e}`),t.$_getRule("isoDate")){const t=l.isoDate(e);t&&(e=t)}if(t._flags.truncate){const s=t.$_getRule("max");if(s){let a=s.args.limit;if(c.isResolvable(a)&&(a=a.resolve(e,r,n),!c.limit(a)))return{value:e,errors:t.$_createError("any.ref",a,{ref:s.args.limit,arg:"limit",reason:"must be a positive integer"},r,n)};e=e.slice(0,a)}}return{value:e}}},validate:(e,{error:t})=>"string"!=typeof e?{value:e,errors:t("string.base")}:""===e?{value:e,errors:t("string.empty")}:void 0,rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(e,t)=>/^[a-zA-Z0-9]+$/.test(e)?e:t.error("string.alphanum")},base64:{method(e={}){return c.assertOptions(e,["paddingRequired","urlSafe"]),e={urlSafe:!1,paddingRequired:!0,...e},a("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),a("boolean"==typeof e.urlSafe,"urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:e}})},validate:(e,t,{options:r})=>l.base64Regex[r.paddingRequired][r.urlSafe].test(e)?e:t.error("string.base64")},case:{method(e){return a(["lower","upper"].includes(e),"Invalid case:",e),this.$_addRule({name:"case",args:{direction:e}})},validate:(e,t,{direction:r})=>"lower"===r&&e===e.toLocaleLowerCase()||"upper"===r&&e===e.toLocaleUpperCase()?e:t.error(`string.${r}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let r=e.length,n=0,s=1;for(;r--;){const t=e.charAt(r)*s;n+=t-9*(t>9),s^=3}return n>0&&n%10==0?e:t.error("string.creditCard")}},dataUri:{method(e={}){return c.assertOptions(e,["paddingRequired"]),e={paddingRequired:!0,...e},a("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:e}})},validate(e,t,{options:r}){const n=e.match(l.dataUriRegex);if(n){if(!n[2])return e;if("base64"!==n[2])return e;if(l.base64Regex[r.paddingRequired].false.test(n[3]))return e}return t.error("string.dataUri")}},guid:{alias:"uuid",method(e={}){c.assertOptions(e,["version","separator"]);let t="";if(e.version){const r=[].concat(e.version);a(r.length>=1,"version must have at least 1 valid version specified");const n=new Set;for(let e=0;el.hexRegex.test(e)?r.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(e,t)=>l.isDomainValid(e)||l.ipRegex.test(e)?e:t.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},isoDate:{method(){return this.$_addRule("isoDate")},validate:(e,{error:t})=>l.isoDate(e)?e:t("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>l.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return l.length(this,"length",e,"=",t)},validate(e,t,{limit:r,encoding:s},{name:a,operator:i,args:o}){const l=s?n&&n.byteLength(e,s):e.length;return c.compare(l,r,i)?e:t.error("string."+a,{limit:o.limit,value:e,encoding:s})},args:[{name:"limit",ref:!0,assert:c.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return l.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return l.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(e="NFC"){return a(l.normalizationForms.includes(e),"normalization form must be one of "+l.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:e}})},validate:(e,{error:t},{form:r})=>e===e.normalize(r)?e:t("string.normalize",{value:e,form:r}),convert:!0},pattern:{alias:"regex",method(e,t={}){a(e instanceof RegExp,"regex must be a RegExp"),a(!e.flags.includes("g")&&!e.flags.includes("y"),"regex should not use global or sticky mode"),"string"==typeof t&&(t={name:t}),c.assertOptions(t,["invert","name"]);const r=["string.pattern",t.invert?".invert":"",t.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:e,options:t},errorCode:r})},validate:(e,t,{regex:r,options:n},{errorCode:s})=>r.test(e)^n.invert?e:t.error(s,{name:n.name,regex:r,value:e}),args:["regex","options"],multi:!0},replace:{method(e,t){"string"==typeof e&&(e=new RegExp(i(e),"g")),a(e instanceof RegExp,"pattern must be a RegExp"),a("string"==typeof t,"replacement must be a String");const r=this.clone();return r.$_terms.replacements||(r.$_terms.replacements=[]),r.$_terms.replacements.push({pattern:e,replacement:t}),r}},token:{method(){return this.$_addRule("token")},validate:(e,t)=>/^\w+$/.test(e)?e:t.error("string.token")},trim:{method(e=!0){return a("boolean"==typeof e,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:e}})},validate:(e,t,{enabled:r})=>r&&e!==e.trim()?t.error("string.trim"):e,convert:!0},truncate:{method(e=!0){return a("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("truncate",e)}},uppercase:{method(){return this.case("upper")}}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:.} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:.} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:.} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:.} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uppercase":"{{#label}} must only contain uppercase characters"}}),l.isoDate=function(e){if(!c.isIsoDate(e))return null;const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},l.length=function(e,t,r,s,i){return a(!i||n&&n.isEncoding(i),"Invalid encoding:",i),e.$_addRule({name:t,method:"length",args:{limit:r,encoding:i},operator:s})},l.rfc3986=function(){const e={},t="[\\dA-Fa-f]",r="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4="(?:"+r+"\\.){3}"+r;const n=t+"{1,4}",s="(?:"+n+":"+n+"|"+e.ipv4+")",a="(?:"+n+":){6}"+s,i="::(?:"+n+":){5}"+s,o="(?:"+n+")?::(?:"+n+":){4}"+s,c="(?:(?:"+n+":){0,1}"+n+")?::(?:"+n+":){3}"+s,l="(?:(?:"+n+":){0,2}"+n+")?::(?:"+n+":){2}"+s,u="(?:(?:"+n+":){0,3}"+n+")?::"+n+":"+s,d="(?:(?:"+n+":){0,4}"+n+")?::"+s,p="(?:(?:"+n+":){0,5}"+n+")?::"+n,h="(?:(?:"+n+":){0,6}"+n+")?::";return e.v4Cidr="(?:\\d|[1-2]\\d|3[0-2])",e.v6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",e.ipv6="(?:"+a+"|"+i+"|"+o+"|"+c+"|"+l+"|"+u+"|"+d+"|"+p+"|"+h+")",e.ipvfuture="v"+t+"+\\.[\\w-\\.~!\\$&'\\(\\)\\*\\+,;=:]+",e},l.ipRegex=function(){const e=l.rfc3986(),t=`(?:${["ipv4","ipv6","ipvfuture"].map((t=>{const r=`\\/${"ipv4"===t?e.v4Cidr:e.v6Cidr}`;return`${e[t]}(?:${r})?`})).join("|")})`;return new RegExp(`^${t}$`)}(),l.isDomainValid=function(e){if(e.length>256)return!1;if(e=e.normalize("NFC"),l.domainControlRx.test(e))return!1;const t=(e=l.punycode(e)).split(".");for(let e=0;e63)return!1;if(!l.domainSegmentRx.test(r))return!1;if(e===t.length-1&&!l.finalSegmentAdditionalRx.test(r))return!1}return!0},l.punycode=function(e){try{return new s.URL(`http://${e}`).host}catch(t){return e}}},(e,t,r)=>{const n=r(40),s=r(74),a={};a.Map=class extends Map{slice(){return new a.Map(this)}},e.exports=s._extend({type:"symbol",terms:{map:{init:new a.Map}},coerce:{method(e,{schema:t,error:r}){const n=t.$_terms.map.get(e);return n&&(e=n),t._flags.only&&"symbol"!=typeof e?{value:e,errors:r("symbol.map",{map:t.$_terms.map})}:{value:e}}},validate(e,{error:t}){if("symbol"!=typeof e)return{value:e,errors:t("symbol.base")}},rules:{map:{method(e){e&&!e[Symbol.iterator]&&"object"==typeof e&&(e=Object.entries(e)),n(e&&e[Symbol.iterator],"Iterable must be an iterable or object");const t=this.clone(),r=[];for(const s of e){n(s&&s[Symbol.iterator],"Entry must be an iterable");const[e,a]=s;n("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),n("symbol"==typeof a,"Value must be a Symbol"),t.$_terms.map.set(e,a),r.push(a)}return t.valid(...r)}}},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},(e,t,r)=>{var n=r(21).Buffer;const s=r(40),a=r(74),i=r(64);e.exports=a._extend({type:"binary",coerce:{from:"string",method(e,{schema:t}){try{return{value:n.from(e,t._flags.encoding)}}catch(e){}}},validate(e,{error:t}){if(!n.isBuffer(e))return{value:e,errors:t("binary.base")}},rules:{encoding:{method(e){return s(n.isEncoding(e),"Invalid encoding:",e),this.$_setFlag("encoding",e)}},length:{method(e){return this.$_addRule({name:"length",method:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:n,operator:s,args:a})=>i.compare(e.length,r,s)?e:t.error("binary."+n,{limit:a.limit,value:e}),args:[{name:"limit",ref:!0,assert:i.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}}},cast:{string:{from:e=>n.isBuffer(e),to:(e,t)=>e.toString()}},messages:{"binary.base":"{{#label}} must be a buffer or a string","binary.length":"{{#label}} must be {{#limit}} bytes","binary.max":"{{#label}} must be less than or equal to {{#limit}} bytes","binary.min":"{{#label}} must be at least {{#limit}} bytes"}})},(e,t,r)=>{const n=r(26),s=r(2),a=r(94),i=r(38),o=r(63),c=r(96),l=r(105),u={};u.schema=o.object({path:o.alternatives(o.array().items(o.string()).single(),o.func()).required(),index:o.alternatives(o.boolean(),o.array().items(o.string()).single()).default(!0),listing:o.boolean(),showHidden:o.boolean(),redirectToSlash:o.boolean(),lookupCompressed:o.boolean(),lookupMap:o.object().min(1).pattern(/.+/,o.string()),etagMethod:o.string().valid("hash","simple").allow(!1),defaultExtension:o.string().alphanum()}),u.resolvePathOption=function(e){if(e instanceof Error)throw e;if("string"==typeof e)return[e];if(Array.isArray(e))return e;throw s.internal("Invalid path function")},t.handler=function(e,t){const r=o.attempt(t,u.schema,"Invalid directory handler options ("+e.path+")");i.assert("}"===e.path[e.path.length-1],"The route path for a directory handler must end with a parameter:",e.path);const l=/\w+/.exec(e.path.slice(e.path.lastIndexOf("{")))[0],d=e.settings.files.relativeTo,p=Array.isArray(r.path)?r.path:null,h=!0===r.index?["index.html"]:r.index||[];return async(e,t)=>{const i=p??u.resolvePathOption(r.path.call(null,e)),o=e.params[l]??"";if(n.isAbsolute(o))throw s.notFound(null,{});if(o&&!r.showHidden&&u.isFileHidden(o))throw s.notFound(null,{});o||!e.server.settings.router.stripTrailingSlash&&e.path.endsWith("/")||(e.path+="/");const f=e.path,m=f.endsWith("/"),g={confine:null,lookupCompressed:r.lookupCompressed,lookupMap:r.lookupMap,etagMethod:r.etagMethod},y=async i=>{g.confine=i;let l,p=o;try{return await c.load(p,e,g)}catch(e){a.ignore(e,"boom"),l=e}if(u.isNotFound(l)){if(!r.defaultExtension)throw l;return m&&(p=p.slice(0,-1)),await c.load(p+"."+r.defaultExtension,e,g)}if(u.isDirectory(l)){if(!1!==r.redirectToSlash&&!e.server.settings.router.stripTrailingSlash&&!m)return t.redirect(f+"/");for(const t of h){const r=n.join(p,t);try{return await c.load(r,e,g)}catch(e){if(a.ignore(e,"boom"),!u.isNotFound(e))throw s.internal(t+" is a directory",e)}}if(r.listing)return u.generateListing(n.join(d,i,p),f,o,m,r,e)}throw l};for(let e=0;e

Directory: "+p+"

    ";if(r){const e=t.substring(0,t.lastIndexOf("/",t.length-(n?2:1)))+"/";h=h+'
  • Parent Directory
  • '}for(const e of d)!o.showHidden&&u.isFileHidden(e)||(h=h+'
  • '+i.escapeHtml(e)+"
  • ");return h+="
",c.generateResponse(h)},u.isFileHidden=function(e){return/(^|[\\\/])\.([^.\\\/]|\.[^\\\/])/.test(e)},u.pathEncode=function(e){return encodeURIComponent(e).replace(/%2F/g,"/").replace(/%5C/g,"\\")},u.isNotFound=function(e){return 404===e.output.statusCode},u.isDirectory=function(e){return 403===e.output.statusCode&&"EISDIR"===e.data.code}},(e,t,r)=>{const n=r(95),s=r(2),a=r(38),i={system:[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,n.AssertionError,a.Error]};t.rethrow=function(e,t,r={}){return i.catch(e,t,r,!0)},t.ignore=function(e,t,r={}){return i.catch(e,t,r,!1)},i.catch=function(e,t,r,n){if(i.match(e,t)===n){if(r.override&&(e=r.override),r.decorate&&Object.assign(e,r.decorate),r.return)return e;throw e}},t.background=async function(e,r="rethrow",n="system",s={}){try{"function"==typeof e?await e():await e}catch(e){t[r](e,n,s)}},t.isBoom=function(e){return s.isBoom(e)},t.isError=function(e){return e instanceof Error},t.isSystem=function(e){if(!e)return!1;if(e.isBoom)return!1;for(const t of i.system)if(e instanceof t)return!0;return!1},i.rules={system:t.isSystem,boom:t.isBoom},i.match=function(e,t){if(!t)return!0;t=Array.isArray(t)?t:[t];for(const r of t)if("string"==typeof r){if(i.rules[r](e))return!0}else if("object"==typeof r){if(a.contain(e,r,{deep:!0,part:!0}))return!0}else if(e instanceof r)return!0;return!1}},e=>{e.exports=require("assert")},(e,t,r)=>{const n=r(26),s=r(97),a=r(2),i=r(94),o=r(38),c=r(63),l=r(99),u=r(105),d={defaultMap:{gzip:".gz"}};d.schema=c.alternatives([c.string(),c.func(),c.object({path:c.alternatives(c.string(),c.func()).required(),confine:c.alternatives(c.string(),c.boolean()).default(!0),filename:c.string(),mode:c.string().valid("attachment","inline").allow(!1),lookupCompressed:c.boolean(),lookupMap:c.object().min(1).pattern(/.+/,c.string()),etagMethod:c.string().valid("hash","simple").allow(!1),start:c.number().integer().min(0).default(0),end:c.number().integer().min(c.ref("start"))}).with("filename","mode")]),t.handler=function(e,r){let n=c.attempt(r,d.schema,"Invalid file handler options ("+e.path+")");n="object"!=typeof r?{path:r,confine:"."}:n,n.confine=!0===n.confine?".":n.confine,o.assert("string"!=typeof n.path||"/"!==n.path[n.path.length-1],"File path cannot end with a '/':",e.path);return e=>{const r="function"==typeof n.path?n.path(e):n.path;return t.response(r,n,e)}},t.load=function(e,r,n){const s=t.response(e,n,r,!0);return d.prepare(s)},t.response=function(e,t,r,s){if(o.assert(!t.mode||-1!==["attachment","inline"].indexOf(t.mode),"options.mode must be either false, attachment, or inline"),t.confine){const s=n.resolve(r.route.settings.files.relativeTo,t.confine);0!==(e=n.isAbsolute(e)?n.normalize(e):n.join(s,e)).lastIndexOf(s,0)&&(e=null)}else e=n.isAbsolute(e)?n.normalize(e):n.join(r.route.settings.files.relativeTo,e);const a={path:e,settings:t,stat:null,file:null},i=s?null:d.prepare;return r.generateResponse(a,{variety:"file",marshal:d.marshal,prepare:i,close:d.close})},d.prepare=async function(e){const{request:t,source:r}=e,{settings:s,path:i}=r;if(null===i)throw a.forbidden(null,{code:"EACCES"});const o=r.file=new u.File(i);try{const r=await o.openStat("r"),a=s.start??0;if(void 0!==s.end?e.bytes(s.end-a+1):e.bytes(r.size-a),e.headers["content-type"]||e.type(t.server.mime.path(i).type??"application/octet-stream"),e.header("last-modified",r.mtime.toUTCString()),s.mode){const t=s.filename??n.basename(i);e.header("content-disposition",s.mode+"; filename="+encodeURIComponent(t))}return await l.apply(e,r),e}catch(t){throw d.close(e),t}},d.marshal=async function(e){const{request:t,source:r}=e,{settings:n}=r;if(n.lookupCompressed&&!n.start&&void 0===n.end&&!1!==t.server.settings.compression){const a=n.lookupMap??d.defaultMap,o=t.info.acceptEncoding,c=a.hasOwnProperty(o)?a[o]:null;if(c){const t=new u.File(`${r.path}${c}`);try{var s=await t.openStat("r")}catch(e){t.close(),i.ignore(e,"boom")}s&&(r.file.close(),r.file=t,e.bytes(s.size),e.header("content-encoding",o),e.vary("accept-encoding"))}}return d.createStream(e)},d.addContentRange=function(e){const{request:t}=e;let r=null;if(t.route.settings.response.ranges){const n=e.headers["content-length"];if(t.headers.range&&n&&(!t.headers["if-range"]||t.headers["if-range"]===e.headers.etag)){const i=t.server.mime.type(e.headers["content-type"]||"application/octet-stream"),o=t.server.settings.compression&&i.compressible&&!e.headers["content-encoding"]?t.info.acceptEncoding:null;if("identity"===o||!o){const i=s.header(t.headers.range,n);if(!i){const e=a.rangeNotSatisfiable();throw e.output.headers["content-range"]="bytes */"+n,e}1===i.length&&(r=i[0],e.code(206),e.bytes(r.to-r.from+1),e.header("content-range","bytes "+r.from+"-"+r.to+"/"+n))}}e.header("accept-ranges","bytes")}return r},d.createStream=function(e){const{settings:t,file:r}=e.source;o.assert(null!==r);const n=d.addContentRange(e),s={start:t.start??0,end:t.end};return n&&(s.end=n.to+s.start,s.start=n.from+s.start),r.createReadStream(s)},d.close=function(e){const{source:t}=e;null!==t.file&&(t.file.close(),t.file=null)}},(e,t,r)=>{const n=r(98),s=r(38),a={headerRx:/^bytes=[\s,]*((?:(?:\d+\-\d*)|(?:\-\d+))(?:\s*,\s*(?:(?:\d+\-\d*)|(?:\-\d+)))*)$/i};t.header=function(e,t){const r=a.headerRx.exec(e);if(!r)return null;const n=t-1,s=[],i=r[1].match(/\d*\-\d*/g);for(let e of i){let r,i;if(e=e.split("-"),e[0]&&(r=parseInt(e[0],10)),e[1]?(i=parseInt(e[1],10),void 0!==r?i>n&&(i=n):(r=t-i,i=n)):i=n,r>i)return null;s.push(new a.Range(r,i))}if(1===s.length)return s;s.sort(((e,t)=>e.from-t.from));const o=[];for(let e=s.length-1;e>0;--e){const t=s[e],r=s[e-1];t.from<=r.to+1?r.to=t.to:o.unshift(t)}return o.unshift(s[0]),o},a.Range=class{constructor(e,t){this.from=e,this.to=t}},t.Clip=class extends n.Transform{constructor(e){if(!(e instanceof a.Range)){s.assert("object"==typeof e,'Expected "range" object');const t=e.from??0;s.assert("number"==typeof t,'"range.from" must be a number'),s.assert(t===parseInt(t,10)&&t>=0,'"range.from" must be a positive integer');const r=e.to??0;s.assert("number"==typeof r,'"range.to" must be a number'),s.assert(r===parseInt(r,10)&&r>=0,'"range.to" must be a positive integer'),s.assert(r>=t,'"range.to" must be greater than or equal to "range.from"'),e=new a.Range(t,r)}super(),this._range=e,this._next=0,this._pipes=new Set,this.on("pipe",(e=>this._pipes.add(e))),this.on("unpipe",(e=>this._pipes.delete(e)))}_transform(e,t,r){try{a.processChunk(this,e)}catch(e){return r(e)}return r()}_flush(e){this._pipes.clear(),e()}},a.processChunk=function(e,t){const r=e._next;if(e._next=e._next+t.length,e._next<=e._range.from)return;if(r>e._range.to){for(const t of e._pipes)t.unpipe(e);return e._pipes.clear(),void e.end()}const n=Math.max(0,e._range.from-r),s=Math.min(t.length,e._range.to-r+1);e.push(t.slice(n,s))}},e=>{e.exports=require("stream")},(e,t,r)=>{const n=r(100),s=r(98),a=r(101),i=r(2),o=r(94),c=r(102),l={pendings:new Map,streamEnd:a.promisify(s.finished),computeHashed:async function(e,t){const r=e.request.server.plugins.inert._etags;if(!r)return null;const n=[e.source.path,t.ino,t.size,t.mtime.getTime()].join("-"),s=r.get(n);if(s)return s;let a=l.pendings.get(n);if(a)return await a;return l.pendings.set(n,a=(async()=>{try{const t=await l.hashFile(e);return r.set(n,t),t}finally{l.pendings.delete(n)}})()),await a},hashFile:async function(e){const t=n.createHash("sha1");t.setEncoding("hex");const r=e.source.file.createReadStream({autoClose:!1});r.pipe(t);try{return await l.streamEnd(r),t.read()}catch(t){throw o.rethrow(t,"system"),i.boomify(t,{message:"Failed to hash file",data:{path:e.source.path}})}},computeSimple:function(e,t){return t.size.toString(16)+"-"+t.mtime.getTime().toString(16)}};t.apply=async function(e,t){const r=e.source.settings.etagMethod;if(!1===r)return;let n;n="simple"===r?l.computeSimple(e,t):await l.computeHashed(e,t),null!==n&&e.etag(n,{vary:!0})},t.Cache=c},e=>{e.exports=require("crypto")},e=>{e.exports=require("util")},(e,t,r)=>{const n=r(103),s=Symbol("max"),a=Symbol("length"),i=Symbol("lengthCalculator"),o=Symbol("allowStale"),c=Symbol("maxAge"),l=Symbol("dispose"),u=Symbol("noDisposeOnSet"),d=Symbol("lruList"),p=Symbol("cache"),h=Symbol("updateAgeOnGet"),f=()=>1;const m=(e,t,r)=>{const n=e[p].get(t);if(n){const t=n.value;if(g(e,t)){if(_(e,n),!e[o])return}else r&&(e[h]&&(n.value.now=Date.now()),e[d].unshiftNode(n));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[c])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[c]&&r>e[c]},y=e=>{if(e[a]>e[s])for(let t=e[d].tail;e[a]>e[s]&&null!==t;){const r=t.prev;_(e,t),t=r}},_=(e,t)=>{if(t){const r=t.value;e[l]&&e[l](r.key,r.value),e[a]-=r.length,e[p].delete(r.key),e[d].removeNode(t)}};class v{constructor(e,t,r,n,s){this.key=e,this.value=t,this.length=r,this.now=n,this.maxAge=s||0}}const b=(e,t,r,n)=>{let s=r.value;g(e,s)&&(_(e,r),e[o]||(s=void 0)),s&&t.call(n,s.value,s.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[s]=e.max||1/0;const t=e.length||f;if(this[i]="function"!=typeof t?f:t,this[o]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[c]=e.maxAge||0,this[l]=e.dispose,this[u]=e.noDisposeOnSet||!1,this[h]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[s]=e||1/0,y(this)}get max(){return this[s]}set allowStale(e){this[o]=!!e}get allowStale(){return this[o]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[c]=e,y(this)}get maxAge(){return this[c]}set lengthCalculator(e){"function"!=typeof e&&(e=f),e!==this[i]&&(this[i]=e,this[a]=0,this[d].forEach((e=>{e.length=this[i](e.value,e.key),this[a]+=e.length}))),y(this)}get lengthCalculator(){return this[i]}get length(){return this[a]}get itemCount(){return this[d].length}rforEach(e,t){t=t||this;for(let r=this[d].tail;null!==r;){const n=r.prev;b(this,e,r,t),r=n}}forEach(e,t){t=t||this;for(let r=this[d].head;null!==r;){const n=r.next;b(this,e,r,t),r=n}}keys(){return this[d].toArray().map((e=>e.key))}values(){return this[d].toArray().map((e=>e.value))}reset(){this[l]&&this[d]&&this[d].length&&this[d].forEach((e=>this[l](e.key,e.value))),this[p]=new Map,this[d]=new n,this[a]=0}dump(){return this[d].map((e=>!g(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[d]}set(e,t,r){if((r=r||this[c])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,o=this[i](t,e);if(this[p].has(e)){if(o>this[s])return _(this,this[p].get(e)),!1;const i=this[p].get(e).value;return this[l]&&(this[u]||this[l](e,i.value)),i.now=n,i.maxAge=r,i.value=t,this[a]+=o-i.length,i.length=o,this.get(e),y(this),!0}const h=new v(e,t,o,n,r);return h.length>this[s]?(this[l]&&this[l](e,t),!1):(this[a]+=h.length,this[d].unshift(h),this[p].set(e,this[d].head),y(this),!0)}has(e){if(!this[p].has(e))return!1;const t=this[p].get(e).value;return!g(this,t)}get(e){return m(this,e,!0)}peek(e){return m(this,e,!1)}pop(){const e=this[d].tail;return e?(_(this,e),e.value):null}del(e){_(this,this[p].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const n=e[r],s=n.e||0;if(0===s)this.set(n.k,n.v);else{const e=s-t;e>0&&this.set(n.k,n.v,e)}}}prune(){this[p].forEach(((e,t)=>m(this,t,!1)))}}},(e,t,r)=>{function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var r=0,s=arguments.length;r1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var s=0;null!==n;s++)r=e(r,n.value,s),n=n.next;return r},n.prototype.reduceReverse=function(e,t){var r,n=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var s=this.length-1;null!==n;s--)r=e(r,n.value,s),n=n.prev;return r},n.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},n.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},n.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new n;if(tthis.length&&(t=this.length);for(var s=0,a=this.head;null!==a&&sthis.length&&(t=this.length);for(var s=this.length,a=this.tail;null!==a&&s>t;s--)a=a.prev;for(;null!==a&&s>e;s--,a=a.prev)r.push(a.value);return r},n.prototype.splice=function(e,t){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var r=0,n=this.head;null!==n&&r{e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},(e,t,r)=>{const n=r(28),s=r(101),a=r(2),i=r(94),o=r(38),c={methods:{promised:["open","close","fstat","readdir"],raw:["createReadStream"]},notFound:new Set(["ENOENT","ENOTDIR"])};t.File=class{constructor(e){this.path=e,this.fd=null}async open(e){o.assert(null===this.fd);try{this.fd=await t.open(this.path,e)}catch(e){const t={path:this.path};if(-1!==this.path.indexOf("\0")||c.notFound.has(e.code))throw a.notFound(null,t);if("EACCES"===e.code||"EPERM"===e.code)throw t.code=e.code,a.forbidden(null,t);throw a.boomify(e,{message:"Failed to open file",data:t})}}close(){null!==this.fd&&(i.background(t.close(this.fd)),this.fd=null)}async stat(){o.assert(null!==this.fd);try{const e=await t.fstat(this.fd);if(e.isDirectory())throw a.forbidden(null,{code:"EISDIR",path:this.path});return e}catch(e){throw this.close(this.fd),i.rethrow(e,["boom","system"]),a.boomify(e,{message:"Failed to stat file",data:{path:this.path}})}}async openStat(e){return await this.open(e),this.stat()}createReadStream(e){o.assert(null!==this.fd),e=Object.assign({fd:this.fd,start:0},e);const r=t.createReadStream(this.path,e);return!1!==e.autoClose&&(this.fd=null),r}};for(const e of c.methods.raw)t[e]=n[e].bind(n);for(const e of c.methods.promised)t[e]=s.promisify(n[e])},e=>{e.exports=JSON.parse('{"name":"@hapi/inert","description":"Static file and directory handlers plugin for hapi.js","version":"7.1.0","repository":"https://github.com/hapijs/inert.git","main":"lib/index.js","types":"lib/index.d.ts","files":["lib"],"keywords":["file","directory","handler","hapi","plugin"],"eslintConfig":{"extends":["plugin:@hapi/module"]},"dependencies":{"@hapi/ammo":"^6.0.1","@hapi/boom":"^10.0.1","@hapi/bounce":"^3.0.1","@hapi/hoek":"^11.0.2","@hapi/validate":"^2.0.1","lru-cache":"^7.14.1"},"devDependencies":{"@hapi/code":"^9.0.3","@hapi/eslint-plugin":"*","@hapi/file":"^3.0.0","@hapi/hapi":"^21.3.0","@hapi/lab":"^25.1.2","@types/node":"^14.18.37","joi":"^17.8.3","typescript":"^4.9.5"},"scripts":{"test":"lab -f -a @hapi/code -t 100 -L -Y","test-cov-html":"lab -f -a @hapi/code -r html -o coverage.html"},"license":"BSD-3-Clause"}')},e=>{e.exports=require("blipp@4.0.2")},e=>{e.exports=require("hapi-auth-jwt2@10.5.1")},e=>{e.exports=require("@hapi/good-console@9.0.1")},(e,t,r)=>{var n=r(21).Buffer;const s=r(40),a=r(43),i=r(111),o=r(112),c=r(121),l=r(118),u=r(122),d=r(123),p=r(120),h=r(116),f=r(124);let m;const g={types:{alternatives:r(126),any:r(127),array:r(133),boolean:r(134),date:r(135),function:r(136),link:r(138),number:r(139),object:r(140),string:r(141),symbol:r(148)},aliases:{alt:"alternatives",bool:"boolean",func:"function"}};n&&(g.types.binary=r(149)),g.root=function(){const e={_types:new Set(Object.keys(g.types))};for(const t of e._types)e[t]=function(...e){return s(!e.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),g.generate(this,g.types[t],e)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(...e){return this.any()[t](...e)};Object.assign(e,g.methods);for(const t in g.aliases){const r=g.aliases[t];e[t]=e[r]}return e.x=e.expression,f.setup&&f.setup(e),e},g.methods={ValidationError:l.ValidationError,version:o.version,cache:i.provider,assert(e,t,...r){g.assert(e,t,!0,r)},attempt:(e,t,...r)=>g.assert(e,t,!1,r),build(e){return s("function"==typeof d.build,"Manifest functionality disabled"),d.build(this,e)},checkPreferences(e){o.checkPreferences(e)},compile(e,t){return c.compile(this,e,t)},defaults(e){s("function"==typeof e,"modifier must be a function");const t=Object.assign({},this);for(const r of t._types){const n=e(t[r]());s(o.isSchema(n),"modifier must return a valid schema object"),t[r]=function(...e){return g.generate(this,n,e)}}return t},expression:(...e)=>new h(...e),extend(...e){o.verifyFlat(e,"extend"),m=m||r(114),s(e.length,"You need to provide at least one extension"),this.assert(e,m.extensions);const t=Object.assign({},this);t._types=new Set(t._types);for(let r of e){"function"==typeof r&&(r=r(t)),this.assert(r,m.extension);const e=g.expandExtension(r,t);for(const r of e){s(void 0===t[r.type]||t._types.has(r.type),"Cannot override name",r.type);const e=r.base||this.any(),n=u.type(e,r);t._types.add(r.type),t[r.type]=function(...e){return g.generate(this,n,e)}}}return t},isError:l.ValidationError.isError,isExpression:h.isTemplate,isRef:p.isRef,isSchema:o.isSchema,in:(...e)=>p.in(...e),override:o.symbols.override,ref:(...e)=>p.create(...e),types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in g.aliases)e[t]=this[t]();return e}},g.assert=function(e,t,r,n){const s=n[0]instanceof Error||"string"==typeof n[0]?n[0]:null,i=null!==s?n[1]:n[0],c=t.validate(e,o.preferences({errors:{stack:!0}},i||{}));let u=c.error;if(!u)return c.value;if(s instanceof Error)throw s;const d=r&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof l.ValidationError==!1&&(u=a(u)),u.message=s?`${s} ${d}`:d,u},g.generate=function(e,t,r){return s(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&r.length?t._definition.args(t,...r):t},g.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const r=[];for(const n of t._types)if(e.type.test(n)){const s=Object.assign({},e);s.type=n,s.base=t[n](),r.push(s)}return r},e.exports=g.root()},(e,t,r)=>{const n=r(40),s=r(43),a=r(112),i={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new i.Cache(e)},i.Cache=class{constructor(e={}){a.assertOptions(e,["max"]),n(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||i.max,this._map=new Map,this._list=new i.List}get length(){return this._map.size}set(e,t){if(null!==e&&!i.supported.has(typeof e))return;let r=this._map.get(e);if(r)return r.value=t,void this._list.first(r);r=this._list.unshift({key:e,value:t}),this._map.set(e,r),this._compact()}get(e){const t=this._map.get(e);if(t)return this._list.first(t),s(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},i.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:t,prev:r}=e;return t.prev=r,r&&(r.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}}},(e,t,r)=>{const n=r(40),s=r(41),a=r(113);let i,o;const c={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};t.version=a.version,t.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},t.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},t.assertOptions=function(e,t,r="Options"){n(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const s=Object.keys(e).filter((e=>!t.includes(e)));n(0===s.length,`${r} contain unknown keys: ${s}`)},t.checkPreferences=function(e){o=o||r(114);const t=o.preferences.validate(e);if(t.error)throw new s([t.error.details[0].message])},t.compare=function(e,t,r){switch(r){case"=":return e===t;case">":return e>t;case"<":return e=":return e>=t;case"<=":return e<=t}},t.default=function(e,t){return void 0===e?t:e},t.isIsoDate=function(e){return c.isoDate.test(e)},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.isResolvable=function(e){return!!e&&(e[t.symbols.ref]||e[t.symbols.template])},t.isSchema=function(e,r={}){const s=e&&e[t.symbols.any];return!!s&&(n(r.legacy||s.version===t.version,"Cannot mix different versions of joi schemas"),!0)},t.isValues=function(e){return e[t.symbols.values]},t.limit=function(e){return Number.isSafeInteger(e)&&e>=0},t.preferences=function(e,n){i=i||r(115),e=e||{},n=n||{};const s=Object.assign({},e,n);return n.errors&&e.errors&&(s.errors=Object.assign({},e.errors,n.errors),s.errors.wrap=Object.assign({},e.errors.wrap,n.errors.wrap)),n.messages&&(s.messages=i.compile(n.messages,e.messages)),delete s[t.symbols.prefs],s},t.tryWithPath=function(e,t,r={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,r.append&&(e.message=`${e.message} (${e.path})`),e}},t.validateArg=function(e,r,{assert:n,message:s}){if(t.isSchema(n)){const t=n.validate(e);if(!t.error)return;return t.error.message}if(!n(e))return r?`${r} ${s}`:s},t.verifyFlat=function(e,t){for(const r of e)n(!Array.isArray(r),"Method no longer accepts array arguments:",t)}},e=>{e.exports=JSON.parse('{"name":"joi","description":"Object schema validation","version":"17.12.2","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause"}')},(e,t,r)=>{const n=r(110),s={};s.wrap=n.string().min(1).max(2).allow(!1),t.preferences=n.object({allowUnknown:n.boolean(),abortEarly:n.boolean(),artifacts:n.boolean(),cache:n.boolean(),context:n.object(),convert:n.boolean(),dateFormat:n.valid("date","iso","string","time","utc"),debug:n.boolean(),errors:{escapeHtml:n.boolean(),label:n.valid("path","key",!1),language:[n.string(),n.object().ref()],render:n.boolean(),stack:n.boolean(),wrap:{label:s.wrap,array:s.wrap,string:s.wrap}},externals:n.boolean(),messages:n.object(),noDefaults:n.boolean(),nonEnumerables:n.boolean(),presence:n.valid("required","optional","forbidden"),skipFunctions:n.boolean(),stripUnknown:n.object({arrays:n.boolean(),objects:n.boolean()}).or("arrays","objects").allow(!0,!1),warnings:n.boolean()}).strict(),s.nameRx=/^[a-zA-Z0-9]\w*$/,s.rule=n.object({alias:n.array().items(n.string().pattern(s.nameRx)).single(),args:n.array().items(n.string(),n.object({name:n.string().pattern(s.nameRx).required(),ref:n.boolean(),assert:n.alternatives([n.function(),n.object().schema()]).conditional("ref",{is:!0,then:n.required()}),normalize:n.function(),message:n.string().when("assert",{is:n.function(),then:n.required()})})),convert:n.boolean(),manifest:n.boolean(),method:n.function().allow(!1),multi:n.boolean(),validate:n.function()}),t.extension=n.object({type:n.alternatives([n.string(),n.object().regex()]).required(),args:n.function(),cast:n.object().pattern(s.nameRx,n.object({from:n.function().maxArity(1).required(),to:n.function().minArity(1).maxArity(2).required()})),base:n.object().schema().when("type",{is:n.object().regex(),then:n.forbidden()}),coerce:[n.function().maxArity(3),n.object({method:n.function().maxArity(3).required(),from:n.array().items(n.string()).single()})],flags:n.object().pattern(s.nameRx,n.object({setter:n.string(),default:n.any()})),manifest:{build:n.function().arity(2)},messages:[n.object(),n.string()],modifiers:n.object().pattern(s.nameRx,n.function().minArity(1).maxArity(2)),overrides:n.object().pattern(s.nameRx,n.function()),prepare:n.function().maxArity(3),rebuild:n.function().arity(1),rules:n.object().pattern(s.nameRx,s.rule),terms:n.object().pattern(s.nameRx,n.object({init:n.array().allow(null).required(),manifest:n.object().pattern(/.+/,[n.valid("schema","single"),n.object({mapped:n.object({from:n.string().required(),to:n.string().required()}).required()})])})),validate:n.function().maxArity(3)}).strict(),t.extensions=n.array().items(n.object(),n.function().arity(1)).strict(),s.desc={buffer:n.object({buffer:n.string()}),func:n.object({function:n.function().required(),options:{literal:!0}}),override:n.object({override:!0}),ref:n.object({ref:n.object({type:n.valid("value","global","local"),path:n.array().required(),separator:n.string().length(1).allow(!1),ancestor:n.number().min(0).integer().allow("root"),map:n.array().items(n.array().length(2)).min(1),adjust:n.function(),iterables:n.boolean(),in:n.boolean(),render:n.boolean()}).required()}),regex:n.object({regex:n.string().min(3)}),special:n.object({special:n.valid("deep").required()}),template:n.object({template:n.string().required(),options:n.object()}),value:n.object({value:n.alternatives([n.object(),n.array()]).required()})},s.desc.entity=n.alternatives([n.array().items(n.link("...")),n.boolean(),n.function(),n.number(),n.string(),s.desc.buffer,s.desc.func,s.desc.ref,s.desc.regex,s.desc.special,s.desc.template,s.desc.value,n.link("/")]),s.desc.values=n.array().items(null,n.boolean(),n.function(),n.number().allow(1/0,-1/0),n.string().allow(""),n.symbol(),s.desc.buffer,s.desc.func,s.desc.override,s.desc.ref,s.desc.regex,s.desc.template,s.desc.value),s.desc.messages=n.object().pattern(/.+/,[n.string(),s.desc.template,n.object().pattern(/.+/,[n.string(),s.desc.template])]),t.description=n.object({type:n.string().required(),flags:n.object({cast:n.string(),default:n.any(),description:n.string(),empty:n.link("/"),failover:s.desc.entity,id:n.string(),label:n.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:n.boolean(),unit:n.string()}).unknown(),preferences:{allowUnknown:n.boolean(),abortEarly:n.boolean(),artifacts:n.boolean(),cache:n.boolean(),convert:n.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:n.boolean(),label:["path","key"],language:[n.string(),s.desc.ref],wrap:{label:s.wrap,array:s.wrap}},externals:n.boolean(),messages:s.desc.messages,noDefaults:n.boolean(),nonEnumerables:n.boolean(),presence:["required","optional","forbidden"],skipFunctions:n.boolean(),stripUnknown:n.object({arrays:n.boolean(),objects:n.boolean()}).or("arrays","objects").allow(!0,!1),warnings:n.boolean()},allow:s.desc.values,invalid:s.desc.values,rules:n.array().min(1).items({name:n.string().required(),args:n.object().min(1),keep:n.boolean(),message:[n.string(),s.desc.messages],warn:n.boolean()}),keys:n.object().pattern(/.*/,n.link("/")),link:s.desc.ref}).pattern(/^[a-z]\w*$/,n.any())},(e,t,r)=>{const n=r(40),s=r(43),a=r(116);t.compile=function(e,t){if("string"==typeof e)return n(!t,"Cannot set single message string"),new a(e);if(a.isTemplate(e))return n(!t,"Cannot set single message template"),e;n("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?s(t):{};for(let r in e){const s=e[r];if("root"===r||a.isTemplate(s)){t[r]=s;continue}if("string"==typeof s){t[r]=new a(s);continue}n("object"==typeof s&&!Array.isArray(s),"Invalid message for",r);const i=r;for(r in t[i]=t[i]||{},s){const e=s[r];"root"===r||a.isTemplate(e)?t[i][r]=e:(n("string"==typeof e,"Invalid message for",r,"in",i),t[i][r]=new a(e))}}return t},t.decompile=function(e){const t={};for(let r in e){const n=e[r];if("root"===r){t.root=n;continue}if(a.isTemplate(n)){t[r]=n.describe({compact:!0});continue}const s=r;for(r in t[s]={},n){const e=n[r];"root"!==r?t[s][r]=e.describe({compact:!0}):t[s].root=e}}return t},t.merge=function(e,r){if(!e)return t.compile(r);if(!r)return e;if("string"==typeof r)return new a(r);if(a.isTemplate(r))return r;const i=s(e);for(let e in r){const t=r[e];if("root"===e||a.isTemplate(t)){i[e]=t;continue}if("string"==typeof t){i[e]=new a(t);continue}n("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const s=e;for(e in i[s]=i[s]||{},t){const r=t[e];"root"===e||a.isTemplate(r)?i[s][e]=r:(n("string"==typeof r,"Invalid message for",e,"in",s),i[s][e]=new a(r))}}return i}},(e,t,r)=>{const n=r(40),s=r(43),a=r(55),i=r(117),o=r(112),c=r(118),l=r(120),u={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};e.exports=u.Template=class{constructor(e,t){if(n("string"==typeof e,"Template source must be a string"),n(!e.includes("\0")&&!e.includes(""),"Template source cannot contain reserved control characters"),this.source=e,this.rendered=e,this._template=null,t){const{functions:e,...r}=t;this._settings=Object.keys(r).length?s(r):void 0,this._functions=e,this._functions&&(n(Object.keys(this._functions).every((e=>"string"==typeof e)),"Functions keys must be strings"),n(Object.values(this._functions).every((e=>"function"==typeof e)),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const e=u.encode(this.source),t=u.split(e);let r=!1;const n=[],s=t.shift();s&&n.push(s);for(const e of t){const t="{"!==e[0],s=t?"}":"}}",a=e.indexOf(s);if(-1===a||"{"===e[1]){n.push(`{${u.decode(e)}`);continue}let i=e.slice(t?0:1,a);const o=":"===i[0];o&&(i=i.slice(1));const c=this._ref(u.decode(i),{raw:t,wrapped:o});n.push(c),"string"!=typeof c&&(r=!0);const l=e.slice(a+s.length);l&&n.push(u.decode(l))}r?this._template=n:this.rendered=n.join("")}static date(e,t){return u.dateFormat[t.dateFormat].call(e)}describe(e={}){if(!this._settings&&e.compact)return this.source;const t={template:this.source};return this._settings&&(t.options=this._settings),this._functions&&(t.functions=this._functions),t}static build(e){return new u.Template(e.template,e.options||e.functions?{...e.options,functions:e.functions}:void 0)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[o.symbols.template]}refs(){if(!this._template)return;const e=[];for(const t of this._template)"string"!=typeof t&&e.push(...t.refs);return e}resolve(e,t,r,n){return this._template&&1===this._template.length?this._part(this._template[0],e,t,r,n,{}):this.render(e,t,r,n)}_part(e,...t){return e.ref?e.ref.resolve(...t):e.formula.evaluate(t)}render(e,t,r,n,s={}){if(!this.isDynamic())return this.rendered;const i=[];for(const o of this._template)if("string"==typeof o)i.push(o);else{const c=this._part(o,e,t,r,n,s),l=u.stringify(c,e,t,r,n,s);if(void 0!==l){const e=o.raw||!1===(s.errors&&s.errors.escapeHtml)?l:a(l);i.push(u.wrap(e,o.wrapped&&r.errors.wrap.label))}}return i.join("")}_ref(e,{raw:t,wrapped:r}){const n=[],s=e=>{const t=l.create(e,this._settings);return n.push(t),e=>{const r=t.resolve(...e);return void 0!==r?r:null}};try{const t=this._functions?{...u.functions,...this._functions}:u.functions;var a=new i.Parser(e,{reference:s,functions:t,constants:u.constants})}catch(t){throw t.message=`Invalid template variable "${e}" fails due to: ${t.message}`,t}if(a.single){if("reference"===a.single.type){const e=n[0];return{ref:e,raw:t,refs:n,wrapped:r||"local"===e.type&&"label"===e.key}}return u.stringify(a.single.value)}return{formula:a,raw:t,refs:n}}toString(){return this.source}},u.Template.prototype[o.symbols.template]=!0,u.Template.prototype.isImmutable=!0,u.encode=function(e){return e.replace(/\\(\{+)/g,((e,t)=>u.opens.slice(0,t.length))).replace(/\\(\}+)/g,((e,t)=>u.closes.slice(0,t.length)))},u.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},u.split=function(e){const t=[];let r="";for(let n=0;n ${n.toString()}`);e=t}if(!Array.isArray(e))return e.toString();const d=[];for(const i of e)d.push(u.stringify(i,t,r,n,s,{arrayItems:!0,...a}));return u.wrap(d.join(", "),!c&&o.array)},u.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},u.functions={if:(e,t,r)=>e?t:r,length:e=>"string"==typeof e?e.length:e&&"object"==typeof e?Array.isArray(e)?e.length:Object.keys(e).length:null,msg(e){const[t,r,n,s,a]=this,i=a.messages;if(!i)return"";const o=c.template(t,i[0],e,r,n)||c.template(t,i[1],e,r,n);return o?o.render(t,r,n,s,a):""},number:e=>"number"==typeof e?e:"string"==typeof e?parseFloat(e):"boolean"==typeof e?e?1:0:e instanceof Date?e.getTime():null}},(e,t)=>{const r={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};t.Parser=class{constructor(e,t={}){if(!t[r.settings]&&t.constants)for(const e in t.constants){const r=t.constants[e];if(null!==r&&!["boolean","number","string"].includes(typeof r))throw new Error(`Formula constant ${e} contains invalid ${typeof r} value type`)}this.settings=t[r.settings]?t:Object.assign({[r.settings]:!0,constants:{},functions:{}},t),this.single=null,this._parts=null,this._parse(e)}_parse(e){let n=[],s="",a=0,i=!1;const o=e=>{if(a)throw new Error("Formula missing closing parenthesis");const o=n.length?n[n.length-1]:null;if(i||s||e){if(o&&"reference"===o.type&&")"===e)return o.type="function",o.value=this._subFormula(s,o.value),void(s="");if(")"===e){const e=new t.Parser(s,this.settings);n.push({type:"segment",value:e})}else if(i){if("]"===i)return n.push({type:"reference",value:s}),void(s="");n.push({type:"literal",value:s})}else if(r.operatorCharacters.includes(s))o&&"operator"===o.type&&r.operators.includes(o.value+s)?o.value+=s:n.push({type:"operator",value:s});else if(s.match(r.numberRx))n.push({type:"constant",value:parseFloat(s)});else if(void 0!==this.settings.constants[s])n.push({type:"constant",value:this.settings.constants[s]});else{if(!s.match(r.tokenRx))throw new Error(`Formula contains invalid token: ${s}`);n.push({type:"reference",value:s})}s=""}};for(const t of e)i?t===i?(o(),i=!1):s+=t:a?"("===t?(s+=t,++a):")"===t?(--a,a?s+=t:o(t)):s+=t:t in r.literals?i=r.literals[t]:"("===t?(o(),++a):r.operatorCharacters.includes(t)?(o(),s=t,o()):" "!==t?s+=t:o();o(),n=n.map(((e,t)=>"operator"!==e.type||"-"!==e.value||t&&"operator"!==n[t-1].type?e:{type:"operator",value:"n"}));let c=!1;for(const e of n){if("operator"===e.type){if(r.operatorsPrefix.includes(e.value))continue;if(!c)throw new Error("Formula contains an operator in invalid position");if(!r.operators.includes(e.value))throw new Error(`Formula contains an unknown operator ${e.value}`)}else if(c)throw new Error("Formula missing expected operator");c=!c}if(!c)throw new Error("Formula contains invalid trailing operator");1===n.length&&["reference","literal","constant"].includes(n[0].type)&&(this.single={type:"reference"===n[0].type?"reference":"value",value:n[0].value}),this._parts=n.map((e=>{if("operator"===e.type)return r.operatorsPrefix.includes(e.value)?e:e.value;if("reference"!==e.type)return e.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(e.value))throw new Error(`Formula contains invalid reference ${e.value}`);return this.settings.reference?this.settings.reference(e.value):r.reference(e.value)}))}_subFormula(e,n){const s=this.settings.functions[n];if("function"!=typeof s)throw new Error(`Formula contains unknown function ${n}`);let a=[];if(e){let t="",s=0,i=!1;const o=()=>{if(!t)throw new Error(`Formula contains function ${n} with invalid arguments ${e}`);a.push(t),t=""};for(let n=0;nnew t.Parser(e,this.settings))),function(e){const t=[];for(const r of a)t.push(r.evaluate(e));return s.call(e,...t)}}evaluate(e){const t=this._parts.slice();for(let n=t.length-2;n>=0;--n){const s=t[n];if(s&&"operator"===s.type){const a=t[n+1];t.splice(n+1,1);const i=r.evaluate(a,e);t[n]=r.single(s.value,i)}}return r.operatorsOrder.forEach((n=>{for(let s=1;s":return t>n;case">=":return t>=n;case"==":return t===n;case"!=":return t!==n;case"&&":return t&&n;case"||":return t||n}return null},r.exists=function(e){return null!=e}},(e,t,r)=>{const n=r(119),s=r(112),a=r(116);t.Report=class{constructor(e,r,n,s,a,i,o){if(this.code=e,this.flags=s,this.messages=a,this.path=i.path,this.prefs=o,this.state=i,this.value=r,this.message=null,this.template=null,this.local=n||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}_setTemplate(e){if(this.template=e,!this.flags.label&&0===this.path.length){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?`Error code "${e}" is not defined, your custom type is missing the correct messages definition`:(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(e,r){return t.template(this.value,e,r||this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const r of e)"object"!=typeof r&&("string"==typeof r?(t&&(t+="."),t+=r):t+=`[${r}]`);return t},t.template=function(e,t,r,n,i){if(!t)return;if(a.isTemplate(t))return"root"!==r?t:null;let o=i.errors.language;if(s.isResolvable(o)&&(o=o.resolve(e,n,i)),o&&t[o]){if(void 0!==t[o][r])return t[o][r];if(void 0!==t[o]["*"])return t[o]["*"]}return t[r]?t[r]:t["*"]},t.label=function(e,r,n,s){if(e.label)return e.label;if(!n.errors.label)return"";let a=r.path;"key"===n.errors.label&&r.path.length>1&&(a=r.path.slice(-1));const i=t.path(a);return i||(t.template(null,n.messages,"root",r,n)||s&&t.template(null,s,"root",r,n)||"value")},t.process=function(e,r,n){if(!e)return null;const{override:s,message:a,details:i}=t.details(e);if(s)return s;if(n.errors.stack)return new t.ValidationError(a,i,r);const o=Error.stackTraceLimit;Error.stackTraceLimit=0;const c=new t.ValidationError(a,i,r);return Error.stackTraceLimit=o,c},t.details=function(e,t={}){let r=[];const n=[];for(const s of e){if(s instanceof Error){if(!1!==t.override)return{override:s};const e=s.toString();r.push(e),n.push({message:e,type:"override",context:{error:s}});continue}const e=s.toString();r.push(e),n.push({message:e,path:s.path.filter((e=>"object"!=typeof e)),type:s.code,context:s.local})}return r.length>1&&(r=[...new Set(r)]),{message:r.join(". "),details:n}},t.ValidationError=class extends Error{constructor(e,t,r){super(e),this._original=r,this.details=t}static isError(e){return e instanceof t.ValidationError}},t.ValidationError.prototype.isJoi=!0,t.ValidationError.prototype.name="ValidationError",t.ValidationError.prototype.annotate=n.error},(e,t,r)=>{const n=r(43),s=r(112),a={annotations:Symbol("annotations")};t.error=function(e){if(!this._original||"object"!=typeof this._original)return this.details[0].message;const t=e?"":"",r=e?"":"",i=e?"":"",o=n(this._original);for(let e=this.details.length-1;e>=0;--e){const t=e+1,r=this.details[e],n=r.path;let i=o;for(let e=0;;++e){const o=n[e];if(s.isSchema(i)&&(i=i.clone()),!(e+1`" ${t}[${r}]${i}`)).replace(l,((e,n,s)=>`${r}"${n}"${i}${t} [${s}]: -- missing --${i}`)).replace(u,((e,r,n)=>`\n${n} ${t}[${r}]${i}`)).replace(d,((e,t)=>t));p=`${p}\n${t}`;for(let e=0;et[0]===n?"[Circular ~]":"[Circular ~."+e.slice(0,t.indexOf(n)).join(".")+"]";return function(n,s){if(t.length>0){const a=t.indexOf(this);~a?(t.length=a+1,e.length=a+1,e[a]=n):(t.push(this),e.push(n)),~t.indexOf(s)&&(s=r.call(this,n,s))}else t.push(s);if(s){const e=s[a.annotations];if(e){if(Array.isArray(s)){const t=[];for(let r=0;r{const n=r(40),s=r(43),a=r(44),i=r(112);let o;const c={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e,t={}){n("string"==typeof e,"Invalid reference key:",e),i.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),n(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const r=Object.assign({},c.defaults,t);delete r.prefix;const s=r.separator,a=c.context(e,s,t.prefix);if(r.type=a.type,e=a.key,"value"===r.type)if(a.root&&(n(!s||e[0]!==s,"Cannot specify relative path with root prefix"),r.ancestor="root",e||(e=null)),s&&s===e)e=null,r.ancestor=0;else if(void 0!==r.ancestor)n(!s||!e||e[0]!==s,"Cannot combine prefix with ancestor option");else{const[t,n]=c.ancestor(e,s);n&&""===(e=e.slice(n))&&(e=null),r.ancestor=t}return r.path=s?null===e?[]:e.split(s):[e],new c.Ref(r)},t.in=function(e,r={}){return t.create(e,{...r,in:!0})},t.isRef=function(e){return!!e&&!!e[i.symbols.ref]},c.Ref=class{constructor(e){n("object"==typeof e,"Invalid reference construction"),i.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),n([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),n(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),n(!e.map||Array.isArray(e.map),"options.map must be an array"),n(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,c.defaults,e),n("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,t,r,s,a={}){return n(!this.in||a.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(r.context,t,a):"local"===this.type?this._resolve(s,t,a):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,a):(n(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,a)):this._resolve(e,t,a)}_resolve(e,t,r){let n;if("value"===this.type&&t.mainstay.shadow&&!1!==r.shadow&&(n=t.mainstay.shadow.get(this.absolute(t))),void 0===n&&(n=a(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(n=this.adjust(n)),this.map){const e=this.map.get(n);void 0!==e&&(n=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,n),n}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new c.Ref(this)}describe(){const e={path:this.path};"value"!==this.type&&(e.type=this.type),"."!==this.separator&&(e.separator=this.separator),"value"===this.type&&1!==this.ancestor&&(e.ancestor=this.ancestor),this.map&&(e.map=[...this.map]);for(const t of["adjust","iterables","render"])null!==this[t]&&void 0!==this[t]&&(e[t]=this[t]);return!1!==this.in&&(e.in=!0),{ref:e}}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display=`ref:${this.type}:${e}`);if(!this.separator)return void(this.display=`ref:${e}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${e}`);if("root"===this.ancestor)return void(this.display=`ref:root:${e}`);if(1===this.ancestor)return void(this.display=`ref:${e||".."}`);const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${t}${e||""}`}},c.Ref.prototype[i.symbols.ref]=!0,t.build=function(e){return"value"===(e=Object.assign({},c.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new c.Ref(e)},c.context=function(e,t,r={}){if(e=e.trim(),r){const n=void 0===r.global?"$":r.global;if(n!==t&&e.startsWith(n))return{key:e.slice(n.length),type:"global"};const s=void 0===r.local?"#":r.local;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"local"};const a=void 0===r.root?"/":r.root;if(a!==t&&e.startsWith(a))return{key:e.slice(a.length),type:"value",root:!0}}return{key:e,type:"value"}},c.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let r=2;for(;e[r]===t;)++r;return[r-1,r]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,n){if(e)if(n=void 0===n?t.toParent:n,Array.isArray(e))for(const t of e)this.register(t,n);else if(i.isSchema(e))for(const t of e._refs.refs)t.ancestor-n>=0&&this.refs.push({ancestor:t.ancestor-n,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-n>=0&&this.refs.push({ancestor:e.ancestor-n,root:e.root}),o=o||r(116),o.isTemplate(e)&&this.register(e.refs(),n)}get length(){return this.refs.length}clone(){const e=new t.Manager;return e.refs=s(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter((e=>!e.ancestor)).map((e=>e.root))}}},(e,t,r)=>{const n=r(40),s=r(112),a=r(120),i={};t.schema=function(e,t,r={}){s.assertOptions(r,["appendPath","override"]);try{return i.schema(e,t,r)}catch(e){throw r.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},i.schema=function(e,t,r){n(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(n(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const a=(t,...n)=>!1!==r.override?t.valid(e.override,...n):t.valid(...n);if(i.simple(t))return a(e,t);if("function"==typeof t)return e.custom(t);if(n("object"==typeof t,"Invalid schema content:",typeof t),s.isResolvable(t))return a(e,t);if(s.isSchema(t))return t;if(Array.isArray(t)){for(const r of t)if(!i.simple(r))return e.alternatives().try(...t);return a(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?a(e.date(),t):(n(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return a.isRef(e)?e:a.create(e,t)},t.compile=function(e,r,a={}){s.assertOptions(a,["legacy"]);const o=r&&r[s.symbols.any];if(o)return n(a.legacy||o.version===s.version,"Cannot mix different versions of joi schemas:",o.version,s.version),r;if("object"!=typeof r||!a.legacy)return t.schema(e,r,{appendPath:!0});const c=i.walk(r);return c?c.compile(c.root,r):t.schema(e,r,{appendPath:!0})},i.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=i.walk(t);if(e)return e}return null}const t=e[s.symbols.any];if(t)return{root:e[t.root],compile:t.compile};n(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const r=i.walk(e[t]);if(r)return r}return null},i.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,r,o){if(void 0===o&&(n(r&&"object"==typeof r,"Missing options"),o=r,r=a.create(".")),Array.isArray(o)&&(o={switch:o}),s.assertOptions(o,["is","not","then","otherwise","switch","break"]),s.isSchema(r))return n(void 0===o.is,'"is" can not be used with a schema condition'),n(void 0===o.not,'"not" can not be used with a schema condition'),n(void 0===o.switch,'"switch" can not be used with a schema condition'),i.condition(e,{is:r,then:o.then,otherwise:o.otherwise,break:o.break});if(n(a.isRef(r)||"string"==typeof r,"Invalid condition:",r),n(void 0===o.not||void 0===o.is,'Cannot combine "is" with "not"'),void 0===o.switch){let c=o;void 0!==o.not&&(c={is:o.not,then:o.otherwise,otherwise:o.then,break:o.break});let l=void 0!==c.is?e.$_compile(c.is):e.$_root.invalid(null,!1,0,"").required();return n(void 0!==c.then||void 0!==c.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),n(void 0===c.break||void 0===c.then||void 0===c.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===o.is||a.isRef(o.is)||s.isSchema(o.is)||(l=l.required()),i.condition(e,{ref:t.ref(r),is:l,then:c.then,otherwise:c.otherwise,break:c.break})}n(Array.isArray(o.switch),'"switch" must be an array'),n(void 0===o.is,'Cannot combine "switch" with "is"'),n(void 0===o.not,'Cannot combine "switch" with "not"'),n(void 0===o.then,'Cannot combine "switch" with "then"');const c={ref:t.ref(r),switch:[],break:o.break};for(let t=0;t{const n=r(40),s=r(43),a=r(112),i=r(115),o={};t.type=function(e,t){const r=Object.getPrototypeOf(e),c=s(r),l=e._assign(Object.create(c)),u=Object.assign({},t);delete u.base,c._definition=u;const d=r._definition||{};u.messages=i.merge(d.messages,u.messages),u.properties=Object.assign({},d.properties,u.properties),l.type=u.type,u.flags=Object.assign({},d.flags,u.flags);const p=Object.assign({},d.terms);if(u.terms)for(const e in u.terms){const t=u.terms[e];n(void 0===l.$_terms[e],"Invalid term override for",u.type,e),l.$_terms[e]=t.init,p[e]=t}u.terms=p,u.args||(u.args=d.args),u.prepare=o.prepare(u.prepare,d.prepare),u.coerce&&("function"==typeof u.coerce&&(u.coerce={method:u.coerce}),u.coerce.from&&!Array.isArray(u.coerce.from)&&(u.coerce={method:u.coerce.method,from:[].concat(u.coerce.from)})),u.coerce=o.coerce(u.coerce,d.coerce),u.validate=o.validate(u.validate,d.validate);const h=Object.assign({},d.rules);if(u.rules)for(const e in u.rules){const t=u.rules[e];n("object"==typeof t,"Invalid rule definition for",u.type,e);let r=t.method;if(void 0===r&&(r=function(){return this.$_addRule(e)}),r&&(n(!c[e],"Rule conflict in",u.type,e),c[e]=r),n(!h[e],"Rule conflict in",u.type,e),h[e]=t,t.alias){const e=[].concat(t.alias);for(const r of e)c[r]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map((e=>("string"==typeof e&&(e={name:e}),n(!t.argsByName.has(e.name),"Duplicated argument name",e.name),a.isSchema(e.assert)&&(e.assert=e.assert.strict().label(e.name)),t.argsByName.set(e.name,e),e))))}u.rules=h;const f=Object.assign({},d.modifiers);if(u.modifiers)for(const e in u.modifiers){n(!c[e],"Rule conflict in",u.type,e);const t=u.modifiers[e];n("function"==typeof t,"Invalid modifier definition for",u.type,e);const r=function(t){return this.rule({[e]:t})};c[e]=r,f[e]=t}if(u.modifiers=f,u.overrides){c._super=r,l.$_super={};for(const e in u.overrides)n(r[e],"Cannot override missing",e),u.overrides[e][a.symbols.parent]=r[e],l.$_super[e]=r[e].bind(l);Object.assign(c,u.overrides)}u.cast=Object.assign({},d.cast,u.cast);const m=Object.assign({},d.manifest,u.manifest);return m.build=o.build(u.manifest&&u.manifest.build,d.manifest&&d.manifest.build),u.manifest=m,u.rebuild=o.rebuild(u.rebuild,d.rebuild),l},o.build=function(e,t){return e&&t?function(r,n){return t(e(r,n),n)}:e||t},o.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(r,n){let s;if((!t.from||t.from.includes(typeof r))&&(s=t.method(r,n),s)){if(s.errors||void 0===s.value)return s;r=s.value}if(!e.from||e.from.includes(typeof r)){const t=e.method(r,n);if(t)return t}return s}}:e||t},o.prepare=function(e,t){return e&&t?function(r,n){const s=e(r,n);if(s){if(s.errors||void 0===s.value)return s;r=s.value}return t(r,n)||s}:e||t},o.rebuild=function(e,t){return e&&t?function(r){t(r),e(r)}:e||t},o.validate=function(e,t){return e&&t?function(r,n){const s=t(r,n);if(s){if(s.errors&&(!Array.isArray(s.errors)||s.errors.length))return s;r=s.value}return e(r,n)||s}:e||t}},(e,t,r)=>{var n=r(21).Buffer;const s=r(40),a=r(43),i=r(112),o=r(115),c=r(120),l=r(116);let u;const d={};t.describe=function(e){const t=e._definition,r={type:e.type,flags:{},rules:[]};for(const t in e._flags)"_"!==t[0]&&(r.flags[t]=d.describe(e._flags[t]));Object.keys(r.flags).length||delete r.flags,e._preferences&&(r.preferences=a(e._preferences,{shallow:["messages"]}),delete r.preferences[i.symbols.prefs],r.preferences.messages&&(r.preferences.messages=o.decompile(r.preferences.messages))),e._valids&&(r.allow=e._valids.describe()),e._invalids&&(r.invalid=e._invalids.describe());for(const n of e._rules){if(!1===t.rules[n.name].manifest)continue;const e={name:n.name};for(const r in t.modifiers)void 0!==n[r]&&(e[r]=d.describe(n[r]));if(n.args){e.args={};for(const t in n.args){const r=n.args[t];("options"!==t||Object.keys(r).length)&&(e.args[t]=d.describe(r,{assign:t}))}Object.keys(e.args).length||delete e.args}r.rules.push(e)}r.rules.length||delete r.rules;for(const n in e.$_terms){if("_"===n[0])continue;s(!r[n],"Cannot describe schema due to internal name conflict with",n);const a=e.$_terms[n];if(!a)continue;if(a instanceof Map){a.size&&(r[n]=[...a.entries()]);continue}if(i.isValues(a)){r[n]=a.describe();continue}s(t.terms[n],"Term",n,"missing configuration");const o=t.terms[n].manifest,c="object"==typeof o;if(!a.length&&!c)continue;const l=[];for(const e of a)l.push(d.describe(e));if(c){const{from:e,to:t}=o.mapped;r[n]={};for(const s of l)r[n][s[t]]=s[e]}else"single"!==o?r[n]=l:(s(1===l.length,"Term",n,"contains more than one item"),r[n]=l[0])}return d.validate(e.$_root,r),r},d.describe=function(e,t={}){if(Array.isArray(e))return e.map(d.describe);if(e===i.symbols.deepDefault)return{special:"deep"};if("object"!=typeof e||null===e)return e;if("options"===t.assign)return a(e);if(n&&n.isBuffer(e))return{buffer:e.toString("binary")};if(e instanceof Date)return e.toISOString();if(e instanceof Error)return e;if(e instanceof RegExp)return"regex"===t.assign?e.toString():{regex:e.toString()};if(e[i.symbols.literal])return{function:e.literal};if("function"==typeof e.describe)return"ref"===t.assign?e.describe().ref:e.describe();const r={};for(const t in e){const n=e[t];void 0!==n&&(r[t]=d.describe(n,{assign:t}))}return r},t.build=function(e,t){return new d.Builder(e).parse(t)},d.Builder=class{constructor(e){this.joi=e}parse(e){d.validate(this.joi,e);let t=this.joi[e.type]()._bare();const r=t._definition;if(e.flags)for(const n in e.flags){const a=r.flags[n]&&r.flags[n].setter||n;s("function"==typeof t[a],"Invalid flag",n,"for type",e.type),t=t[a](this.build(e.flags[n]))}if(e.preferences&&(t=t.preferences(this.build(e.preferences))),e.allow&&(t=t.allow(...this.build(e.allow))),e.invalid&&(t=t.invalid(...this.build(e.invalid))),e.rules)for(const n of e.rules){s("function"==typeof t[n.name],"Invalid rule",n.name,"for type",e.type);const a=[];if(n.args){const t={};for(const e in n.args)t[e]=this.build(n.args[e],{assign:e});const i=Object.keys(t),o=r.rules[n.name].args;if(o){s(i.length<=o.length,"Invalid number of arguments for",e.type,n.name,"(expected up to",o.length,", found",i.length,")");for(const{name:e}of o)a.push(t[e])}else s(1===i.length,"Invalid number of arguments for",e.type,n.name,"(expected up to 1, found",i.length,")"),a.push(t[i[0]])}t=t[n.name](...a);const i={};for(const e in r.modifiers)void 0!==n[e]&&(i[e]=this.build(n[e]));Object.keys(i).length&&(t=t.rule(i))}const n={};for(const t in e){if(["allow","flags","invalid","whens","preferences","rules","type"].includes(t))continue;s(r.terms[t],"Term",t,"missing configuration");const a=r.terms[t].manifest;if("schema"!==a)if("values"!==a)if("single"!==a)if("object"!=typeof a)n[t]=this.build(e[t]);else{n[t]={};for(const r in e[t]){const s=e[t][r];n[t][r]=this.parse(s)}}else n[t]=this.build(e[t]);else n[t]=e[t].map((e=>this.build(e)));else n[t]=e[t].map((e=>this.parse(e)))}return e.whens&&(n.whens=e.whens.map((e=>this.build(e)))),t=r.manifest.build(t,n),t.$_temp.ruleset=!1,t}build(e,t={}){if(null===e)return null;if(Array.isArray(e))return e.map((e=>this.build(e)));if(e instanceof Error)return e;if("options"===t.assign)return a(e);if("regex"===t.assign)return d.regex(e);if("ref"===t.assign)return c.build(e);if("object"!=typeof e)return e;if(1===Object.keys(e).length){if(e.buffer)return s(n,"Buffers are not supported"),n&&n.from(e.buffer,"binary");if(e.function)return{[i.symbols.literal]:!0,literal:e.function};if(e.override)return i.symbols.override;if(e.ref)return c.build(e.ref);if(e.regex)return d.regex(e.regex);if(e.special)return s(["deep"].includes(e.special),"Unknown special value",e.special),i.symbols.deepDefault;if(e.value)return a(e.value)}if(e.type)return this.parse(e);if(e.template)return l.build(e);const r={};for(const t in e)r[t]=this.build(e[t],{assign:t});return r}},d.regex=function(e){const t=e.lastIndexOf("/"),r=e.slice(1,t),n=e.slice(t+1);return new RegExp(r,n)},d.validate=function(e,t){u=u||r(114),e.assert(t,u.description)}},(e,t,r)=>{const n=r(52),s=r(125),a=r(118),i={codes:{error:1,pass:2,full:3},labels:{0:"never used",1:"always error",2:"always pass"}};t.setup=function(e){const t=function(){return e._tracer=e._tracer||new i.Tracer,e._tracer};e.trace=t,e[Symbol.for("@hapi/lab/coverage/initialize")]=t,e.untrace=()=>{e._tracer=null}},t.location=function(e){return e.$_setFlag("_tracerLocation",s.location(2))},i.Tracer=class{constructor(){this.name="Joi",this._schemas=new Map}_register(e){const t=this._schemas.get(e);if(t)return t.store;const r=new i.Store(e),{filename:n,line:a}=e._flags._tracerLocation||s.location(5);return this._schemas.set(e,{filename:n,line:a,store:r}),r}_combine(e,t){for(const{store:r}of this._schemas.values())r._combine(e,t)}report(e){const t=[];for(const{filename:r,line:n,store:s}of this._schemas.values()){if(e&&e!==r)continue;const a=[],o=[];for(const[e,t]of s._sources.entries()){if(i.sub(t.paths,o))continue;if(!t.entry){a.push({status:"never reached",paths:[...t.paths]}),o.push(...t.paths);continue}for(const r of["valid","invalid"]){const n=e[`_${r}s`];if(!n)continue;const s=new Set(n._values),i=new Set(n._refs);for(const{value:e,ref:n}of t[r])s.delete(e),i.delete(n);(s.size||i.size)&&a.push({status:[...s,...[...i].map((e=>e.display))],rule:`${r}s`})}const r=e._rules.map((e=>e.name));for(const t of["default","failover"])void 0!==e._flags[t]&&r.push(t);for(const e of r){const r=i.labels[t.rule[e]||0];if(r){const n={rule:e,status:r};t.paths.size&&(n.paths=[...t.paths]),a.push(n)}}}a.length&&t.push({filename:r,line:n,missing:a,severity:"error",message:`Schema missing tests for ${a.map(i.message).join(", ")}`})}return t.length?t:null}},i.Store=class{constructor(e){this.active=!0,this._sources=new Map,this._combos=new Map,this._scan(e)}debug(e,t,r,n){e.mainstay.debug&&e.mainstay.debug.push({type:t,name:r,result:n,path:e.path})}entry(e,t){i.debug(t,{type:"entry"}),this._record(e,(e=>{e.entry=!0}))}filter(e,t,r,n){i.debug(t,{type:r,...n}),this._record(e,(e=>{e[r].add(n)}))}log(e,t,r,n,s){i.debug(t,{type:r,name:n,result:"full"===s?"pass":s}),this._record(e,(e=>{e[r][n]=e[r][n]||0,e[r][n]|=i.codes[s]}))}resolve(e,t,r){if(!e.mainstay.debug)return;const n={type:"resolve",ref:t.display,to:r,path:e.path};e.mainstay.debug.push(n)}value(e,t,r,s,a){if(!e.mainstay.debug||n(r,s))return;const i={type:"value",by:t,from:r,to:s,path:e.path};a&&(i.name=a),e.mainstay.debug.push(i)}_record(e,t){const r=this._sources.get(e);if(r)return void t(r);const n=this._combos.get(e);for(const e of n)this._record(e,t)}_scan(e,t){const r=t||[];let n=this._sources.get(e);n||(n={paths:new Set,entry:!1,rule:{},valid:new Set,invalid:new Set},this._sources.set(e,n)),r.length&&n.paths.add(r);e.$_modify({each:(e,t)=>{const n=i.id(e,t);this._scan(e,r.concat(n))},ref:!1})}_combine(e,t){this._combos.set(e,t)}},i.message=function(e){return`${e.paths?a.path(e.paths[0])+(e.rule?":":""):""}${e.rule||""} (${e.status})`},i.id=function(e,{source:t,name:r,path:n,key:s}){return e._flags.id?e._flags.id:s||(r=`@${r}`,"terms"===t?[r,n[Math.min(n.length-1,1)]]:r)},i.sub=function(e,t){for(const r of e)for(const e of t)if(n(r.slice(0,e.length),e))return!0;return!1},i.debug=function(e,t){e.mainstay.debug&&(t.path=e.debug?[...e.path,e.debug]:e.path,e.mainstay.debug.push(t))}},(e,t)=>{t.location=function(e=0){const t=Error.prepareStackTrace;Error.prepareStackTrace=(e,t)=>t;const r={};Error.captureStackTrace(r,this);const n=r.stack[e+1];return Error.prepareStackTrace=t,{filename:n.getFileName(),line:n.getLineNumber()}}},(e,t,r)=>{const n=r(40),s=r(47),a=r(127),i=r(112),o=r(121),c=r(118),l=r(120),u={};e.exports=a.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:l.toSibling}},args:(e,...t)=>1===t.length&&Array.isArray(t[0])?e.try(...t[0]):e.try(...t),validate(e,t){const{schema:r,error:n,state:a,prefs:i}=t;if(r._flags.match){const t=[],o=[];for(let n=0;nc.details(e,{override:!1})))})}}if("one"===r._flags.match)return 1===t.length?{value:t[0]}:{errors:n("alternatives.one")};if(t.length!==r.$_terms.matches.length){return{errors:n("alternatives.all",{details:o.map((e=>c.details(e,{override:!1})))})}}const l=e=>e.$_terms.matches.some((e=>"object"===e.schema.type||"alternatives"===e.schema.type&&l(e.schema)));return l(r)?{value:t.reduce(((e,t)=>s(e,t,{mergeArrays:!1})))}:{value:t[t.length-1]}}const o=[];for(let t=0;t"is"!==r.path[0]&&"string"!=typeof t._flags.label?t.label(e):void 0,ref:!1})}},rebuild(e){e.$_modify({each:t=>{i.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(e,t){if(t.matches)for(const r of t.matches){const{schema:t,ref:n,is:s,not:a,then:i,otherwise:o}=r;e=t?e.try(t):n?e.conditional(n,{is:s,then:i,not:a,otherwise:o,switch:r.switch}):e.conditional(s,{then:i,otherwise:o})}return e}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),u.errors=function(e,{error:t,state:r}){if(!e.length)return{errors:t("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const n=new Set,s=[];for(const{reports:a,schema:i}of e){if(a.length>1)return u.unmatched(e,t);const o=a[0];if(o instanceof c.Report==!1)return u.unmatched(e,t);if(o.state.path.length!==r.path.length){s.push({type:i.type,report:o});continue}if("any.only"===o.code){for(const e of o.local.valids)n.add(e);continue}const[l,d]=o.code.split(".");"base"===d?n.add(l):s.push({type:i.type,report:o})}return s.length?1===s.length?{errors:s[0].report}:u.unmatched(e,t):{errors:t("alternatives.types",{types:[...n]})}},u.unmatched=function(e,t){const r=[];for(const t of e)r.push(...t.reports);return{errors:t("alternatives.match",c.details(r,{override:!1}))}}},(e,t,r)=>{const n=r(40),s=r(128),a=r(112),i=r(115);e.exports=s.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(e,t){return n("function"==typeof e,"Method must be a function"),n(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:e,description:t}})},validate(e,t,{method:r}){try{return r(e,t)}catch(e){return t.error("any.custom",{error:e})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(e){n(a.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const t=this.clone();return t.$_terms.shared=t.$_terms.shared||[],t.$_terms.shared.push(e),t.$_mutateRegister(e),t}},warning:{method(e,t){return n(e&&"string"==typeof e,"Invalid warning code"),this.$_addRule({name:"warning",args:{code:e,local:t},warn:!0})},validate:(e,t,{code:r,local:n})=>t.error(r,n),args:["code","local"],multi:!0}},modifiers:{keep(e,t=!0){e.keep=t},message(e,t){e.message=i.compile(t)},warn(e,t=!0){e.warn=t}},manifest:{build(e,t){for(const r in t){const n=t[r];if(["examples","externals","metas","notes","tags"].includes(r))for(const t of n)e=e[r.slice(0,-1)](t);else if("alterations"!==r)if("whens"!==r){if("shared"===r)for(const t of n)e=e.shared(t)}else for(const t of n){const{ref:r,is:n,not:s,then:a,otherwise:i,concat:o}=t;e=o?e.concat(o):r?e.when(r,{is:n,not:s,then:a,otherwise:i,switch:t.switch,break:t.break}):e.when(n,{then:a,otherwise:i,break:t.break})}else{const t={};for(const{target:e,adjuster:r}of n)t[e]=r;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},(e,t,r)=>{const n=r(40),s=r(43),a=r(52),i=r(47),o=r(111),c=r(112),l=r(121),u=r(118),d=r(122),p=r(123),h=r(115),f=r(129),m=r(120),g=r(124),y=r(130),_=r(132),v={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new f.Ids,this._preferences=null,this._refs=new m.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return n("function"==typeof p.describe,"Manifest functionality disabled"),p.describe(this)}allow(...e){return c.verifyFlat(e,"allow"),this._values(e,"_valids")}alter(e){n(e&&"object"==typeof e&&!Array.isArray(e),"Invalid targets argument"),n(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const r in e){const s=e[r];n("function"==typeof s,"Alteration adjuster for",r,"must be a function"),t.$_terms.alterations.push({target:r,adjuster:s})}return t.$_temp.ruleset=!1,t}artifact(e){return n(void 0!==e,"Artifact cannot be undefined"),n(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",e)}cast(e){return n(!1===e||"string"==typeof e,"Invalid to value"),n(!1===e||this._definition.cast[e],"Type",this.type,"does not support casting to",e),this.$_setFlag("cast",!1===e?void 0:e)}default(e,t){return this._default("default",e,t)}description(e){return n(e&&"string"==typeof e,"Description must be a non-empty string"),this.$_setFlag("description",e)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(e){return n(e,"Missing error"),n(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}example(e,t={}){return n(void 0!==e,"Missing example"),c.assertOptions(t,["override"]),this._inner("examples",e,{single:!0,override:t.override})}external(e,t){return"object"==typeof e&&(n(!t,"Cannot combine options with description"),t=e.description,e=e.method),n("function"==typeof e,"Method must be a function"),n(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this._inner("externals",{method:e,description:t},{single:!0})}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(e){return e?(n("string"==typeof e,"id must be a non-empty string"),n(/^[^\.]+$/.test(e),"id cannot contain period character"),this.$_setFlag("id",e)):this.$_setFlag("id",void 0)}invalid(...e){return this._values(e,"_invalids")}label(e){return n(e&&"string"==typeof e,"Label name must be a non-empty string"),this.$_setFlag("label",e)}meta(e){return n(void 0!==e,"Meta cannot be undefined"),this._inner("metas",e,{single:!0})}note(...e){n(e.length,"Missing notes");for(const t of e)n(t&&"string"==typeof t,"Notes must be non-empty strings");return this._inner("notes",e)}only(e=!0){return n("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){n(e,"Missing preferences"),n(void 0===e.context,"Cannot override context"),n(void 0===e.externals,"Cannot override externals"),n(void 0===e.warnings,"Cannot override warnings"),n(void 0===e.debug,"Cannot override debug"),c.checkPreferences(e);const t=this.clone();return t._preferences=c.preferences(t._preferences,e),t}presence(e){return n(["optional","required","forbidden"].includes(e),"Unknown presence mode",e),this.$_setFlag("presence",e)}raw(e=!0){return this.$_setFlag("result",e?"raw":void 0)}result(e){return n(["raw","strip"].includes(e),"Unknown result mode",e),this.$_setFlag("result",e)}required(){return this.presence("required")}strict(e){const t=this.clone(),r=void 0!==e&&!e;return t._preferences=c.preferences(t._preferences,{convert:r}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}tag(...e){n(e.length,"Missing tags");for(const t of e)n(t&&"string"==typeof t,"Tags must be non-empty strings");return this._inner("tags",e)}unit(e){return n(e&&"string"==typeof e,"Unit name must be a non-empty string"),this.$_setFlag("unit",e)}valid(...e){c.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(e,t){const r=this.clone();r.$_terms.whens||(r.$_terms.whens=[]);const s=l.when(r,e,t);if(!["any","link"].includes(r.type)){const e=s.is?[s]:s.switch;for(const t of e)n(!t.then||"any"===t.then.type||t.then.type===r.type,"Cannot combine",r.type,"with",t.then&&t.then.type),n(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===r.type,"Cannot combine",r.type,"with",t.otherwise&&t.otherwise.type)}return r.$_terms.whens.push(s),r.$_mutateRebuild()}cache(e){n(!this._inRuleset(),"Cannot set caching inside a ruleset"),n(!this._cache,"Cannot override schema cache"),n(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const t=this.clone();return t._cache=e||o.provider.provision(),t.$_temp.ruleset=!1,t}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){n(c.isSchema(e),"Invalid schema object"),n("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type),n(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),n(!e._inRuleset(),"Cannot concatenate a schema with open ruleset");let t=this.clone();if("any"===this.type&&"any"!==e.type){const r=e.clone();for(const e of Object.keys(t))"type"!==e&&(r[e]=t[e]);t=r}t._ids.concat(e._ids),t._refs.register(e,m.toSibling),t._preferences=t._preferences?c.preferences(t._preferences,e._preferences):e._preferences,t._valids=_.merge(t._valids,e._valids,e._invalids),t._invalids=_.merge(t._invalids,e._invalids,e._valids);for(const r of e._singleRules.keys())t._singleRules.has(r)&&(t._rules=t._rules.filter((e=>e.keep||e.name!==r)),t._singleRules.delete(r));for(const r of e._rules)e._definition.rules[r.method].multi||t._singleRules.set(r.name,r),t._rules.push(r);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const r=Object.assign({},e._flags);delete r.empty,i(t._flags,r)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const r=Object.assign({},e._flags);delete r.empty,i(t._flags,r)}else i(t._flags,e._flags);for(const r in e.$_terms){const n=e.$_terms[r];n?t.$_terms[r]?t.$_terms[r]=t.$_terms[r].concat(n):t.$_terms[r]=n.slice():t.$_terms[r]||(t.$_terms[r]=n)}return this.$_root._tracer&&this.$_root._tracer._combine(t,[this,e]),t.$_mutateRebuild()}extend(e){return n(!e.base,"Cannot extend type with another base"),d.type(this,e)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(e,t){n(!this._inRuleset(),"Cannot fork inside a ruleset");let r=this;for(let n of[].concat(e))n=Array.isArray(n)?n:n.split("."),r=r._ids.fork(n,t,r);return r.$_temp.ruleset=!1,r}rule(e){const t=this._definition;c.assertOptions(e,Object.keys(t.modifiers)),n(!1!==this.$_temp.ruleset,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const r=null===this.$_temp.ruleset?this._rules.length-1:this.$_temp.ruleset;n(r>=0&&rt.tailor(e),ref:!1}),t.$_temp.ruleset=!1,t.$_mutateRebuild()}tracer(){return g.location?g.location(this):this}validate(e,t){return y.entry(e,this,t)}validateAsync(e,t){return y.entryAsync(e,this,t)}$_addRule(e){"string"==typeof e&&(e={name:e}),n(e&&"object"==typeof e,"Invalid options"),n(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)n("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const r=this._definition.rules[t.method],s=t.args;n(r,"Unknown rule",t.method);const a=this.clone();if(s){n(1===Object.keys(s).length||Object.keys(s).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in s){let i=s[e];if(r.argsByName){const o=r.argsByName.get(e);if(o.ref&&c.isResolvable(i))t._resolve.push(e),a.$_mutateRegister(i);else if(o.normalize&&(i=o.normalize(i),s[e]=i),o.assert){const t=c.validateArg(i,e,o);n(!t,t,"or reference")}}void 0!==i?s[e]=i:delete s[e]}}return r.multi||(a._ruleRemove(t.name,{clone:!1}),a._singleRules.set(t.name,t)),!1===a.$_temp.ruleset&&(a.$_temp.ruleset=null),r.priority?a._rules.unshift(t):a._rules.push(t),a}$_compile(e,t){return l.schema(this.$_root,e,t)}$_createError(e,t,r,n,s,a={}){const i=!1!==a.flags?this._flags:{},o=a.messages?h.merge(this._definition.messages,a.messages):this._definition.messages;return new u.Report(e,t,r,i,o,n,s)}$_getFlag(e){return this._flags[e]}$_getRule(e){return this._singleRules.get(e)}$_mapLabels(e){return e=Array.isArray(e)?e:e.split("."),this._ids.labels(e)}$_match(e,t,r,n){(r=Object.assign({},r)).abortEarly=!0,r._externals=!1,t.snapshot();const s=!y.validate(e,this,t,r,n).errors;return t.restore(),s}$_modify(e){return c.assertOptions(e,["each","once","ref","schema"]),f.schema(this,e)||this}$_mutateRebuild(){n(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset();return this.$_modify({each:(e,{source:t,name:r,path:n,key:s})=>{const a=this._definition[t][r]&&this._definition[t][r].register;!1!==a&&this.$_mutateRegister(e,{family:a,key:s})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e,{family:t,key:r}={}){this._refs.register(e,t),this._ids.register(e,{key:r})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t,r={}){n("_"===e[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const s=this._definition.flags[e]||{};if(a(t,s.default)&&(t=void 0),a(t,this._flags[e]))return this;const i=!1!==r.clone?this.clone():this;return void 0!==t?(i._flags[e]=t,i.$_mutateRegister(t)):delete i._flags[e],"_"!==e[0]&&(i.$_temp.ruleset=!1),i}$_parent(e,...t){return this[e][c.symbols.parent].call(this,...t)}$_validate(e,t,r){return y.validate(e,this,t,r)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=s(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_bare(){const e=this.clone();e._reset();const t=e._definition.terms;for(const r in t){const n=t[r];e.$_terms[r]=n.init}return e.$_mutateRebuild()}_default(e,t,r={}){c.assertOptions(r,"literal"),n(void 0!==t,"Missing",e,"value"),n("function"==typeof t||!r.literal,"Only function value supports literal option"),"function"==typeof t&&r.literal&&(t={[c.symbols.literal]:!0,literal:t});return this.$_setFlag(e,t)}_generate(e,t,r){if(!this.$_terms.whens)return{schema:this};const n=[],s=[];for(let a=0;al)break}const a=s.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",a),!a)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[a])return{schema:this.$_temp.whens[a],id:a};let i=this;this._definition.generate&&(i=this._definition.generate(this,e,t,r));for(const e of n)i=i.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(i,[this,...n]),this.$_temp.whens[a]=i,{schema:i,id:a}}_inner(e,t,r={}){n(!this._inRuleset(),`Cannot set ${e} inside a ruleset`);const s=this.clone();return s.$_terms[e]&&!r.override||(s.$_terms[e]=[]),r.single?s.$_terms[e].push(t):s.$_terms[e].push(...t),s.$_temp.ruleset=!1,s}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e,t={}){if(!this._singleRules.has(e))return this;const r=!1!==t.clone?this.clone():this;r._singleRules.delete(e);const n=[];for(let t=0;t{const n=r(40),s=r(112),a=r(120),i={};t.Ids=i.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new i.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,r]of e._byId.entries())n(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,r);for(const[t,r]of e._byKey.entries())n(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,r)}fork(e,t,r){const a=this._collect(e);a.push({schema:r});const o=a.shift();let c={id:o.id,schema:t(o.schema)};n(s.isSchema(c.schema),"adjuster function failed to return a joi schema type");for(const e of a)c={id:e.id,schema:i.fork(e.schema,c.id,c.schema)};return c.schema}labels(e,t=[]){const r=e[0],n=this._get(r);if(!n)return[...t,...e].join(".");const s=e.slice(1);return t=[...t,n.schema._flags.label||r],s.length?n.schema._ids.labels(s,t):t.join(".")}reach(e,t=[]){const r=e[0],s=this._get(r);n(s,"Schema does not contain path",[...t,...e].join("."));const a=e.slice(1);return a.length?s.schema._ids.reach(a,[...t,r]):s.schema}register(e,{key:t}={}){if(!e||!s.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const r=e._flags.id;if(r){const t=this._byId.get(r);n(!t||t.schema===e,"Cannot add different schemas with the same id:",r),n(!this._byKey.has(r),"Schema id conflicts with existing key:",r),this._byId.set(r,{schema:e,id:r})}t&&(n(!this._byKey.has(t),"Schema already contains key:",t),n(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,{schema:e,id:t}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e,t=[],r=[]){const s=e[0],a=this._get(s);n(a,"Schema does not contain path",[...t,...e].join(".")),r=[a,...r];const i=e.slice(1);return i.length?a.schema._ids._collect(i,[...t,s],r):r}_get(e){return this._byId.get(e)||this._byKey.get(e)}},i.fork=function(e,r,n){const s=t.schema(e,{each:(e,{key:t})=>{if(r===(e._flags.id||t))return n},ref:!1});return s?s.$_mutateRebuild():e},t.schema=function(e,t){let r;for(const n in e._flags){if("_"===n[0])continue;const s=i.scan(e._flags[n],{source:"flags",name:n},t);void 0!==s&&(r=r||e.clone(),r._flags[n]=s)}for(let n=0;n{const n=r(40),s=r(43),a=r(50),i=r(44),o=r(112),c=r(118),l=r(131),u={result:Symbol("result")};t.entry=function(e,t,r){let s=o.defaults;r&&(n(void 0===r.warnings,"Cannot override warnings preference in synchronous validation"),n(void 0===r.artifacts,"Cannot override artifacts preference in synchronous validation"),s=o.preferences(o.defaults,r));const a=u.entry(e,t,s);n(!a.mainstay.externals.length,"Schema with external rules must use validateAsync()");const i={value:a.value};return a.error&&(i.error=a.error),a.mainstay.warnings.length&&(i.warning=c.details(a.mainstay.warnings)),a.mainstay.debug&&(i.debug=a.mainstay.debug),a.mainstay.artifacts&&(i.artifacts=a.mainstay.artifacts),i},t.entryAsync=async function(e,t,r){let n=o.defaults;r&&(n=o.preferences(o.defaults,r));const s=u.entry(e,t,n),a=s.mainstay;if(s.error)throw a.debug&&(s.error.debug=a.debug),s.error;if(a.externals.length){let t=s.value;const l=[];for(const s of a.externals){const d=s.state.path,p="link"===s.schema.type?a.links.get(s.schema):null;let h,f,m=t;const g=d.length?[t]:[],y=d.length?i(e,d):e;if(d.length){h=d[d.length-1];let e=t;for(const t of d.slice(0,-1))e=e[t],g.unshift(e);f=g[0],m=f[h]}try{const e=(e,t)=>(p||s.schema).$_createError(e,m,t,s.state,n),i=await s.method(m,{schema:s.schema,linked:p,state:s.state,prefs:r,original:y,error:e,errorsArray:u.errorsArray,warn:(e,t)=>a.warnings.push((p||s.schema).$_createError(e,m,t,s.state,n)),message:(e,t)=>(p||s.schema).$_createError("external",m,t,s.state,n,{messages:e})});if(void 0===i||i===m)continue;if(i instanceof c.Report){if(a.tracer.log(s.schema,s.state,"rule","external","error"),l.push(i),n.abortEarly)break;continue}if(Array.isArray(i)&&i[o.symbols.errors]){if(a.tracer.log(s.schema,s.state,"rule","external","error"),l.push(...i),n.abortEarly)break;continue}f?(a.tracer.value(s.state,"rule",m,i,"external"),f[h]=i):(a.tracer.value(s.state,"rule",t,i,"external"),t=i)}catch(e){throw n.errors.label&&(e.message+=` (${s.label})`),e}}if(s.value=t,l.length)throw s.error=c.process(l,e,n),a.debug&&(s.error.debug=a.debug),s.error}if(!n.warnings&&!n.debug&&!n.artifacts)return s.value;const l={value:s.value};return a.warnings.length&&(l.warning=c.details(a.warnings)),a.debug&&(l.debug=a.debug),a.artifacts&&(l.artifacts=a.artifacts),l},u.Mainstay=class{constructor(e,t,r){this.externals=[],this.warnings=[],this.tracer=e,this.debug=t,this.links=r,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const e=this._snapshots.pop();this.externals=e.externals,this.warnings=e.warnings}commit(){this._snapshots.pop()}},u.entry=function(e,r,n){const{tracer:s,cleanup:a}=u.tracer(r,n),i=n.debug?[]:null,o=r._ids._schemaChain?new Map:null,d=new u.Mainstay(s,i,o),p=r._ids._schemaChain?[{schema:r}]:null,h=new l([],[],{mainstay:d,schemas:p}),f=t.validate(e,r,h,n);a&&r.$_root.untrace();const m=c.process(f.errors,e,n);return{value:f.value,error:m,mainstay:d}},u.tracer=function(e,t){return e.$_root._tracer?{tracer:e.$_root._tracer._register(e)}:t.debug?(n(e.$_root.trace,"Debug mode not supported"),{tracer:e.$_root.trace()._register(e),cleanup:!0}):{tracer:u.ignore}},t.validate=function(e,t,r,n,s={}){if(t.$_terms.whens&&(t=t._generate(e,r,n).schema),t._preferences&&(n=u.prefs(t,n)),t._cache&&n.cache){const n=t._cache.get(e);if(r.mainstay.tracer.debug(r,"validate","cached",!!n),n)return n}const a=(s,a,i)=>t.$_createError(s,e,a,i||r,n),i={original:e,prefs:n,schema:t,state:r,error:a,errorsArray:u.errorsArray,warn:(e,t,n)=>r.mainstay.warnings.push(a(e,t,n)),message:(s,a)=>t.$_createError("custom",e,a,r,n,{messages:s})};r.mainstay.tracer.entry(t,r);const c=t._definition;if(c.prepare&&void 0!==e&&n.convert){const t=c.prepare(e,i);if(t){if(r.mainstay.tracer.value(r,"prepare",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),i);e=t.value}}if(c.coerce&&void 0!==e&&n.convert&&(!c.coerce.from||c.coerce.from.includes(typeof e))){const t=c.coerce.method(e,i);if(t){if(r.mainstay.tracer.value(r,"coerced",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),i);e=t.value}}const l=t._flags.empty;l&&l.$_match(u.trim(e,t),r.nest(l),o.defaults)&&(r.mainstay.tracer.value(r,"empty",e,void 0),e=void 0);const d=s.presence||t._flags.presence||(t._flags._endedSwitch?null:n.presence);if(void 0===e){if("forbidden"===d)return u.finalize(e,null,i);if("required"===d)return u.finalize(e,[t.$_createError("any.required",e,null,r,n)],i);if("optional"===d){if(t._flags.default!==o.symbols.deepDefault)return u.finalize(e,null,i);r.mainstay.tracer.value(r,"default",e,{}),e={}}}else if("forbidden"===d)return u.finalize(e,[t.$_createError("any.unknown",e,null,r,n)],i);const p=[];if(t._valids){const s=t._valids.get(e,r,n,t._flags.insensitive);if(s)return n.convert&&(r.mainstay.tracer.value(r,"valids",e,s.value),e=s.value),r.mainstay.tracer.filter(t,r,"valid",s),u.finalize(e,null,i);if(t._flags.only){const s=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},r,n);if(n.abortEarly)return u.finalize(e,[s],i);p.push(s)}}if(t._invalids){const s=t._invalids.get(e,r,n,t._flags.insensitive);if(s){r.mainstay.tracer.filter(t,r,"invalid",s);const a=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,n);if(n.abortEarly)return u.finalize(e,[a],i);p.push(a)}}if(c.validate){const t=c.validate(e,i);if(t&&(r.mainstay.tracer.value(r,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return p.push(t.errors),u.finalize(e,p,i);if(t.errors.length)return p.push(...t.errors),u.finalize(e,p,i)}}return t._rules.length?u.rules(e,p,i):u.finalize(e,p,i)},u.rules=function(e,t,r){const{schema:n,state:s,prefs:a}=r;for(const i of n._rules){const c=n._definition.rules[i.method];if(c.convert&&a.convert){s.mainstay.tracer.log(n,s,"rule",i.name,"full");continue}let l,d=i.args;if(i._resolve.length){d=Object.assign({},d);for(const t of i._resolve){const r=c.argsByName.get(t),i=d[t].resolve(e,s,a),u=r.normalize?r.normalize(i):i,p=o.validateArg(u,null,r);if(p){l=n.$_createError("any.ref",i,{arg:t,ref:d[t],reason:p},s,a);break}d[t]=u}}l=l||c.validate(e,r,d,i);const p=u.rule(l,i);if(p.errors){if(s.mainstay.tracer.log(n,s,"rule",i.name,"error"),i.warn){s.mainstay.warnings.push(...p.errors);continue}if(a.abortEarly)return u.finalize(e,p.errors,r);t.push(...p.errors)}else s.mainstay.tracer.log(n,s,"rule",i.name,"pass"),s.mainstay.tracer.value(s,"rule",e,p.value,i.name),e=p.value}return u.finalize(e,t,r)},u.rule=function(e,t){return e instanceof c.Report?(u.error(e,t),{errors:[e],value:null}):Array.isArray(e)&&e[o.symbols.errors]?(e.forEach((e=>u.error(e,t))),{errors:e,value:null}):{errors:null,value:e}},u.error=function(e,t){return t.message&&e._setTemplate(t.message),e},u.finalize=function(e,t,r){t=t||[];const{schema:s,state:a,prefs:i}=r;if(t.length){const n=u.default("failover",void 0,t,r);void 0!==n&&(a.mainstay.tracer.value(a,"failover",e,n),e=n,t=[])}if(t.length&&s._flags.error)if("function"==typeof s._flags.error){t=s._flags.error(t),Array.isArray(t)||(t=[t]);for(const e of t)n(e instanceof Error||e instanceof c.Report,"error() must return an Error object")}else t=[s._flags.error];if(void 0===e){const n=u.default("default",e,t,r);a.mainstay.tracer.value(a,"default",e,n),e=n}if(s._flags.cast&&void 0!==e){const t=s._definition.cast[s._flags.cast];if(t.from(e)){const n=t.to(e,r);a.mainstay.tracer.value(a,"cast",e,n,s._flags.cast),e=n}}if(s.$_terms.externals&&i.externals&&!1!==i._externals)for(const{method:e}of s.$_terms.externals)a.mainstay.externals.push({method:e,schema:s,state:a,label:c.label(s._flags,a,i)});const o={value:e,errors:t.length?t:null};return s._flags.result&&(o.value="strip"===s._flags.result?void 0:r.original,a.mainstay.tracer.value(a,s._flags.result,e,o.value),a.shadow(e,s._flags.result)),s._cache&&!1!==i.cache&&!s._refs.length&&s._cache.set(r.original,o),void 0===e||o.errors||void 0===s._flags.artifact||(a.mainstay.artifacts=a.mainstay.artifacts||new Map,a.mainstay.artifacts.has(s._flags.artifact)||a.mainstay.artifacts.set(s._flags.artifact,[]),a.mainstay.artifacts.get(s._flags.artifact).push(a.path)),o},u.prefs=function(e,t){const r=t===o.defaults;return r&&e._preferences[o.symbols.prefs]?e._preferences[o.symbols.prefs]:(t=o.preferences(t,e._preferences),r&&(e._preferences[o.symbols.prefs]=t),t)},u.default=function(e,t,r,n){const{schema:a,state:i,prefs:c}=n,l=a._flags[e];if(c.noDefaults||void 0===l)return t;if(i.mainstay.tracer.log(a,i,"rule",e,"full"),!l)return l;if("function"==typeof l){const t=l.length?[s(i.ancestors[0]),n]:[];try{return l(...t)}catch(t){return void r.push(a.$_createError(`any.${e}`,null,{error:t},i,c))}}return"object"!=typeof l?l:l[o.symbols.literal]?l.literal:o.isResolvable(l)?l.resolve(t,i,c):s(l)},u.trim=function(e,t){if("string"!=typeof e)return e;const r=t.$_getRule("trim");return r&&r.args.enabled?e.trim():e},u.ignore={active:!1,debug:a,entry:a,filter:a,log:a,resolve:a,value:a},u.errorsArray=function(){const e=[];return e[o.symbols.errors]=!0,e}},(e,t,r)=>{const n=r(43),s=r(44),a=r(112),i={value:Symbol("value")};e.exports=i.State=class{constructor(e,t,r){this.path=e,this.ancestors=t,this.mainstay=r.mainstay,this.schemas=r.schemas,this.debug=null}localize(e,t=null,r=null){const n=new i.State(e,t,this);return r&&n.schemas&&(n.schemas=[i.schemas(r),...n.schemas]),n}nest(e,t){const r=new i.State(this.path,this.ancestors,this);return r.schemas=r.schemas&&[i.schemas(e),...r.schemas],r.debug=t,r}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new i.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=n(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},i.schemas=function(e){return a.isSchema(e)?{schema:e}:e},i.Shadow=class{constructor(){this._values=null}set(e,t,r){if(!e.length)return;if("strip"===r&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let n=this._values;for(let t=0;t{const n=r(40),s=r(52),a=r(112),i={};e.exports=i.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=i.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){a.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,r){if(e=e||new i.Values,t){if(t._override)return t.clone();for(const r of[...t._values,...t._refs])e.add(r)}if(r)for(const t of[...r._values,...r._refs])e.remove(t);return e.length?e:null}remove(e){a.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,r,n){return!!this.get(e,t,r,n)}get(e,t,r,n){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&n){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const t of this._values)if(s(t,e))return{value:t};if(t)for(const a of this._refs){const i=a.resolve(e,t,r,null,{in:!0});if(void 0===i)continue;const o=a.in&&"object"==typeof i?Array.isArray(i)?i:Object.keys(i):[i];for(const t of o)if(typeof t==typeof e)if(n&&e&&"string"==typeof e){if(t.toLowerCase()===e.toLowerCase())return{value:t,ref:a}}else if(s(t,e))return{value:t,ref:a}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new i.Values(this._values,this._refs);return e._override=this._override,e}concat(e){n(!e._override,"Cannot concat override set of values");const t=new i.Values([...this._values,...e._values],[...this._refs,...e._refs]);return t._override=this._override,t}describe(){const e=[];this._override&&e.push({override:!0});for(const t of this._values.values())e.push(t&&"object"==typeof t?{value:t}:t);for(const t of this._refs.values())e.push(t.describe());return e}},i.Values.prototype[a.symbols.values]=!0,i.Values.prototype.slice=i.Values.prototype.clone,i.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t}},(e,t,r)=>{const n=r(40),s=r(52),a=r(44),i=r(127),o=r(112),c=r(121),l={};e.exports=i.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,{schema:t,state:r,prefs:n}){if(!Array.isArray(e))return;const s=t.$_getRule("sort");return s?l.sort(t,e,s.args.options,r,n):void 0}},validate(e,{schema:t,error:r}){if(!Array.isArray(e)){if(t._flags.single){const t=[e];return t[o.symbols.arraySingle]=!0,{value:t}}return{errors:r("array.base")}}if(t.$_getRule("items")||t.$_terms.externals)return{value:e.slice()}},rules:{has:{method(e){e=this.$_compile(e,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:e}});return t.$_mutateRegister(e),t},validate(e,{state:t,prefs:r,error:n},{schema:s}){const a=[e,...t.ancestors];for(let n=0;nthis.$_compile(e[r])),r,{append:!0});t.$_terms.items.push(n)}return t.$_mutateRebuild()},validate(e,{schema:t,error:r,state:n,prefs:s,errorsArray:a}){const i=t.$_terms._requireds.slice(),c=t.$_terms.ordered.slice(),u=[...t.$_terms._inclusions,...i],d=!e[o.symbols.arraySingle];delete e[o.symbols.arraySingle];const p=a();let h=e.length;for(let a=0;a="})}},ordered:{method(...e){o.verifyFlat(e,"ordered");const t=this.$_addRule("items");for(let r=0;rthis.$_compile(e[r])),r,{append:!0});l.validateSingle(n,t),t.$_mutateRegister(n),t.$_terms.ordered.push(n)}return t.$_mutateRebuild()}},single:{method(e){const t=void 0===e||!!e;return n(!t||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",t)}},sort:{method(e={}){o.assertOptions(e,["by","order"]);const t={order:e.order||"ascending"};return e.by&&(t.by=c.ref(e.by,{ancestor:0}),n(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(e,{error:t,state:r,prefs:n,schema:s},{options:a}){const{value:i,errors:o}=l.sort(s,e,a,r,n);if(o)return o;for(let r=0;rnew Set(e)}},rebuild(e){e.$_terms._inclusions=[],e.$_terms._exclusions=[],e.$_terms._requireds=[];for(const t of e.$_terms.items)l.validateSingle(t,e),"required"===t._flags.presence?e.$_terms._requireds.push(t):"forbidden"===t._flags.presence?e.$_terms._exclusions.push(t):e.$_terms._inclusions.push(t);for(const t of e.$_terms.ordered)l.validateSingle(t,e)},manifest:{build:(e,t)=>(t.items&&(e=e.items(...t.items)),t.ordered&&(e=e.ordered(...t.ordered)),e)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),l.fillMissedErrors=function(e,t,r,n,s,a){const i=[];let o=0;for(const e of r){const t=e._flags.label;t?i.push(t):++o}i.length?o?t.push(e.$_createError("array.includesRequiredBoth",n,{knownMisses:i,unknownMisses:o},s,a)):t.push(e.$_createError("array.includesRequiredKnowns",n,{knownMisses:i},s,a)):t.push(e.$_createError("array.includesRequiredUnknowns",n,{unknownMisses:o},s,a))},l.fillOrderedErrors=function(e,t,r,n,s,a){const i=[];for(const e of r)"required"===e._flags.presence&&i.push(e);i.length&&l.fillMissedErrors(e,t,i,n,s,a)},l.fillDefault=function(e,t,r,n){const s=[];let a=!0;for(let i=e.length-1;i>=0;--i){const o=e[i],c=[t,...r.ancestors],l=o.$_validate(void 0,r.localize(r.path,c,o),n).value;if(a){if(void 0===l)continue;a=!1}s.unshift(l)}s.length&&t.push(...s)},l.fastSplice=function(e,t){let r=t;for(;r{let d=l.compare(c,u,i,o);if(null!==d)return d;if(r.by&&(c=r.by.resolve(c,n,s),u=r.by.resolve(u,n,s)),d=l.compare(c,u,i,o),null!==d)return d;const p=typeof c;if(p!==typeof u)throw e.$_createError("array.sort.mismatching",t,null,n,s);if("number"!==p&&"string"!==p)throw e.$_createError("array.sort.unsupported",t,{type:p},n,s);return"number"===p?(c-u)*a:c{const n=r(40),s=r(127),a=r(112),i=r(132),o={isBool:function(e){return"boolean"==typeof e}};e.exports=s.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(e,{schema:t}){if("boolean"!=typeof e){if("string"==typeof e){const r=t._flags.sensitive?e:e.toLowerCase();e="true"===r||"false"!==r&&e}return"boolean"!=typeof e&&(e=t.$_terms.truthy&&t.$_terms.truthy.has(e,null,null,!t._flags.sensitive)||(!t.$_terms.falsy||!t.$_terms.falsy.has(e,null,null,!t._flags.sensitive))&&e),{value:e}}},validate(e,{error:t}){if("boolean"!=typeof e)return{value:e,errors:t("boolean.base")}},rules:{truthy:{method(...e){a.verifyFlat(e,"truthy");const t=this.clone();t.$_terms.truthy=t.$_terms.truthy||new i;for(let r=0;re?1:0},string:{from:o.isBool,to:(e,t)=>e?"true":"false"}},manifest:{build:(e,t)=>(t.truthy&&(e=e.truthy(...t.truthy)),t.falsy&&(e=e.falsy(...t.falsy)),e)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},(e,t,r)=>{const n=r(40),s=r(127),a=r(112),i=r(116),o={isDate:function(e){return e instanceof Date}};e.exports=s.extend({type:"date",coerce:{from:["number","string"],method:(e,{schema:t})=>({value:o.parse(e,t._flags.format)||e})},validate(e,{schema:t,error:r,prefs:n}){if(e instanceof Date&&!isNaN(e.getTime()))return;const s=t._flags.format;return n.convert&&s&&"string"==typeof e?{value:e,errors:r("date.format",{format:s})}:{value:e,errors:r("date.base")}},rules:{compare:{method:!1,validate(e,t,{date:r},{name:n,operator:s,args:i}){const o="now"===r?Date.now():r.getTime();return a.compare(e.getTime(),o,s)?e:t.error("date."+n,{limit:i.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:o.parse(e),assert:e=>null!==e,message:"must have a valid date format"}]},format:{method(e){return n(["iso","javascript","unix"].includes(e),"Unknown date format",e),this.$_setFlag("format",e)}},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{date:e},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{date:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{date:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{date:e},operator:">="})}},timestamp:{method(e="javascript"){return n(["javascript","unix"].includes(e),'"type" must be one of "javascript, unix"'),this.format(e)}}},cast:{number:{from:o.isDate,to:(e,t)=>e.getTime()},string:{from:o.isDate,to:(e,{prefs:t})=>i.date(e,t)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),o.parse=function(e,t){if(e instanceof Date)return e;if("string"!=typeof e&&(isNaN(e)||!isFinite(e)))return null;if(/^\s*$/.test(e))return null;if("iso"===t)return a.isIsoDate(e)?o.date(e.toString()):null;const r=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return o.date(1*e);if("unix"===t)return o.date(1e3*e);if("string"==typeof r)return null}return o.date(e)},o.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t}},(e,t,r)=>{const n=r(40),s=r(137);e.exports=s.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(e){return n(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:e}})},validate:(e,t,{n:r})=>e.length===r?e:t.error("function.arity",{n:r})},class:{method(){return this.$_addRule("class")},validate:(e,t)=>/^\s*class\s/.test(e.toString())?e:t.error("function.class",{value:e})},minArity:{method(e){return n(Number.isSafeInteger(e)&&e>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:e}})},validate:(e,t,{n:r})=>e.length>=r?e:t.error("function.minArity",{n:r})},maxArity:{method(e){return n(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:e}})},validate:(e,t,{n:r})=>e.length<=r?e:t.error("function.maxArity",{n:r})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},(e,t,r)=>{const n=r(39),s=r(40),a=r(43),i=r(86),o=r(127),c=r(112),l=r(121),u=r(118),d=r(120),p=r(116),h={renameDefaults:{alias:!1,multiple:!1,override:!1}};e.exports=o.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:!1}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(e,t)=>e.keys(t),validate(e,{schema:t,error:r,state:n,prefs:s}){if(!e||typeof e!==t.$_property("typeof")||Array.isArray(e))return{value:e,errors:r("object.base",{type:t.$_property("typeof")})};if(!(t.$_terms.renames||t.$_terms.dependencies||t.$_terms.keys||t.$_terms.patterns||t.$_terms.externals))return;e=h.clone(e,s);const a=[];if(t.$_terms.renames&&!h.rename(t,e,n,s,a))return{value:e,errors:a};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:a};const i=new Set(Object.keys(e));if(t.$_terms.keys){const r=[e,...n.ancestors];for(const o of t.$_terms.keys){const t=o.key,c=e[t];i.delete(t);const l=n.localize([...n.path,t],r,o),u=o.schema.$_validate(c,l,s);if(u.errors){if(s.abortEarly)return{value:e,errors:u.errors};void 0!==u.value&&(e[t]=u.value),a.push(...u.errors)}else"strip"===o.schema._flags.result||void 0===u.value&&void 0!==c?delete e[t]:void 0!==u.value&&(e[t]=u.value)}}if(i.size||t._flags._hasPatternMatch){const r=h.unknown(t,e,i,a,n,s);if(r)return r}if(t.$_terms.dependencies)for(const r of t.$_terms.dependencies){if(null!==r.key&&!1===h.isPresent(r.options)(r.key.resolve(e,n,s,null,{shadow:!1})))continue;const i=h.dependencies[r.rel](t,r,e,n,s);if(i){const r=t.$_createError(i.code,e,i.context,n,s);if(s.abortEarly)return{value:e,errors:r};a.push(r)}}return{value:e,errors:a}},rules:{and:{method(...e){return c.verifyFlat(e,"and"),h.dependency(this,"and",null,e)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,t,r){p.isTemplate(e)||(e=l.ref(e)),s(void 0===r||"string"==typeof r,"Message must be a string"),t=this.$_compile(t,{appendPath:!0});const n=this.$_addRule({name:"assert",args:{subject:e,schema:t,message:r}});return n.$_mutateRegister(e),n.$_mutateRegister(t),n},validate(e,{error:t,prefs:r,state:n},{subject:s,schema:a,message:i}){const o=s.resolve(e,n,r),c=d.isRef(s)?s.absolute(n):[];return a.$_match(o,n.localize(c,[e,...n.ancestors],a),r)?e:t("object.assert",{subject:s,message:i})},args:["subject","schema","message"],multi:!0},instance:{method(e,t){return s("function"==typeof e,"constructor must be a function"),t=t||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:t}})},validate:(e,t,{constructor:r,name:n})=>e instanceof r?e:t.error("object.instance",{type:n,value:e}),args:["constructor","name"]},keys:{method(e){s(void 0===e||"object"==typeof e,"Object schema must be a valid object"),s(!c.isSchema(e),"Object schema cannot be a joi schema");const t=this.clone();if(e)if(Object.keys(e).length){t.$_terms.keys=t.$_terms.keys?t.$_terms.keys.filter((t=>!e.hasOwnProperty(t.key))):new h.Keys;for(const r in e)c.tryWithPath((()=>t.$_terms.keys.push({key:r,schema:this.$_compile(e[r])})),r)}else t.$_terms.keys=new h.Keys;else t.$_terms.keys=null;return t.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:n,operator:s,args:a})=>c.compare(Object.keys(e).length,r,s)?e:t.error("object."+n,{limit:a.limit,value:e}),args:[{name:"limit",ref:!0,assert:c.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},nand:{method(...e){return c.verifyFlat(e,"nand"),h.dependency(this,"nand",null,e)}},or:{method(...e){return c.verifyFlat(e,"or"),h.dependency(this,"or",null,e)}},oxor:{method(...e){return h.dependency(this,"oxor",null,e)}},pattern:{method(e,t,r={}){const n=e instanceof RegExp;n||(e=this.$_compile(e,{appendPath:!0})),s(void 0!==t,"Invalid rule"),c.assertOptions(r,["fallthrough","matches"]),n&&s(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),t=this.$_compile(t,{appendPath:!0});const a=this.clone();a.$_terms.patterns=a.$_terms.patterns||[];const i={[n?"regex":"schema"]:e,rule:t};return r.matches&&(i.matches=this.$_compile(r.matches),"array"!==i.matches.type&&(i.matches=i.matches.$_root.array().items(i.matches)),a.$_mutateRegister(i.matches),a.$_setFlag("_hasPatternMatch",!0,{clone:!1})),r.fallthrough&&(i.fallthrough=!0),a.$_terms.patterns.push(i),a.$_mutateRegister(t),a}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>d.isRef(e)?e:t.error("object.refType",{value:e})},regex:{method(){return this.$_addRule("regex")},validate:(e,t)=>e instanceof RegExp?e:t.error("object.regex",{value:e})},rename:{method(e,t,r={}){s("string"==typeof e||e instanceof RegExp,"Rename missing the from argument"),s("string"==typeof t||t instanceof p,"Invalid rename to argument"),s(t!==e,"Cannot rename key to same name:",e),c.assertOptions(r,["alias","ignoreUndefined","override","multiple"]);const a=this.clone();a.$_terms.renames=a.$_terms.renames||[];for(const t of a.$_terms.renames)s(t.from!==e,"Cannot rename the same key multiple times");return t instanceof p&&a.$_mutateRegister(t),a.$_terms.renames.push({from:e,to:t,options:n(h.renameDefaults,r)}),a}},schema:{method(e="any"){return this.$_addRule({name:"schema",args:{type:e}})},validate:(e,t,{type:r})=>!c.isSchema(e)||"any"!==r&&e.type!==r?t.error("object.schema",{type:r}):e},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t,r={}){return h.dependency(this,"with",e,t,r)}},without:{method(e,t,r={}){return h.dependency(this,"without",e,t,r)}},xor:{method(...e){return c.verifyFlat(e,"xor"),h.dependency(this,"xor",null,e)}}},overrides:{default(e,t){return void 0===e&&(e=c.symbols.deepDefault),this.$_parent("default",e,t)}},rebuild(e){if(e.$_terms.keys){const t=new i.Sorter;for(const r of e.$_terms.keys)c.tryWithPath((()=>t.add(r,{after:r.schema.$_rootReferences(),group:r.key})),r.key);e.$_terms.keys=new h.Keys(...t.nodes)}},manifest:{build(e,t){if(t.keys&&(e=e.keys(t.keys)),t.dependencies)for(const{rel:r,key:n=null,peers:s,options:a}of t.dependencies)e=h.dependency(e,r,n,s,a);if(t.patterns)for(const{regex:r,schema:n,rule:s,fallthrough:a,matches:i}of t.patterns)e=e.pattern(r||n,s,{fallthrough:a,matches:i});if(t.renames)for(const{from:r,to:n,options:s}of t.renames)e=e.rename(r,n,s);return e}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),h.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return a(e,{shallow:!0});const r=Object.create(Object.getPrototypeOf(e));return Object.assign(r,e),r}const r=function(...t){return e.apply(this,t)};return r.prototype=a(e.prototype),Object.defineProperty(r,"name",{value:e.name,writable:!1}),Object.defineProperty(r,"length",{value:e.length,writable:!1}),Object.assign(r,e),r},h.dependency=function(e,t,r,n,a){s(null===r||"string"==typeof r,t,"key must be a strings"),a||(a=n.length>1&&"object"==typeof n[n.length-1]?n.pop():{}),c.assertOptions(a,["separator","isPresent"]),n=[].concat(n);const i=c.default(a.separator,"."),o=[];for(const e of n)s("string"==typeof e,t,"peers must be strings"),o.push(l.ref(e,{separator:i,ancestor:0,prefix:!1}));null!==r&&(r=l.ref(r,{separator:i,ancestor:0,prefix:!1}));const u=e.clone();return u.$_terms.dependencies=u.$_terms.dependencies||[],u.$_terms.dependencies.push(new h.Dependency(t,r,o,n,a)),u},h.dependencies={and(e,t,r,n,s){const a=[],i=[],o=t.peers.length,c=h.isPresent(t.options);for(const e of t.peers)!1===c(e.resolve(r,n,s,null,{shadow:!1}))?a.push(e.key):i.push(e.key);if(a.length!==o&&i.length!==o)return{code:"object.and",context:{present:i,presentWithLabels:h.keysToLabels(e,i),missing:a,missingWithLabels:h.keysToLabels(e,a)}}},nand(e,t,r,n,s){const a=[],i=h.isPresent(t.options);for(const e of t.peers)i(e.resolve(r,n,s,null,{shadow:!1}))&&a.push(e.key);if(a.length!==t.peers.length)return;const o=t.paths[0],c=t.paths.slice(1);return{code:"object.nand",context:{main:o,mainWithLabel:h.keysToLabels(e,o),peers:c,peersWithLabels:h.keysToLabels(e,c)}}},or(e,t,r,n,s){const a=h.isPresent(t.options);for(const e of t.peers)if(a(e.resolve(r,n,s,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:t.paths,peersWithLabels:h.keysToLabels(e,t.paths)}}},oxor(e,t,r,n,s){const a=[],i=h.isPresent(t.options);for(const e of t.peers)i(e.resolve(r,n,s,null,{shadow:!1}))&&a.push(e.key);if(!a.length||1===a.length)return;const o={peers:t.paths,peersWithLabels:h.keysToLabels(e,t.paths)};return o.present=a,o.presentWithLabels=h.keysToLabels(e,a),{code:"object.oxor",context:o}},with(e,t,r,n,s){const a=h.isPresent(t.options);for(const i of t.peers)if(!1===a(i.resolve(r,n,s,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:h.keysToLabels(e,t.key.key),peer:i.key,peerWithLabel:h.keysToLabels(e,i.key)}}},without(e,t,r,n,s){const a=h.isPresent(t.options);for(const i of t.peers)if(a(i.resolve(r,n,s,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:h.keysToLabels(e,t.key.key),peer:i.key,peerWithLabel:h.keysToLabels(e,i.key)}}},xor(e,t,r,n,s){const a=[],i=h.isPresent(t.options);for(const e of t.peers)i(e.resolve(r,n,s,null,{shadow:!1}))&&a.push(e.key);if(1===a.length)return;const o={peers:t.paths,peersWithLabels:h.keysToLabels(e,t.paths)};return 0===a.length?{code:"object.missing",context:o}:(o.present=a,o.presentWithLabels=h.keysToLabels(e,a),{code:"object.xor",context:o})}},h.keysToLabels=function(e,t){return Array.isArray(t)?t.map((t=>e.$_mapLabels(t))):e.$_mapLabels(t)},h.isPresent=function(e){return"function"==typeof e.isPresent?e.isPresent:e=>void 0!==e},h.rename=function(e,t,r,n,s){const a={};for(const i of e.$_terms.renames){const o=[],c="string"!=typeof i.from;if(c)for(const e in t){if(void 0===t[e]&&i.options.ignoreUndefined)continue;if(e===i.to)continue;const r=i.from.exec(e);r&&o.push({from:e,to:i.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,i.from)||void 0===t[i.from]&&i.options.ignoreUndefined||o.push(i);for(const l of o){const o=l.from;let u=l.to;if(u instanceof p&&(u=u.render(t,r,n,l.match)),o!==u){if(!i.options.multiple&&a[u]&&(s.push(e.$_createError("object.rename.multiple",t,{from:o,to:u,pattern:c},r,n)),n.abortEarly))return!1;if(Object.prototype.hasOwnProperty.call(t,u)&&!i.options.override&&!a[u]&&(s.push(e.$_createError("object.rename.override",t,{from:o,to:u,pattern:c},r,n)),n.abortEarly))return!1;void 0===t[o]?delete t[u]:t[u]=t[o],a[u]=!0,i.options.alias||delete t[o]}}}return!0},h.unknown=function(e,t,r,n,s,a){if(e.$_terms.patterns){let i=!1;const o=e.$_terms.patterns.map((e=>{if(e.matches)return i=!0,[]})),c=[t,...s.ancestors];for(const i of r){const l=t[i],u=[...s.path,i];for(let d=0;d{const n=r(40),s=r(127),a=r(112),i=r(121),o=r(118),c={};e.exports=s.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(e,t)=>e.ref(t),validate(e,{schema:t,state:r,prefs:s}){n(t.$_terms.link,"Uninitialized link schema");const a=c.generate(t,e,r,s),i=t.$_terms.link[0].ref;return a.$_validate(e,r.nest(a,`link:${i.display}:${a.type}`),s)},generate:(e,t,r,n)=>c.generate(e,t,r,n),rules:{ref:{method(e){n(!this.$_terms.link,"Cannot reinitialize schema"),e=i.ref(e),n("value"===e.type||"local"===e.type,"Invalid reference type:",e.type),n("local"===e.type||"root"===e.ancestor||e.ancestor>0,"Link cannot reference itself");const t=this.clone();return t.$_terms.link=[{ref:e}],t}},relative:{method(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(e){n(this.$_terms.link,"Uninitialized link schema"),n(a.isSchema(e),"Invalid schema object"),n("link"!==e.type,"Cannot merge type link with another link");const t=this.clone();return t.$_terms.whens||(t.$_terms.whens=[]),t.$_terms.whens.push({concat:e}),t.$_mutateRebuild()}},manifest:{build:(e,t)=>(n(t.link,"Invalid link description missing link"),e.ref(t.link))}}),c.generate=function(e,t,r,n){let s=r.mainstay.links.get(e);if(s)return s._generate(t,r,n).schema;const a=e.$_terms.link[0].ref,{perspective:i,path:o}=c.perspective(a,r);c.assert(i,"which is outside of schema boundaries",a,e,r,n);try{s=o.length?i.$_reach(o):i}catch(t){c.assert(!1,"to non-existing schema",a,e,r,n)}return c.assert("link"!==s.type,"which is another link",a,e,r,n),e._flags.relative||r.mainstay.links.set(e,s),s._generate(t,r,n).schema},c.perspective=function(e,t){if("local"===e.type){for(const{schema:r,key:n}of t.schemas){if((r._flags.id||n)===e.path[0])return{perspective:r,path:e.path.slice(1)};if(r.$_terms.shared)for(const t of r.$_terms.shared)if(t._flags.id===e.path[0])return{perspective:t,path:e.path.slice(1)}}return{perspective:null,path:null}}return"root"===e.ancestor?{perspective:t.schemas[t.schemas.length-1].schema,path:e.path}:{perspective:t.schemas[e.ancestor]&&t.schemas[e.ancestor].schema,path:e.path}},c.assert=function(e,t,r,s,a,i){e||n(!1,`"${o.label(s._flags,a,i)}" contains link reference "${r.display}" ${t}`)}},(e,t,r)=>{const n=r(40),s=r(127),a=r(112),i={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/,decimalPlaces(e){const t=e.toString(),r=t.indexOf("."),n=t.indexOf("e");return(r<0?0:(n<0?t.length:n)-r-1)+(n<0?0:Math.max(0,-parseInt(t.slice(n+1))))}};e.exports=s.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:r}){if(!e.match(i.numberRx))return;e=e.trim();const n={value:parseFloat(e)};if(0===n.value&&(n.value=0),!t._flags.unsafe)if(e.match(/e/i)){if(i.extractSignificantDigits(e)!==i.extractSignificantDigits(String(n.value)))return n.errors=r("number.unsafe"),n}else{const t=n.value.toString();if(t.match(/e/i))return n;if(t!==i.normalizeDecimal(e))return n.errors=r("number.unsafe"),n}return n}},validate(e,{schema:t,error:r,prefs:n}){if(e===1/0||e===-1/0)return{value:e,errors:r("number.infinity")};if(!a.isNumber(e))return{value:e,errors:r("number.base")};const s={value:e};if(n.convert){const e=t.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);s.value=Math.round(s.value*t)/t}}return 0===s.value&&(s.value=0),!t._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||ea.compare(e,r,s)?e:t.error("number."+n,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:a.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){const t="number"==typeof e?i.decimalPlaces(e):null,r=Math.pow(10,t);return this.$_addRule({name:"multiple",args:{base:e,baseDecimalPlace:t,pfactor:r}})},validate:(e,t,{base:r,baseDecimalPlace:n,pfactor:s},a)=>i.decimalPlaces(e)>n?t.error("number.multiple",{multiple:a.args.base,value:e}):Math.round(s*e)%Math.round(s*r)==0?e:t.error("number.multiple",{multiple:a.args.base,value:e}),args:[{name:"base",ref:!0,assert:e=>"number"==typeof e&&isFinite(e)&&e>0,message:"must be a positive number"},"baseDecimalPlace","pfactor"],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,t)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:t.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(e){return n(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,t,{limit:r}){const n=e.toString().match(i.precisionRx);return Math.max((n[1]?n[1].length:0)-(n[2]?parseInt(n[2],10):0),0)<=r?e:t.error("number.precision",{limit:r,value:e})},convert:!0},sign:{method(e){return n(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate:(e,t,{sign:r})=>"negative"===r&&e<0||"positive"===r&&e>0?e:t.error(`number.${r}`)},unsafe:{method(e=!0){return n("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("unsafe",e)}}},cast:{string:{from:e=>"number"==typeof e,to:(e,t)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),i.extractSignificantDigits=function(e){return e.replace(i.exponentialPartRegex,"").replace(i.dotRegex,"").replace(i.trailingZerosRegex,"").replace(i.leadingSignAndZerosRegex,"")},i.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e}},(e,t,r)=>{const n=r(137);e.exports=n.extend({type:"object",cast:{map:{from:e=>e&&"object"==typeof e,to:(e,t)=>new Map(Object.entries(e))}}})},(e,t,r)=>{var n=r(21).Buffer;const s=r(40),a=r(142),i=r(144),o=r(145),c=r(53),l=r(147),u=r(146),d=r(127),p=r(112),h={tlds:l instanceof Set&&{tlds:{allow:l,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:{withPrefix:/^0x[0-9a-f]+$/i,withOptionalPrefix:/^(?:0x)?[0-9a-f]+$/i,withoutPrefix:/^[0-9a-f]+$/i},ipRegex:o.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};e.exports=d.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,{schema:t,state:r,prefs:n}){const s=t.$_getRule("normalize");s&&(e=e.normalize(s.args.form));const a=t.$_getRule("case");a&&(e="upper"===a.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const i=t.$_getRule("trim");if(i&&i.args.enabled&&(e=e.trim()),t.$_terms.replacements)for(const r of t.$_terms.replacements)e=e.replace(r.pattern,r.replacement);const o=t.$_getRule("hex");if(o&&o.args.options.byteAligned&&e.length%2!=0&&(e=`0${e}`),t.$_getRule("isoDate")){const t=h.isoDate(e);t&&(e=t)}if(t._flags.truncate){const s=t.$_getRule("max");if(s){let a=s.args.limit;if(p.isResolvable(a)&&(a=a.resolve(e,r,n),!p.limit(a)))return{value:e,errors:t.$_createError("any.ref",a,{ref:s.args.limit,arg:"limit",reason:"must be a positive integer"},r,n)};e=e.slice(0,a)}}return{value:e}}},validate(e,{schema:t,error:r}){if("string"!=typeof e)return{value:e,errors:r("string.base")};if(""===e){const n=t.$_getRule("min");if(n&&0===n.args.limit)return;return{value:e,errors:r("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(e,t)=>/^[a-zA-Z0-9]+$/.test(e)?e:t.error("string.alphanum")},base64:{method(e={}){return p.assertOptions(e,["paddingRequired","urlSafe"]),e={urlSafe:!1,paddingRequired:!0,...e},s("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),s("boolean"==typeof e.urlSafe,"urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:e}})},validate:(e,t,{options:r})=>h.base64Regex[r.paddingRequired][r.urlSafe].test(e)?e:t.error("string.base64")},case:{method(e){return s(["lower","upper"].includes(e),"Invalid case:",e),this.$_addRule({name:"case",args:{direction:e}})},validate:(e,t,{direction:r})=>"lower"===r&&e===e.toLocaleLowerCase()||"upper"===r&&e===e.toLocaleUpperCase()?e:t.error(`string.${r}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let r=e.length,n=0,s=1;for(;r--;){const t=e.charAt(r)*s;n+=t-9*(t>9),s^=3}return n>0&&n%10==0?e:t.error("string.creditCard")}},dataUri:{method(e={}){return p.assertOptions(e,["paddingRequired"]),e={paddingRequired:!0,...e},s("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:e}})},validate(e,t,{options:r}){const n=e.match(h.dataUriRegex);if(n){if(!n[2])return e;if("base64"!==n[2])return e;if(h.base64Regex[r.paddingRequired].false.test(n[3]))return e}return t.error("string.dataUri")}},domain:{method(e){e&&p.assertOptions(e,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const t=h.addressOptions(e);return this.$_addRule({name:"domain",args:{options:e},address:t})},validate:(e,t,r,{address:n})=>a.isValid(e,n)?e:t.error("string.domain")},email:{method(e={}){p.assertOptions(e,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),s(void 0===e.multiple||"boolean"==typeof e.multiple,"multiple option must be an boolean");const t=h.addressOptions(e),r=new RegExp(`\\s*[${e.separator?c(e.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:e},regex:r,address:t})},validate(e,t,{options:r},{regex:n,address:s}){const a=r.multiple?e.split(n):[e],o=[];for(const e of a)i.isValid(e,s)||o.push(e);return o.length?t.error("string.email",{value:e,invalids:o}):e}},guid:{alias:"uuid",method(e={}){p.assertOptions(e,["version","separator"]);let t="";if(e.version){const r=[].concat(e.version);s(r.length>=1,"version must have at least 1 valid version specified");const n=new Set;for(let e=0;e("optional"===r.prefix?h.hexRegex.withOptionalPrefix:!0===r.prefix?h.hexRegex.withPrefix:h.hexRegex.withoutPrefix).test(e)?r.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(e,t)=>a.isValid(e,{minDomainSegments:1})||h.ipRegex.test(e)?e:t.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(e={}){p.assertOptions(e,["cidr","version"]);const{cidr:t,versions:r,regex:n}=o.regex(e),s=e.version?r:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:t,version:s}},regex:n})},validate:(e,t,{options:r},{regex:n})=>n.test(e)?e:r.version?t.error("string.ipVersion",{value:e,cidr:r.cidr,version:r.version}):t.error("string.ip",{value:e,cidr:r.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(e,{error:t})=>h.isoDate(e)?e:t("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>h.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return h.length(this,"length",e,"=",t)},validate(e,t,{limit:r,encoding:s},{name:a,operator:i,args:o}){const c=s?n&&n.byteLength(e,s):e.length;return p.compare(c,r,i)?e:t.error("string."+a,{limit:o.limit,value:e,encoding:s})},args:[{name:"limit",ref:!0,assert:p.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return h.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return h.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(e="NFC"){return s(h.normalizationForms.includes(e),"normalization form must be one of "+h.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:e}})},validate:(e,{error:t},{form:r})=>e===e.normalize(r)?e:t("string.normalize",{value:e,form:r}),convert:!0},pattern:{alias:"regex",method(e,t={}){s(e instanceof RegExp,"regex must be a RegExp"),s(!e.flags.includes("g")&&!e.flags.includes("y"),"regex should not use global or sticky mode"),"string"==typeof t&&(t={name:t}),p.assertOptions(t,["invert","name"]);const r=["string.pattern",t.invert?".invert":"",t.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:e,options:t},errorCode:r})},validate:(e,t,{regex:r,options:n},{errorCode:s})=>r.test(e)^n.invert?e:t.error(s,{name:n.name,regex:r,value:e}),args:["regex","options"],multi:!0},replace:{method(e,t){"string"==typeof e&&(e=new RegExp(c(e),"g")),s(e instanceof RegExp,"pattern must be a RegExp"),s("string"==typeof t,"replacement must be a String");const r=this.clone();return r.$_terms.replacements||(r.$_terms.replacements=[]),r.$_terms.replacements.push({pattern:e,replacement:t}),r}},token:{method(){return this.$_addRule("token")},validate:(e,t)=>/^\w+$/.test(e)?e:t.error("string.token")},trim:{method(e=!0){return s("boolean"==typeof e,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:e}})},validate:(e,t,{enabled:r})=>r&&e!==e.trim()?t.error("string.trim"):e,convert:!0},truncate:{method(e=!0){return s("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("truncate",e)}},uppercase:{method(){return this.case("upper")}},uri:{method(e={}){p.assertOptions(e,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme"]),e.domain&&p.assertOptions(e.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:t,scheme:r}=u.regex(e),n=e.domain?h.addressOptions(e.domain):null;return this.$_addRule({name:"uri",args:{options:e},regex:t,domain:n,scheme:r})},validate(e,t,{options:r},{regex:n,domain:s,scheme:i}){if(["http:/","https:/"].includes(e))return t.error("string.uri");const o=n.exec(e);if(o){const n=o[1]||o[2];return!s||r.allowRelative&&!n||a.isValid(n,s)?e:t.error("string.domain",{value:n})}return r.relativeOnly?t.error("string.uriRelativeOnly"):r.scheme?t.error("string.uriCustomScheme",{scheme:i,value:e}):t.error("string.uri")}}},manifest:{build(e,t){if(t.replacements)for(const{pattern:r,replacement:n}of t.replacements)e=e.replace(r,n);return e}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),h.addressOptions=function(e){if(!e)return h.tlds||e;if(s(void 0===e.minDomainSegments||Number.isSafeInteger(e.minDomainSegments)&&e.minDomainSegments>0,"minDomainSegments must be a positive integer"),s(void 0===e.maxDomainSegments||Number.isSafeInteger(e.maxDomainSegments)&&e.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),!1===e.tlds)return e;if(!0===e.tlds||void 0===e.tlds)return s(h.tlds,"Built-in TLD list disabled"),Object.assign({},e,h.tlds);s("object"==typeof e.tlds,"tlds must be true, false, or an object");const t=e.tlds.deny;if(t)return Array.isArray(t)&&(e=Object.assign({},e,{tlds:{deny:new Set(t)}})),s(e.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),s(!e.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),h.validateTlds(e.tlds.deny,"tlds.deny"),e;const r=e.tlds.allow;return r?!0===r?(s(h.tlds,"Built-in TLD list disabled"),Object.assign({},e,h.tlds)):(Array.isArray(r)&&(e=Object.assign({},e,{tlds:{allow:new Set(r)}})),s(e.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),h.validateTlds(e.tlds.allow,"tlds.allow"),e):e},h.validateTlds=function(e,t){for(const r of e)s(a.isValid(r,{minDomainSegments:1,maxDomainSegments:1}),`${t} must contain valid top level domain names`)},h.isoDate=function(e){if(!p.isIsoDate(e))return null;/.*T.*[+-]\d\d$/.test(e)&&(e+="00");const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},h.length=function(e,t,r,a,i){return s(!i||n&&n.isEncoding(i),"Invalid encoding:",i),e.$_addRule({name:t,method:"length",args:{limit:r,encoding:i},operator:a})}},(e,t,r)=>{const n=r(8),s=r(143),a={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:n.URL||URL};t.analyze=function(e,t={}){if(!e)return s.code("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return s.code("DOMAIN_TOO_LONG");if(!!a.nonAsciiRx.test(e)){if(!1===t.allowUnicode)return s.code("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(a.domainControlRx.test(e))return s.code("DOMAIN_INVALID_CHARS");e=a.punycode(e),t.allowFullyQualified&&"."===e[e.length-1]&&(e=e.slice(0,-1));const r=t.minDomainSegments||a.minDomainSegments,n=e.split(".");if(n.lengtht.maxDomainSegments)return s.code("DOMAIN_SEGMENTS_COUNT_MAX");const i=t.tlds;if(i){const e=n[n.length-1].toLowerCase();if(i.deny&&i.deny.has(e)||i.allow&&!i.allow.has(e))return s.code("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e63)return s.code("DOMAIN_LONG_SEGMENT");if(e{t.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},t.code=function(e){return{code:e,error:t.codes[e]}}},(e,t,r)=>{const n=r(101),s=r(142),a=r(143),i={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(n.TextEncoder||TextEncoder)};t.analyze=function(e,t){return i.email(e,t)},t.isValid=function(e,t){return!i.email(e,t)},i.email=function(e,t={}){if("string"!=typeof e)throw new Error("Invalid input: email must be a string");if(!e)return a.code("EMPTY_STRING");const r=!i.nonAsciiRx.test(e);if(!r){if(!1===t.allowUnicode)return a.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const n=e.split("@");if(2!==n.length)return n.length>2?a.code("MULTIPLE_AT_CHAR"):a.code("MISSING_AT_CHAR");const[o,c]=n;if(!o)return a.code("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return a.code("ADDRESS_TOO_LONG");if(i.encoder.encode(o).length>64)return a.code("LOCAL_TOO_LONG")}return i.local(o,r)||s.analyze(c,t)},i.local=function(e,t){const r=e.split(".");for(const e of r){if(!e.length)return a.code("EMPTY_LOCAL_SEGMENT");if(t){if(!i.atextRx.test(e))return a.code("INVALID_LOCAL_CHARS")}else for(const t of e){if(i.atextRx.test(t))continue;const e=i.binary(t);if(!i.atomRx.test(e))return a.code("INVALID_LOCAL_CHARS")}}},i.binary=function(e){return Array.from(i.encoder.encode(e)).map((e=>String.fromCharCode(e))).join("")},i.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,i.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},(e,t,r)=>{const n=r(40),s=r(146);t.regex=function(e={}){n(void 0===e.cidr||"string"==typeof e.cidr,"options.cidr must be a string");const t=e.cidr?e.cidr.toLowerCase():"optional";n(["required","optional","forbidden"].includes(t),"options.cidr must be one of required, optional, forbidden"),n(void 0===e.version||"string"==typeof e.version||Array.isArray(e.version),"options.version must be a string or an array of string");let r=e.version||["ipv4","ipv6","ipvfuture"];Array.isArray(r)||(r=[r]),n(r.length>=1,"options.version must have at least 1 version specified");for(let e=0;e{if("forbidden"===t)return s.ip[e];const r=`\\/${"ipv4"===e?s.ip.v4Cidr:s.ip.v6Cidr}`;return"required"===t?`${s.ip[e]}${r}`:`${s.ip[e]}(?:${r})?`})).join("|")})`,i=new RegExp(`^${a}$`);return{cidr:t,versions:r,regex:i,raw:a}}},(e,t,r)=>{const n=r(40),s=r(53),a={generate:function(){const e={},t="\\dA-Fa-f",r="["+t+"]",n="\\w-\\.~",s="!\\$&'\\(\\)\\*\\+,;=",a="%"+t,i=n+a+s+":@",o="["+i+"]",c="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4address="(?:"+c+"\\.){3}"+c;const l=r+"{1,4}",u="(?:"+l+":"+l+"|"+e.ipv4address+")",d="(?:"+l+":){6}"+u,p="::(?:"+l+":){5}"+u,h="(?:"+l+")?::(?:"+l+":){4}"+u,f="(?:(?:"+l+":){0,1}"+l+")?::(?:"+l+":){3}"+u,m="(?:(?:"+l+":){0,2}"+l+")?::(?:"+l+":){2}"+u,g="(?:(?:"+l+":){0,3}"+l+")?::"+l+":"+u,y="(?:(?:"+l+":){0,4}"+l+")?::"+u,_="(?:(?:"+l+":){0,5}"+l+")?::"+l,v="(?:(?:"+l+":){0,6}"+l+")?::";e.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",e.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",e.ipv6address="(?:"+d+"|"+p+"|"+h+"|"+f+"|"+m+"|"+g+"|"+y+"|"+_+"|"+v+")",e.ipvFuture="v"+r+"+\\.["+n+s+":]+",e.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",e.schemeRegex=new RegExp(e.scheme);const b="["+n+a+s+":]*",w="["+n+a+s+"]{1,255}",E="(?:"+("\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]")+"|"+e.ipv4address+"|"+w+")",R="(?:"+b+"@)?"+E+"(?::\\d*)?",S="(?:"+b+"@)?("+E+")(?::\\d*)?",A=o+"*",O=o+"+",P="(?:\\/"+A+")*",T="\\/(?:"+O+P+")?",C=O+P,k="["+n+a+s+"@]+"+P,I="(?:\\/\\/\\/"+A+P+")";return e.hierPart="(?:(?:\\/\\/"+R+P+")|"+T+"|"+C+"|"+I+")",e.hierPartCapture="(?:(?:\\/\\/"+S+P+")|"+T+"|"+C+")",e.relativeRef="(?:(?:\\/\\/"+R+P+")|"+T+"|"+k+"|)",e.relativeRefCapture="(?:(?:\\/\\/"+S+P+")|"+T+"|"+k+"|)",e.query="["+i+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+i+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+i+"\\/\\?]*",e}};a.rfc3986=a.generate(),t.ip={v4Cidr:a.rfc3986.ipv4Cidr,v6Cidr:a.rfc3986.ipv6Cidr,ipv4:a.rfc3986.ipv4address,ipv6:a.rfc3986.ipv6address,ipvfuture:a.rfc3986.ipvFuture},a.createRegex=function(e){const t=a.rfc3986,r="(?:\\?"+(e.allowQuerySquareBrackets?t.queryWithSquareBrackets:t.query)+")?(?:#"+t.fragment+")?",i=e.domain?t.relativeRefCapture:t.relativeRef;if(e.relativeOnly)return a.wrap(i+r);let o="";if(e.scheme){n(e.scheme instanceof RegExp||"string"==typeof e.scheme||Array.isArray(e.scheme),"scheme must be a RegExp, String, or Array");const r=[].concat(e.scheme);n(r.length>=1,"scheme must have at least 1 scheme specified");const a=[];for(let e=0;e{const t={tlds:["AAA","AARP","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"]};e.exports=new Set(t.tlds.map((e=>e.toLowerCase())))},(e,t,r)=>{const n=r(40),s=r(127),a={};a.Map=class extends Map{slice(){return new a.Map(this)}},e.exports=s.extend({type:"symbol",terms:{map:{init:new a.Map}},coerce:{method(e,{schema:t,error:r}){const n=t.$_terms.map.get(e);return n&&(e=n),t._flags.only&&"symbol"!=typeof e?{value:e,errors:r("symbol.map",{map:t.$_terms.map})}:{value:e}}},validate(e,{error:t}){if("symbol"!=typeof e)return{value:e,errors:t("symbol.base")}},rules:{map:{method(e){e&&!e[Symbol.iterator]&&"object"==typeof e&&(e=Object.entries(e)),n(e&&e[Symbol.iterator],"Iterable must be an iterable or object");const t=this.clone(),r=[];for(const s of e){n(s&&s[Symbol.iterator],"Entry must be an iterable");const[e,a]=s;n("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),n("symbol"==typeof a,"Value must be a Symbol"),t.$_terms.map.set(e,a),r.push(a)}return t.valid(...r)}}},manifest:{build:(e,t)=>(t.map&&(e=e.map(t.map)),e)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},(e,t,r)=>{var n=r(21).Buffer;const s=r(40),a=r(127),i=r(112);e.exports=a.extend({type:"binary",coerce:{from:["string","object"],method(e,{schema:t}){if("string"==typeof e||null!==e&&"Buffer"===e.type)try{return{value:n.from(e,t._flags.encoding)}}catch(e){}}},validate(e,{error:t}){if(!n.isBuffer(e))return{value:e,errors:t("binary.base")}},rules:{encoding:{method(e){return s(n.isEncoding(e),"Invalid encoding:",e),this.$_setFlag("encoding",e)}},length:{method(e){return this.$_addRule({name:"length",method:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:n,operator:s,args:a})=>i.compare(e.length,r,s)?e:t.error("binary."+n,{limit:a.limit,value:e}),args:[{name:"limit",ref:!0,assert:i.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}}},cast:{string:{from:e=>n.isBuffer(e),to:(e,t)=>e.toString()}},messages:{"binary.base":"{{#label}} must be a buffer or a string","binary.length":"{{#label}} must be {{#limit}} bytes","binary.max":"{{#label}} must be less than or equal to {{#limit}} bytes","binary.min":"{{#label}} must be at least {{#limit}} bytes"}})},(e,t,r)=>{const{authPlugin:n}=r(151),{assetsPlugin:s}=r(324),{handlersPlugin:a}=r(325),{htmlPlugin:i}=r(328),{routesPlugin:o}=r(331),{storagePlugin:c}=r(408),l=[n,s,a,i,o,c];e.exports=l},(e,t,r)=>{r.r(t),r.d(t,{authPlugin:()=>g});var n=r(101),s=r(2),a=r.n(s),i=r(100),o=r.n(i),c=r(152),l=r.n(c),u=r(153),d=r.n(u),p=r(4),h=r.n(p),f=r(154),m=r(322);const g={register:async e=>{e.auth.scheme("extension-secret",(()=>({authenticate:(e,t)=>{const r=e.headers["x-api-key"];return e.storage.getApiKey().then((e=>{if(r&&r===(e=>o().createHmac("sha256",`${e} + ${h()("AUTH0_CLIENT_SECRET")}`).update(h()("EXTENSION_SECRET")).digest("hex"))(e))return t.authenticated({credentials:{user:"rule"}});throw a().unauthorized("Invalid API Key")}))}}))),e.auth.strategy("extension-secret","extension-secret");const t={dashboardAdmin:{key:h()("EXTENSION_SECRET"),verifyOptions:{audience:"urn:api-authz",issuer:h()("PUBLIC_WT_URL"),algorithms:["HS256"]}},resourceServer:{key:l().hapiJwt2Key({cache:!0,rateLimit:!0,jwksRequestsPerMinute:2,jwksUri:`https://${h()("AUTH0_DOMAIN")}/.well-known/jwks.json`}),verifyOptions:{audience:"urn:auth0-authz-api",issuer:`https://${h()("AUTH0_DOMAIN")}/`,algorithms:["RS256"]}}};e.auth.strategy("jwt","jwt",{complete:!0,verify:async(e,r)=>{try{if(!e)return{isValid:!1};const s=r.headers.authorization;if(!s||0===!s.indexOf("Bearer "))return{isValid:!1};const a=s.split(" ")[1],i=e&&e.payload&&e.payload.iss===`https://${h()("AUTH0_DOMAIN")}/`,o=e&&e.payload&&e.payload.iss===h()("PUBLIC_WT_URL"),c=(0,n.promisify)(t.resourceServer.key),l=(0,n.promisify)(d().verify);if(i){if(e.payload.gty&&"client-credentials"!==e.payload.gty)return{isValid:!1};if(!e.payload.sub.endsWith("@clients"))return{isValid:!1};const r=await c(e);return r?(await l(a,r,t.resourceServer.verifyOptions),e.payload.scope&&"string"==typeof e.payload.scope&&(e.payload.scope=e.payload.scope.split(" ")),{credentials:e.payload,isValid:!0}):{isValid:!1}}if(o)return e.payload.access_token&&e.payload.access_token.length?(await l(a,t.dashboardAdmin.key,t.dashboardAdmin.verifyOptions),e.payload.scope=f.scopes.map((e=>e.value)),{credentials:e.payload,isValid:!0}):{isValid:!1}}catch(e){return{isValid:!1}}}}),e.auth.default("jwt");const r={plugin:m.plugin,options:{stateKey:"authz-state",nonceKey:"authz-nonce",sessionStorageKey:"authz:apiToken",rta:h()("AUTH0_RTA").replace("https://",""),domain:h()("AUTH0_DOMAIN"),scopes:"read:resource_servers create:resource_servers update:resource_servers delete:resource_servers read:clients read:connections read:rules create:rules update:rules update:rules_configs read:users read:configuration",baseUrl:h()("PUBLIC_WT_URL"),audience:"urn:api-authz",secret:h()("EXTENSION_SECRET"),clientName:"Authorization Extension",onLoginSuccess:(e,t)=>{if(e)return e.scope=f.scopes.map((e=>e.value)),e;throw a().unauthorized("Invalid token","Token")}}};e.register(r)},name:"auth"}},e=>{e.exports=require("jwks-rsa@3.0.1")},e=>{e.exports=require("jsonwebtoken@9.0.1")},(e,t,r)=>{r.r(t),r.d(t,{createApi:()=>h,deleteApi:()=>m,getApi:()=>p,scopes:()=>g,updateApi:()=>f});var n=r(3),s=r.n(n),a=r(155),i=r.n(a),o=r(4),c=r.n(o);const l="urn:auth0-authz-api",u=[{value:"read:users"},{value:"read:applications"},{value:"read:connections"},{value:"read:configuration"},{value:"update:configuration"},{value:"read:groups"},{value:"create:groups"},{value:"update:groups"},{value:"delete:groups"},{value:"read:roles"},{value:"create:roles"},{value:"update:roles"},{value:"delete:roles"},{value:"read:permissions"},{value:"create:permissions"},{value:"update:permissions"},{value:"delete:permissions"},{value:"read:resource-server"},{value:"create:resource-server"},{value:"update:resource-server"},{value:"delete:resource-server"}],d=(e,t,r,n)=>new Promise(((a,o)=>(e=>e.auth&&e.auth.credentials&&e.auth.credentials.access_token&&e.auth.credentials.access_token.length?Promise.resolve(e.auth.credentials.access_token):i().getAccessTokenCached(c()("AUTH0_DOMAIN"),c()("AUTH0_CLIENT_ID"),c()("AUTH0_CLIENT_SECRET")))(e).then((e=>{s()(r,`https://${c()("AUTH0_DOMAIN")}/api/v2/${t}`).send(n||{}).set("Content-Type","application/json").set("Authorization",`Bearer ${e}`).end(((e,t)=>e?o(e):a(t.body)))})))),p=e=>d(e,`resource-servers/${l}`,"GET").catch((()=>({}))),h=(e,t)=>d(e,"resource-servers","POST",{name:"auth0-authorization-extension-api",identifier:l,signing_alg:"RS256",scopes:u,token_lifetime:t}),f=(e,t)=>p(e).then((r=>r.id?d(e,`resource-servers/${r.id}`,"PATCH",{token_lifetime:t||86400}):h(e,t||86400))),m=(e,t)=>p(e).then((r=>r.id?d(e,`resource-servers/${r.id}`,"DELETE"):r.id||t?Promise.resolve():Promise.reject(new Error("Unable to disable resource-server. Is it enabled?")))),g=u},(e,t,r)=>{const n=r(153),s=r(156),a=r(321),i=r(3),o=r(13).ArgumentError,c=r(13).ManagementApiError,l=function(e,t,r){return new Promise((function(n,s){i.post("https://"+e+"/oauth/token").send({audience:"https://"+e+"/api/v2/",client_id:t,client_secret:r,grant_type:"client_credentials"}).set("Accept","application/json").end((function(e,r){return e&&401===e.status?s(new c("unauthorized","Invalid credentials for "+t,e.status)):e&&r&&r.body&&r.body.error?s(new c(r.body.error,r.body.error_description||r.body.error,e.status)):e?s(e):r.ok&&r.body.access_token?n(r.body.access_token):s(new c("unknown_error","Unknown error from Management Api or no access token was provided: "+(r.text||r.status)))}))}))},u=a({load:function(e,t,r,n){l(e,t,r).then((function(e){return n(null,e)})).catch((function(e){return n(e)}))},hash:function(e,t,r){return e+"-"+t+"-"+r},itemMaxAge:function(e,t,r,s){try{const e=n.decode(s),t=new Date(0);t.setUTCSeconds(e.exp);const r=(new Date).valueOf();return t.valueOf()-r-1e4}catch(e){return 1e3}},max:100,maxAge:36e5}),d=function(e,t,r){return new Promise((function(n,s){u(e,t,r,(function(e,t){return e?s(e):n(t)}))}))};e.exports={getAccessToken:l,getAccessTokenCached:d,getClient:function(e){if(null==e)throw new o("An options object must be provided");if(null===e.domain||void 0===e.domain)throw new o("An options object must contain the domain");if("string"!=typeof e.domain||0===e.domain.length)throw new o("The provided domain is invalid: "+e.domain);if(e.accessToken){if("string"!=typeof e.accessToken||0===e.accessToken.length)throw new o("The provided accessToken is invalid");const t=new s.ManagementClient({domain:e.domain,token:e.accessToken,headers:e.headers});return Promise.resolve(t)}if(null===e.clientId||void 0===e.clientId)throw new o("An options object must contain the clientId");if("string"!=typeof e.clientId||0===e.clientId.length)throw new o("The provided clientId is invalid: "+e.clientId);if(null===e.clientSecret||void 0===e.clientSecret)throw new o("An options object must contain the clientSecret");if("string"!=typeof e.clientSecret||0===e.clientSecret.length)throw new o("The provided clientSecret is invalid");return d(e.domain,e.clientId,e.clientSecret).then((function(t){return new s.ManagementClient({domain:e.domain,token:t,headers:e.headers})}))}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),s(r(157),t),s(r(203),t),s(r(319),t),s(r(165),t),s(r(166),t),s(r(320),t)},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),s(r(158),t),s(r(159),t),s(r(160),t)},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ManagementClient=t.ManagementApiError=void 0;const n=r(160),s=r(201),a=r(318),i=r(312);class o extends Error{constructor(e,t,r,n,s,a){super(a),this.errorCode=e,this.error=t,this.statusCode=r,this.body=n,this.headers=s,this.msg=a,this.name="ManagementApiError"}}async function c(e){const t=await e.text();let r;try{return r=JSON.parse(t),new o(r.errorCode,r.error,r.statusCode||e.status,t,e.headers,r.message)}catch(r){return new a.ResponseError(e.status,t,e.headers,"Response returned an error code")}}t.ManagementApiError=o;class l extends n.ManagementClientBase{constructor(e){super({...e,baseUrl:`https://${e.domain}/api/v2`,middleware:[new s.TokenProviderMiddleware(e),...!1!==e.telemetry?[new i.TelemetryMiddleware(e)]:[]],parseError:c})}}t.ManagementClient=l},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.ManagementClientBase=void 0,s(r(161),t),s(r(200),t);const a=r(161);t.ManagementClientBase=class{constructor(e){this.configuration=e,this.actions=new a.ActionsManager(this.configuration),this.anomaly=new a.AnomalyManager(this.configuration),this.attackProtection=new a.AttackProtectionManager(this.configuration),this.blacklists=new a.BlacklistsManager(this.configuration),this.branding=new a.BrandingManager(this.configuration),this.clientGrants=new a.ClientGrantsManager(this.configuration),this.clients=new a.ClientsManager(this.configuration),this.connections=new a.ConnectionsManager(this.configuration),this.customDomains=new a.CustomDomainsManager(this.configuration),this.deviceCredentials=new a.DeviceCredentialsManager(this.configuration),this.emailTemplates=new a.EmailTemplatesManager(this.configuration),this.emails=new a.EmailsManager(this.configuration),this.grants=new a.GrantsManager(this.configuration),this.guardian=new a.GuardianManager(this.configuration),this.hooks=new a.HooksManager(this.configuration),this.jobs=new a.JobsManager(this.configuration),this.keys=new a.KeysManager(this.configuration),this.logStreams=new a.LogStreamsManager(this.configuration),this.logs=new a.LogsManager(this.configuration),this.organizations=new a.OrganizationsManager(this.configuration),this.prompts=new a.PromptsManager(this.configuration),this.refreshTokens=new a.RefreshTokensManager(this.configuration),this.resourceServers=new a.ResourceServersManager(this.configuration),this.roles=new a.RolesManager(this.configuration),this.rules=new a.RulesManager(this.configuration),this.rulesConfigs=new a.RulesConfigsManager(this.configuration),this.selfServiceProfiles=new a.SelfServiceProfilesManager(this.configuration),this.sessions=new a.SessionsManager(this.configuration),this.stats=new a.StatsManager(this.configuration),this.tenants=new a.TenantsManager(this.configuration),this.tickets=new a.TicketsManager(this.configuration),this.userBlocks=new a.UserBlocksManager(this.configuration),this.users=new a.UsersManager(this.configuration),this.usersByEmail=new a.UsersByEmailManager(this.configuration)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),s(r(162),t),s(r(167),t),s(r(168),t),s(r(169),t),s(r(170),t),s(r(171),t),s(r(172),t),s(r(173),t),s(r(174),t),s(r(175),t),s(r(176),t),s(r(177),t),s(r(178),t),s(r(179),t),s(r(180),t),s(r(181),t),s(r(182),t),s(r(183),t),s(r(184),t),s(r(185),t),s(r(186),t),s(r(187),t),s(r(188),t),s(r(189),t),s(r(190),t),s(r(191),t),s(r(192),t),s(r(193),t),s(r(194),t),s(r(195),t),s(r(196),t),s(r(197),t),s(r(198),t),s(r(199),t)},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ActionsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.ActionsManager=class extends o{async delete(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"force",config:{}}]),n=await this.request({path:"/actions/actions/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",query:r},t);return i.VoidApiResponse.fromResponse(n)}async get(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/actions/actions/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async getVersion(e,t){i.validateRequiredRequestParams(e,["actionId","id"]);const r=await this.request({path:"/actions/actions/{actionId}/versions/{id}".replace("{actionId}",encodeURIComponent(String(e.actionId))).replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async getVersions(e,t){i.validateRequiredRequestParams(e,["actionId"]);const r=i.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}}]),n=await this.request({path:"/actions/actions/{actionId}/versions".replace("{actionId}",encodeURIComponent(String(e.actionId))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getAll(e={},t){const r=i.applyQueryParams(e,[{key:"triggerId",config:{}},{key:"actionName",config:{}},{key:"deployed",config:{}},{key:"page",config:{}},{key:"per_page",config:{}},{key:"installed",config:{}}]),n=await this.request({path:"/actions/actions",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getTriggerBindings(e,t){i.validateRequiredRequestParams(e,["triggerId"]);const r=i.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}}]),n=await this.request({path:"/actions/triggers/{triggerId}/bindings".replace("{triggerId}",encodeURIComponent(String(e.triggerId))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getExecution(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/actions/executions/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async getAllTriggers(e){const t=await this.request({path:"/actions/triggers",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async update(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/actions/actions/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async updateTriggerBindings(e,t,r){i.validateRequiredRequestParams(e,["triggerId"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/actions/triggers/{triggerId}/bindings".replace("{triggerId}",encodeURIComponent(String(e.triggerId))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/actions/actions",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async deploy(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/actions/actions/{id}/deploy".replace("{id}",encodeURIComponent(String(e.id))),method:"POST"},t);return i.JSONApiResponse.fromResponse(r)}async deployVersion(e,t,r){i.validateRequiredRequestParams(e,["id","actionId"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/actions/actions/{actionId}/versions/{id}/deploy".replace("{id}",encodeURIComponent(String(e.id))).replace("{actionId}",encodeURIComponent(String(e.actionId))),method:"POST",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async test(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/actions/actions/{id}/test".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.parseFormParam=t.applyQueryParams=t.validateRequiredRequestParams=t.COLLECTION_FORMATS=t.BaseAPI=void 0;const a=r(164),i=r(165);s(r(166),t);t.BaseAPI=class{constructor(e){if(this.configuration=e,this.fetchWithTimeout=async(e,t)=>{const r=new AbortController,n=setTimeout((()=>{r.abort()}),this.timeoutDuration);try{return await this.fetchApi(e,{signal:r.signal,...t})}catch(e){if("AbortError"===e.name)throw new i.TimeoutError;throw e}finally{clearTimeout(n)}},this.fetch=async(e,t)=>{var r;let n,s,o={url:e,init:t};for(const e of this.middleware)e.pre&&(o=await e.pre({fetch:this.fetchWithTimeout,...o})||o);try{n=!1!==(null===(r=this.configuration.retry)||void 0===r?void 0:r.enabled)?await(0,a.retry)((()=>this.fetchWithTimeout(o.url,o.init)),{...this.configuration.retry}):await this.fetchWithTimeout(o.url,o.init)}catch(e){s=e}if(s||!n.ok){for(const e of this.middleware)e.onError&&(n=await e.onError({fetch:this.fetchWithTimeout,...o,error:s,response:n?n.clone():void 0})||n);if(void 0===n)throw new i.FetchError(s,"The request failed and the interceptors did not return an alternative response")}else for(const e of this.middleware)e.post&&(n=await e.post({fetch:this.fetchApi,...o,response:n.clone()})||n);return n},null===e.baseUrl||void 0===e.baseUrl)throw new Error("Must provide a base URL for the API");if("string"!=typeof e.baseUrl||0===e.baseUrl.length)throw new Error("The provided base URL is invalid");this.middleware=e.middleware||[],this.fetchApi=e.fetch||fetch,this.parseError=e.parseError,this.timeoutDuration="number"==typeof e.timeoutDuration?e.timeoutDuration:1e4}async request(e,t){const{url:r,init:n}=await this.createFetchParams(e,t),s=await this.fetch(r,n);if(s&&s.status>=200&&s.status<300)return s;throw await this.parseError(s)}async createFetchParams(e,t){let r=this.configuration.baseUrl+e.path;var n;void 0!==e.query&&0!==Object.keys(e.query).length&&(r+=`?${n=e.query,Object.keys(n).map((e=>function(e,t){if(t instanceof Array){const r=t.map((e=>encodeURIComponent(String(e)))).join(`&${encodeURIComponent(e)}=`);return`${encodeURIComponent(e)}=${r}`}return`${encodeURIComponent(e)}=${encodeURIComponent(String(t))}`}(e,n[e]))).filter((e=>e.length>0)).join("&")}`);const s=Object.assign({},this.configuration.headers,e.headers);Object.keys(s).forEach((e=>void 0===s[e]?delete s[e]:{}));const a="function"==typeof t?t:async()=>t,i={method:e.method,headers:s,body:e.body,dispatcher:this.configuration.agent},o={...i,...await a({init:i,context:e})};return{url:r,init:{...o,body:o.body instanceof FormData||o.body instanceof URLSearchParams||o.body instanceof Blob?o.body:JSON.stringify(o.body)}}}},t.COLLECTION_FORMATS={csv:",",ssv:" ",tsv:"\t",pipes:"|"},t.validateRequiredRequestParams=function(e,t){t.forEach((t=>{if(null===e[t]||void 0===e[t])throw new i.RequiredError(t,`Required parameter requestParameters.${t} was null or undefined.`)}))},t.applyQueryParams=function(e,r){return r.reduce(((r,{key:n,config:s})=>{let a;return s.isArray?a=s.isCollectionFormatMulti?e[n]:e[n].join(t.COLLECTION_FORMATS[s.collectionFormat]):void 0!==e[n]&&(a=e[n]),void 0!==a?{...r,[n]:a}:r}),{})},t.parseFormParam=async function(e){let t=e;return t="number"==typeof t||"boolean"==typeof t?""+t:t,t}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.retry=void 0;t.retry=function(e,{maxRetries:t,retryWhen:r}){const n=Math.min(10,null!=t?t:3);let s=0;const a=async()=>{let t;if(t=await e(),(r||[429]).includes(t.status)&&ssetTimeout(t,e)))}(e),t=await a()}var i,o;return t};return a()}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RequiredError=t.FetchError=t.TimeoutError=t.ResponseError=void 0;class r extends Error{constructor(e,t,r,n){super(n),this.statusCode=e,this.body=t,this.headers=r,this.name="ResponseError"}}t.ResponseError=r;class n extends Error{constructor(){super("The request was timed out."),this.name="TimeoutError"}}t.TimeoutError=n;class s extends Error{constructor(e,t){super(t),this.cause=e,this.name="FetchError"}}t.FetchError=s;class a extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}t.RequiredError=a},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextApiResponse=t.VoidApiResponse=t.JSONApiResponse=void 0;class r{constructor(e,t,r,n){this.data=e,this.headers=t,this.status=r,this.statusText=n}static async fromResponse(e){const t=await e.json();return new r(t,e.headers,e.status,e.statusText)}}t.JSONApiResponse=r;class n{constructor(e,t,r){this.headers=e,this.status=t,this.statusText=r}static async fromResponse(e){return new n(e.headers,e.status,e.statusText)}}t.VoidApiResponse=n;class s{constructor(e,t,r,n){this.data=e,this.headers=t,this.status=r,this.statusText=n}static async fromResponse(e){const t=await e.text();return new s(t,e.headers,e.status,e.statusText)}}t.TextApiResponse=s},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.AnomalyManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.AnomalyManager=class extends o{async deleteBlockedIp(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/anomaly/blocks/ips/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async checkIfIpIsBlocked(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/anomaly/blocks/ips/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.VoidApiResponse.fromResponse(r)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.AttackProtectionManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.AttackProtectionManager=class extends o{async getBreachedPasswordDetectionConfig(e){const t=await this.request({path:"/attack-protection/breached-password-detection",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async getBruteForceConfig(e){const t=await this.request({path:"/attack-protection/brute-force-protection",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async getSuspiciousIpThrottlingConfig(e){const t=await this.request({path:"/attack-protection/suspicious-ip-throttling",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async updateBreachedPasswordDetectionConfig(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/attack-protection/breached-password-detection",method:"PATCH",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async updateBruteForceConfig(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/attack-protection/brute-force-protection",method:"PATCH",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async updateSuspiciousIpThrottlingConfig(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/attack-protection/suspicious-ip-throttling",method:"PATCH",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.BlacklistsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.BlacklistsManager=class extends o{async getAll(e={},t){const r=i.applyQueryParams(e,[{key:"aud",config:{}}]),n=await this.request({path:"/blacklists/tokens",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async add(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/blacklists/tokens",method:"POST",headers:r,body:e},t);return i.VoidApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.BrandingManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.BrandingManager=class extends o{async deleteTheme(e,t){i.validateRequiredRequestParams(e,["themeId"]);const r=await this.request({path:"/branding/themes/{themeId}".replace("{themeId}",encodeURIComponent(String(e.themeId))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async deleteUniversalLoginTemplate(e){const t=await this.request({path:"/branding/templates/universal-login",method:"DELETE"},e);return i.VoidApiResponse.fromResponse(t)}async getSettings(e){const t=await this.request({path:"/branding",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async getTheme(e,t){i.validateRequiredRequestParams(e,["themeId"]);const r=await this.request({path:"/branding/themes/{themeId}".replace("{themeId}",encodeURIComponent(String(e.themeId))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async getDefaultTheme(e){const t=await this.request({path:"/branding/themes/default",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async getUniversalLoginTemplate(e){const t=await this.request({path:"/branding/templates/universal-login",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async updateSettings(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/branding",method:"PATCH",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async updateTheme(e,t,r){i.validateRequiredRequestParams(e,["themeId"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/branding/themes/{themeId}".replace("{themeId}",encodeURIComponent(String(e.themeId))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async createTheme(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/branding/themes",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async setUniversalLoginTemplate(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/branding/templates/universal-login",method:"PUT",headers:r,body:e},t);return i.VoidApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientGrantsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.ClientGrantsManager=class extends o{async delete(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/client-grants/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async getAll(e={},t){const r=i.applyQueryParams(e,[{key:"per_page",config:{}},{key:"page",config:{}},{key:"include_totals",config:{}},{key:"audience",config:{}},{key:"client_id",config:{}}]),n=await this.request({path:"/client-grants",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async update(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/client-grants/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/client-grants",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.ClientsManager=class extends o{async delete(e,t){i.validateRequiredRequestParams(e,["client_id"]);const r=await this.request({path:"/clients/{client_id}".replace("{client_id}",encodeURIComponent(String(e.client_id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async deleteCredential(e,t){i.validateRequiredRequestParams(e,["client_id","credential_id"]);const r=await this.request({path:"/clients/{client_id}/credentials/{credential_id}".replace("{client_id}",encodeURIComponent(String(e.client_id))).replace("{credential_id}",encodeURIComponent(String(e.credential_id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async getAll(e={},t){const r=i.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}},{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"is_global",config:{}},{key:"is_first_party",config:{}},{key:"app_type",config:{}}]),n=await this.request({path:"/clients",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async get(e,t){i.validateRequiredRequestParams(e,["client_id"]);const r=i.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/clients/{client_id}".replace("{client_id}",encodeURIComponent(String(e.client_id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getCredentials(e,t){i.validateRequiredRequestParams(e,["client_id"]);const r=await this.request({path:"/clients/{client_id}/credentials".replace("{client_id}",encodeURIComponent(String(e.client_id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async getCredential(e,t){i.validateRequiredRequestParams(e,["client_id","credential_id"]);const r=await this.request({path:"/clients/{client_id}/credentials/{credential_id}".replace("{client_id}",encodeURIComponent(String(e.client_id))).replace("{credential_id}",encodeURIComponent(String(e.credential_id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async update(e,t,r){i.validateRequiredRequestParams(e,["client_id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/clients/{client_id}".replace("{client_id}",encodeURIComponent(String(e.client_id))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async updateCredential(e,t,r){i.validateRequiredRequestParams(e,["client_id","credential_id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/clients/{client_id}/credentials/{credential_id}".replace("{client_id}",encodeURIComponent(String(e.client_id))).replace("{credential_id}",encodeURIComponent(String(e.credential_id))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/clients",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async createCredential(e,t,r){i.validateRequiredRequestParams(e,["client_id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/clients/{client_id}/credentials".replace("{client_id}",encodeURIComponent(String(e.client_id))),method:"POST",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async rotateClientSecret(e,t){i.validateRequiredRequestParams(e,["client_id"]);const r=await this.request({path:"/clients/{client_id}/rotate-secret".replace("{client_id}",encodeURIComponent(String(e.client_id))),method:"POST"},t);return i.JSONApiResponse.fromResponse(r)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.ConnectionsManager=class extends o{async delete(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/connections/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async deleteScimConfiguration(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/connections/{id}/scim-configuration".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async deleteScimToken(e,t){i.validateRequiredRequestParams(e,["id","tokenId"]);const r=await this.request({path:"/connections/{id}/scim-configuration/tokens/{tokenId}".replace("{id}",encodeURIComponent(String(e.id))).replace("{tokenId}",encodeURIComponent(String(e.tokenId))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async deleteUserByEmail(e,t){i.validateRequiredRequestParams(e,["id","email"]);const r=i.applyQueryParams(e,[{key:"email",config:{}}]),n=await this.request({path:"/connections/{id}/users".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",query:r},t);return i.VoidApiResponse.fromResponse(n)}async getAll(e={},t){const r=i.applyQueryParams(e,[{key:"per_page",config:{}},{key:"page",config:{}},{key:"include_totals",config:{}},{key:"from",config:{}},{key:"take",config:{}},{key:"strategy",config:{isArray:!0,isCollectionFormatMulti:!0}},{key:"name",config:{}},{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/connections",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async get(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/connections/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getDefaultScimMapping(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/connections/{id}/scim-configuration/default-mapping".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async getScimConfiguration(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/connections/{id}/scim-configuration".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async getScimTokens(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/connections/{id}/scim-configuration/tokens".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async checkStatus(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/connections/{id}/status".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.VoidApiResponse.fromResponse(r)}async update(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/connections/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async updateScimConfiguration(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/connections/{id}/scim-configuration".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/connections",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async createScimConfiguration(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/connections/{id}/scim-configuration".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async createScimToken(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/connections/{id}/scim-configuration/tokens".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.CustomDomainsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.CustomDomainsManager=class extends o{async delete(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/custom-domains/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async getAll(e){const t=await this.request({path:"/custom-domains",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async get(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/custom-domains/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async update(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/custom-domains/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/custom-domains",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async verify(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/custom-domains/{id}/verify".replace("{id}",encodeURIComponent(String(e.id))),method:"POST"},t);return i.JSONApiResponse.fromResponse(r)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceCredentialsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.DeviceCredentialsManager=class extends o{async delete(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/device-credentials/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async getAll(e={},t){const r=i.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"fields",config:{}},{key:"include_fields",config:{}},{key:"user_id",config:{}},{key:"client_id",config:{}},{key:"type",config:{}}]),n=await this.request({path:"/device-credentials",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async createPublicKey(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/device-credentials",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.EmailTemplatesManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.EmailTemplatesManager=class extends o{async get(e,t){i.validateRequiredRequestParams(e,["templateName"]);const r=await this.request({path:"/email-templates/{templateName}".replace("{templateName}",encodeURIComponent(String(e.templateName))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async update(e,t,r){i.validateRequiredRequestParams(e,["templateName"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/email-templates/{templateName}".replace("{templateName}",encodeURIComponent(String(e.templateName))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/email-templates",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async put(e,t,r){i.validateRequiredRequestParams(e,["templateName"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/email-templates/{templateName}".replace("{templateName}",encodeURIComponent(String(e.templateName))),method:"PUT",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.EmailsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.EmailsManager=class extends o{async get(e={},t){const r=i.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/emails/provider",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async update(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/emails/provider",method:"PATCH",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async configure(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/emails/provider",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.GrantsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.GrantsManager=class extends o{async delete(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/grants/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async deleteByUserId(e,t){i.validateRequiredRequestParams(e,["user_id"]);const r=i.applyQueryParams(e,[{key:"user_id",config:{}}]),n=await this.request({path:"/grants",method:"DELETE",query:r},t);return i.VoidApiResponse.fromResponse(n)}async getAll(e={},t){const r=i.applyQueryParams(e,[{key:"per_page",config:{}},{key:"page",config:{}},{key:"include_totals",config:{}},{key:"user_id",config:{}},{key:"client_id",config:{}},{key:"audience",config:{}}]),n=await this.request({path:"/grants",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.GuardianManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.GuardianManager=class extends o{async deleteGuardianEnrollment(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/guardian/enrollments/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async getPushNotificationProviderAPNS(e){const t=await this.request({path:"/guardian/factors/push-notification/providers/apns",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async getGuardianEnrollment(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/guardian/enrollments/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async getPhoneFactorTemplates(e){const t=await this.request({path:"/guardian/factors/phone/templates",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async getSmsFactorTemplates(e){const t=await this.request({path:"/guardian/factors/sms/templates",method:"GET"},e);return 204===t.status?i.VoidApiResponse.fromResponse(t):i.JSONApiResponse.fromResponse(t)}async getFactors(e){const t=await this.request({path:"/guardian/factors",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async getPhoneFactorMessageTypes(e){const t=await this.request({path:"/guardian/factors/phone/message-types",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async getPhoneFactorSelectedProvider(e){const t=await this.request({path:"/guardian/factors/phone/selected-provider",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async getPhoneFactorProviderTwilio(e){const t=await this.request({path:"/guardian/factors/phone/providers/twilio",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async getPushNotificationSelectedProvider(e){const t=await this.request({path:"/guardian/factors/push-notification/selected-provider",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async getPolicies(e){const t=await this.request({path:"/guardian/policies",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async getSmsSelectedProvider(e){const t=await this.request({path:"/guardian/factors/sms/selected-provider",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async getSmsFactorProviderTwilio(e){const t=await this.request({path:"/guardian/factors/sms/providers/twilio",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async getPushNotificationProviderSNS(e){const t=await this.request({path:"/guardian/factors/push-notification/providers/sns",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async updatePushNotificationProviderAPNS(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/push-notification/providers/apns",method:"PATCH",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async updatePushNotificationProviderFCM(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/push-notification/providers/fcm",method:"PATCH",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async updatePushNotificationProviderSNS(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/push-notification/providers/sns",method:"PATCH",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async createEnrollmentTicket(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/enrollments/ticket",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async setPushNotificationProviderAPNS(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/push-notification/providers/apns",method:"PUT",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async setPhoneFactorTemplates(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/phone/templates",method:"PUT",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async setSmsFactorTemplates(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/sms/templates",method:"PUT",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async updateFactor(e,t,r){i.validateRequiredRequestParams(e,["name"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/guardian/factors/{name}".replace("{name}",encodeURIComponent(String(e.name))),method:"PUT",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async setPushNotificationProviderFCM(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/push-notification/providers/fcm",method:"PUT",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async updatePhoneFactorMessageTypes(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/phone/message-types",method:"PUT",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async updatePhoneFactorSelectedProvider(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/phone/selected-provider",method:"PUT",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async setPushNotificationSelectedProvider(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/push-notification/selected-provider",method:"PUT",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async updatePolicies(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/policies",method:"PUT",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async setSmsSelectedProvider(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/sms/selected-provider",method:"PUT",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async setSmsFactorProviderTwilio(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/sms/providers/twilio",method:"PUT",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async setPushNotificationProviderSNS(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/push-notification/providers/sns",method:"PUT",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async updatePhoneFactorProviderTwilio(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/guardian/factors/phone/providers/twilio",method:"PUT",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.HooksManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.HooksManager=class extends o{async delete(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/hooks/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async deleteSecrets(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/hooks/{id}/secrets".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:n,body:t},r);return i.VoidApiResponse.fromResponse(s)}async getAll(e={},t){const r=i.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"enabled",config:{}},{key:"fields",config:{}},{key:"triggerId",config:{}}]),n=await this.request({path:"/hooks",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async get(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"fields",config:{}}]),n=await this.request({path:"/hooks/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getSecrets(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/hooks/{id}/secrets".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async update(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/hooks/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async updateSecrets(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/hooks/{id}/secrets".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return i.VoidApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/hooks",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async addSecrets(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/hooks/{id}/secrets".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return i.VoidApiResponse.fromResponse(s)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.JobsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.JobsManager=class extends o{async getErrors(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/jobs/{id}/errors".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return 204===r.status?i.VoidApiResponse.fromResponse(r):i.JSONApiResponse.fromResponse(r)}async get(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/jobs/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async exportUsers(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/jobs/users-exports",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async importUsers(e,t){const r=new FormData;void 0!==e.users&&r.append("users",await i.parseFormParam(e.users)),void 0!==e.connection_id&&r.append("connection_id",await i.parseFormParam(e.connection_id)),void 0!==e.upsert&&r.append("upsert",await i.parseFormParam(e.upsert)),void 0!==e.external_id&&r.append("external_id",await i.parseFormParam(e.external_id)),void 0!==e.send_completion_email&&r.append("send_completion_email",await i.parseFormParam(e.send_completion_email));const n=await this.request({path:"/jobs/users-imports",method:"POST",body:r},t);return i.JSONApiResponse.fromResponse(n)}async verifyEmail(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/jobs/verification-email",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.KeysManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.KeysManager=class extends o{async get(e,t){i.validateRequiredRequestParams(e,["kid"]);const r=await this.request({path:"/keys/signing/{kid}".replace("{kid}",encodeURIComponent(String(e.kid))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async getAll(e){const t=await this.request({path:"/keys/signing",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async rotate(e){const t=await this.request({path:"/keys/signing/rotate",method:"POST"},e);return i.JSONApiResponse.fromResponse(t)}async revoke(e,t){i.validateRequiredRequestParams(e,["kid"]);const r=await this.request({path:"/keys/signing/{kid}/revoke".replace("{kid}",encodeURIComponent(String(e.kid))),method:"PUT"},t);return i.JSONApiResponse.fromResponse(r)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.LogStreamsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.LogStreamsManager=class extends o{async delete(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/log-streams/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async getAll(e){const t=await this.request({path:"/log-streams",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async get(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/log-streams/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async update(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/log-streams/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/log-streams",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.LogsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.LogsManager=class extends o{async getAll(e={},t){const r=i.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"sort",config:{}},{key:"fields",config:{}},{key:"include_fields",config:{}},{key:"include_totals",config:{}},{key:"from",config:{}},{key:"take",config:{}},{key:"q",config:{}}]),n=await this.request({path:"/logs",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async get(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/logs/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.OrganizationsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.OrganizationsManager=class extends o{async deleteEnabledConnection(e,t){i.validateRequiredRequestParams(e,["id","connectionId"]);const r=await this.request({path:"/organizations/{id}/enabled_connections/{connectionId}".replace("{id}",encodeURIComponent(String(e.id))).replace("{connectionId}",encodeURIComponent(String(e.connectionId))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async deleteInvitation(e,t){i.validateRequiredRequestParams(e,["id","invitation_id"]);const r=await this.request({path:"/organizations/{id}/invitations/{invitation_id}".replace("{id}",encodeURIComponent(String(e.id))).replace("{invitation_id}",encodeURIComponent(String(e.invitation_id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async deleteMembers(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/organizations/{id}/members".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:n,body:t},r);return i.VoidApiResponse.fromResponse(s)}async deleteMemberRoles(e,t,r){i.validateRequiredRequestParams(e,["id","user_id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/organizations/{id}/members/{user_id}/roles".replace("{id}",encodeURIComponent(String(e.id))).replace("{user_id}",encodeURIComponent(String(e.user_id))),method:"DELETE",headers:n,body:t},r);return i.VoidApiResponse.fromResponse(s)}async delete(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/organizations/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async getEnabledConnections(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}}]),n=await this.request({path:"/organizations/{id}/enabled_connections".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getEnabledConnection(e,t){i.validateRequiredRequestParams(e,["id","connectionId"]);const r=await this.request({path:"/organizations/{id}/enabled_connections/{connectionId}".replace("{id}",encodeURIComponent(String(e.id))).replace("{connectionId}",encodeURIComponent(String(e.connectionId))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async getInvitations(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"fields",config:{}},{key:"include_fields",config:{}},{key:"sort",config:{}}]),n=await this.request({path:"/organizations/{id}/invitations".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getInvitation(e,t){i.validateRequiredRequestParams(e,["id","invitation_id"]);const r=i.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/organizations/{id}/invitations/{invitation_id}".replace("{id}",encodeURIComponent(String(e.id))).replace("{invitation_id}",encodeURIComponent(String(e.invitation_id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getMembers(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"from",config:{}},{key:"take",config:{}},{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/organizations/{id}/members".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getByName(e,t){i.validateRequiredRequestParams(e,["name"]);const r=await this.request({path:"/organizations/name/{name}".replace("{name}",encodeURIComponent(String(e.name))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async getMemberRoles(e,t){i.validateRequiredRequestParams(e,["id","user_id"]);const r=i.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}}]),n=await this.request({path:"/organizations/{id}/members/{user_id}/roles".replace("{id}",encodeURIComponent(String(e.id))).replace("{user_id}",encodeURIComponent(String(e.user_id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getAll(e={},t){const r=i.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"from",config:{}},{key:"take",config:{}},{key:"sort",config:{}}]),n=await this.request({path:"/organizations",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async get(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/organizations/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async updateEnabledConnection(e,t,r){i.validateRequiredRequestParams(e,["id","connectionId"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/organizations/{id}/enabled_connections/{connectionId}".replace("{id}",encodeURIComponent(String(e.id))).replace("{connectionId}",encodeURIComponent(String(e.connectionId))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async update(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/organizations/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async addEnabledConnection(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/organizations/{id}/enabled_connections".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async createInvitation(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/organizations/{id}/invitations".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async addMembers(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/organizations/{id}/members".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return i.VoidApiResponse.fromResponse(s)}async addMemberRoles(e,t,r){i.validateRequiredRequestParams(e,["id","user_id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/organizations/{id}/members/{user_id}/roles".replace("{id}",encodeURIComponent(String(e.id))).replace("{user_id}",encodeURIComponent(String(e.user_id))),method:"POST",headers:n,body:t},r);return i.VoidApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/organizations",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PromptsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.PromptsManager=class extends o{async getCustomTextByLanguage(e,t){i.validateRequiredRequestParams(e,["prompt","language"]);const r=await this.request({path:"/prompts/{prompt}/custom-text/{language}".replace("{prompt}",encodeURIComponent(String(e.prompt))).replace("{language}",encodeURIComponent(String(e.language))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async getPartials(e,t){i.validateRequiredRequestParams(e,["prompt"]);const r=await this.request({path:"/prompts/{prompt}/partials".replace("{prompt}",encodeURIComponent(String(e.prompt))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async get(e){const t=await this.request({path:"/prompts",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async update(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/prompts",method:"PATCH",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async updateCustomTextByLanguage(e,t,r){i.validateRequiredRequestParams(e,["prompt","language"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/prompts/{prompt}/custom-text/{language}".replace("{prompt}",encodeURIComponent(String(e.prompt))).replace("{language}",encodeURIComponent(String(e.language))),method:"PUT",headers:n,body:t},r);return i.VoidApiResponse.fromResponse(s)}async updatePartials(e,t,r){i.validateRequiredRequestParams(e,["prompt"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/prompts/{prompt}/partials".replace("{prompt}",encodeURIComponent(String(e.prompt))),method:"PUT",headers:n,body:t},r);return i.VoidApiResponse.fromResponse(s)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.RefreshTokensManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.RefreshTokensManager=class extends o{async delete(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/refresh-tokens/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async get(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/refresh-tokens/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ResourceServersManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.ResourceServersManager=class extends o{async delete(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/resource-servers/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async getAll(e={},t){const r=i.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/resource-servers",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async get(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"include_fields",config:{}}]),n=await this.request({path:"/resource-servers/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async update(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/resource-servers/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/resource-servers",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.RolesManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.RolesManager=class extends o{async deletePermissions(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/roles/{id}/permissions".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:n,body:t},r);return i.VoidApiResponse.fromResponse(s)}async delete(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/roles/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async getPermissions(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"per_page",config:{}},{key:"page",config:{}},{key:"include_totals",config:{}}]),n=await this.request({path:"/roles/{id}/permissions".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getUsers(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"per_page",config:{}},{key:"page",config:{}},{key:"include_totals",config:{}},{key:"from",config:{}},{key:"take",config:{}}]),n=await this.request({path:"/roles/{id}/users".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getAll(e={},t){const r=i.applyQueryParams(e,[{key:"per_page",config:{}},{key:"page",config:{}},{key:"include_totals",config:{}},{key:"name_filter",config:{}}]),n=await this.request({path:"/roles",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async get(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/roles/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async update(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/roles/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async addPermissions(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/roles/{id}/permissions".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return i.VoidApiResponse.fromResponse(s)}async assignUsers(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/roles/{id}/users".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return i.VoidApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/roles",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.RulesManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.RulesManager=class extends o{async delete(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/rules/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async getAll(e={},t){const r=i.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"enabled",config:{}},{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/rules",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async get(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/rules/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async update(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/rules/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/rules",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.RulesConfigsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.RulesConfigsManager=class extends o{async delete(e,t){i.validateRequiredRequestParams(e,["key"]);const r=await this.request({path:"/rules-configs/{key}".replace("{key}",encodeURIComponent(String(e.key))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async getAll(e){const t=await this.request({path:"/rules-configs",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async set(e,t,r){i.validateRequiredRequestParams(e,["key"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/rules-configs/{key}".replace("{key}",encodeURIComponent(String(e.key))),method:"PUT",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.SelfServiceProfilesManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.SelfServiceProfilesManager=class extends o{async deleteSelfServiceProfiles(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/self-service-profiles/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async getSelfServiceProfiles(e){const t=await this.request({path:"/self-service-profiles",method:"GET"},e);return i.JSONApiResponse.fromResponse(t)}async getSelfServiceProfilesById(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/self-service-profiles/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async patchSelfServiceProfiles(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/self-service-profiles/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async postSelfServiceProfiles(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/self-service-profiles",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async postSsoTicket(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/self-service-profiles/{id}/sso-ticket".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.SessionsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.SessionsManager=class extends o{async delete(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/sessions/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async get(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/sessions/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.StatsManager=class extends o{async getActiveUsersCount(e){const t=await this.request({path:"/stats/active-users",method:"GET"},e);return i.TextApiResponse.fromResponse(t)}async getDaily(e={},t){const r=i.applyQueryParams(e,[{key:"from",config:{}},{key:"to",config:{}}]),n=await this.request({path:"/stats/daily",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TenantsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.TenantsManager=class extends o{async updateSettings(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/tenants/settings",method:"PATCH",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async getSettings(e={},t){const r=i.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/tenants/settings",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TicketsManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.TicketsManager=class extends o{async verifyEmail(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/tickets/email-verification",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async changePassword(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/tickets/password-change",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.UserBlocksManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.UserBlocksManager=class extends o{async deleteAll(e,t){i.validateRequiredRequestParams(e,["identifier"]);const r=i.applyQueryParams(e,[{key:"identifier",config:{}}]),n=await this.request({path:"/user-blocks",method:"DELETE",query:r},t);return i.VoidApiResponse.fromResponse(n)}async delete(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/user-blocks/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async getAll(e,t){i.validateRequiredRequestParams(e,["identifier"]);const r=i.applyQueryParams(e,[{key:"identifier",config:{}},{key:"consider_brute_force_enablement",config:{}}]),n=await this.request({path:"/user-blocks",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async get(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"consider_brute_force_enablement",config:{}}]),n=await this.request({path:"/user-blocks/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.UsersManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.UsersManager=class extends o{async deleteAuthenticationMethods(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/users/{id}/authentication-methods".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async deleteAuthenticationMethod(e,t){i.validateRequiredRequestParams(e,["id","authentication_method_id"]);const r=await this.request({path:"/users/{id}/authentication-methods/{authentication_method_id}".replace("{id}",encodeURIComponent(String(e.id))).replace("{authentication_method_id}",encodeURIComponent(String(e.authentication_method_id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async deleteAllAuthenticators(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/users/{id}/authenticators".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async deleteMultifactorProvider(e,t){i.validateRequiredRequestParams(e,["id","provider"]);const r=await this.request({path:"/users/{id}/multifactor/{provider}".replace("{id}",encodeURIComponent(String(e.id))).replace("{provider}",encodeURIComponent(String(e.provider))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async deletePermissions(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}/permissions".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:n,body:t},r);return i.VoidApiResponse.fromResponse(s)}async deleteRefreshTokens(e,t){i.validateRequiredRequestParams(e,["user_id"]);const r=await this.request({path:"/users/{user_id}/refresh-tokens".replace("{user_id}",encodeURIComponent(String(e.user_id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async deleteSessions(e,t){i.validateRequiredRequestParams(e,["user_id"]);const r=await this.request({path:"/users/{user_id}/sessions".replace("{user_id}",encodeURIComponent(String(e.user_id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async unlink(e,t){i.validateRequiredRequestParams(e,["id","provider","user_id"]);const r=await this.request({path:"/users/{id}/identities/{provider}/{user_id}".replace("{id}",encodeURIComponent(String(e.id))).replace("{provider}",encodeURIComponent(String(e.provider))).replace("{user_id}",encodeURIComponent(String(e.user_id))),method:"DELETE"},t);return i.JSONApiResponse.fromResponse(r)}async deleteRoles(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}/roles".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:n,body:t},r);return i.VoidApiResponse.fromResponse(s)}async delete(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/users/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE"},t);return i.VoidApiResponse.fromResponse(r)}async getAuthenticationMethods(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}}]),n=await this.request({path:"/users/{id}/authentication-methods".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getAuthenticationMethod(e,t){i.validateRequiredRequestParams(e,["id","authentication_method_id"]);const r=await this.request({path:"/users/{id}/authentication-methods/{authentication_method_id}".replace("{id}",encodeURIComponent(String(e.id))).replace("{authentication_method_id}",encodeURIComponent(String(e.authentication_method_id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async getEnrollments(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/users/{id}/enrollments".replace("{id}",encodeURIComponent(String(e.id))),method:"GET"},t);return i.JSONApiResponse.fromResponse(r)}async getLogs(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"sort",config:{}},{key:"include_totals",config:{}}]),n=await this.request({path:"/users/{id}/logs".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getPermissions(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"per_page",config:{}},{key:"page",config:{}},{key:"include_totals",config:{}}]),n=await this.request({path:"/users/{id}/permissions".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getRefreshTokens(e,t){i.validateRequiredRequestParams(e,["user_id"]);const r=i.applyQueryParams(e,[{key:"include_totals",config:{}},{key:"from",config:{}},{key:"take",config:{}}]),n=await this.request({path:"/users/{user_id}/refresh-tokens".replace("{user_id}",encodeURIComponent(String(e.user_id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getSessions(e,t){i.validateRequiredRequestParams(e,["user_id"]);const r=i.applyQueryParams(e,[{key:"include_totals",config:{}},{key:"from",config:{}},{key:"take",config:{}}]),n=await this.request({path:"/users/{user_id}/sessions".replace("{user_id}",encodeURIComponent(String(e.user_id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getUserOrganizations(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}}]),n=await this.request({path:"/users/{id}/organizations".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getRoles(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"per_page",config:{}},{key:"page",config:{}},{key:"include_totals",config:{}}]),n=await this.request({path:"/users/{id}/roles".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async getAll(e={},t){const r=i.applyQueryParams(e,[{key:"page",config:{}},{key:"per_page",config:{}},{key:"include_totals",config:{}},{key:"sort",config:{}},{key:"connection",config:{}},{key:"fields",config:{}},{key:"include_fields",config:{}},{key:"q",config:{}},{key:"search_engine",config:{}}]),n=await this.request({path:"/users",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async get(e,t){i.validateRequiredRequestParams(e,["id"]);const r=i.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}}]),n=await this.request({path:"/users/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}async updateAuthenticationMethod(e,t,r){i.validateRequiredRequestParams(e,["id","authentication_method_id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}/authentication-methods/{authentication_method_id}".replace("{id}",encodeURIComponent(String(e.id))).replace("{authentication_method_id}",encodeURIComponent(String(e.authentication_method_id))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async update(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async createAuthenticationMethod(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}/authentication-methods".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async link(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}/identities".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}async invalidateRememberBrowser(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/users/{id}/multifactor/actions/invalidate-remember-browser".replace("{id}",encodeURIComponent(String(e.id))),method:"POST"},t);return i.VoidApiResponse.fromResponse(r)}async assignPermissions(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}/permissions".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return i.VoidApiResponse.fromResponse(s)}async regenerateRecoveryCode(e,t){i.validateRequiredRequestParams(e,["id"]);const r=await this.request({path:"/users/{id}/recovery-code-regeneration".replace("{id}",encodeURIComponent(String(e.id))),method:"POST"},t);return i.JSONApiResponse.fromResponse(r)}async assignRoles(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}/roles".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,body:t},r);return i.VoidApiResponse.fromResponse(s)}async create(e,t){const r={"Content-Type":"application/json"},n=await this.request({path:"/users",method:"POST",headers:r,body:e},t);return i.JSONApiResponse.fromResponse(n)}async updateAuthenticationMethods(e,t,r){i.validateRequiredRequestParams(e,["id"]);const n={"Content-Type":"application/json"},s=await this.request({path:"/users/{id}/authentication-methods".replace("{id}",encodeURIComponent(String(e.id))),method:"PUT",headers:n,body:t},r);return i.JSONApiResponse.fromResponse(s)}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.UsersByEmailManager=void 0;const i=a(r(163)),{BaseAPI:o}=i;t.UsersByEmailManager=class extends o{async getByEmail(e,t){i.validateRequiredRequestParams(e,["email"]);const r=i.applyQueryParams(e,[{key:"fields",config:{}},{key:"include_fields",config:{}},{key:"email",config:{}}]),n=await this.request({path:"/users-by-email",method:"GET",query:r},t);return i.JSONApiResponse.fromResponse(n)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GetBreachedPasswordDetection200ResponseStagePreUserRegistrationShieldsEnum=t.GetBreachedPasswordDetection200ResponseMethodEnum=t.GetBreachedPasswordDetection200ResponseAdminNotificationFrequencyEnum=t.GetBreachedPasswordDetection200ResponseShieldsEnum=t.GetAuthenticationMethods200ResponseOneOfInnerAuthenticationMethodsInnerTypeEnum=t.GetAuthenticationMethods200ResponseOneOfInnerPreferredAuthenticationMethodEnum=t.GetAuthenticationMethods200ResponseOneOfInnerTypeEnum=t.GetActions200ResponseActionsInnerSupportedTriggersInnerIdAnyOf=t.GetActions200ResponseActionsInnerIntegrationCurrentReleaseRequiredSecretsInnerTypeEnum=t.GetActions200ResponseActionsInnerIntegrationFeatureTypeEnum=t.GetActions200ResponseActionsInnerStatusEnum=t.GetActionVersions200ResponseVersionsInnerStatusEnum=t.FactorNameEnum=t.EnrollmentStatusEnum=t.EmailTemplateUpdateTemplateEnum=t.EmailProviderUpdateNameEnum=t.EmailProviderCreateNameEnum=t.DeviceCredentialCreateTypeEnum=t.DeviceCredentialTypeEnum=t.CustomDomainTypeEnum=t.CustomDomainStatusEnum=t.ConnectionUpdateOptionsSetUserRootAttributesEnum=t.ConnectionUpdateOptionsPasswordPolicyEnum=t.ConnectionCreateOptionsPasskeyOptionsChallengeUiEnum=t.ConnectionCreateOptionsSetUserRootAttributesEnum=t.ConnectionCreateOptionsPasswordPolicyEnum=t.ConnectionCreateStrategyEnum=t.ClientUpdateJwtConfigurationAlgEnum=t.ClientUpdateComplianceLevelEnum=t.ClientUpdateOrganizationRequireBehaviorEnum=t.ClientUpdateOrganizationUsageEnum=t.ClientUpdateAppTypeEnum=t.ClientUpdateTokenEndpointAuthMethodEnum=t.ClientRefreshTokenExpirationTypeEnum=t.ClientRefreshTokenRotationTypeEnum=t.ClientJwtConfigurationAlgEnum=t.ClientCreateJwtConfigurationAlgEnum=t.ClientCreateClientAuthenticationMethodsTlsClientAuthCredentialsInnerCredentialTypeEnum=t.ClientCreateClientAuthenticationMethodsSelfSignedTlsClientAuthCredentialsInnerCredentialTypeEnum=t.ClientCreateClientAuthenticationMethodsPrivateKeyJwtCredentialsInnerAlgEnum=t.ClientCreateClientAuthenticationMethodsPrivateKeyJwtCredentialsInnerCredentialTypeEnum=t.ClientCreateComplianceLevelEnum=t.ClientCreateOrganizationRequireBehaviorEnum=t.ClientCreateOrganizationUsageEnum=t.ClientCreateAppTypeEnum=t.ClientCreateTokenEndpointAuthMethodEnum=t.ClientComplianceLevelEnum=t.ClientOrganizationRequireBehaviorEnum=t.ClientOrganizationUsageEnum=t.ClientTokenEndpointAuthMethodEnum=void 0,t.PostAuthenticationMethods201ResponseTypeEnum=t.PatchSuspiciousIpThrottlingRequestShieldsEnum=t.PatchLogStreamsByIdRequestSinkOneOf3MixpanelRegionEnum=t.PatchLogStreamsByIdRequestSinkOneOfDatadogRegionEnum=t.PatchLogStreamsByIdRequestStatusEnum=t.PatchEmailTemplatesByTemplateNameRequestTemplateEnum=t.PatchCustomDomainsByIdRequestCustomClientIpHeaderEnum=t.PatchCustomDomainsByIdRequestTlsPolicyEnum=t.PatchBruteForceProtectionRequestModeEnum=t.PatchBruteForceProtectionRequestShieldsEnum=t.PatchBreachedPasswordDetectionRequestStagePreUserRegistrationShieldsEnum=t.PatchBreachedPasswordDetectionRequestMethodEnum=t.PatchBreachedPasswordDetectionRequestAdminNotificationFrequencyEnum=t.PatchBreachedPasswordDetectionRequestShieldsEnum=t.PatchBindingsRequestBindingsInnerOneOfRefTypeEnum=t.PatchAuthenticationMethodsByAuthenticationMethodIdRequestPreferredAuthenticationMethodEnum=t.JobFormatEnum=t.HookCreateTriggerIdEnum=t.GetSuspiciousIpThrottling200ResponseShieldsEnum=t.GetPnProviders200ResponseProviderEnum=t.GetPhoneProviders200ResponseProviderEnum=t.GetMessageTypes200ResponseMessageTypesEnum=t.GetLogStreams200ResponseInnerOneOfSinkHttpContentFormatEnum=t.GetLogStreams200ResponseInnerOneOfFiltersInnerNameEnum=t.GetLogStreams200ResponseInnerOneOfFiltersInnerTypeEnum=t.GetLogStreams200ResponseInnerOneOf7SinkMixpanelRegionEnum=t.GetLogStreams200ResponseInnerOneOf7TypeEnum=t.GetLogStreams200ResponseInnerOneOf7StatusEnum=t.GetLogStreams200ResponseInnerOneOf6TypeEnum=t.GetLogStreams200ResponseInnerOneOf6StatusEnum=t.GetLogStreams200ResponseInnerOneOf5TypeEnum=t.GetLogStreams200ResponseInnerOneOf5StatusEnum=t.GetLogStreams200ResponseInnerOneOf4TypeEnum=t.GetLogStreams200ResponseInnerOneOf4StatusEnum=t.GetLogStreams200ResponseInnerOneOf3SinkDatadogRegionEnum=t.GetLogStreams200ResponseInnerOneOf3TypeEnum=t.GetLogStreams200ResponseInnerOneOf3StatusEnum=t.GetLogStreams200ResponseInnerOneOf2SinkAzureRegionEnum=t.GetLogStreams200ResponseInnerOneOf2TypeEnum=t.GetLogStreams200ResponseInnerOneOf2StatusEnum=t.GetLogStreams200ResponseInnerOneOf1SinkAwsRegionEnum=t.GetLogStreams200ResponseInnerOneOf1TypeEnum=t.GetLogStreams200ResponseInnerOneOf1StatusEnum=t.GetLogStreams200ResponseInnerOneOfTypeEnum=t.GetLogStreams200ResponseInnerOneOfStatusEnum=t.GetExecution200ResponseStatusEnum=t.GetEmailTemplatesByTemplateName200ResponseTemplateEnum=t.GetCredentials200ResponseInnerAlgEnum=t.GetBruteForceProtection200ResponseModeEnum=t.GetBruteForceProtection200ResponseShieldsEnum=void 0,t.ResourceServerProofOfPossessionMechanismEnum=t.ResourceServerCreateConsentPolicyEnum=t.ResourceServerCreateTokenDialectEnum=t.ResourceServerCreateSigningAlgEnum=t.ResourceServerConsentPolicyEnum=t.ResourceServerTokenDialectEnum=t.ResourceServerSigningAlgEnum=t.PutAuthenticationMethodsRequestInnerPreferredAuthenticationMethodEnum=t.PutAuthenticationMethodsRequestInnerTypeEnum=t.PutAuthenticationMethods200ResponseInnerAuthenticationMethodsInnerTypeEnum=t.PutAuthenticationMethods200ResponseInnerPreferredAuthenticationMethodEnum=t.PutAuthenticationMethods200ResponseInnerTypeEnum=t.PromptsSettingsUpdateUniversalLoginExperienceEnum=t.PromptsSettingsUniversalLoginExperienceEnum=t.PostVerify200ResponseTypeEnum=t.PostVerify200ResponseStatusEnum=t.PostVerificationEmailRequestIdentityProviderEnum=t.PostUsersExportsRequestFormatEnum=t.PostLogStreamsRequestOneOfFiltersInnerNameEnum=t.PostLogStreamsRequestOneOfFiltersInnerTypeEnum=t.PostLogStreamsRequestOneOf7TypeEnum=t.PostLogStreamsRequestOneOf6TypeEnum=t.PostLogStreamsRequestOneOf5TypeEnum=t.PostLogStreamsRequestOneOf4TypeEnum=t.PostLogStreamsRequestOneOf3TypeEnum=t.PostLogStreamsRequestOneOf2SinkAzureRegionEnum=t.PostLogStreamsRequestOneOf2TypeEnum=t.PostLogStreamsRequestOneOf1SinkAwsRegionEnum=t.PostLogStreamsRequestOneOf1TypeEnum=t.PostLogStreamsRequestOneOfTypeEnum=t.PostIdentitiesRequestProviderEnum=t.PostEmailTemplatesRequestTemplateEnum=t.PostCustomDomainsRequestCustomClientIpHeaderEnum=t.PostCustomDomainsRequestTlsPolicyEnum=t.PostCustomDomainsRequestVerificationMethodEnum=t.PostCustomDomainsRequestTypeEnum=t.PostCustomDomains201ResponseVerificationMethodsInnerNameEnum=t.PostCustomDomains201ResponseTypeEnum=t.PostCustomDomains201ResponseStatusEnum=t.PostCredentialsRequestCredentialTypeEnum=t.PostBrandingThemeRequestWidgetSocialButtonsLayoutEnum=t.PostBrandingThemeRequestWidgetLogoPositionEnum=t.PostBrandingThemeRequestWidgetHeaderTextAlignmentEnum=t.PostBrandingThemeRequestPageBackgroundPageLayoutEnum=t.PostBrandingThemeRequestFontsLinksStyleEnum=t.PostBrandingThemeRequestBordersInputsStyleEnum=t.PostBrandingThemeRequestBordersButtonsStyleEnum=t.PostAuthenticationMethodsRequestPreferredAuthenticationMethodEnum=t.PostAuthenticationMethodsRequestTypeEnum=t.PostAuthenticationMethods201ResponsePreferredAuthenticationMethodEnum=void 0,t.GetUsersSearchEngineEnum=t.DeleteUserIdentityByUserIdProviderEnum=t.DeleteMultifactorByProviderProviderEnum=t.PutPartialsPromptEnum=t.PutCustomTextByLanguageLanguageEnum=t.PutCustomTextByLanguagePromptEnum=t.GetPartialsPromptEnum=t.GetCustomTextByLanguageLanguageEnum=t.GetCustomTextByLanguagePromptEnum=t.GetHooksTriggerIdEnum=t.PutFactorsByNameOperationNameEnum=t.PutEmailTemplatesByTemplateNameTemplateNameEnum=t.PatchEmailTemplatesByTemplateNameOperationTemplateNameEnum=t.GetEmailTemplatesByTemplateNameTemplateNameEnum=t.GetDeviceCredentialsTypeEnum=t.GetConnectionsStrategyEnum=t.UserEnrollmentAuthMethodEnum=t.UserEnrollmentStatusEnum=t.TenantSettingsUpdateFlagsChangePwdFlowV1Enum=t.TenantSettingsUpdateDeviceFlowCharsetEnum=t.TenantSettingsUpdateEnabledLocalesEnum=t.TenantSettingsSessionCookieModeEnum=t.TenantSettingsDeviceFlowCharsetEnum=t.TenantSettingsEnabledLocalesEnum=t.ResourceServerUpdateConsentPolicyEnum=t.ResourceServerUpdateTokenDialectEnum=t.ResourceServerUpdateSigningAlgEnum=t.ResourceServerTokenEncryptionEncryptionKeyAlgEnum=t.ResourceServerTokenEncryptionFormatEnum=void 0,t.ClientTokenEndpointAuthMethodEnum={none:"none",client_secret_post:"client_secret_post",client_secret_basic:"client_secret_basic"},t.ClientOrganizationUsageEnum={deny:"deny",allow:"allow",require:"require"},t.ClientOrganizationRequireBehaviorEnum={no_prompt:"no_prompt",pre_login_prompt:"pre_login_prompt",post_login_prompt:"post_login_prompt"},t.ClientComplianceLevelEnum={none:"none",fapi1_adv_pkj_par:"fapi1_adv_pkj_par",fapi1_adv_mtls_par:"fapi1_adv_mtls_par",null:"null"},t.ClientCreateTokenEndpointAuthMethodEnum={none:"none",client_secret_post:"client_secret_post",client_secret_basic:"client_secret_basic"},t.ClientCreateAppTypeEnum={native:"native",spa:"spa",regular_web:"regular_web",non_interactive:"non_interactive",rms:"rms",box:"box",cloudbees:"cloudbees",concur:"concur",dropbox:"dropbox",mscrm:"mscrm",echosign:"echosign",egnyte:"egnyte",newrelic:"newrelic",office365:"office365",salesforce:"salesforce",sentry:"sentry",sharepoint:"sharepoint",slack:"slack",springcm:"springcm",zendesk:"zendesk",zoom:"zoom",sso_integration:"sso_integration",oag:"oag"},t.ClientCreateOrganizationUsageEnum={deny:"deny",allow:"allow",require:"require"},t.ClientCreateOrganizationRequireBehaviorEnum={no_prompt:"no_prompt",pre_login_prompt:"pre_login_prompt",post_login_prompt:"post_login_prompt"},t.ClientCreateComplianceLevelEnum={none:"none",fapi1_adv_pkj_par:"fapi1_adv_pkj_par",fapi1_adv_mtls_par:"fapi1_adv_mtls_par",null:"null"},t.ClientCreateClientAuthenticationMethodsPrivateKeyJwtCredentialsInnerCredentialTypeEnum={public_key:"public_key"},t.ClientCreateClientAuthenticationMethodsPrivateKeyJwtCredentialsInnerAlgEnum={RS256:"RS256",RS384:"RS384",PS256:"PS256"},t.ClientCreateClientAuthenticationMethodsSelfSignedTlsClientAuthCredentialsInnerCredentialTypeEnum={x509_cert:"x509_cert"},t.ClientCreateClientAuthenticationMethodsTlsClientAuthCredentialsInnerCredentialTypeEnum={cert_subject_dn:"cert_subject_dn"},t.ClientCreateJwtConfigurationAlgEnum={HS256:"HS256",RS256:"RS256",PS256:"PS256"},t.ClientJwtConfigurationAlgEnum={HS256:"HS256",RS256:"RS256",PS256:"PS256"},t.ClientRefreshTokenRotationTypeEnum={rotating:"rotating",non_rotating:"non-rotating"},t.ClientRefreshTokenExpirationTypeEnum={expiring:"expiring",non_expiring:"non-expiring"},t.ClientUpdateTokenEndpointAuthMethodEnum={none:"none",client_secret_post:"client_secret_post",client_secret_basic:"client_secret_basic",null:"null"},t.ClientUpdateAppTypeEnum={native:"native",spa:"spa",regular_web:"regular_web",non_interactive:"non_interactive",rms:"rms",box:"box",cloudbees:"cloudbees",concur:"concur",dropbox:"dropbox",mscrm:"mscrm",echosign:"echosign",egnyte:"egnyte",newrelic:"newrelic",office365:"office365",salesforce:"salesforce",sentry:"sentry",sharepoint:"sharepoint",slack:"slack",springcm:"springcm",zendesk:"zendesk",zoom:"zoom",sso_integration:"sso_integration",oag:"oag"},t.ClientUpdateOrganizationUsageEnum={deny:"deny",allow:"allow",require:"require"},t.ClientUpdateOrganizationRequireBehaviorEnum={no_prompt:"no_prompt",pre_login_prompt:"pre_login_prompt",post_login_prompt:"post_login_prompt"},t.ClientUpdateComplianceLevelEnum={none:"none",fapi1_adv_pkj_par:"fapi1_adv_pkj_par",fapi1_adv_mtls_par:"fapi1_adv_mtls_par",null:"null"},t.ClientUpdateJwtConfigurationAlgEnum={HS256:"HS256",RS256:"RS256",PS256:"PS256"},t.ConnectionCreateStrategyEnum={ad:"ad",adfs:"adfs",amazon:"amazon",apple:"apple",dropbox:"dropbox",bitbucket:"bitbucket",aol:"aol",auth0_oidc:"auth0-oidc",auth0:"auth0",baidu:"baidu",bitly:"bitly",box:"box",custom:"custom",daccount:"daccount",dwolla:"dwolla",email:"email",evernote_sandbox:"evernote-sandbox",evernote:"evernote",exact:"exact",facebook:"facebook",fitbit:"fitbit",flickr:"flickr",github:"github",google_apps:"google-apps",google_oauth2:"google-oauth2",instagram:"instagram",ip:"ip",line:"line",linkedin:"linkedin",miicard:"miicard",oauth1:"oauth1",oauth2:"oauth2",office365:"office365",oidc:"oidc",okta:"okta",paypal:"paypal",paypal_sandbox:"paypal-sandbox",pingfederate:"pingfederate",planningcenter:"planningcenter",renren:"renren",salesforce_community:"salesforce-community",salesforce_sandbox:"salesforce-sandbox",salesforce:"salesforce",samlp:"samlp",sharepoint:"sharepoint",shopify:"shopify",sms:"sms",soundcloud:"soundcloud",thecity_sandbox:"thecity-sandbox",thecity:"thecity",thirtysevensignals:"thirtysevensignals",twitter:"twitter",untappd:"untappd",vkontakte:"vkontakte",waad:"waad",weibo:"weibo",windowslive:"windowslive",wordpress:"wordpress",yahoo:"yahoo",yammer:"yammer",yandex:"yandex"},t.ConnectionCreateOptionsPasswordPolicyEnum={none:"none",low:"low",fair:"fair",good:"good",excellent:"excellent",null:"null"},t.ConnectionCreateOptionsSetUserRootAttributesEnum={each_login:"on_each_login",first_login:"on_first_login"},t.ConnectionCreateOptionsPasskeyOptionsChallengeUiEnum={both:"both",autofill:"autofill",button:"button"},t.ConnectionUpdateOptionsPasswordPolicyEnum={none:"none",low:"low",fair:"fair",good:"good",excellent:"excellent",null:"null"},t.ConnectionUpdateOptionsSetUserRootAttributesEnum={each_login:"on_each_login",first_login:"on_first_login"},t.CustomDomainStatusEnum={disabled:"disabled",pending:"pending",pending_verification:"pending_verification",ready:"ready"},t.CustomDomainTypeEnum={auth0_managed_certs:"auth0_managed_certs",self_managed_certs:"self_managed_certs"},t.DeviceCredentialTypeEnum={public_key:"public_key",refresh_token:"refresh_token",rotating_refresh_token:"rotating_refresh_token"},t.DeviceCredentialCreateTypeEnum={public_key:"public_key"},t.EmailProviderCreateNameEnum={mailgun:"mailgun",mandrill:"mandrill",sendgrid:"sendgrid",ses:"ses",sparkpost:"sparkpost",smtp:"smtp",azure_cs:"azure_cs",ms365:"ms365"},t.EmailProviderUpdateNameEnum={mailgun:"mailgun",mandrill:"mandrill",sendgrid:"sendgrid",ses:"ses",sparkpost:"sparkpost",smtp:"smtp",azure_cs:"azure_cs",ms365:"ms365"},t.EmailTemplateUpdateTemplateEnum={verify_email:"verify_email",verify_email_by_code:"verify_email_by_code",reset_email:"reset_email",welcome_email:"welcome_email",blocked_account:"blocked_account",stolen_credentials:"stolen_credentials",enrollment_email:"enrollment_email",mfa_oob_code:"mfa_oob_code",user_invitation:"user_invitation",change_password:"change_password",password_reset:"password_reset"},t.EnrollmentStatusEnum={pending:"pending",confirmed:"confirmed"},t.FactorNameEnum={push_notification:"push-notification",sms:"sms",email:"email",duo:"duo",otp:"otp",webauthn_roaming:"webauthn-roaming",webauthn_platform:"webauthn-platform",recovery_code:"recovery-code"},t.GetActionVersions200ResponseVersionsInnerStatusEnum={pending:"pending",building:"building",packaged:"packaged",built:"built",retrying:"retrying",failed:"failed"},t.GetActions200ResponseActionsInnerStatusEnum={pending:"pending",building:"building",packaged:"packaged",built:"built",retrying:"retrying",failed:"failed"},t.GetActions200ResponseActionsInnerIntegrationFeatureTypeEnum={unspecified:"unspecified",action:"action",social_connection:"social_connection",log_stream:"log_stream",sso_integration:"sso_integration",sms_provider:"sms_provider"},t.GetActions200ResponseActionsInnerIntegrationCurrentReleaseRequiredSecretsInnerTypeEnum={UNSPECIFIED:"UNSPECIFIED",STRING:"STRING"},t.GetActions200ResponseActionsInnerSupportedTriggersInnerIdAnyOf={post_login:"post-login",credentials_exchange:"credentials-exchange",pre_user_registration:"pre-user-registration",post_user_registration:"post-user-registration",post_change_password:"post-change-password",send_phone_message:"send-phone-message",iga_approval:"iga-approval",iga_certification:"iga-certification",iga_fulfillment_assignment:"iga-fulfillment-assignment",iga_fulfillment_execution:"iga-fulfillment-execution",password_reset_post_challenge:"password-reset-post-challenge"},t.GetAuthenticationMethods200ResponseOneOfInnerTypeEnum={recovery_code:"recovery-code",totp:"totp",push:"push",phone:"phone",email:"email",email_verification:"email-verification",webauthn_roaming:"webauthn-roaming",webauthn_platform:"webauthn-platform",guardian:"guardian",passkey:"passkey"},t.GetAuthenticationMethods200ResponseOneOfInnerPreferredAuthenticationMethodEnum={sms:"sms",voice:"voice"},t.GetAuthenticationMethods200ResponseOneOfInnerAuthenticationMethodsInnerTypeEnum={totp:"totp",push:"push",sms:"sms",voice:"voice"},t.GetBreachedPasswordDetection200ResponseShieldsEnum={block:"block",user_notification:"user_notification",admin_notification:"admin_notification"},t.GetBreachedPasswordDetection200ResponseAdminNotificationFrequencyEnum={immediately:"immediately",daily:"daily",weekly:"weekly",monthly:"monthly"},t.GetBreachedPasswordDetection200ResponseMethodEnum={standard:"standard",enhanced:"enhanced"},t.GetBreachedPasswordDetection200ResponseStagePreUserRegistrationShieldsEnum={block:"block",admin_notification:"admin_notification"},t.GetBruteForceProtection200ResponseShieldsEnum={block:"block",user_notification:"user_notification"},t.GetBruteForceProtection200ResponseModeEnum={identifier_and_ip:"count_per_identifier_and_ip",identifier:"count_per_identifier"},t.GetCredentials200ResponseInnerAlgEnum={RS256:"RS256",RS384:"RS384",PS256:"PS256"},t.GetEmailTemplatesByTemplateName200ResponseTemplateEnum={verify_email:"verify_email",verify_email_by_code:"verify_email_by_code",reset_email:"reset_email",welcome_email:"welcome_email",blocked_account:"blocked_account",stolen_credentials:"stolen_credentials",enrollment_email:"enrollment_email",mfa_oob_code:"mfa_oob_code",user_invitation:"user_invitation",change_password:"change_password",password_reset:"password_reset"},t.GetExecution200ResponseStatusEnum={unspecified:"unspecified",pending:"pending",final:"final",partial:"partial",canceled:"canceled",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOfStatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOfTypeEnum={http:"http"},t.GetLogStreams200ResponseInnerOneOf1StatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOf1TypeEnum={eventbridge:"eventbridge"},t.GetLogStreams200ResponseInnerOneOf1SinkAwsRegionEnum={ap_east_1:"ap-east-1",ap_northeast_1:"ap-northeast-1",ap_northeast_2:"ap-northeast-2",ap_northeast_3:"ap-northeast-3",ap_south_1:"ap-south-1",ap_southeast_1:"ap-southeast-1",ap_southeast_2:"ap-southeast-2",ca_central_1:"ca-central-1",cn_north_1:"cn-north-1",cn_northwest_1:"cn-northwest-1",eu_central_1:"eu-central-1",eu_north_1:"eu-north-1",eu_west_1:"eu-west-1",eu_west_2:"eu-west-2",eu_west_3:"eu-west-3",me_south_1:"me-south-1",sa_east_1:"sa-east-1",us_gov_east_1:"us-gov-east-1",us_gov_west_1:"us-gov-west-1",us_east_1:"us-east-1",us_east_2:"us-east-2",us_west_1:"us-west-1",us_west_2:"us-west-2"},t.GetLogStreams200ResponseInnerOneOf2StatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOf2TypeEnum={eventgrid:"eventgrid"},t.GetLogStreams200ResponseInnerOneOf2SinkAzureRegionEnum={australiacentral:"australiacentral",australiaeast:"australiaeast",australiasoutheast:"australiasoutheast",brazilsouth:"brazilsouth",canadacentral:"canadacentral",canadaeast:"canadaeast",centralindia:"centralindia",centralus:"centralus",eastasia:"eastasia",eastus:"eastus",eastus2:"eastus2",francecentral:"francecentral",germanywestcentral:"germanywestcentral",japaneast:"japaneast",japanwest:"japanwest",koreacentral:"koreacentral",koreasouth:"koreasouth",northcentralus:"northcentralus",northeurope:"northeurope",norwayeast:"norwayeast",southafricanorth:"southafricanorth",southcentralus:"southcentralus",southeastasia:"southeastasia",southindia:"southindia",switzerlandnorth:"switzerlandnorth",uaenorth:"uaenorth",uksouth:"uksouth",ukwest:"ukwest",westcentralus:"westcentralus",westeurope:"westeurope",westindia:"westindia",westus:"westus",westus2:"westus2"},t.GetLogStreams200ResponseInnerOneOf3StatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOf3TypeEnum={datadog:"datadog"},t.GetLogStreams200ResponseInnerOneOf3SinkDatadogRegionEnum={us:"us",eu:"eu",us3:"us3",us5:"us5"},t.GetLogStreams200ResponseInnerOneOf4StatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOf4TypeEnum={splunk:"splunk"},t.GetLogStreams200ResponseInnerOneOf5StatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOf5TypeEnum={sumo:"sumo"},t.GetLogStreams200ResponseInnerOneOf6StatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOf6TypeEnum={segment:"segment"},t.GetLogStreams200ResponseInnerOneOf7StatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.GetLogStreams200ResponseInnerOneOf7TypeEnum={mixpanel:"mixpanel"},t.GetLogStreams200ResponseInnerOneOf7SinkMixpanelRegionEnum={us:"us",eu:"eu"},t.GetLogStreams200ResponseInnerOneOfFiltersInnerTypeEnum={category:"category"},t.GetLogStreams200ResponseInnerOneOfFiltersInnerNameEnum={auth_ancillary_fail:"auth.ancillary.fail",auth_ancillary_success:"auth.ancillary.success",auth_login_fail:"auth.login.fail",auth_login_notification:"auth.login.notification",auth_login_success:"auth.login.success",auth_logout_fail:"auth.logout.fail",auth_logout_success:"auth.logout.success",auth_signup_fail:"auth.signup.fail",auth_signup_success:"auth.signup.success",auth_silent_auth_fail:"auth.silent_auth.fail",auth_silent_auth_success:"auth.silent_auth.success",auth_token_exchange_fail:"auth.token_exchange.fail",auth_token_exchange_success:"auth.token_exchange.success",management_fail:"management.fail",management_success:"management.success",system_notification:"system.notification",user_fail:"user.fail",user_notification:"user.notification",user_success:"user.success",other:"other"},t.GetLogStreams200ResponseInnerOneOfSinkHttpContentFormatEnum={JSONARRAY:"JSONARRAY",JSONLINES:"JSONLINES",JSONOBJECT:"JSONOBJECT"},t.GetMessageTypes200ResponseMessageTypesEnum={sms:"sms",voice:"voice"},t.GetPhoneProviders200ResponseProviderEnum={auth0:"auth0",twilio:"twilio",phone_message_hook:"phone-message-hook"},t.GetPnProviders200ResponseProviderEnum={guardian:"guardian",sns:"sns",direct:"direct"},t.GetSuspiciousIpThrottling200ResponseShieldsEnum={block:"block",admin_notification:"admin_notification"},t.HookCreateTriggerIdEnum={credentials_exchange:"credentials-exchange",pre_user_registration:"pre-user-registration",post_user_registration:"post-user-registration",post_change_password:"post-change-password",send_phone_message:"send-phone-message"},t.JobFormatEnum={json:"json",csv:"csv"},t.PatchAuthenticationMethodsByAuthenticationMethodIdRequestPreferredAuthenticationMethodEnum={voice:"voice",sms:"sms"},t.PatchBindingsRequestBindingsInnerOneOfRefTypeEnum={binding_id:"binding_id",action_id:"action_id",action_name:"action_name"},t.PatchBreachedPasswordDetectionRequestShieldsEnum={block:"block",user_notification:"user_notification",admin_notification:"admin_notification"},t.PatchBreachedPasswordDetectionRequestAdminNotificationFrequencyEnum={immediately:"immediately",daily:"daily",weekly:"weekly",monthly:"monthly"},t.PatchBreachedPasswordDetectionRequestMethodEnum={standard:"standard",enhanced:"enhanced"},t.PatchBreachedPasswordDetectionRequestStagePreUserRegistrationShieldsEnum={block:"block",admin_notification:"admin_notification"},t.PatchBruteForceProtectionRequestShieldsEnum={block:"block",user_notification:"user_notification"},t.PatchBruteForceProtectionRequestModeEnum={identifier_and_ip:"count_per_identifier_and_ip",identifier:"count_per_identifier"},t.PatchCustomDomainsByIdRequestTlsPolicyEnum={recommended:"recommended",compatible:"compatible"},t.PatchCustomDomainsByIdRequestCustomClientIpHeaderEnum={true_client_ip:"true-client-ip",cf_connecting_ip:"cf-connecting-ip",x_forwarded_for:"x-forwarded-for",x_azure_clientip:"x-azure-clientip",empty:""},t.PatchEmailTemplatesByTemplateNameRequestTemplateEnum={verify_email:"verify_email",verify_email_by_code:"verify_email_by_code",reset_email:"reset_email",welcome_email:"welcome_email",blocked_account:"blocked_account",stolen_credentials:"stolen_credentials",enrollment_email:"enrollment_email",mfa_oob_code:"mfa_oob_code",user_invitation:"user_invitation",change_password:"change_password",password_reset:"password_reset"},t.PatchLogStreamsByIdRequestStatusEnum={active:"active",paused:"paused",suspended:"suspended"},t.PatchLogStreamsByIdRequestSinkOneOfDatadogRegionEnum={us:"us",eu:"eu",us3:"us3",us5:"us5"},t.PatchLogStreamsByIdRequestSinkOneOf3MixpanelRegionEnum={us:"us",eu:"eu"},t.PatchSuspiciousIpThrottlingRequestShieldsEnum={block:"block",admin_notification:"admin_notification"},t.PostAuthenticationMethods201ResponseTypeEnum={phone:"phone",email:"email",totp:"totp",webauthn_roaming:"webauthn-roaming"},t.PostAuthenticationMethods201ResponsePreferredAuthenticationMethodEnum={voice:"voice",sms:"sms"},t.PostAuthenticationMethodsRequestTypeEnum={phone:"phone",email:"email",totp:"totp",webauthn_roaming:"webauthn-roaming"},t.PostAuthenticationMethodsRequestPreferredAuthenticationMethodEnum={voice:"voice",sms:"sms"},t.PostBrandingThemeRequestBordersButtonsStyleEnum={pill:"pill",rounded:"rounded",sharp:"sharp"},t.PostBrandingThemeRequestBordersInputsStyleEnum={pill:"pill",rounded:"rounded",sharp:"sharp"},t.PostBrandingThemeRequestFontsLinksStyleEnum={normal:"normal",underlined:"underlined"},t.PostBrandingThemeRequestPageBackgroundPageLayoutEnum={center:"center",left:"left",right:"right"},t.PostBrandingThemeRequestWidgetHeaderTextAlignmentEnum={center:"center",left:"left",right:"right"},t.PostBrandingThemeRequestWidgetLogoPositionEnum={center:"center",left:"left",none:"none",right:"right"},t.PostBrandingThemeRequestWidgetSocialButtonsLayoutEnum={bottom:"bottom",top:"top"},t.PostCredentialsRequestCredentialTypeEnum={public_key:"public_key",cert_subject_dn:"cert_subject_dn",x509_cert:"x509_cert"},t.PostCustomDomains201ResponseStatusEnum={disabled:"disabled",pending:"pending",pending_verification:"pending_verification",ready:"ready"},t.PostCustomDomains201ResponseTypeEnum={auth0_managed_certs:"auth0_managed_certs",self_managed_certs:"self_managed_certs"},t.PostCustomDomains201ResponseVerificationMethodsInnerNameEnum={cname:"cname",txt:"txt"},t.PostCustomDomainsRequestTypeEnum={auth0_managed_certs:"auth0_managed_certs",self_managed_certs:"self_managed_certs"},t.PostCustomDomainsRequestVerificationMethodEnum={txt:"txt"},t.PostCustomDomainsRequestTlsPolicyEnum={recommended:"recommended",compatible:"compatible"},t.PostCustomDomainsRequestCustomClientIpHeaderEnum={true_client_ip:"true-client-ip",cf_connecting_ip:"cf-connecting-ip",x_forwarded_for:"x-forwarded-for",x_azure_clientip:"x-azure-clientip",null:"null"},t.PostEmailTemplatesRequestTemplateEnum={verify_email:"verify_email",verify_email_by_code:"verify_email_by_code",reset_email:"reset_email",welcome_email:"welcome_email",blocked_account:"blocked_account",stolen_credentials:"stolen_credentials",enrollment_email:"enrollment_email",mfa_oob_code:"mfa_oob_code",user_invitation:"user_invitation",change_password:"change_password",password_reset:"password_reset"},t.PostIdentitiesRequestProviderEnum={ad:"ad",adfs:"adfs",amazon:"amazon",apple:"apple",dropbox:"dropbox",bitbucket:"bitbucket",aol:"aol",auth0_oidc:"auth0-oidc",auth0:"auth0",baidu:"baidu",bitly:"bitly",box:"box",custom:"custom",daccount:"daccount",dwolla:"dwolla",email:"email",evernote_sandbox:"evernote-sandbox",evernote:"evernote",exact:"exact",facebook:"facebook",fitbit:"fitbit",flickr:"flickr",github:"github",google_apps:"google-apps",google_oauth2:"google-oauth2",instagram:"instagram",ip:"ip",line:"line",linkedin:"linkedin",miicard:"miicard",oauth1:"oauth1",oauth2:"oauth2",office365:"office365",oidc:"oidc",okta:"okta",paypal:"paypal",paypal_sandbox:"paypal-sandbox",pingfederate:"pingfederate",planningcenter:"planningcenter",renren:"renren",salesforce_community:"salesforce-community",salesforce_sandbox:"salesforce-sandbox",salesforce:"salesforce",samlp:"samlp",sharepoint:"sharepoint",shopify:"shopify",sms:"sms",soundcloud:"soundcloud",thecity_sandbox:"thecity-sandbox",thecity:"thecity",thirtysevensignals:"thirtysevensignals",twitter:"twitter",untappd:"untappd",vkontakte:"vkontakte",waad:"waad",weibo:"weibo",windowslive:"windowslive",wordpress:"wordpress",yahoo:"yahoo",yammer:"yammer",yandex:"yandex"},t.PostLogStreamsRequestOneOfTypeEnum={http:"http"},t.PostLogStreamsRequestOneOf1TypeEnum={eventbridge:"eventbridge"},t.PostLogStreamsRequestOneOf1SinkAwsRegionEnum={ap_east_1:"ap-east-1",ap_northeast_1:"ap-northeast-1",ap_northeast_2:"ap-northeast-2",ap_northeast_3:"ap-northeast-3",ap_south_1:"ap-south-1",ap_southeast_1:"ap-southeast-1",ap_southeast_2:"ap-southeast-2",ca_central_1:"ca-central-1",cn_north_1:"cn-north-1",cn_northwest_1:"cn-northwest-1",eu_central_1:"eu-central-1",eu_north_1:"eu-north-1",eu_west_1:"eu-west-1",eu_west_2:"eu-west-2",eu_west_3:"eu-west-3",me_south_1:"me-south-1",sa_east_1:"sa-east-1",us_gov_east_1:"us-gov-east-1",us_gov_west_1:"us-gov-west-1",us_east_1:"us-east-1",us_east_2:"us-east-2",us_west_1:"us-west-1",us_west_2:"us-west-2"},t.PostLogStreamsRequestOneOf2TypeEnum={eventgrid:"eventgrid"},t.PostLogStreamsRequestOneOf2SinkAzureRegionEnum={australiacentral:"australiacentral",australiaeast:"australiaeast",australiasoutheast:"australiasoutheast",brazilsouth:"brazilsouth",canadacentral:"canadacentral",canadaeast:"canadaeast",centralindia:"centralindia",centralus:"centralus",eastasia:"eastasia",eastus:"eastus",eastus2:"eastus2",francecentral:"francecentral",germanywestcentral:"germanywestcentral",japaneast:"japaneast",japanwest:"japanwest",koreacentral:"koreacentral",koreasouth:"koreasouth",northcentralus:"northcentralus",northeurope:"northeurope",norwayeast:"norwayeast",southafricanorth:"southafricanorth",southcentralus:"southcentralus",southeastasia:"southeastasia",southindia:"southindia",switzerlandnorth:"switzerlandnorth",uaenorth:"uaenorth",uksouth:"uksouth",ukwest:"ukwest",westcentralus:"westcentralus",westeurope:"westeurope",westindia:"westindia",westus:"westus",westus2:"westus2"},t.PostLogStreamsRequestOneOf3TypeEnum={datadog:"datadog"},t.PostLogStreamsRequestOneOf4TypeEnum={splunk:"splunk"},t.PostLogStreamsRequestOneOf5TypeEnum={sumo:"sumo"},t.PostLogStreamsRequestOneOf6TypeEnum={segment:"segment"},t.PostLogStreamsRequestOneOf7TypeEnum={mixpanel:"mixpanel"},t.PostLogStreamsRequestOneOfFiltersInnerTypeEnum={category:"category"},t.PostLogStreamsRequestOneOfFiltersInnerNameEnum={auth_ancillary_fail:"auth.ancillary.fail",auth_ancillary_success:"auth.ancillary.success",auth_login_fail:"auth.login.fail",auth_login_notification:"auth.login.notification",auth_login_success:"auth.login.success",auth_logout_fail:"auth.logout.fail",auth_logout_success:"auth.logout.success",auth_signup_fail:"auth.signup.fail",auth_signup_success:"auth.signup.success",auth_silent_auth_fail:"auth.silent_auth.fail",auth_silent_auth_success:"auth.silent_auth.success",auth_token_exchange_fail:"auth.token_exchange.fail",auth_token_exchange_success:"auth.token_exchange.success",management_fail:"management.fail",management_success:"management.success",system_notification:"system.notification",user_fail:"user.fail",user_notification:"user.notification",user_success:"user.success",other:"other"},t.PostUsersExportsRequestFormatEnum={json:"json",csv:"csv"},t.PostVerificationEmailRequestIdentityProviderEnum={ad:"ad",adfs:"adfs",amazon:"amazon",apple:"apple",dropbox:"dropbox",bitbucket:"bitbucket",aol:"aol",auth0_oidc:"auth0-oidc",auth0:"auth0",baidu:"baidu",bitly:"bitly",box:"box",custom:"custom",daccount:"daccount",dwolla:"dwolla",email:"email",evernote_sandbox:"evernote-sandbox",evernote:"evernote",exact:"exact",facebook:"facebook",fitbit:"fitbit",flickr:"flickr",github:"github",google_apps:"google-apps",google_oauth2:"google-oauth2",instagram:"instagram",ip:"ip",line:"line",linkedin:"linkedin",miicard:"miicard",oauth1:"oauth1",oauth2:"oauth2",office365:"office365",oidc:"oidc",okta:"okta",paypal:"paypal",paypal_sandbox:"paypal-sandbox",pingfederate:"pingfederate",planningcenter:"planningcenter",renren:"renren",salesforce_community:"salesforce-community",salesforce_sandbox:"salesforce-sandbox",salesforce:"salesforce",samlp:"samlp",sharepoint:"sharepoint",shopify:"shopify",sms:"sms",soundcloud:"soundcloud",thecity_sandbox:"thecity-sandbox",thecity:"thecity",thirtysevensignals:"thirtysevensignals",twitter:"twitter",untappd:"untappd",vkontakte:"vkontakte",waad:"waad",weibo:"weibo",windowslive:"windowslive",wordpress:"wordpress",yahoo:"yahoo",yammer:"yammer",yandex:"yandex"},t.PostVerify200ResponseStatusEnum={disabled:"disabled",pending:"pending",pending_verification:"pending_verification",ready:"ready"},t.PostVerify200ResponseTypeEnum={auth0_managed_certs:"auth0_managed_certs",self_managed_certs:"self_managed_certs"},t.PromptsSettingsUniversalLoginExperienceEnum={new:"new",classic:"classic"},t.PromptsSettingsUpdateUniversalLoginExperienceEnum={new:"new",classic:"classic"},t.PutAuthenticationMethods200ResponseInnerTypeEnum={phone:"phone",email:"email",totp:"totp",webauthn_roaming:"webauthn-roaming"},t.PutAuthenticationMethods200ResponseInnerPreferredAuthenticationMethodEnum={voice:"voice",sms:"sms"},t.PutAuthenticationMethods200ResponseInnerAuthenticationMethodsInnerTypeEnum={totp:"totp",push:"push",sms:"sms",voice:"voice"},t.PutAuthenticationMethodsRequestInnerTypeEnum={phone:"phone",email:"email",totp:"totp"},t.PutAuthenticationMethodsRequestInnerPreferredAuthenticationMethodEnum={voice:"voice",sms:"sms"},t.ResourceServerSigningAlgEnum={HS256:"HS256",RS256:"RS256",PS256:"PS256"},t.ResourceServerTokenDialectEnum={access_token:"access_token",access_token_authz:"access_token_authz",rfc9068_profile:"rfc9068_profile",rfc9068_profile_authz:"rfc9068_profile_authz"},t.ResourceServerConsentPolicyEnum={transactional_authorization_with_mfa:"transactional-authorization-with-mfa",null:"null"},t.ResourceServerCreateSigningAlgEnum={HS256:"HS256",RS256:"RS256",PS256:"PS256"},t.ResourceServerCreateTokenDialectEnum={access_token:"access_token",access_token_authz:"access_token_authz",rfc9068_profile:"rfc9068_profile",rfc9068_profile_authz:"rfc9068_profile_authz"},t.ResourceServerCreateConsentPolicyEnum={transactional_authorization_with_mfa:"transactional-authorization-with-mfa",null:"null"},t.ResourceServerProofOfPossessionMechanismEnum={mtls:"mtls"},t.ResourceServerTokenEncryptionFormatEnum={compact_nested_jwe:"compact-nested-jwe"},t.ResourceServerTokenEncryptionEncryptionKeyAlgEnum={_256:"RSA-OAEP-256",_384:"RSA-OAEP-384",_512:"RSA-OAEP-512"},t.ResourceServerUpdateSigningAlgEnum={HS256:"HS256",RS256:"RS256",PS256:"PS256"},t.ResourceServerUpdateTokenDialectEnum={access_token:"access_token",access_token_authz:"access_token_authz",rfc9068_profile:"rfc9068_profile",rfc9068_profile_authz:"rfc9068_profile_authz"},t.ResourceServerUpdateConsentPolicyEnum={transactional_authorization_with_mfa:"transactional-authorization-with-mfa",null:"null"},t.TenantSettingsEnabledLocalesEnum={ar:"ar",bg:"bg",bs:"bs",ca_ES:"ca-ES",cs:"cs",cy:"cy",da:"da",de:"de",el:"el",en:"en",es:"es",et:"et",eu_ES:"eu-ES",fi:"fi",fr:"fr",fr_CA:"fr-CA",fr_FR:"fr-FR",gl_ES:"gl-ES",he:"he",hi:"hi",hr:"hr",hu:"hu",id:"id",is:"is",it:"it",ja:"ja",ko:"ko",lt:"lt",lv:"lv",nb:"nb",nl:"nl",nn:"nn",no:"no",pl:"pl",pt:"pt",pt_BR:"pt-BR",pt_PT:"pt-PT",ro:"ro",ru:"ru",sk:"sk",sl:"sl",sr:"sr",sv:"sv",th:"th",tr:"tr",uk:"uk",vi:"vi",zh_CN:"zh-CN",zh_TW:"zh-TW"},t.TenantSettingsDeviceFlowCharsetEnum={base20:"base20",digits:"digits"},t.TenantSettingsSessionCookieModeEnum={persistent:"persistent",non_persistent:"non-persistent"},t.TenantSettingsUpdateEnabledLocalesEnum={ar:"ar",bg:"bg",bs:"bs",ca_ES:"ca-ES",cs:"cs",cy:"cy",da:"da",de:"de",el:"el",en:"en",es:"es",et:"et",eu_ES:"eu-ES",fi:"fi",fr:"fr",fr_CA:"fr-CA",fr_FR:"fr-FR",gl_ES:"gl-ES",he:"he",hi:"hi",hr:"hr",hu:"hu",id:"id",is:"is",it:"it",ja:"ja",ko:"ko",lt:"lt",lv:"lv",nb:"nb",nl:"nl",nn:"nn",no:"no",pl:"pl",pt:"pt",pt_BR:"pt-BR",pt_PT:"pt-PT",ro:"ro",ru:"ru",sk:"sk",sl:"sl",sr:"sr",sv:"sv",th:"th",tr:"tr",uk:"uk",vi:"vi",zh_CN:"zh-CN",zh_TW:"zh-TW"},t.TenantSettingsUpdateDeviceFlowCharsetEnum={base20:"base20",digits:"digits"},t.TenantSettingsUpdateFlagsChangePwdFlowV1Enum={false:!1},t.UserEnrollmentStatusEnum={pending:"pending",confirmed:"confirmed"},t.UserEnrollmentAuthMethodEnum={authenticator:"authenticator",guardian:"guardian",sms:"sms",webauthn_platform:"webauthn-platform",webauthn_roaming:"webauthn-roaming"},t.GetConnectionsStrategyEnum={ad:"ad",adfs:"adfs",amazon:"amazon",apple:"apple",dropbox:"dropbox",bitbucket:"bitbucket",aol:"aol",auth0_oidc:"auth0-oidc",auth0:"auth0",baidu:"baidu",bitly:"bitly",box:"box",custom:"custom",daccount:"daccount",dwolla:"dwolla",email:"email",evernote_sandbox:"evernote-sandbox",evernote:"evernote",exact:"exact",facebook:"facebook",fitbit:"fitbit",flickr:"flickr",github:"github",google_apps:"google-apps",google_oauth2:"google-oauth2",instagram:"instagram",ip:"ip",line:"line",linkedin:"linkedin",miicard:"miicard",oauth1:"oauth1",oauth2:"oauth2",office365:"office365",oidc:"oidc",okta:"okta",paypal:"paypal",paypal_sandbox:"paypal-sandbox",pingfederate:"pingfederate",planningcenter:"planningcenter",renren:"renren",salesforce_community:"salesforce-community",salesforce_sandbox:"salesforce-sandbox",salesforce:"salesforce",samlp:"samlp",sharepoint:"sharepoint",shopify:"shopify",sms:"sms",soundcloud:"soundcloud",thecity_sandbox:"thecity-sandbox",thecity:"thecity",thirtysevensignals:"thirtysevensignals",twitter:"twitter",untappd:"untappd",vkontakte:"vkontakte",waad:"waad",weibo:"weibo",windowslive:"windowslive",wordpress:"wordpress",yahoo:"yahoo",yammer:"yammer",yandex:"yandex",auth0_adldap:"auth0-adldap"},t.GetDeviceCredentialsTypeEnum={public_key:"public_key",refresh_token:"refresh_token",rotating_refresh_token:"rotating_refresh_token"},t.GetEmailTemplatesByTemplateNameTemplateNameEnum={verify_email:"verify_email",verify_email_by_code:"verify_email_by_code",reset_email:"reset_email",welcome_email:"welcome_email",blocked_account:"blocked_account",stolen_credentials:"stolen_credentials",enrollment_email:"enrollment_email",mfa_oob_code:"mfa_oob_code",user_invitation:"user_invitation",change_password:"change_password",password_reset:"password_reset"},t.PatchEmailTemplatesByTemplateNameOperationTemplateNameEnum={verify_email:"verify_email",verify_email_by_code:"verify_email_by_code",reset_email:"reset_email",welcome_email:"welcome_email",blocked_account:"blocked_account",stolen_credentials:"stolen_credentials",enrollment_email:"enrollment_email",mfa_oob_code:"mfa_oob_code",user_invitation:"user_invitation",change_password:"change_password",password_reset:"password_reset"},t.PutEmailTemplatesByTemplateNameTemplateNameEnum={verify_email:"verify_email",verify_email_by_code:"verify_email_by_code",reset_email:"reset_email",welcome_email:"welcome_email",blocked_account:"blocked_account",stolen_credentials:"stolen_credentials",enrollment_email:"enrollment_email",mfa_oob_code:"mfa_oob_code",user_invitation:"user_invitation",change_password:"change_password",password_reset:"password_reset"},t.PutFactorsByNameOperationNameEnum={push_notification:"push-notification",sms:"sms",email:"email",duo:"duo",otp:"otp",webauthn_roaming:"webauthn-roaming",webauthn_platform:"webauthn-platform",recovery_code:"recovery-code"},t.GetHooksTriggerIdEnum={credentials_exchange:"credentials-exchange",pre_user_registration:"pre-user-registration",post_user_registration:"post-user-registration",post_change_password:"post-change-password",send_phone_message:"send-phone-message"},t.GetCustomTextByLanguagePromptEnum={login:"login",login_id:"login-id",login_password:"login-password",login_passwordless:"login-passwordless",login_email_verification:"login-email-verification",signup:"signup",signup_id:"signup-id",signup_password:"signup-password",phone_identifier_enrollment:"phone-identifier-enrollment",phone_identifier_challenge:"phone-identifier-challenge",reset_password:"reset-password",consent:"consent",logout:"logout",mfa_push:"mfa-push",mfa_otp:"mfa-otp",mfa_voice:"mfa-voice",mfa_phone:"mfa-phone",mfa_webauthn:"mfa-webauthn",mfa_sms:"mfa-sms",mfa_email:"mfa-email",mfa_recovery_code:"mfa-recovery-code",mfa:"mfa",status:"status",device_flow:"device-flow",email_verification:"email-verification",email_otp_challenge:"email-otp-challenge",organizations:"organizations",invitation:"invitation",common:"common",passkeys:"passkeys"},t.GetCustomTextByLanguageLanguageEnum={ar:"ar",bg:"bg",bs:"bs",ca_ES:"ca-ES",cs:"cs",cy:"cy",da:"da",de:"de",el:"el",en:"en",es:"es",et:"et",eu_ES:"eu-ES",fi:"fi",fr:"fr",fr_CA:"fr-CA",fr_FR:"fr-FR",gl_ES:"gl-ES",he:"he",hi:"hi",hr:"hr",hu:"hu",id:"id",is:"is",it:"it",ja:"ja",ko:"ko",lt:"lt",lv:"lv",nb:"nb",nl:"nl",nn:"nn",no:"no",pl:"pl",pt:"pt",pt_BR:"pt-BR",pt_PT:"pt-PT",ro:"ro",ru:"ru",sk:"sk",sl:"sl",sr:"sr",sv:"sv",th:"th",tr:"tr",uk:"uk",vi:"vi",zh_CN:"zh-CN",zh_TW:"zh-TW"},t.GetPartialsPromptEnum={login:"login",login_id:"login-id",login_password:"login-password",signup:"signup",signup_id:"signup-id",signup_password:"signup-password",customized_consent:"customized-consent"},t.PutCustomTextByLanguagePromptEnum={login:"login",login_id:"login-id",login_password:"login-password",login_passwordless:"login-passwordless",login_email_verification:"login-email-verification",signup:"signup",signup_id:"signup-id",signup_password:"signup-password",phone_identifier_enrollment:"phone-identifier-enrollment",phone_identifier_challenge:"phone-identifier-challenge",reset_password:"reset-password",consent:"consent",logout:"logout",mfa_push:"mfa-push",mfa_otp:"mfa-otp",mfa_voice:"mfa-voice",mfa_phone:"mfa-phone",mfa_webauthn:"mfa-webauthn",mfa_sms:"mfa-sms",mfa_email:"mfa-email",mfa_recovery_code:"mfa-recovery-code",mfa:"mfa",status:"status",device_flow:"device-flow",email_verification:"email-verification",email_otp_challenge:"email-otp-challenge",organizations:"organizations",invitation:"invitation",common:"common",passkeys:"passkeys"},t.PutCustomTextByLanguageLanguageEnum={ar:"ar",bg:"bg",bs:"bs",ca_ES:"ca-ES",cs:"cs",cy:"cy",da:"da",de:"de",el:"el",en:"en",es:"es",et:"et",eu_ES:"eu-ES",fi:"fi",fr:"fr",fr_CA:"fr-CA",fr_FR:"fr-FR",gl_ES:"gl-ES",he:"he",hi:"hi",hr:"hr",hu:"hu",id:"id",is:"is",it:"it",ja:"ja",ko:"ko",lt:"lt",lv:"lv",nb:"nb",nl:"nl",nn:"nn",no:"no",pl:"pl",pt:"pt",pt_BR:"pt-BR",pt_PT:"pt-PT",ro:"ro",ru:"ru",sk:"sk",sl:"sl",sr:"sr",sv:"sv",th:"th",tr:"tr",uk:"uk",vi:"vi",zh_CN:"zh-CN",zh_TW:"zh-TW"},t.PutPartialsPromptEnum={login:"login",login_id:"login-id",login_password:"login-password",signup:"signup",signup_id:"signup-id",signup_password:"signup-password",customized_consent:"customized-consent"},t.DeleteMultifactorByProviderProviderEnum={duo:"duo",google_authenticator:"google-authenticator"},t.DeleteUserIdentityByUserIdProviderEnum={ad:"ad",adfs:"adfs",amazon:"amazon",apple:"apple",dropbox:"dropbox",bitbucket:"bitbucket",aol:"aol",auth0_oidc:"auth0-oidc",auth0:"auth0",baidu:"baidu",bitly:"bitly",box:"box",custom:"custom",daccount:"daccount",dwolla:"dwolla",email:"email",evernote_sandbox:"evernote-sandbox",evernote:"evernote",exact:"exact",facebook:"facebook",fitbit:"fitbit",flickr:"flickr",github:"github",google_apps:"google-apps",google_oauth2:"google-oauth2",instagram:"instagram",ip:"ip",line:"line",linkedin:"linkedin",miicard:"miicard",oauth1:"oauth1",oauth2:"oauth2",office365:"office365",oidc:"oidc",okta:"okta",paypal:"paypal",paypal_sandbox:"paypal-sandbox",pingfederate:"pingfederate",planningcenter:"planningcenter",renren:"renren",salesforce_community:"salesforce-community",salesforce_sandbox:"salesforce-sandbox",salesforce:"salesforce",samlp:"samlp",sharepoint:"sharepoint",shopify:"shopify",sms:"sms",soundcloud:"soundcloud",thecity_sandbox:"thecity-sandbox",thecity:"thecity",thirtysevensignals:"thirtysevensignals",twitter:"twitter",untappd:"untappd",vkontakte:"vkontakte",waad:"waad",weibo:"weibo",windowslive:"windowslive",wordpress:"wordpress",yahoo:"yahoo",yammer:"yammer",yandex:"yandex"},t.GetUsersSearchEngineEnum={v1:"v1",v2:"v2",v3:"v3"}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TokenProviderMiddleware=void 0;const n=r(202);t.TokenProviderMiddleware=class{constructor(e){var t;this.tokenProvider="token"in e?{getAccessToken:()=>Promise.resolve(e.token)}:new n.TokenProvider({...e,audience:null!==(t=e.audience)&&void 0!==t?t:`https://${e.domain}/api/v2/`,clientSecret:e.clientSecret,clientAssertionSigningKey:e.clientAssertionSigningKey})}async pre(e){const t=await this.tokenProvider.getAccessToken();return e.init.headers={...e.init.headers,Authorization:`Bearer ${t}`},{url:e.url,init:e.init}}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TokenProvider=void 0;const n=r(203);t.TokenProvider=class{constructor(e){this.options=e,this.expiresAt=0,this.accessToken="",this.authenticationClient=new n.AuthenticationClient(e)}async getAccessToken(){if(!this.accessToken||Date.now()>this.expiresAt-1e4){this.pending=this.pending||this.authenticationClient.oauth.clientCredentialsGrant({audience:this.options.audience});const{data:{access_token:e,expires_in:t}}=await this.pending.finally((()=>{delete this.pending}));this.expiresAt=Date.now()+1e3*t,this.accessToken=e}return this.accessToken}}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.AuthenticationClient=t.AuthApiError=t.IdTokenValidatorError=void 0;const a=r(204),i=r(315),o=r(317);s(r(204),t),s(r(315),t),s(r(317),t);var c=r(316);Object.defineProperty(t,"IdTokenValidatorError",{enumerable:!0,get:function(){return c.IdTokenValidatorError}});var l=r(205);Object.defineProperty(t,"AuthApiError",{enumerable:!0,get:function(){return l.AuthApiError}});t.AuthenticationClient=class{constructor(e){this.database=new a.Database(e),this.oauth=new i.OAuth(e),this.passwordless=new o.Passwordless(e)}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Database=void 0;const n=r(166),s=r(163),a=r(205);class i extends a.BaseAuthAPI{async signUp(e,t){(0,s.validateRequiredRequestParams)(e,["email","password","connection"]);const r=await this.request({path:"/dbconnections/signup",method:"POST",headers:{"Content-Type":"application/json"},body:{client_id:this.clientId,...e}},t);return n.JSONApiResponse.fromResponse(r)}async changePassword(e,t){(0,s.validateRequiredRequestParams)(e,["email","connection"]);const r=await this.request({path:"/dbconnections/change_password",method:"POST",headers:{"Content-Type":"application/json"},body:{client_id:this.clientId,...e}},t);return n.TextApiResponse.fromResponse(r)}}t.Database=i},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.grant=t.BaseAuthAPI=t.AuthApiError=void 0;const n=r(165),s=r(163),a=r(206),i=r(312);class o extends Error{constructor(e,t,r,n,s){super(t||e),this.error=e,this.error_description=t,this.statusCode=r,this.body=n,this.headers=s,this.name="AuthApiError"}}async function c(e){const t=await e.text();try{const r=function(e){const t=JSON.parse(e);let r;return r=t.error?t:{error:t.code,error_description:t.description},r}(t);return new o(r.error,r.error_description,e.status,t,e.headers)}catch(r){return new n.ResponseError(e.status,t,e.headers,"Response returned an error code")}}t.AuthApiError=o;class l extends s.BaseAPI{constructor(e){super({...e,baseUrl:`https://${e.domain}`,middleware:!1!==e.telemetry?[new i.TelemetryMiddleware(e)]:[],parseError:c,retry:{enabled:!1,...e.retry}}),this.domain=e.domain,this.clientId=e.clientId,this.clientSecret=e.clientSecret,this.clientAssertionSigningKey=e.clientAssertionSigningKey,this.clientAssertionSigningAlg=e.clientAssertionSigningAlg,this.useMTLS=e.useMTLS}async addClientAuthentication(e){return(0,a.addClientAuthentication)({payload:e,domain:this.domain,clientId:this.clientId,clientSecret:this.clientSecret,clientAssertionSigningKey:this.clientAssertionSigningKey,clientAssertionSigningAlg:this.clientAssertionSigningAlg,useMTLS:this.useMTLS})}}t.BaseAuthAPI=l,t.grant=async function(e,t,{idTokenValidateOptions:r,initOverrides:n}={},a,i,o){const c=await o({path:"/oauth/token",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:a,...t,grant_type:e})},n),l=await s.JSONApiResponse.fromResponse(c);return l.data.id_token&&await i.validate(l.data.id_token,r),l}},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.addClientAuthentication=void 0;const i=a(r(207)),o=r(296);t.addClientAuthentication=async({payload:e,domain:t,clientId:r,clientAssertionSigningKey:n,clientAssertionSigningAlg:s,clientSecret:a,useMTLS:c})=>{const l=e.client_id||r;if(n&&!e.client_assertion){const r=s||"RS256",a=await i.importPKCS8(n,r);e.client_assertion=await new i.SignJWT({}).setProtectedHeader({alg:r}).setIssuedAt().setSubject(l).setJti((0,o.v4)()).setIssuer(l).setAudience(`https://${t}/`).setExpirationTime("2mins").sign(a),e.client_assertion_type="urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}else a&&!e.client_secret&&(e.client_secret=a);if(!(e.client_secret&&0!==e.client_secret.trim().length||e.client_assertion&&0!==e.client_assertion.trim().length||c))throw new Error("The client_secret or client_assertion field is required, or it should be mTLS request.");return e}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.cryptoRuntime=t.base64url=t.generateSecret=t.generateKeyPair=t.errors=t.decodeJwt=t.decodeProtectedHeader=t.importJWK=t.importX509=t.importPKCS8=t.importSPKI=t.exportJWK=t.exportSPKI=t.exportPKCS8=t.UnsecuredJWT=t.createRemoteJWKSet=t.createLocalJWKSet=t.EmbeddedJWK=t.calculateJwkThumbprintUri=t.calculateJwkThumbprint=t.EncryptJWT=t.SignJWT=t.GeneralSign=t.FlattenedSign=t.CompactSign=t.FlattenedEncrypt=t.CompactEncrypt=t.jwtDecrypt=t.jwtVerify=t.generalVerify=t.flattenedVerify=t.compactVerify=t.GeneralEncrypt=t.generalDecrypt=t.flattenedDecrypt=t.compactDecrypt=void 0;var n=r(208);Object.defineProperty(t,"compactDecrypt",{enumerable:!0,get:function(){return n.compactDecrypt}});var s=r(209);Object.defineProperty(t,"flattenedDecrypt",{enumerable:!0,get:function(){return s.flattenedDecrypt}});var a=r(251);Object.defineProperty(t,"generalDecrypt",{enumerable:!0,get:function(){return a.generalDecrypt}});var i=r(252);Object.defineProperty(t,"GeneralEncrypt",{enumerable:!0,get:function(){return i.GeneralEncrypt}});var o=r(258);Object.defineProperty(t,"compactVerify",{enumerable:!0,get:function(){return o.compactVerify}});var c=r(259);Object.defineProperty(t,"flattenedVerify",{enumerable:!0,get:function(){return c.flattenedVerify}});var l=r(266);Object.defineProperty(t,"generalVerify",{enumerable:!0,get:function(){return l.generalVerify}});var u=r(267);Object.defineProperty(t,"jwtVerify",{enumerable:!0,get:function(){return u.jwtVerify}});var d=r(271);Object.defineProperty(t,"jwtDecrypt",{enumerable:!0,get:function(){return d.jwtDecrypt}});var p=r(272);Object.defineProperty(t,"CompactEncrypt",{enumerable:!0,get:function(){return p.CompactEncrypt}});var h=r(253);Object.defineProperty(t,"FlattenedEncrypt",{enumerable:!0,get:function(){return h.FlattenedEncrypt}});var f=r(273);Object.defineProperty(t,"CompactSign",{enumerable:!0,get:function(){return f.CompactSign}});var m=r(274);Object.defineProperty(t,"FlattenedSign",{enumerable:!0,get:function(){return m.FlattenedSign}});var g=r(275);Object.defineProperty(t,"GeneralSign",{enumerable:!0,get:function(){return g.GeneralSign}});var y=r(276);Object.defineProperty(t,"SignJWT",{enumerable:!0,get:function(){return y.SignJWT}});var _=r(278);Object.defineProperty(t,"EncryptJWT",{enumerable:!0,get:function(){return _.EncryptJWT}});var v=r(279);Object.defineProperty(t,"calculateJwkThumbprint",{enumerable:!0,get:function(){return v.calculateJwkThumbprint}}),Object.defineProperty(t,"calculateJwkThumbprintUri",{enumerable:!0,get:function(){return v.calculateJwkThumbprintUri}});var b=r(280);Object.defineProperty(t,"EmbeddedJWK",{enumerable:!0,get:function(){return b.EmbeddedJWK}});var w=r(281);Object.defineProperty(t,"createLocalJWKSet",{enumerable:!0,get:function(){return w.createLocalJWKSet}});var E=r(282);Object.defineProperty(t,"createRemoteJWKSet",{enumerable:!0,get:function(){return E.createRemoteJWKSet}});var R=r(287);Object.defineProperty(t,"UnsecuredJWT",{enumerable:!0,get:function(){return R.UnsecuredJWT}});var S=r(255);Object.defineProperty(t,"exportPKCS8",{enumerable:!0,get:function(){return S.exportPKCS8}}),Object.defineProperty(t,"exportSPKI",{enumerable:!0,get:function(){return S.exportSPKI}}),Object.defineProperty(t,"exportJWK",{enumerable:!0,get:function(){return S.exportJWK}});var A=r(241);Object.defineProperty(t,"importSPKI",{enumerable:!0,get:function(){return A.importSPKI}}),Object.defineProperty(t,"importPKCS8",{enumerable:!0,get:function(){return A.importPKCS8}}),Object.defineProperty(t,"importX509",{enumerable:!0,get:function(){return A.importX509}}),Object.defineProperty(t,"importJWK",{enumerable:!0,get:function(){return A.importJWK}});var O=r(288);Object.defineProperty(t,"decodeProtectedHeader",{enumerable:!0,get:function(){return O.decodeProtectedHeader}});var P=r(290);Object.defineProperty(t,"decodeJwt",{enumerable:!0,get:function(){return P.decodeJwt}}),t.errors=r(216);var T=r(291);Object.defineProperty(t,"generateKeyPair",{enumerable:!0,get:function(){return T.generateKeyPair}});var C=r(293);Object.defineProperty(t,"generateSecret",{enumerable:!0,get:function(){return C.generateSecret}}),t.base64url=r(289);var k=r(294);Object.defineProperty(t,"cryptoRuntime",{enumerable:!0,get:function(){return k.default}})},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.compactDecrypt=void 0;const n=r(209),s=r(216),a=r(212);t.compactDecrypt=async function(e,t,r){if(e instanceof Uint8Array&&(e=a.decoder.decode(e)),"string"!=typeof e)throw new s.JWEInvalid("Compact JWE must be a string or Uint8Array");const{0:i,1:o,2:c,3:l,4:u,length:d}=e.split(".");if(5!==d)throw new s.JWEInvalid("Invalid Compact JWE");const p=await(0,n.flattenedDecrypt)({ciphertext:l,iv:c||void 0,protected:i||void 0,tag:u||void 0,encrypted_key:o||void 0},t,r),h={plaintext:p.plaintext,protectedHeader:p.protectedHeader};return"function"==typeof t?{...h,key:p.key}:h}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.flattenedDecrypt=void 0;const n=r(210),s=r(214),a=r(228),i=r(216),o=r(230),c=r(231),l=r(232),u=r(212),d=r(240),p=r(249),h=r(250);t.flattenedDecrypt=async function(e,t,r){var f;if(!(0,c.default)(e))throw new i.JWEInvalid("Flattened JWE must be an object");if(void 0===e.protected&&void 0===e.header&&void 0===e.unprotected)throw new i.JWEInvalid("JOSE Header missing");if("string"!=typeof e.iv)throw new i.JWEInvalid("JWE Initialization Vector missing or incorrect type");if("string"!=typeof e.ciphertext)throw new i.JWEInvalid("JWE Ciphertext missing or incorrect type");if("string"!=typeof e.tag)throw new i.JWEInvalid("JWE Authentication Tag missing or incorrect type");if(void 0!==e.protected&&"string"!=typeof e.protected)throw new i.JWEInvalid("JWE Protected Header incorrect type");if(void 0!==e.encrypted_key&&"string"!=typeof e.encrypted_key)throw new i.JWEInvalid("JWE Encrypted Key incorrect type");if(void 0!==e.aad&&"string"!=typeof e.aad)throw new i.JWEInvalid("JWE AAD incorrect type");if(void 0!==e.header&&!(0,c.default)(e.header))throw new i.JWEInvalid("JWE Shared Unprotected Header incorrect type");if(void 0!==e.unprotected&&!(0,c.default)(e.unprotected))throw new i.JWEInvalid("JWE Per-Recipient Unprotected Header incorrect type");let m;if(e.protected)try{const t=(0,n.decode)(e.protected);m=JSON.parse(u.decoder.decode(t))}catch{throw new i.JWEInvalid("JWE Protected Header is invalid")}if(!(0,o.default)(m,e.header,e.unprotected))throw new i.JWEInvalid("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");const g={...m,...e.header,...e.unprotected};if((0,p.default)(i.JWEInvalid,new Map,null==r?void 0:r.crit,m,g),void 0!==g.zip){if(!m||!m.zip)throw new i.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if("DEF"!==g.zip)throw new i.JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}const{alg:y,enc:_}=g;if("string"!=typeof y||!y)throw new i.JWEInvalid("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof _||!_)throw new i.JWEInvalid("missing JWE Encryption Algorithm (enc) in JWE Header");const v=r&&(0,h.default)("keyManagementAlgorithms",r.keyManagementAlgorithms),b=r&&(0,h.default)("contentEncryptionAlgorithms",r.contentEncryptionAlgorithms);if(v&&!v.has(y))throw new i.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');if(b&&!b.has(_))throw new i.JOSEAlgNotAllowed('"enc" (Encryption Algorithm) Header Parameter not allowed');let w;if(void 0!==e.encrypted_key)try{w=(0,n.decode)(e.encrypted_key)}catch{throw new i.JWEInvalid("Failed to base64url decode the encrypted_key")}let E,R,S,A=!1;"function"==typeof t&&(t=await t(m,e),A=!0);try{E=await(0,l.default)(y,t,w,g,r)}catch(e){if(e instanceof TypeError||e instanceof i.JWEInvalid||e instanceof i.JOSENotSupported)throw e;E=(0,d.default)(_)}try{R=(0,n.decode)(e.iv)}catch{throw new i.JWEInvalid("Failed to base64url decode the iv")}try{S=(0,n.decode)(e.tag)}catch{throw new i.JWEInvalid("Failed to base64url decode the tag")}const O=u.encoder.encode(null!==(f=e.protected)&&void 0!==f?f:"");let P,T;P=void 0!==e.aad?(0,u.concat)(O,u.encoder.encode("."),u.encoder.encode(e.aad)):O;try{T=(0,n.decode)(e.ciphertext)}catch{throw new i.JWEInvalid("Failed to base64url decode the ciphertext")}let C=await(0,s.default)(_,E,T,R,S,P);"DEF"===g.zip&&(C=await((null==r?void 0:r.inflateRaw)||a.inflate)(C));const k={plaintext:C};if(void 0!==e.protected&&(k.protectedHeader=m),void 0!==e.aad)try{k.additionalAuthenticatedData=(0,n.decode)(e.aad)}catch{throw new i.JWEInvalid("Failed to base64url decode the aad")}return void 0!==e.unprotected&&(k.sharedUnprotectedHeader=e.unprotected),void 0!==e.header&&(k.unprotectedHeader=e.header),A?{...k,key:t}:k}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=t.encodeBase64=t.decodeBase64=void 0;const n=r(211),s=r(212);let a;n.Buffer.isEncoding("base64url")?t.encode=a=e=>n.Buffer.from(e).toString("base64url"):t.encode=a=e=>n.Buffer.from(e).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");t.decodeBase64=e=>n.Buffer.from(e,"base64");t.encodeBase64=e=>n.Buffer.from(e).toString("base64");t.decode=e=>n.Buffer.from(function(e){let t=e;return t instanceof Uint8Array&&(t=s.decoder.decode(t)),t}(e),"base64")},e=>{e.exports=require("buffer")},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concatKdf=t.lengthAndInput=t.uint32be=t.uint64be=t.p2s=t.concat=t.decoder=t.encoder=void 0;const n=r(213);t.encoder=new TextEncoder,t.decoder=new TextDecoder;const s=2**32;function a(...e){const t=e.reduce(((e,{length:t})=>e+t),0),r=new Uint8Array(t);let n=0;return e.forEach((e=>{r.set(e,n),n+=e.length})),r}function i(e,t,r){if(t<0||t>=s)throw new RangeError(`value must be >= 0 and <= ${s-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,255&t],r)}function o(e){const t=new Uint8Array(4);return i(t,e),t}t.concat=a,t.p2s=function(e,r){return a(t.encoder.encode(e),new Uint8Array([0]),r)},t.uint64be=function(e){const t=Math.floor(e/s),r=e%s,n=new Uint8Array(8);return i(n,t,0),i(n,r,4),n},t.uint32be=o,t.lengthAndInput=function(e){return a(o(e.length),e)},t.concatKdf=async function(e,t,r){const s=Math.ceil((t>>3)/32),a=new Uint8Array(32*s);for(let t=0;t>3)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100);t.default=(e,t)=>(0,n.createHash)(e).update(t).digest()},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(215),a=r(219),i=r(212),o=r(216),c=r(221),l=r(222),u=r(223),d=r(224),p=r(220),h=r(225),f=r(226),m=r(227);t.default=(e,t,r,g,y,_)=>{let v;if((0,u.isCryptoKey)(t))(0,d.checkEncCryptoKey)(t,e,"decrypt"),v=n.KeyObject.from(t);else{if(!(t instanceof Uint8Array||(0,p.default)(t)))throw new TypeError((0,h.default)(t,...m.types,"Uint8Array"));v=t}switch((0,a.default)(e,v),(0,s.default)(e,g),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return function(e,t,r,s,a,u){const d=parseInt(e.slice(1,4),10);(0,p.default)(t)&&(t=t.export());const h=t.subarray(d>>3),m=t.subarray(0,d>>3),g=parseInt(e.slice(-3),10),y=`aes-${d}-cbc`;if(!(0,f.default)(y))throw new o.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);const _=(0,l.default)(u,s,r,g,m,d);let v,b;try{v=(0,c.default)(a,_)}catch{}if(!v)throw new o.JWEDecryptionFailed;try{const e=(0,n.createDecipheriv)(y,h,s);b=(0,i.concat)(e.update(r),e.final())}catch{}if(!b)throw new o.JWEDecryptionFailed;return b}(e,v,r,g,y,_);case"A128GCM":case"A192GCM":case"A256GCM":return function(e,t,r,s,a,i){const c=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!(0,f.default)(c))throw new o.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);try{const e=(0,n.createDecipheriv)(c,t,s,{authTagLength:16});e.setAuthTag(a),i.byteLength&&e.setAAD(i,{plaintextLength:r.length});const o=e.update(r);return e.final(),o}catch{throw new o.JWEDecryptionFailed}}(e,v,r,g,y,_);default:throw new o.JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(216),s=r(217);t.default=(e,t)=>{if(t.length<<3!==(0,s.bitLength)(e))throw new n.JWEInvalid("Invalid Initialization Vector length")}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JWSSignatureVerificationFailed=t.JWKSTimeout=t.JWKSMultipleMatchingKeys=t.JWKSNoMatchingKey=t.JWKSInvalid=t.JWKInvalid=t.JWTInvalid=t.JWSInvalid=t.JWEInvalid=t.JWEDecompressionFailed=t.JWEDecryptionFailed=t.JOSENotSupported=t.JOSEAlgNotAllowed=t.JWTExpired=t.JWTClaimValidationFailed=t.JOSEError=void 0;class r extends Error{static get code(){return"ERR_JOSE_GENERIC"}constructor(e){var t;super(e),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,this.constructor)}}t.JOSEError=r;t.JWTClaimValidationFailed=class extends r{static get code(){return"ERR_JWT_CLAIM_VALIDATION_FAILED"}constructor(e,t="unspecified",r="unspecified"){super(e),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=t,this.reason=r}};t.JWTExpired=class extends r{static get code(){return"ERR_JWT_EXPIRED"}constructor(e,t="unspecified",r="unspecified"){super(e),this.code="ERR_JWT_EXPIRED",this.claim=t,this.reason=r}};t.JOSEAlgNotAllowed=class extends r{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}static get code(){return"ERR_JOSE_ALG_NOT_ALLOWED"}};t.JOSENotSupported=class extends r{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}static get code(){return"ERR_JOSE_NOT_SUPPORTED"}};t.JWEDecryptionFailed=class extends r{constructor(){super(...arguments),this.code="ERR_JWE_DECRYPTION_FAILED",this.message="decryption operation failed"}static get code(){return"ERR_JWE_DECRYPTION_FAILED"}};t.JWEDecompressionFailed=class extends r{constructor(){super(...arguments),this.code="ERR_JWE_DECOMPRESSION_FAILED",this.message="decompression operation failed"}static get code(){return"ERR_JWE_DECOMPRESSION_FAILED"}};t.JWEInvalid=class extends r{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}static get code(){return"ERR_JWE_INVALID"}};t.JWSInvalid=class extends r{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}static get code(){return"ERR_JWS_INVALID"}};t.JWTInvalid=class extends r{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}static get code(){return"ERR_JWT_INVALID"}};t.JWKInvalid=class extends r{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}static get code(){return"ERR_JWK_INVALID"}};t.JWKSInvalid=class extends r{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}static get code(){return"ERR_JWKS_INVALID"}};t.JWKSNoMatchingKey=class extends r{constructor(){super(...arguments),this.code="ERR_JWKS_NO_MATCHING_KEY",this.message="no applicable key found in the JSON Web Key Set"}static get code(){return"ERR_JWKS_NO_MATCHING_KEY"}};t.JWKSMultipleMatchingKeys=class extends r{constructor(){super(...arguments),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS",this.message="multiple matching keys found in the JSON Web Key Set"}static get code(){return"ERR_JWKS_MULTIPLE_MATCHING_KEYS"}},Symbol.asyncIterator;t.JWKSTimeout=class extends r{constructor(){super(...arguments),this.code="ERR_JWKS_TIMEOUT",this.message="request timed out"}static get code(){return"ERR_JWKS_TIMEOUT"}};t.JWSSignatureVerificationFailed=class extends r{constructor(){super(...arguments),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED",this.message="signature verification failed"}static get code(){return"ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bitLength=void 0;const n=r(216),s=r(218);function a(e){switch(e){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new n.JOSENotSupported(`Unsupported JWE Algorithm: ${e}`)}}t.bitLength=a,t.default=e=>(0,s.default)(new Uint8Array(a(e)>>3))},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=r(100);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n.randomFillSync}})},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(216),s=r(220);t.default=(e,t)=>{let r;switch(e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":r=parseInt(e.slice(-3),10);break;case"A128GCM":case"A192GCM":case"A256GCM":r=parseInt(e.slice(1,4),10);break;default:throw new n.JOSENotSupported(`Content Encryption Algorithm ${e} is not supported either by JOSE or your javascript runtime`)}if(t instanceof Uint8Array){const e=t.byteLength<<3;if(e!==r)throw new n.JWEInvalid(`Invalid Content Encryption Key length. Expected ${r} bits, got ${e} bits`)}else{if(!(0,s.default)(t)||"secret"!==t.type)throw new TypeError("Invalid Content Encryption Key type");{const e=t.symmetricKeySize<<3;if(e!==r)throw new n.JWEInvalid(`Invalid Content Encryption Key length. Expected ${r} bits, got ${e} bits`)}}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(101);t.default=s.types.isKeyObject?e=>s.types.isKeyObject(e):e=>null!=e&&e instanceof n.KeyObject},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100).timingSafeEqual;t.default=n},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(212);t.default=function(e,t,r,a,i,o){const c=(0,s.concat)(e,t,r,(0,s.uint64be)(e.length<<3)),l=(0,n.createHmac)(`sha${a}`,i);return l.update(c),l.digest().slice(0,o>>3)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isCryptoKey=void 0;const n=r(100),s=r(101),a=n.webcrypto;t.default=a,t.isCryptoKey=s.types.isCryptoKey?e=>s.types.isCryptoKey(e):e=>!1},(e,t)=>{function r(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function n(e,t){return e.name===t}function s(e){return parseInt(e.name.slice(4),10)}function a(e,t){if(t.length&&!t.some((t=>e.usages.includes(t)))){let e="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const r=t.pop();e+=`one of ${t.join(", ")}, or ${r}.`}else 2===t.length?e+=`one of ${t[0]} or ${t[1]}.`:e+=`${t[0]}.`;throw new TypeError(e)}}Object.defineProperty(t,"__esModule",{value:!0}),t.checkEncCryptoKey=t.checkSigCryptoKey=void 0,t.checkSigCryptoKey=function(e,t,...i){switch(t){case"HS256":case"HS384":case"HS512":{if(!n(e.algorithm,"HMAC"))throw r("HMAC");const a=parseInt(t.slice(2),10);if(s(e.algorithm.hash)!==a)throw r(`SHA-${a}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!n(e.algorithm,"RSASSA-PKCS1-v1_5"))throw r("RSASSA-PKCS1-v1_5");const a=parseInt(t.slice(2),10);if(s(e.algorithm.hash)!==a)throw r(`SHA-${a}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!n(e.algorithm,"RSA-PSS"))throw r("RSA-PSS");const a=parseInt(t.slice(2),10);if(s(e.algorithm.hash)!==a)throw r(`SHA-${a}`,"algorithm.hash");break}case"EdDSA":if("Ed25519"!==e.algorithm.name&&"Ed448"!==e.algorithm.name)throw r("Ed25519 or Ed448");break;case"ES256":case"ES384":case"ES512":{if(!n(e.algorithm,"ECDSA"))throw r("ECDSA");const s=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}(t);if(e.algorithm.namedCurve!==s)throw r(s,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}a(e,i)},t.checkEncCryptoKey=function(e,t,...i){switch(t){case"A128GCM":case"A192GCM":case"A256GCM":{if(!n(e.algorithm,"AES-GCM"))throw r("AES-GCM");const s=parseInt(t.slice(1,4),10);if(e.algorithm.length!==s)throw r(s,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!n(e.algorithm,"AES-KW"))throw r("AES-KW");const s=parseInt(t.slice(1,4),10);if(e.algorithm.length!==s)throw r(s,"algorithm.length");break}case"ECDH":switch(e.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw r("ECDH, X25519, or X448")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!n(e.algorithm,"PBKDF2"))throw r("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!n(e.algorithm,"RSA-OAEP"))throw r("RSA-OAEP");const a=parseInt(t.slice(9),10)||1;if(s(e.algorithm.hash)!==a)throw r(`SHA-${a}`,"algorithm.hash");break}default:throw new TypeError("CryptoKey does not support this operation")}a(e,i)}},(e,t)=>{function r(e,t,...r){if(r.length>2){const t=r.pop();e+=`one of type ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor&&t.constructor.name&&(e+=` Received an instance of ${t.constructor.name}`),e}Object.defineProperty(t,"__esModule",{value:!0}),t.withAlg=void 0,t.default=(e,...t)=>r("Key must be ",e,...t),t.withAlg=function(e,t,...n){return r(`Key for the ${e} algorithm must be `,t,...n)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100);let s;t.default=e=>(s||(s=new Set((0,n.getCiphers)())),s.has(e))},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.types=void 0;const n=r(223),s=r(220);t.default=e=>(0,s.default)(e)||(0,n.isCryptoKey)(e);const a=["KeyObject"];t.types=a,(globalThis.CryptoKey||(null===n.default||void 0===n.default?void 0:n.default.CryptoKey))&&a.push("CryptoKey")},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.deflate=t.inflate=void 0;const n=r(101),s=r(229),a=r(216),i=(0,n.promisify)(s.inflateRaw),o=(0,n.promisify)(s.deflateRaw);t.inflate=e=>i(e,{maxOutputLength:25e4}).catch((()=>{throw new a.JWEDecompressionFailed}));t.deflate=e=>o(e)},e=>{e.exports=require("zlib")},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=(...e)=>{const t=e.filter(Boolean);if(0===t.length||1===t.length)return!0;let r;for(const e of t){const t=Object.keys(e);if(r&&0!==r.size)for(const e of t){if(r.has(e))return!1;r.add(e)}else r=new Set(t)}return!0}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if("object"!=typeof(t=e)||null===t||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t;if(null===Object.getPrototypeOf(e))return!0;let r=e;for(;null!==Object.getPrototypeOf(r);)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(233),s=r(234),a=r(236),i=r(238),o=r(210),c=r(216),l=r(240),u=r(241),d=r(246),p=r(231),h=r(247);t.default=async function(e,t,r,f,m){switch((0,d.default)(e,t,"decrypt"),e){case"dir":if(void 0!==r)throw new c.JWEInvalid("Encountered unexpected JWE Encrypted Key");return t;case"ECDH-ES":if(void 0!==r)throw new c.JWEInvalid("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!(0,p.default)(f.epk))throw new c.JWEInvalid('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!s.ecdhAllowed(t))throw new c.JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");const a=await(0,u.importJWK)(f.epk,e);let i,d;if(void 0!==f.apu){if("string"!=typeof f.apu)throw new c.JWEInvalid('JOSE Header "apu" (Agreement PartyUInfo) invalid');try{i=(0,o.decode)(f.apu)}catch{throw new c.JWEInvalid("Failed to base64url decode the apu")}}if(void 0!==f.apv){if("string"!=typeof f.apv)throw new c.JWEInvalid('JOSE Header "apv" (Agreement PartyVInfo) invalid');try{d=(0,o.decode)(f.apv)}catch{throw new c.JWEInvalid("Failed to base64url decode the apv")}}const h=await s.deriveKey(a,t,"ECDH-ES"===e?f.enc:e,"ECDH-ES"===e?(0,l.bitLength)(f.enc):parseInt(e.slice(-5,-2),10),i,d);if("ECDH-ES"===e)return h;if(void 0===r)throw new c.JWEInvalid("JWE Encrypted Key missing");return(0,n.unwrap)(e.slice(-6),h,r)}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if(void 0===r)throw new c.JWEInvalid("JWE Encrypted Key missing");return(0,i.decrypt)(e,t,r);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{if(void 0===r)throw new c.JWEInvalid("JWE Encrypted Key missing");if("number"!=typeof f.p2c)throw new c.JWEInvalid('JOSE Header "p2c" (PBES2 Count) missing or invalid');const n=(null==m?void 0:m.maxPBES2Count)||1e4;if(f.p2c>n)throw new c.JWEInvalid('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof f.p2s)throw new c.JWEInvalid('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let s;try{s=(0,o.decode)(f.p2s)}catch{throw new c.JWEInvalid("Failed to base64url decode the p2s")}return(0,a.decrypt)(e,t,r,f.p2c,s)}case"A128KW":case"A192KW":case"A256KW":if(void 0===r)throw new c.JWEInvalid("JWE Encrypted Key missing");return(0,n.unwrap)(e,t,r);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{if(void 0===r)throw new c.JWEInvalid("JWE Encrypted Key missing");if("string"!=typeof f.iv)throw new c.JWEInvalid('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof f.tag)throw new c.JWEInvalid('JOSE Header "tag" (Authentication Tag) missing or invalid');let n,s;try{n=(0,o.decode)(f.iv)}catch{throw new c.JWEInvalid("Failed to base64url decode the iv")}try{s=(0,o.decode)(f.tag)}catch{throw new c.JWEInvalid("Failed to base64url decode the tag")}return(0,h.unwrap)(e,t,r,n,s)}default:throw new c.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.unwrap=t.wrap=void 0;const n=r(211),s=r(100),a=r(216),i=r(212),o=r(223),c=r(224),l=r(220),u=r(225),d=r(226),p=r(227);function h(e,t){if(e.symmetricKeySize<<3!==parseInt(t.slice(1,4),10))throw new TypeError(`Invalid key size for alg: ${t}`)}function f(e,t,r){if((0,l.default)(e))return e;if(e instanceof Uint8Array)return(0,s.createSecretKey)(e);if((0,o.isCryptoKey)(e))return(0,c.checkEncCryptoKey)(e,t,r),s.KeyObject.from(e);throw new TypeError((0,u.default)(e,...p.types,"Uint8Array"))}t.wrap=(e,t,r)=>{const o=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!(0,d.default)(o))throw new a.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`);const c=f(t,e,"wrapKey");h(c,e);const l=(0,s.createCipheriv)(o,c,n.Buffer.alloc(8,166));return(0,i.concat)(l.update(r),l.final())};t.unwrap=(e,t,r)=>{const o=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!(0,d.default)(o))throw new a.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`);const c=f(t,e,"unwrapKey");h(c,e);const l=(0,s.createDecipheriv)(o,c,n.Buffer.alloc(8,166));return(0,i.concat)(l.update(r),l.final())}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ecdhAllowed=t.generateEpk=t.deriveKey=void 0;const n=r(100),s=r(101),a=r(235),i=r(212),o=r(216),c=r(223),l=r(224),u=r(220),d=r(225),p=r(227),h=(0,s.promisify)(n.generateKeyPair);t.deriveKey=async function(e,t,r,s,a=new Uint8Array(0),o=new Uint8Array(0)){let h,f;if((0,c.isCryptoKey)(e))(0,l.checkEncCryptoKey)(e,"ECDH"),h=n.KeyObject.from(e);else{if(!(0,u.default)(e))throw new TypeError((0,d.default)(e,...p.types));h=e}if((0,c.isCryptoKey)(t))(0,l.checkEncCryptoKey)(t,"ECDH","deriveBits"),f=n.KeyObject.from(t);else{if(!(0,u.default)(t))throw new TypeError((0,d.default)(t,...p.types));f=t}const m=(0,i.concat)((0,i.lengthAndInput)(i.encoder.encode(r)),(0,i.lengthAndInput)(a),(0,i.lengthAndInput)(o),(0,i.uint32be)(s)),g=(0,n.diffieHellman)({privateKey:f,publicKey:h});return(0,i.concatKdf)(g,s,m)},t.generateEpk=async function(e){let t;if((0,c.isCryptoKey)(e))t=n.KeyObject.from(e);else{if(!(0,u.default)(e))throw new TypeError((0,d.default)(e,...p.types));t=e}switch(t.asymmetricKeyType){case"x25519":return h("x25519");case"x448":return h("x448");case"ec":{const e=(0,a.default)(t);return h("ec",{namedCurve:e})}default:throw new o.JOSENotSupported("Invalid or unsupported EPK")}};t.ecdhAllowed=e=>["P-256","P-384","P-521","X25519","X448"].includes((0,a.default)(e))},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setCurve=t.weakMap=void 0;const n=r(211),s=r(100),a=r(216),i=r(223),o=r(220),c=r(225),l=r(227),u=n.Buffer.from([42,134,72,206,61,3,1,7]),d=n.Buffer.from([43,129,4,0,34]),p=n.Buffer.from([43,129,4,0,35]),h=n.Buffer.from([43,129,4,0,10]);t.weakMap=new WeakMap;const f=(e,r)=>{var n;let m;if((0,i.isCryptoKey)(e))m=s.KeyObject.from(e);else{if(!(0,o.default)(e))throw new TypeError((0,c.default)(e,...l.types));m=e}if("secret"===m.type)throw new TypeError('only "private" or "public" type keys can be used for this operation');switch(m.asymmetricKeyType){case"ed25519":case"ed448":return`Ed${m.asymmetricKeyType.slice(2)}`;case"x25519":case"x448":return`X${m.asymmetricKeyType.slice(1)}`;case"ec":{if(t.weakMap.has(m))return t.weakMap.get(m);let e=null===(n=m.asymmetricKeyDetails)||void 0===n?void 0:n.namedCurve;if(e||"private"!==m.type){if(!e){const t=m.export({format:"der",type:"spki"}),r=t[1]<128?14:15,n=t[r],s=t.slice(r+1,r+1+n);if(s.equals(u))e="prime256v1";else if(s.equals(d))e="secp384r1";else if(s.equals(p))e="secp521r1";else{if(!s.equals(h))throw new a.JOSENotSupported("Unsupported key curve for this operation");e="secp256k1"}}}else e=f((0,s.createPublicKey)(m),!0);if(r)return e;const i=(e=>{switch(e){case"prime256v1":return"P-256";case"secp384r1":return"P-384";case"secp521r1":return"P-521";case"secp256k1":return"secp256k1";default:throw new a.JOSENotSupported("Unsupported key curve for this operation")}})(e);return t.weakMap.set(m,i),i}default:throw new TypeError("Invalid asymmetric key type for this operation")}};t.setCurve=function(e,r){t.weakMap.set(e,r)},t.default=f},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=void 0;const n=r(101),s=r(100),a=r(218),i=r(212),o=r(210),c=r(233),l=r(237),u=r(223),d=r(224),p=r(220),h=r(225),f=r(227),m=(0,n.promisify)(s.pbkdf2);function g(e,t){if((0,p.default)(e))return e.export();if(e instanceof Uint8Array)return e;if((0,u.isCryptoKey)(e))return(0,d.checkEncCryptoKey)(e,t,"deriveBits","deriveKey"),s.KeyObject.from(e).export();throw new TypeError((0,h.default)(e,...f.types,"Uint8Array"))}t.encrypt=async(e,t,r,n=2048,s=(0,a.default)(new Uint8Array(16)))=>{(0,l.default)(s);const u=(0,i.p2s)(e,s),d=parseInt(e.slice(13,16),10)>>3,p=g(t,e),h=await m(p,u,n,d,`sha${e.slice(8,11)}`);return{encryptedKey:await(0,c.wrap)(e.slice(-6),h,r),p2c:n,p2s:(0,o.encode)(s)}};t.decrypt=async(e,t,r,n,s)=>{(0,l.default)(s);const a=(0,i.p2s)(e,s),o=parseInt(e.slice(13,16),10)>>3,u=g(t,e),d=await m(u,a,n,o,`sha${e.slice(8,11)}`);return(0,c.unwrap)(e.slice(-6),d,r)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(216);t.default=function(e){if(!(e instanceof Uint8Array)||e.length<8)throw new n.JWEInvalid("PBES2 Salt Input must be 8 or more octets")}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=void 0;const n=r(100),s=r(239),a=r(223),i=r(224),o=r(220),c=r(225),l=r(227),u=(e,t)=>{if("rsa"!==e.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");(0,s.default)(e,t)},d=e=>{switch(e){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return n.constants.RSA_PKCS1_OAEP_PADDING;case"RSA1_5":return n.constants.RSA_PKCS1_PADDING;default:return}},p=e=>{switch(e){case"RSA-OAEP":return"sha1";case"RSA-OAEP-256":return"sha256";case"RSA-OAEP-384":return"sha384";case"RSA-OAEP-512":return"sha512";default:return}};function h(e,t,...r){if((0,o.default)(e))return e;if((0,a.isCryptoKey)(e))return(0,i.checkEncCryptoKey)(e,t,...r),n.KeyObject.from(e);throw new TypeError((0,c.default)(e,...l.types))}t.encrypt=(e,t,r)=>{const s=d(e),a=p(e),i=h(t,e,"wrapKey","encrypt");return u(i,e),(0,n.publicEncrypt)({key:i,oaepHash:a,padding:s},r)};t.decrypt=(e,t,r)=>{const s=d(e),a=p(e),i=h(t,e,"unwrapKey","decrypt");return u(i,e),(0,n.privateDecrypt)({key:i,oaepHash:a,padding:s},r)}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setModulusLength=t.weakMap=void 0,t.weakMap=new WeakMap;const r=(e,t)=>{let n=e.readUInt8(1);if(0==(128&n))return 0===t?n:r(e.subarray(2+n),t-1);const s=127&n;n=0;for(let t=0;t{var n,s;if(t.weakMap.has(e))return t.weakMap.get(e);const a=null!==(s=null===(n=e.asymmetricKeyDetails)||void 0===n?void 0:n.modulusLength)&&void 0!==s?s:((e,t)=>{const n=e.readUInt8(1);if(0==(128&n))return r(e.subarray(2),t);const s=127&n;return r(e.subarray(2+s),t)})(e.export({format:"der",type:"pkcs1"}),"private"===e.type?1:0)-1<<3;return t.weakMap.set(e,a),a};t.setModulusLength=(e,r)=>{t.weakMap.set(e,r)},t.default=(e,t)=>{if(n(e)<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bitLength=void 0;const n=r(216),s=r(218);function a(e){switch(e){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new n.JOSENotSupported(`Unsupported JWE Algorithm: ${e}`)}}t.bitLength=a,t.default=e=>(0,s.default)(new Uint8Array(a(e)>>3))},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.importJWK=t.importPKCS8=t.importX509=t.importSPKI=void 0;const n=r(210),s=r(242),a=r(243),i=r(216),o=r(231);t.importSPKI=async function(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PUBLIC KEY-----"))throw new TypeError('"spki" must be SPKI formatted string');return(0,s.fromSPKI)(e,t,r)},t.importX509=async function(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN CERTIFICATE-----"))throw new TypeError('"x509" must be X.509 formatted string');return(0,s.fromX509)(e,t,r)},t.importPKCS8=async function(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return(0,s.fromPKCS8)(e,t,r)},t.importJWK=async function(e,t,r){var s;if(!(0,o.default)(e))throw new TypeError("JWK must be an object");switch(t||(t=e.alg),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return null!=r||(r=!0!==e.ext),r?(0,a.default)({...e,alg:t,ext:null!==(s=e.ext)&&void 0!==s&&s}):(0,n.decode)(e.k);case"RSA":if(void 0!==e.oth)throw new i.JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return(0,a.default)({...e,alg:t});default:throw new i.JOSENotSupported('Unsupported "kty" (Key Type) Parameter value')}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fromX509=t.fromSPKI=t.fromPKCS8=t.toPKCS8=t.toSPKI=void 0;const n=r(100),s=r(211),a=r(223),i=r(220),o=r(225),c=r(227),l=(e,t,r)=>{let s;if((0,a.isCryptoKey)(r)){if(!r.extractable)throw new TypeError("CryptoKey is not extractable");s=n.KeyObject.from(r)}else{if(!(0,i.default)(r))throw new TypeError((0,o.default)(r,...c.types));s=r}if(s.type!==e)throw new TypeError(`key is not a ${e} key`);return s.export({format:"pem",type:t})};t.toSPKI=e=>l("public","spki",e);t.toPKCS8=e=>l("private","pkcs8",e);t.fromPKCS8=e=>(0,n.createPrivateKey)({key:s.Buffer.from(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,""),"base64"),type:"pkcs8",format:"der"});t.fromSPKI=e=>(0,n.createPublicKey)({key:s.Buffer.from(e.replace(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,""),"base64"),type:"spki",format:"der"});t.fromX509=e=>(0,n.createPublicKey)({key:e,type:"spki",format:"pem"})},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(211),s=r(100),a=r(210),i=r(216),o=r(235),c=r(239),l=r(244),u=r(245);t.default=e=>{if(u.jwkImport&&"oct"!==e.kty)return e.d?(0,s.createPrivateKey)({format:"jwk",key:e}):(0,s.createPublicKey)({format:"jwk",key:e});switch(e.kty){case"oct":return(0,s.createSecretKey)((0,a.decode)(e.k));case"RSA":{const t=new l.default,r=void 0!==e.d,a=n.Buffer.from(e.n,"base64"),i=n.Buffer.from(e.e,"base64");r?(t.zero(),t.unsignedInteger(a),t.unsignedInteger(i),t.unsignedInteger(n.Buffer.from(e.d,"base64")),t.unsignedInteger(n.Buffer.from(e.p,"base64")),t.unsignedInteger(n.Buffer.from(e.q,"base64")),t.unsignedInteger(n.Buffer.from(e.dp,"base64")),t.unsignedInteger(n.Buffer.from(e.dq,"base64")),t.unsignedInteger(n.Buffer.from(e.qi,"base64"))):(t.unsignedInteger(a),t.unsignedInteger(i));const o={key:t.end(),format:"der",type:"pkcs1"},u=r?(0,s.createPrivateKey)(o):(0,s.createPublicKey)(o);return(0,c.setModulusLength)(u,a.length<<3),u}case"EC":{const t=new l.default,r=void 0!==e.d,a=n.Buffer.concat([n.Buffer.alloc(1,4),n.Buffer.from(e.x,"base64"),n.Buffer.from(e.y,"base64")]);if(r){t.zero();const r=new l.default;r.oidFor("ecPublicKey"),r.oidFor(e.crv),t.add(r.end());const i=new l.default;i.one(),i.octStr(n.Buffer.from(e.d,"base64"));const c=new l.default;c.bitStr(a);const u=c.end(n.Buffer.from([161]));i.add(u);const d=i.end(),p=new l.default;p.add(d);const h=p.end(n.Buffer.from([4]));t.add(h);const f=t.end(),m=(0,s.createPrivateKey)({key:f,format:"der",type:"pkcs8"});return(0,o.setCurve)(m,e.crv),m}const i=new l.default;i.oidFor("ecPublicKey"),i.oidFor(e.crv),t.add(i.end()),t.bitStr(a);const c=t.end(),u=(0,s.createPublicKey)({key:c,format:"der",type:"spki"});return(0,o.setCurve)(u,e.crv),u}case"OKP":{const t=new l.default;if(void 0!==e.d){t.zero();const r=new l.default;r.oidFor(e.crv),t.add(r.end());const a=new l.default;a.octStr(n.Buffer.from(e.d,"base64"));const i=a.end(n.Buffer.from([4]));t.add(i);const o=t.end();return(0,s.createPrivateKey)({key:o,format:"der",type:"pkcs8"})}const r=new l.default;r.oidFor(e.crv),t.add(r.end()),t.bitStr(n.Buffer.from(e.x,"base64"));const a=t.end();return(0,s.createPublicKey)({key:a,format:"der",type:"spki"})}default:throw new i.JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(211),s=r(216),a=n.Buffer.from([0]),i=n.Buffer.from([2]),o=n.Buffer.from([3]),c=n.Buffer.from([48]),l=n.Buffer.from([4]),u=e=>{if(e<128)return n.Buffer.from([e]);const t=n.Buffer.alloc(5);t.writeUInt32BE(e,1);let r=1;for(;0===t[r];)r++;return t[r-1]=128|5-r,t.slice(r-1)},d=new Map([["P-256",n.Buffer.from("06 08 2A 86 48 CE 3D 03 01 07".replace(/ /g,""),"hex")],["secp256k1",n.Buffer.from("06 05 2B 81 04 00 0A".replace(/ /g,""),"hex")],["P-384",n.Buffer.from("06 05 2B 81 04 00 22".replace(/ /g,""),"hex")],["P-521",n.Buffer.from("06 05 2B 81 04 00 23".replace(/ /g,""),"hex")],["ecPublicKey",n.Buffer.from("06 07 2A 86 48 CE 3D 02 01".replace(/ /g,""),"hex")],["X25519",n.Buffer.from("06 03 2B 65 6E".replace(/ /g,""),"hex")],["X448",n.Buffer.from("06 03 2B 65 6F".replace(/ /g,""),"hex")],["Ed25519",n.Buffer.from("06 03 2B 65 70".replace(/ /g,""),"hex")],["Ed448",n.Buffer.from("06 03 2B 65 71".replace(/ /g,""),"hex")]]);t.default=class{constructor(){this.length=0,this.elements=[]}oidFor(e){const t=d.get(e);if(!t)throw new s.JOSENotSupported("Invalid or unsupported OID");this.elements.push(t),this.length+=t.length}zero(){this.elements.push(i,n.Buffer.from([1]),a),this.length+=3}one(){this.elements.push(i,n.Buffer.from([1]),n.Buffer.from([1])),this.length+=3}unsignedInteger(e){if(128&e[0]){const t=u(e.length+1);this.elements.push(i,t,a,e),this.length+=2+t.length+e.length}else{let t=0;for(;0===e[t]&&0==(128&e[t+1]);)t++;const r=u(e.length-t);this.elements.push(i,u(e.length-t),e.slice(t)),this.length+=1+r.length+e.length-t}}octStr(e){const t=u(e.length);this.elements.push(l,u(e.length),e),this.length+=1+t.length+e.length}bitStr(e){const t=u(e.length+1);this.elements.push(o,u(e.length+1),a,e),this.length+=1+t.length+e.length+1}add(e){this.elements.push(e),this.length+=e.length}end(e=c){const t=u(this.length);return n.Buffer.concat([e,t,...this.elements],1+t.length+this.length)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.jwkImport=t.jwkExport=t.rsaPssParams=t.oneShotCallback=void 0;const[r,n]=process.versions.node.split(".").map((e=>parseInt(e,10)));t.oneShotCallback=r>=16||15===r&&n>=13,t.rsaPssParams=!("electron"in process.versions)&&(r>=17||16===r&&n>=9),t.jwkExport=r>=16||15===r&&n>=9,t.jwkImport=r>=16||15===r&&n>=12},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(225),s=r(227);t.default=(e,t,r)=>{e.startsWith("HS")||"dir"===e||e.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(e)?((e,t)=>{if(!(t instanceof Uint8Array)){if(!(0,s.default)(t))throw new TypeError((0,n.withAlg)(e,t,...s.types,"Uint8Array"));if("secret"!==t.type)throw new TypeError(`${s.types.join(" or ")} instances for symmetric algorithms must be of type "secret"`)}})(e,t):((e,t,r)=>{if(!(0,s.default)(t))throw new TypeError((0,n.withAlg)(e,t,...s.types));if("secret"===t.type)throw new TypeError(`${s.types.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);if("sign"===r&&"public"===t.type)throw new TypeError(`${s.types.join(" or ")} instances for asymmetric algorithm signing must be of type "private"`);if("decrypt"===r&&"public"===t.type)throw new TypeError(`${s.types.join(" or ")} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&"verify"===r&&"private"===t.type)throw new TypeError(`${s.types.join(" or ")} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&"encrypt"===r&&"private"===t.type)throw new TypeError(`${s.types.join(" or ")} instances for asymmetric algorithm encryption must be of type "public"`)})(e,t,r)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.unwrap=t.wrap=void 0;const n=r(248),s=r(214),a=r(217),i=r(210);t.wrap=async function(e,t,r,s){const o=e.slice(0,7);s||(s=(0,a.default)(o));const{ciphertext:c,tag:l}=await(0,n.default)(o,r,t,s,new Uint8Array(0));return{encryptedKey:c,iv:(0,i.encode)(s),tag:(0,i.encode)(l)}},t.unwrap=async function(e,t,r,n,a){const i=e.slice(0,7);return(0,s.default)(i,t,r,n,a,new Uint8Array(0))}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(215),a=r(219),i=r(212),o=r(222),c=r(223),l=r(224),u=r(220),d=r(225),p=r(216),h=r(226),f=r(227);t.default=(e,t,r,m,g)=>{let y;if((0,c.isCryptoKey)(r))(0,l.checkEncCryptoKey)(r,e,"encrypt"),y=n.KeyObject.from(r);else{if(!(r instanceof Uint8Array||(0,u.default)(r)))throw new TypeError((0,d.default)(r,...f.types,"Uint8Array"));y=r}switch((0,a.default)(e,y),(0,s.default)(e,m),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return function(e,t,r,s,a){const c=parseInt(e.slice(1,4),10);(0,u.default)(r)&&(r=r.export());const l=r.subarray(c>>3),d=r.subarray(0,c>>3),f=`aes-${c}-cbc`;if(!(0,h.default)(f))throw new p.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);const m=(0,n.createCipheriv)(f,l,s),g=(0,i.concat)(m.update(t),m.final()),y=parseInt(e.slice(-3),10);return{ciphertext:g,tag:(0,o.default)(a,s,g,y,d,c)}}(e,t,y,m,g);case"A128GCM":case"A192GCM":case"A256GCM":return function(e,t,r,s,a){const i=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!(0,h.default)(i))throw new p.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);const o=(0,n.createCipheriv)(i,r,s,{authTagLength:16});a.byteLength&&o.setAAD(a,{plaintextLength:t.length});const c=o.update(t);return o.final(),{ciphertext:c,tag:o.getAuthTag()}}(e,t,y,m,g);default:throw new p.JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(216);t.default=function(e,t,r,s,a){if(void 0!==a.crit&&void 0===s.crit)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!s||void 0===s.crit)return new Set;if(!Array.isArray(s.crit)||0===s.crit.length||s.crit.some((e=>"string"!=typeof e||0===e.length)))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;i=void 0!==r?new Map([...Object.entries(r),...t.entries()]):t;for(const t of s.crit){if(!i.has(t))throw new n.JOSENotSupported(`Extension Header Parameter "${t}" is not recognized`);if(void 0===a[t])throw new e(`Extension Header Parameter "${t}" is missing`);if(i.get(t)&&void 0===s[t])throw new e(`Extension Header Parameter "${t}" MUST be integrity protected`)}return new Set(s.crit)}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=(e,t)=>{if(void 0!==t&&(!Array.isArray(t)||t.some((e=>"string"!=typeof e))))throw new TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generalDecrypt=void 0;const n=r(209),s=r(216),a=r(231);t.generalDecrypt=async function(e,t,r){if(!(0,a.default)(e))throw new s.JWEInvalid("General JWE must be an object");if(!Array.isArray(e.recipients)||!e.recipients.every(a.default))throw new s.JWEInvalid("JWE Recipients missing or incorrect type");if(!e.recipients.length)throw new s.JWEInvalid("JWE Recipients has no members");for(const s of e.recipients)try{return await(0,n.flattenedDecrypt)({aad:e.aad,ciphertext:e.ciphertext,encrypted_key:s.encrypted_key,header:s.header,iv:e.iv,protected:e.protected,tag:e.tag,unprotected:e.unprotected},t,r)}catch{}throw new s.JWEDecryptionFailed}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GeneralEncrypt=void 0;const n=r(253),s=r(216),a=r(240),i=r(230),o=r(254),c=r(210),l=r(249);class u{constructor(e,t,r){this.parent=e,this.key=t,this.options=r}setUnprotectedHeader(e){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=e,this}addRecipient(...e){return this.parent.addRecipient(...e)}encrypt(...e){return this.parent.encrypt(...e)}done(){return this.parent}}t.GeneralEncrypt=class{constructor(e){this._recipients=[],this._plaintext=e}addRecipient(e,t){const r=new u(this,e,{crit:null==t?void 0:t.crit});return this._recipients.push(r),r}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}async encrypt(e){var t,r,u;if(!this._recipients.length)throw new s.JWEInvalid("at least one recipient must be added");if(e={deflateRaw:null==e?void 0:e.deflateRaw},1===this._recipients.length){const[t]=this._recipients,r=await new n.FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(t.unprotectedHeader).encrypt(t.key,{...t.options,...e});let s={ciphertext:r.ciphertext,iv:r.iv,recipients:[{}],tag:r.tag};return r.aad&&(s.aad=r.aad),r.protected&&(s.protected=r.protected),r.unprotected&&(s.unprotected=r.unprotected),r.encrypted_key&&(s.recipients[0].encrypted_key=r.encrypted_key),r.header&&(s.recipients[0].header=r.header),s}let d;for(let e=0;e{Object.defineProperty(t,"__esModule",{value:!0}),t.FlattenedEncrypt=t.unprotected=void 0;const n=r(210),s=r(248),a=r(228),i=r(217),o=r(254),c=r(216),l=r(230),u=r(212),d=r(249);t.unprotected=Symbol();t.FlattenedEncrypt=class{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("plaintext must be an instance of Uint8Array");this._plaintext=e}setKeyManagementParameters(e){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._sharedUnprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}setContentEncryptionKey(e){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=e,this}async encrypt(e,r){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new c.JWEInvalid("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!(0,l.default)(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new c.JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");const p={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if((0,d.default)(c.JWEInvalid,new Map,null==r?void 0:r.crit,this._protectedHeader,p),void 0!==p.zip){if(!this._protectedHeader||!this._protectedHeader.zip)throw new c.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if("DEF"!==p.zip)throw new c.JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}const{alg:h,enc:f}=p;if("string"!=typeof h||!h)throw new c.JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof f||!f)throw new c.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let m,g,y,_,v,b,w;if("dir"===h){if(this._cek)throw new TypeError("setContentEncryptionKey cannot be called when using Direct Encryption")}else if("ECDH-ES"===h&&this._cek)throw new TypeError("setContentEncryptionKey cannot be called when using Direct Key Agreement");{let n;({cek:g,encryptedKey:m,parameters:n}=await(0,o.default)(h,f,e,this._cek,this._keyManagementParameters)),n&&(r&&t.unprotected in r?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...n}:this.setUnprotectedHeader(n):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...n}:this.setProtectedHeader(n))}if(this._iv||(this._iv=(0,i.default)(f)),_=this._protectedHeader?u.encoder.encode((0,n.encode)(JSON.stringify(this._protectedHeader))):u.encoder.encode(""),this._aad?(v=(0,n.encode)(this._aad),y=(0,u.concat)(_,u.encoder.encode("."),u.encoder.encode(v))):y=_,"DEF"===p.zip){const e=await((null==r?void 0:r.deflateRaw)||a.deflate)(this._plaintext);({ciphertext:b,tag:w}=await(0,s.default)(f,e,g,this._iv,y))}else({ciphertext:b,tag:w}=await(0,s.default)(f,this._plaintext,g,this._iv,y));const E={ciphertext:(0,n.encode)(b),iv:(0,n.encode)(this._iv),tag:(0,n.encode)(w)};return m&&(E.encrypted_key=(0,n.encode)(m)),v&&(E.aad=v),this._protectedHeader&&(E.protected=u.decoder.decode(_)),this._sharedUnprotectedHeader&&(E.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(E.header=this._unprotectedHeader),E}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(233),s=r(234),a=r(236),i=r(238),o=r(210),c=r(240),l=r(216),u=r(255),d=r(246),p=r(247);t.default=async function(e,t,r,h,f={}){let m,g,y;switch((0,d.default)(e,r,"encrypt"),e){case"dir":y=r;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!s.ecdhAllowed(r))throw new l.JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");const{apu:a,apv:i}=f;let{epk:d}=f;d||(d=(await s.generateEpk(r)).privateKey);const{x:p,y:_,crv:v,kty:b}=await(0,u.exportJWK)(d),w=await s.deriveKey(r,d,"ECDH-ES"===e?t:e,"ECDH-ES"===e?(0,c.bitLength)(t):parseInt(e.slice(-5,-2),10),a,i);if(g={epk:{x:p,crv:v,kty:b}},"EC"===b&&(g.epk.y=_),a&&(g.apu=(0,o.encode)(a)),i&&(g.apv=(0,o.encode)(i)),"ECDH-ES"===e){y=w;break}y=h||(0,c.default)(t);const E=e.slice(-6);m=await(0,n.wrap)(E,w,y);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":y=h||(0,c.default)(t),m=await(0,i.encrypt)(e,r,y);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{y=h||(0,c.default)(t);const{p2c:n,p2s:s}=f;({encryptedKey:m,...g}=await(0,a.encrypt)(e,r,y,n,s));break}case"A128KW":case"A192KW":case"A256KW":y=h||(0,c.default)(t),m=await(0,n.wrap)(e,r,y);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{y=h||(0,c.default)(t);const{iv:n}=f;({encryptedKey:m,...g}=await(0,p.wrap)(e,r,y,n));break}default:throw new l.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek:y,encryptedKey:m,parameters:g}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.exportJWK=t.exportPKCS8=t.exportSPKI=void 0;const n=r(242),s=r(242),a=r(256);t.exportSPKI=async function(e){return(0,n.toSPKI)(e)},t.exportPKCS8=async function(e){return(0,s.toPKCS8)(e)},t.exportJWK=async function(e){return(0,a.default)(e)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(210),a=r(257),i=r(216),o=r(235),c=r(223),l=r(220),u=r(225),d=r(227),p=r(245),h=e=>{let t;if((0,c.isCryptoKey)(e)){if(!e.extractable)throw new TypeError("CryptoKey is not extractable");t=n.KeyObject.from(e)}else{if(!(0,l.default)(e)){if(e instanceof Uint8Array)return{kty:"oct",k:(0,s.encode)(e)};throw new TypeError((0,u.default)(e,...d.types,"Uint8Array"))}t=e}if(p.jwkExport){if("secret"!==t.type&&!["rsa","ec","ed25519","x25519","ed448","x448"].includes(t.asymmetricKeyType))throw new i.JOSENotSupported("Unsupported key asymmetricKeyType");return t.export({format:"jwk"})}switch(t.type){case"secret":return{kty:"oct",k:(0,s.encode)(t.export())};case"private":case"public":switch(t.asymmetricKeyType){case"rsa":{const e=t.export({format:"der",type:"pkcs1"}),r=new a.default(e);"private"===t.type&&r.unsignedInteger();const n=(0,s.encode)(r.unsignedInteger()),i=(0,s.encode)(r.unsignedInteger());let o;return"private"===t.type&&(o={d:(0,s.encode)(r.unsignedInteger()),p:(0,s.encode)(r.unsignedInteger()),q:(0,s.encode)(r.unsignedInteger()),dp:(0,s.encode)(r.unsignedInteger()),dq:(0,s.encode)(r.unsignedInteger()),qi:(0,s.encode)(r.unsignedInteger())}),r.end(),{kty:"RSA",n,e:i,...o}}case"ec":{const e=(0,o.default)(t);let r,a,c;switch(e){case"secp256k1":r=64,a=33,c=-1;break;case"P-256":r=64,a=36,c=-1;break;case"P-384":r=96,a=35,c=-3;break;case"P-521":r=132,a=35,c=-3;break;default:throw new i.JOSENotSupported("Unsupported curve")}if("public"===t.type){const n=t.export({type:"spki",format:"der"});return{kty:"EC",crv:e,x:(0,s.encode)(n.subarray(-r,-r/2)),y:(0,s.encode)(n.subarray(-r/2))}}const l=t.export({type:"pkcs8",format:"der"});return l.length<100&&(a+=c),{...h((0,n.createPublicKey)(t)),d:(0,s.encode)(l.subarray(a,a+r/2))}}case"ed25519":case"x25519":{const e=(0,o.default)(t);if("public"===t.type){const r=t.export({type:"spki",format:"der"});return{kty:"OKP",crv:e,x:(0,s.encode)(r.subarray(-32))}}const r=t.export({type:"pkcs8",format:"der"});return{...h((0,n.createPublicKey)(t)),d:(0,s.encode)(r.subarray(-32))}}case"ed448":case"x448":{const e=(0,o.default)(t);if("public"===t.type){const r=t.export({type:"spki",format:"der"});return{kty:"OKP",crv:e,x:(0,s.encode)(r.subarray("Ed448"===e?-57:-56))}}const r=t.export({type:"pkcs8",format:"der"});return{...h((0,n.createPublicKey)(t)),d:(0,s.encode)(r.subarray("Ed448"===e?-57:-56))}}default:throw new i.JOSENotSupported("Unsupported key asymmetricKeyType")}default:throw new i.JOSENotSupported("Unsupported key type")}};t.default=h},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e){if(48!==e[0])throw new TypeError;this.buffer=e,this.offset=1;if(this.decodeLength()!==e.length-this.offset)throw new TypeError}decodeLength(){let e=this.buffer[this.offset++];if(128&e){const t=-129&e;e=0;for(let r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.compactVerify=void 0;const n=r(259),s=r(216),a=r(212);t.compactVerify=async function(e,t,r){if(e instanceof Uint8Array&&(e=a.decoder.decode(e)),"string"!=typeof e)throw new s.JWSInvalid("Compact JWS must be a string or Uint8Array");const{0:i,1:o,2:c,length:l}=e.split(".");if(3!==l)throw new s.JWSInvalid("Invalid Compact JWS");const u=await(0,n.flattenedVerify)({payload:o,protected:i,signature:c},t,r),d={payload:u.payload,protectedHeader:u.protectedHeader};return"function"==typeof t?{...d,key:u.key}:d}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.flattenedVerify=void 0;const n=r(210),s=r(260),a=r(216),i=r(212),o=r(230),c=r(231),l=r(246),u=r(249),d=r(250);t.flattenedVerify=async function(e,t,r){var p;if(!(0,c.default)(e))throw new a.JWSInvalid("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new a.JWSInvalid('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new a.JWSInvalid("JWS Protected Header incorrect type");if(void 0===e.payload)throw new a.JWSInvalid("JWS Payload missing");if("string"!=typeof e.signature)throw new a.JWSInvalid("JWS Signature missing or incorrect type");if(void 0!==e.header&&!(0,c.default)(e.header))throw new a.JWSInvalid("JWS Unprotected Header incorrect type");let h={};if(e.protected)try{const t=(0,n.decode)(e.protected);h=JSON.parse(i.decoder.decode(t))}catch{throw new a.JWSInvalid("JWS Protected Header is invalid")}if(!(0,o.default)(h,e.header))throw new a.JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const f={...h,...e.header};let m=!0;if((0,u.default)(a.JWSInvalid,new Map([["b64",!0]]),null==r?void 0:r.crit,h,f).has("b64")&&(m=h.b64,"boolean"!=typeof m))throw new a.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:g}=f;if("string"!=typeof g||!g)throw new a.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');const y=r&&(0,d.default)("algorithms",r.algorithms);if(y&&!y.has(g))throw new a.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');if(m){if("string"!=typeof e.payload)throw new a.JWSInvalid("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new a.JWSInvalid("JWS Payload must be a string or an Uint8Array instance");let _=!1;"function"==typeof t&&(t=await t(h,e),_=!0),(0,l.default)(g,t,"verify");const v=(0,i.concat)(i.encoder.encode(null!==(p=e.protected)&&void 0!==p?p:""),i.encoder.encode("."),"string"==typeof e.payload?i.encoder.encode(e.payload):e.payload);let b,w;try{b=(0,n.decode)(e.signature)}catch{throw new a.JWSInvalid("Failed to base64url decode the signature")}if(!await(0,s.default)(g,t,b,v))throw new a.JWSSignatureVerificationFailed;if(m)try{w=(0,n.decode)(e.payload)}catch{throw new a.JWSInvalid("Failed to base64url decode the payload")}else w="string"==typeof e.payload?i.encoder.encode(e.payload):e.payload;const E={payload:w};return void 0!==e.protected&&(E.protectedHeader=h),void 0!==e.header&&(E.unprotectedHeader=e.header),_?{...E,key:t}:E}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(101),a=r(261),i=r(262),o=r(263),c=r(265),l=r(245);let u;u=n.verify.length>4&&l.oneShotCallback?(0,s.promisify)(n.verify):n.verify;t.default=async(e,t,r,s)=>{const l=(0,c.default)(e,t,"verify");if(e.startsWith("HS")){const t=await(0,o.default)(e,l,s),a=r;try{return n.timingSafeEqual(a,t)}catch{return!1}}const d=(0,a.default)(e),p=(0,i.default)(e,l);try{return await u(d,s,p,r)}catch{return!1}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(216);t.default=function(e){switch(e){case"PS256":case"RS256":case"ES256":case"ES256K":return"sha256";case"PS384":case"RS384":case"ES384":return"sha384";case"PS512":case"RS512":case"ES512":return"sha512";case"EdDSA":return;default:throw new n.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(235),a=r(216),i=r(239),o=r(245),c={padding:n.constants.RSA_PKCS1_PSS_PADDING,saltLength:n.constants.RSA_PSS_SALTLEN_DIGEST},l=new Map([["ES256","P-256"],["ES256K","secp256k1"],["ES384","P-384"],["ES512","P-521"]]);t.default=function(e,t){switch(e){case"EdDSA":if(!["ed25519","ed448"].includes(t.asymmetricKeyType))throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be ed25519 or ed448");return t;case"RS256":case"RS384":case"RS512":if("rsa"!==t.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");return(0,i.default)(t,e),t;case o.rsaPssParams&&"PS256":case o.rsaPssParams&&"PS384":case o.rsaPssParams&&"PS512":if("rsa-pss"===t.asymmetricKeyType){const{hashAlgorithm:r,mgf1HashAlgorithm:n,saltLength:s}=t.asymmetricKeyDetails,a=parseInt(e.slice(-3),10);if(void 0!==r&&(r!==`sha${a}`||n!==r))throw new TypeError(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}`);if(void 0!==s&&s>a>>3)throw new TypeError(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}`)}else if("rsa"!==t.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa or rsa-pss");return(0,i.default)(t,e),{key:t,...c};case!o.rsaPssParams&&"PS256":case!o.rsaPssParams&&"PS384":case!o.rsaPssParams&&"PS512":if("rsa"!==t.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");return(0,i.default)(t,e),{key:t,...c};case"ES256":case"ES256K":case"ES384":case"ES512":{if("ec"!==t.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be ec");const r=(0,s.default)(t),n=l.get(e);if(r!==n)throw new TypeError(`Invalid key curve for the algorithm, its curve must be ${n}, got ${r}`);return{dsaEncoding:"ieee-p1363",key:t}}default:throw new a.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(101),a=r(261),i=r(264),o=r(262),c=r(265);let l;l=n.sign.length>3?(0,s.promisify)(n.sign):n.sign;t.default=async(e,t,r)=>{const s=(0,c.default)(e,t,"sign");if(e.startsWith("HS")){const t=n.createHmac((0,i.default)(e),s);return t.update(r),t.digest()}return l((0,a.default)(e),r,(0,o.default)(e,s))}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(216);t.default=function(e){switch(e){case"HS256":return"sha256";case"HS384":return"sha384";case"HS512":return"sha512";default:throw new n.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(100),s=r(223),a=r(224),i=r(225),o=r(227);t.default=function(e,t,r){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError((0,i.default)(t,...o.types));return(0,n.createSecretKey)(t)}if(t instanceof n.KeyObject)return t;if((0,s.isCryptoKey)(t))return(0,a.checkSigCryptoKey)(t,e,r),n.KeyObject.from(t);throw new TypeError((0,i.default)(t,...o.types,"Uint8Array"))}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generalVerify=void 0;const n=r(259),s=r(216),a=r(231);t.generalVerify=async function(e,t,r){if(!(0,a.default)(e))throw new s.JWSInvalid("General JWS must be an object");if(!Array.isArray(e.signatures)||!e.signatures.every(a.default))throw new s.JWSInvalid("JWS Signatures missing or incorrect type");for(const s of e.signatures)try{return await(0,n.flattenedVerify)({header:s.header,payload:e.payload,protected:s.protected,signature:s.signature},t,r)}catch{}throw new s.JWSSignatureVerificationFailed}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.jwtVerify=void 0;const n=r(258),s=r(268),a=r(216);t.jwtVerify=async function(e,t,r){var i;const o=await(0,n.compactVerify)(e,t,r);if((null===(i=o.protectedHeader.crit)||void 0===i?void 0:i.includes("b64"))&&!1===o.protectedHeader.b64)throw new a.JWTInvalid("JWTs MUST NOT use unencoded payload");const c={payload:(0,s.default)(o.protectedHeader,o.payload,r),protectedHeader:o.protectedHeader};return"function"==typeof t?{...c,key:o.key}:c}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(216),s=r(212),a=r(269),i=r(270),o=r(231),c=e=>e.toLowerCase().replace(/^application\//,"");t.default=(e,t,r={})=>{const{typ:l}=r;if(l&&("string"!=typeof e.typ||c(e.typ)!==c(l)))throw new n.JWTClaimValidationFailed('unexpected "typ" JWT header value',"typ","check_failed");let u;try{u=JSON.parse(s.decoder.decode(t))}catch{}if(!(0,o.default)(u))throw new n.JWTInvalid("JWT Claims Set must be a top-level JSON object");const{requiredClaims:d=[],issuer:p,subject:h,audience:f,maxTokenAge:m}=r;void 0!==m&&d.push("iat"),void 0!==f&&d.push("aud"),void 0!==h&&d.push("sub"),void 0!==p&&d.push("iss");for(const e of new Set(d.reverse()))if(!(e in u))throw new n.JWTClaimValidationFailed(`missing required "${e}" claim`,e,"missing");if(p&&!(Array.isArray(p)?p:[p]).includes(u.iss))throw new n.JWTClaimValidationFailed('unexpected "iss" claim value',"iss","check_failed");if(h&&u.sub!==h)throw new n.JWTClaimValidationFailed('unexpected "sub" claim value',"sub","check_failed");if(f&&(g=u.aud,y="string"==typeof f?[f]:f,!("string"==typeof g?y.includes(g):Array.isArray(g)&&y.some(Set.prototype.has.bind(new Set(g))))))throw new n.JWTClaimValidationFailed('unexpected "aud" claim value',"aud","check_failed");var g,y;let _;switch(typeof r.clockTolerance){case"string":_=(0,i.default)(r.clockTolerance);break;case"number":_=r.clockTolerance;break;case"undefined":_=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:v}=r,b=(0,a.default)(v||new Date);if((void 0!==u.iat||m)&&"number"!=typeof u.iat)throw new n.JWTClaimValidationFailed('"iat" claim must be a number',"iat","invalid");if(void 0!==u.nbf){if("number"!=typeof u.nbf)throw new n.JWTClaimValidationFailed('"nbf" claim must be a number',"nbf","invalid");if(u.nbf>b+_)throw new n.JWTClaimValidationFailed('"nbf" claim timestamp check failed',"nbf","check_failed")}if(void 0!==u.exp){if("number"!=typeof u.exp)throw new n.JWTClaimValidationFailed('"exp" claim must be a number',"exp","invalid");if(u.exp<=b-_)throw new n.JWTExpired('"exp" claim timestamp check failed',"exp","check_failed")}if(m){const e=b-u.iat;if(e-_>("number"==typeof m?m:(0,i.default)(m)))throw new n.JWTExpired('"iat" claim timestamp check failed (too far in the past)',"iat","check_failed");if(e<0-_)throw new n.JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)',"iat","check_failed")}return u}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=e=>Math.floor(e.getTime()/1e3)},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});const r=86400,n=/^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i;t.default=e=>{const t=n.exec(e);if(!t)throw new TypeError("Invalid time period format");const s=parseFloat(t[1]);switch(t[2].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":return Math.round(s);case"minute":case"minutes":case"min":case"mins":case"m":return Math.round(60*s);case"hour":case"hours":case"hr":case"hrs":case"h":return Math.round(3600*s);case"day":case"days":case"d":return Math.round(s*r);case"week":case"weeks":case"w":return Math.round(604800*s);default:return Math.round(31557600*s)}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.jwtDecrypt=void 0;const n=r(208),s=r(268),a=r(216);t.jwtDecrypt=async function(e,t,r){const i=await(0,n.compactDecrypt)(e,t,r),o=(0,s.default)(i.protectedHeader,i.plaintext,r),{protectedHeader:c}=i;if(void 0!==c.iss&&c.iss!==o.iss)throw new a.JWTClaimValidationFailed('replicated "iss" claim header parameter mismatch',"iss","mismatch");if(void 0!==c.sub&&c.sub!==o.sub)throw new a.JWTClaimValidationFailed('replicated "sub" claim header parameter mismatch',"sub","mismatch");if(void 0!==c.aud&&JSON.stringify(c.aud)!==JSON.stringify(o.aud))throw new a.JWTClaimValidationFailed('replicated "aud" claim header parameter mismatch',"aud","mismatch");const l={payload:o,protectedHeader:c};return"function"==typeof t?{...l,key:i.key}:l}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CompactEncrypt=void 0;const n=r(253);t.CompactEncrypt=class{constructor(e){this._flattened=new n.FlattenedEncrypt(e)}setContentEncryptionKey(e){return this._flattened.setContentEncryptionKey(e),this}setInitializationVector(e){return this._flattened.setInitializationVector(e),this}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}setKeyManagementParameters(e){return this._flattened.setKeyManagementParameters(e),this}async encrypt(e,t){const r=await this._flattened.encrypt(e,t);return[r.protected,r.encrypted_key,r.iv,r.ciphertext,r.tag].join(".")}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CompactSign=void 0;const n=r(274);t.CompactSign=class{constructor(e){this._flattened=new n.FlattenedSign(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,t){const r=await this._flattened.sign(e,t);if(void 0===r.payload)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FlattenedSign=void 0;const n=r(210),s=r(263),a=r(230),i=r(216),o=r(212),c=r(246),l=r(249);t.FlattenedSign=class{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}async sign(e,t){if(!this._protectedHeader&&!this._unprotectedHeader)throw new i.JWSInvalid("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!(0,a.default)(this._protectedHeader,this._unprotectedHeader))throw new i.JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const r={...this._protectedHeader,...this._unprotectedHeader};let u=!0;if((0,l.default)(i.JWSInvalid,new Map([["b64",!0]]),null==t?void 0:t.crit,this._protectedHeader,r).has("b64")&&(u=this._protectedHeader.b64,"boolean"!=typeof u))throw new i.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:d}=r;if("string"!=typeof d||!d)throw new i.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');(0,c.default)(d,e,"sign");let p,h=this._payload;u&&(h=o.encoder.encode((0,n.encode)(h))),p=this._protectedHeader?o.encoder.encode((0,n.encode)(JSON.stringify(this._protectedHeader))):o.encoder.encode("");const f=(0,o.concat)(p,o.encoder.encode("."),h),m=await(0,s.default)(d,e,f),g={signature:(0,n.encode)(m),payload:""};return u&&(g.payload=o.decoder.decode(h)),this._unprotectedHeader&&(g.header=this._unprotectedHeader),this._protectedHeader&&(g.protected=o.decoder.decode(p)),g}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GeneralSign=void 0;const n=r(274),s=r(216);class a{constructor(e,t,r){this.parent=e,this.key=t,this.options=r}setProtectedHeader(e){if(this.protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this.protectedHeader=e,this}setUnprotectedHeader(e){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=e,this}addSignature(...e){return this.parent.addSignature(...e)}sign(...e){return this.parent.sign(...e)}done(){return this.parent}}t.GeneralSign=class{constructor(e){this._signatures=[],this._payload=e}addSignature(e,t){const r=new a(this,e,t);return this._signatures.push(r),r}async sign(){if(!this._signatures.length)throw new s.JWSInvalid("at least one signature must be added");const e={signatures:[],payload:""};for(let t=0;t{Object.defineProperty(t,"__esModule",{value:!0}),t.SignJWT=void 0;const n=r(273),s=r(216),a=r(212),i=r(277);class o extends i.ProduceJWT{setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,t){var r;const i=new n.CompactSign(a.encoder.encode(JSON.stringify(this._payload)));if(i.setProtectedHeader(this._protectedHeader),Array.isArray(null===(r=this._protectedHeader)||void 0===r?void 0:r.crit)&&this._protectedHeader.crit.includes("b64")&&!1===this._protectedHeader.b64)throw new s.JWTInvalid("JWTs MUST NOT use unencoded payload");return i.sign(e,t)}}t.SignJWT=o},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ProduceJWT=void 0;const n=r(269),s=r(231),a=r(270);t.ProduceJWT=class{constructor(e){if(!(0,s.default)(e))throw new TypeError("JWT Claims Set MUST be an object");this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return this._payload="number"==typeof e?{...this._payload,nbf:e}:{...this._payload,nbf:(0,n.default)(new Date)+(0,a.default)(e)},this}setExpirationTime(e){return this._payload="number"==typeof e?{...this._payload,exp:e}:{...this._payload,exp:(0,n.default)(new Date)+(0,a.default)(e)},this}setIssuedAt(e){return this._payload=void 0===e?{...this._payload,iat:(0,n.default)(new Date)}:{...this._payload,iat:e},this}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EncryptJWT=void 0;const n=r(272),s=r(212),a=r(277);class i extends a.ProduceJWT{setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setKeyManagementParameters(e){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setContentEncryptionKey(e){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=e,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(e,t){const r=new n.CompactEncrypt(s.encoder.encode(JSON.stringify(this._payload)));return this._replicateIssuerAsHeader&&(this._protectedHeader={...this._protectedHeader,iss:this._payload.iss}),this._replicateSubjectAsHeader&&(this._protectedHeader={...this._protectedHeader,sub:this._payload.sub}),this._replicateAudienceAsHeader&&(this._protectedHeader={...this._protectedHeader,aud:this._payload.aud}),r.setProtectedHeader(this._protectedHeader),this._iv&&r.setInitializationVector(this._iv),this._cek&&r.setContentEncryptionKey(this._cek),this._keyManagementParameters&&r.setKeyManagementParameters(this._keyManagementParameters),r.encrypt(e,t)}}t.EncryptJWT=i},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.calculateJwkThumbprintUri=t.calculateJwkThumbprint=void 0;const n=r(213),s=r(210),a=r(216),i=r(212),o=r(231),c=(e,t)=>{if("string"!=typeof e||!e)throw new a.JWKInvalid(`${t} missing or invalid`)};async function l(e,t){if(!(0,o.default)(e))throw new TypeError("JWK must be an object");if(null!=t||(t="sha256"),"sha256"!==t&&"sha384"!==t&&"sha512"!==t)throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let r;switch(e.kty){case"EC":c(e.crv,'"crv" (Curve) Parameter'),c(e.x,'"x" (X Coordinate) Parameter'),c(e.y,'"y" (Y Coordinate) Parameter'),r={crv:e.crv,kty:e.kty,x:e.x,y:e.y};break;case"OKP":c(e.crv,'"crv" (Subtype of Key Pair) Parameter'),c(e.x,'"x" (Public Key) Parameter'),r={crv:e.crv,kty:e.kty,x:e.x};break;case"RSA":c(e.e,'"e" (Exponent) Parameter'),c(e.n,'"n" (Modulus) Parameter'),r={e:e.e,kty:e.kty,n:e.n};break;case"oct":c(e.k,'"k" (Key Value) Parameter'),r={k:e.k,kty:e.kty};break;default:throw new a.JOSENotSupported('"kty" (Key Type) Parameter missing or unsupported')}const l=i.encoder.encode(JSON.stringify(r));return(0,s.encode)(await(0,n.default)(t,l))}t.calculateJwkThumbprint=l,t.calculateJwkThumbprintUri=async function(e,t){null!=t||(t="sha256");const r=await l(e,t);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${t.slice(-3)}:${r}`}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EmbeddedJWK=void 0;const n=r(241),s=r(231),a=r(216);t.EmbeddedJWK=async function(e,t){const r={...e,...null==t?void 0:t.header};if(!(0,s.default)(r.jwk))throw new a.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a JSON object');const i=await(0,n.importJWK)({...r.jwk,ext:!0},r.alg,!0);if(i instanceof Uint8Array||"public"!==i.type)throw new a.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a public key');return i}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createLocalJWKSet=t.LocalJWKSet=t.isJWKSLike=void 0;const n=r(241),s=r(216),a=r(231);function i(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(o)}function o(e){return(0,a.default)(e)}t.isJWKSLike=i;class c{constructor(e){if(this._cached=new WeakMap,!i(e))throw new s.JWKSInvalid("JSON Web Key Set malformed");var t;this._jwks=(t=e,"function"==typeof structuredClone?structuredClone(t):JSON.parse(JSON.stringify(t)))}async getKey(e,t){const{alg:r,kid:n}={...e,...null==t?void 0:t.header},a=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new s.JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set')}}(r),i=this._jwks.keys.filter((e=>{let t=a===e.kty;if(t&&"string"==typeof n&&(t=n===e.kid),t&&"string"==typeof e.alg&&(t=r===e.alg),t&&"string"==typeof e.use&&(t="sig"===e.use),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes("verify")),t&&"EdDSA"===r&&(t="Ed25519"===e.crv||"Ed448"===e.crv),t)switch(r){case"ES256":t="P-256"===e.crv;break;case"ES256K":t="secp256k1"===e.crv;break;case"ES384":t="P-384"===e.crv;break;case"ES512":t="P-521"===e.crv}return t})),{0:o,length:c}=i;if(0===c)throw new s.JWKSNoMatchingKey;if(1!==c){const e=new s.JWKSMultipleMatchingKeys,{_cached:t}=this;throw e[Symbol.asyncIterator]=async function*(){for(const e of i)try{yield await l(t,e,r)}catch{continue}},e}return l(this._cached,o,r)}}async function l(e,t,r){const a=e.get(t)||e.set(t,{}).get(t);if(void 0===a[r]){const e=await(0,n.importJWK)({...t,ext:!0},r);if(e instanceof Uint8Array||"public"!==e.type)throw new s.JWKSInvalid("JSON Web Key Set members must be public keys");a[r]=e}return a[r]}t.LocalJWKSet=c,t.createLocalJWKSet=function(e){const t=new c(e);return async function(e,r){return t.getKey(e,r)}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createRemoteJWKSet=void 0;const n=r(283),s=r(216),a=r(281);class i extends a.LocalJWKSet{constructor(e,t){if(super({keys:[]}),this._jwks=void 0,!(e instanceof URL))throw new TypeError("url must be an instance of URL");this._url=new URL(e.href),this._options={agent:null==t?void 0:t.agent,headers:null==t?void 0:t.headers},this._timeoutDuration="number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3,this._cooldownDuration="number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4,this._cacheMaxAge="number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5}coolingDown(){return"number"==typeof this._jwksTimestamp&&Date.now(){if(!(0,a.isJWKSLike)(e))throw new s.JWKSInvalid("JSON Web Key Set malformed");this._jwks={keys:e.keys},this._jwksTimestamp=Date.now(),this._pendingFetch=void 0})).catch((e=>{throw this._pendingFetch=void 0,e}))),await this._pendingFetch}}t.createRemoteJWKSet=function(e,t){const r=new i(e,t);return async function(e,t){return r.getKey(e,t)}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(284),s=r(285),a=r(286),i=r(216),o=r(212);t.default=async(e,t,r)=>{let c;switch(e.protocol){case"https:":c=s.get;break;case"http:":c=n.get;break;default:throw new TypeError("Unsupported URL protocol.")}const{agent:l,headers:u}=r,d=c(e.href,{agent:l,timeout:t,headers:u}),[p]=await Promise.race([(0,a.once)(d,"response"),(0,a.once)(d,"timeout")]);if(!p)throw d.destroy(),new i.JWKSTimeout;if(200!==p.statusCode)throw new i.JOSEError("Expected 200 OK from the JSON Web Key Set HTTP response");const h=[];for await(const e of p)h.push(e);try{return JSON.parse(o.decoder.decode((0,o.concat)(...h)))}catch{throw new i.JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON")}}},e=>{e.exports=require("http")},e=>{e.exports=require("https")},e=>{e.exports=require("events")},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnsecuredJWT=void 0;const n=r(210),s=r(212),a=r(216),i=r(268),o=r(277);class c extends o.ProduceJWT{encode(){return`${n.encode(JSON.stringify({alg:"none"}))}.${n.encode(JSON.stringify(this._payload))}.`}static decode(e,t){if("string"!=typeof e)throw new a.JWTInvalid("Unsecured JWT must be a string");const{0:r,1:o,2:c,length:l}=e.split(".");if(3!==l||""!==c)throw new a.JWTInvalid("Invalid Unsecured JWT");let u;try{if(u=JSON.parse(s.decoder.decode(n.decode(r))),"none"!==u.alg)throw new Error}catch{throw new a.JWTInvalid("Invalid Unsecured JWT")}return{payload:(0,i.default)(u,n.decode(o),t),header:u}}}t.UnsecuredJWT=c},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decodeProtectedHeader=void 0;const n=r(289),s=r(212),a=r(231);t.decodeProtectedHeader=function(e){let t;if("string"==typeof e){const r=e.split(".");3!==r.length&&5!==r.length||([t]=r)}else if("object"==typeof e&&e){if(!("protected"in e))throw new TypeError("Token does not contain a Protected Header");t=e.protected}try{if("string"!=typeof t||!t)throw new Error;const e=JSON.parse(s.decoder.decode((0,n.decode)(t)));if(!(0,a.default)(e))throw new Error;return e}catch{throw new TypeError("Invalid Token or Protected Header formatting")}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=void 0;const n=r(210);t.encode=n.encode,t.decode=n.decode},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decodeJwt=void 0;const n=r(289),s=r(212),a=r(231),i=r(216);t.decodeJwt=function(e){if("string"!=typeof e)throw new i.JWTInvalid("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:r}=e.split(".");if(5===r)throw new i.JWTInvalid("Only JWTs using Compact JWS serialization can be decoded");if(3!==r)throw new i.JWTInvalid("Invalid JWT");if(!t)throw new i.JWTInvalid("JWTs must contain a payload");let o,c;try{o=(0,n.decode)(t)}catch{throw new i.JWTInvalid("Failed to base64url decode the payload")}try{c=JSON.parse(s.decoder.decode(o))}catch{throw new i.JWTInvalid("Failed to parse the decoded payload as JSON")}if(!(0,a.default)(c))throw new i.JWTInvalid("Invalid JWT Claims Set");return c}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generateKeyPair=void 0;const n=r(292);t.generateKeyPair=async function(e,t){return(0,n.generateKeyPair)(e,t)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generateKeyPair=t.generateSecret=void 0;const n=r(100),s=r(101),a=r(218),i=r(239),o=r(216),c=(0,s.promisify)(n.generateKeyPair);t.generateSecret=async function(e,t){let r;switch(e){case"HS256":case"HS384":case"HS512":case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":r=parseInt(e.slice(-3),10);break;case"A128KW":case"A192KW":case"A256KW":case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":r=parseInt(e.slice(1,4),10);break;default:throw new o.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return(0,n.createSecretKey)((0,a.default)(new Uint8Array(r>>3)))},t.generateKeyPair=async function(e,t){var r,n;switch(e){case"RS256":case"RS384":case"RS512":case"PS256":case"PS384":case"PS512":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":case"RSA1_5":{const e=null!==(r=null==t?void 0:t.modulusLength)&&void 0!==r?r:2048;if("number"!=typeof e||e<2048)throw new o.JOSENotSupported("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");const n=await c("rsa",{modulusLength:e,publicExponent:65537});return(0,i.setModulusLength)(n.privateKey,e),(0,i.setModulusLength)(n.publicKey,e),n}case"ES256":return c("ec",{namedCurve:"P-256"});case"ES256K":return c("ec",{namedCurve:"secp256k1"});case"ES384":return c("ec",{namedCurve:"P-384"});case"ES512":return c("ec",{namedCurve:"P-521"});case"EdDSA":switch(null==t?void 0:t.crv){case void 0:case"Ed25519":return c("ed25519");case"Ed448":return c("ed448");default:throw new o.JOSENotSupported("Invalid or unsupported crv option provided, supported values are Ed25519 and Ed448")}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":const e=null!==(n=null==t?void 0:t.crv)&&void 0!==n?n:"P-256";switch(e){case void 0:case"P-256":case"P-384":case"P-521":return c("ec",{namedCurve:e});case"X25519":return c("x25519");case"X448":return c("x448");default:throw new o.JOSENotSupported("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448")}default:throw new o.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generateSecret=void 0;const n=r(292);t.generateSecret=async function(e,t){return(0,n.generateSecret)(e,t)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(295);t.default=n.default},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default="node:crypto"},(e,t,r)=>{r.r(t),r.d(t,{NIL:()=>o.default,parse:()=>d.default,stringify:()=>u.default,v1:()=>n.default,v3:()=>s.default,v4:()=>a.default,v5:()=>i.default,validate:()=>l.default,version:()=>c.default});var n=r(297),s=r(302),a=r(306),i=r(308),o=r(310),c=r(311),l=r(300),u=r(299),d=r(304)},(e,t,r)=>{r.r(t),r.d(t,{default:()=>l});var n=r(298),s=r(299);let a,i,o=0,c=0;const l=function(e,t,r){let l=t&&r||0;const u=t||new Array(16);let d=(e=e||{}).node||a,p=void 0!==e.clockseq?e.clockseq:i;if(null==d||null==p){const t=e.random||(e.rng||n.default)();null==d&&(d=a=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==p&&(p=i=16383&(t[6]<<8|t[7]))}let h=void 0!==e.msecs?e.msecs:Date.now(),f=void 0!==e.nsecs?e.nsecs:c+1;const m=h-o+(f-c)/1e4;if(m<0&&void 0===e.clockseq&&(p=p+1&16383),(m<0||h>o)&&void 0===e.nsecs&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");o=h,c=f,i=p,h+=122192928e5;const g=(1e4*(268435455&h)+f)%4294967296;u[l++]=g>>>24&255,u[l++]=g>>>16&255,u[l++]=g>>>8&255,u[l++]=255&g;const y=h/4294967296*1e4&268435455;u[l++]=y>>>8&255,u[l++]=255&y,u[l++]=y>>>24&15|16,u[l++]=y>>>16&255,u[l++]=p>>>8|128,u[l++]=255&p;for(let e=0;e<6;++e)u[l+e]=d[e];return t||(0,s.unsafeStringify)(u)}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>o});var n=r(100),s=r.n(n);const a=new Uint8Array(256);let i=a.length;function o(){return i>a.length-16&&(s().randomFillSync(a),i=0),a.slice(i,i+=16)}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i,unsafeStringify:()=>a});var n=r(300);const s=[];for(let e=0;e<256;++e)s.push((e+256).toString(16).slice(1));function a(e,t=0){return s[e[t+0]]+s[e[t+1]]+s[e[t+2]]+s[e[t+3]]+"-"+s[e[t+4]]+s[e[t+5]]+"-"+s[e[t+6]]+s[e[t+7]]+"-"+s[e[t+8]]+s[e[t+9]]+"-"+s[e[t+10]]+s[e[t+11]]+s[e[t+12]]+s[e[t+13]]+s[e[t+14]]+s[e[t+15]]}const i=function(e,t=0){const r=a(e,t);if(!(0,n.default)(r))throw TypeError("Stringified UUID is invalid");return r}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>s});var n=r(301);const s=function(e){return"string"==typeof e&&n.default.test(e)}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});const n=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var n=r(303),s=r(305);const a=(0,n.default)("v3",48,s.default)},(e,t,r)=>{r.r(t),r.d(t,{DNS:()=>a,URL:()=>i,default:()=>o});var n=r(299),s=r(304);const a="6ba7b810-9dad-11d1-80b4-00c04fd430c8",i="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function o(e,t,r){function o(e,a,i,o){var c;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let r=0;r{r.r(t),r.d(t,{default:()=>s});var n=r(300);const s=function(e){if(!(0,n.default)(e))throw TypeError("Invalid UUID");let t;const r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var n=r(100),s=r.n(n),a=r(21).Buffer;const i=function(e){return Array.isArray(e)?e=a.from(e):"string"==typeof e&&(e=a.from(e,"utf8")),s().createHash("md5").update(e).digest()}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var n=r(307),s=r(298),a=r(299);const i=function(e,t,r){if(n.default.randomUUID&&!t&&!e)return n.default.randomUUID();const i=(e=e||{}).random||(e.rng||s.default)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=i[e];return t}return(0,a.unsafeStringify)(i)}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>s});var n=r(100);const s={randomUUID:r.n(n)().randomUUID}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var n=r(303),s=r(309);const a=(0,n.default)("v5",80,s.default)},(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var n=r(100),s=r.n(n),a=r(21).Buffer;const i=function(e){return Array.isArray(e)?e=a.from(e):"string"==typeof e&&(e=a.from(e,"utf8")),s().createHash("sha1").update(e).digest()}},(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});const n="00000000-0000-0000-0000-000000000000"},(e,t,r)=>{r.r(t),r.d(t,{default:()=>s});var n=r(300);const s=function(e){if(!(0,n.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TelemetryMiddleware=void 0;const n=r(313),s=r(207);t.TelemetryMiddleware=class{constructor(e){this.clientInfo=e.clientInfo||(0,n.generateClientInfo)()}async pre(e){return"string"==typeof this.clientInfo.name&&this.clientInfo.name.length>0&&(e.init.headers={...e.init.headers,"Auth0-Client":s.base64url.encode(JSON.stringify(this.clientInfo))}),{url:e.url,init:e.init}}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mtlsPrefix=t.generateClientInfo=void 0;const n=r(314);t.generateClientInfo=()=>({name:"node-auth0",version:n.version,env:{node:process.version.replace("v","")}}),t.mtlsPrefix="mtls"},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="4.9.0"},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OAuth=void 0;const n=r(163),s=r(205),a=r(316),i=r(313);class o extends s.BaseAuthAPI{constructor(e){super({...e,domain:e.useMTLS?`${i.mtlsPrefix}.${e.domain}`:e.domain}),this.idTokenValidator=new a.IDTokenValidator(e)}async authorizationCodeGrant(e,t={}){return(0,n.validateRequiredRequestParams)(e,["code"]),(0,s.grant)("authorization_code",await this.addClientAuthentication(e),t,this.clientId,this.idTokenValidator,this.request.bind(this))}async authorizationCodeGrantWithPKCE(e,t={}){return(0,n.validateRequiredRequestParams)(e,["code","code_verifier"]),(0,s.grant)("authorization_code",await this.addClientAuthentication(e),t,this.clientId,this.idTokenValidator,this.request.bind(this))}async clientCredentialsGrant(e,t={}){return(0,n.validateRequiredRequestParams)(e,["audience"]),(0,s.grant)("client_credentials",await this.addClientAuthentication(e),t,this.clientId,this.idTokenValidator,this.request.bind(this))}async pushedAuthorization(e,t={}){(0,n.validateRequiredRequestParams)(e,["client_id","response_type","redirect_uri"]);const r=await this.addClientAuthentication(e),s=await this.request({path:"/oauth/par",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:this.clientId,...r})},t.initOverrides);return n.JSONApiResponse.fromResponse(s)}async passwordGrant(e,t={}){return(0,n.validateRequiredRequestParams)(e,["username","password"]),(0,s.grant)(e.realm?"http://auth0.com/oauth/grant-type/password-realm":"password",await this.addClientAuthentication(e),t,this.clientId,this.idTokenValidator,this.request.bind(this))}async refreshTokenGrant(e,t={}){return(0,n.validateRequiredRequestParams)(e,["refresh_token"]),(0,s.grant)("refresh_token",await this.addClientAuthentication(e),t,this.clientId,this.idTokenValidator,this.request.bind(this))}async revokeRefreshToken(e,t={}){(0,n.validateRequiredRequestParams)(e,["token"]);const r=await this.request({path:"/oauth/revoke",method:"POST",headers:{"Content-Type":"application/json"},body:await this.addClientAuthentication({client_id:this.clientId,...e})},t.initOverrides);return n.VoidApiResponse.fromResponse(r)}}t.OAuth=o},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=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 s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.IDTokenValidator=t.IdTokenValidatorError=void 0;const i=a(r(207));class o extends Error{}t.IdTokenValidatorError=o;t.IDTokenValidator=class{constructor({domain:e,clientId:t,clientSecret:r,agent:n,headers:s,timeoutDuration:a,idTokenSigningAlg:o="RS256",clockTolerance:c=60}){this.jwks=i.createRemoteJWKSet(new URL(`https://${e}/.well-known/jwks.json`),{timeoutDuration:a,agent:n,headers:s}),this.alg=o,this.audience=t,this.secret=(new TextEncoder).encode(r),this.issuer=`https://${e}/`,this.clockTolerance=c}async validate(e,{nonce:t,maxAge:r,organization:n}={}){const s="HS256"===this.alg?this.secret:this.jwks,a=i.decodeProtectedHeader(e),c=i.decodeJwt(e);if("RS256"!==a.alg&&"HS256"!==a.alg)throw new Error(`Signature algorithm of "${a.alg}" is not supported. Expected the ID token to be signed with "RS256" or "HS256".`);if(!c.iss||"string"!=typeof c.iss)throw new o("Issuer (iss) claim must be a string present in the ID token");if(c.iss!==this.issuer)throw new o(`Issuer (iss) claim mismatch in the ID token; expected "${this.issuer}", found "${c.iss}"`);if(!c.sub||"string"!=typeof c.sub)throw new o("Subject (sub) claim must be a string present in the ID token");if(!c.aud||"string"!=typeof c.aud&&!Array.isArray(c.aud))throw new o("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(c.aud)&&!c.aud.includes(this.audience))throw new o(`Audience (aud) claim mismatch in the ID token; expected "${this.audience}" but was not one of "${c.aud.join(", ")}"`);if("string"==typeof c.aud&&c.aud!==this.audience)throw new o(`Audience (aud) claim mismatch in the ID token; expected "${this.audience}" but found "${c.aud}"`);if(n)if(0===n.indexOf("org_")){if(!c.org_id||"string"!=typeof c.org_id)throw new Error("Organization Id (org_id) claim must be a string present in the ID token");if(c.org_id!==n)throw new Error(`Organization Id (org_id) claim value mismatch in the ID token; expected "${n}", found "${c.org_id}"'`)}else{if(!c.org_name||"string"!=typeof c.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(c.org_name!==n.toLowerCase())throw new Error(`Organization Name (org_name) claim value mismatch in the ID token; expected "${n}", found "${c.org_name}"'`)}const l=Math.floor(Date.now()/1e3);if(!c.exp||"number"!=typeof c.exp)throw new o("Expiration Time (exp) claim must be a number present in the ID token");const u=c.exp+this.clockTolerance;if(l>u)throw new o(`Expiration Time (exp) claim error in the ID token; current time (${l}) is after expiration time (${u})`);if(!c.iat||"number"!=typeof c.iat)throw new o("Issued At (iat) claim must be a number present in the ID token");if(t||c.nonce){if(!c.nonce||"string"!=typeof c.nonce)throw new o("Nonce (nonce) claim must be a string present in the ID token");if(c.nonce!==t)throw new o(`Nonce (nonce) claim mismatch in the ID token; expected "${t}", found "${c.nonce}"`)}if(Array.isArray(c.aud)&&c.aud.length>1){if(!c.azp||"string"!=typeof c.azp)throw new o("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(c.azp!==this.audience)throw new o(`Authorized Party (azp) claim mismatch in the ID token; expected "${this.audience}", found "${c.azp}"`)}if(r){if(!c.auth_time||"number"!=typeof c.auth_time)throw new o("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");const e=c.auth_time+r+this.clockTolerance;if(l>e)throw new o(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Currrent time (${l}) is after last auth at ${e}`)}await i.jwtVerify(e,s,{issuer:this.issuer,audience:this.audience,clockTolerance:this.clockTolerance,maxTokenAge:r,algorithms:["HS256","RS256"]})}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Passwordless=void 0;const n=r(163),s=r(205),a=r(316);class i extends s.BaseAuthAPI{constructor(e){super(e),this.idTokenValidator=new a.IDTokenValidator(e)}async sendEmail(e,t){(0,n.validateRequiredRequestParams)(e,["email"]);const r=await this.request({path:"/passwordless/start",method:"POST",headers:{"Content-Type":"application/json"},body:await this.addClientAuthentication({client_id:this.clientId,connection:"email",...e})},t);return n.VoidApiResponse.fromResponse(r)}async sendSMS(e,t){(0,n.validateRequiredRequestParams)(e,["phone_number"]);const r=await this.request({path:"/passwordless/start",method:"POST",headers:{"Content-Type":"application/json"},body:await this.addClientAuthentication({client_id:this.clientId,connection:"sms",...e})},t);return n.VoidApiResponse.fromResponse(r)}async loginWithEmail(e,t={}){(0,n.validateRequiredRequestParams)(e,["email","code"]);const{email:r,code:a,...i}=e;return(0,s.grant)("http://auth0.com/oauth/grant-type/passwordless/otp",await this.addClientAuthentication({username:r,otp:a,realm:"email",...i}),t,this.clientId,this.idTokenValidator,this.request.bind(this))}async loginWithSMS(e,t={}){(0,n.validateRequiredRequestParams)(e,["phone_number","code"]);const{phone_number:r,code:a,...i}=e;return(0,s.grant)("http://auth0.com/oauth/grant-type/passwordless/otp",await this.addClientAuthentication({username:r,otp:a,realm:"sms",...i}),t,this.clientId,this.idTokenValidator,this.request.bind(this))}}t.Passwordless=i},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),s(r(165),t),s(r(166),t)},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UserInfoClient=t.parseError=t.UserInfoError=void 0;const n=r(165),s=r(312),a=r(166),i=r(163);class o extends Error{constructor(e,t,r,n,s){super(t||e),this.error=e,this.error_description=t,this.statusCode=r,this.body=n,this.headers=s,this.name="UserInfoError"}}async function c(e){const t=await e.text();let r;try{return r=JSON.parse(t),new o(r.error,r.error_description,e.status,t,e.headers)}catch(r){return new n.ResponseError(e.status,t,e.headers,"Response returned an error code")}}t.UserInfoError=o,t.parseError=c;class l extends i.BaseAPI{constructor(e){super({...e,baseUrl:`https://${e.domain}`,middleware:!1!==e.telemetry?[new s.TelemetryMiddleware(e)]:[],parseError:c})}async getUserInfo(e,t){const r=await this.request({path:"/userinfo",method:"GET",headers:{Authorization:`Bearer ${e}`}},t);return a.JSONApiResponse.fromResponse(r)}}t.UserInfoClient=l},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PostProviderRequestNameEnum=t.PatchProviderRequestNameEnum=void 0;const n=r(200);t.PatchProviderRequestNameEnum=n.EmailProviderUpdateNameEnum,t.PostProviderRequestNameEnum=n.EmailProviderCreateNameEnum},e=>{e.exports=require("lru-memoizer@2.2.0")},(e,t,r)=>{r.r(t),r.d(t,{plugin:()=>g});const{promisify:n}=r(101),s=r(2),a=r(26),i=r(100),o=r(153),{ArgumentError:c}=r(13),l=r(323),u=r(152),{getBasePath:d,getBaseUrl:p}=r(7),h=r(4),f=function(e){return a.join.apply(null,e).replace(/\\/g,"/").replace("http:/","http://").replace("https:/","https://")},m=function(e,t){return Array.isArray(e)?-1===e.indexOf(t):e!==t},g={register:async function(e,t){if(!t||"object"!=typeof t)return new c("Must provide the options");if(null===t.onLoginSuccess||void 0===t.onLoginSuccess)return new c("Must provide a valid login callback");if(null===t.secret||void 0===t.secret)return new c("Must provide a valid secret");if("string"!=typeof t.secret||0===t.secret.length)return new c("The provided secret is invalid: "+t.secret);if(null===t.audience||void 0===t.audience)return new c("Must provide a valid audience");if("string"!=typeof t.audience||0===t.audience.length)return new c("The provided audience is invalid: "+t.audience);if(null===t.rta||void 0===t.rta)return new c("Must provide a valid rta");if("string"!=typeof t.rta||0===t.rta.length)return new c("The provided rta is invalid: "+t.rta);if(null===t.domain||void 0===t.domain)return new c("Must provide a valid domain");if("string"!=typeof t.domain||0===t.domain.length)return new c("The provided domain is invalid: "+t.domain);if(null===t.baseUrl||void 0===t.baseUrl)return new c("Must provide a valid base URL");if("string"!=typeof t.baseUrl||0===t.baseUrl.length)return new c("The provided base URL is invalid: "+t.baseUrl);if(null===t.clientName||void 0===t.clientName)return new c("Must provide a valid client name");if("string"!=typeof t.clientName||0===t.clientName.length)return new c("The provided client name is invalid: "+t.clientName);const r=t.stateKey||"state",a=t.nonceKey||"nonce",g=t.urlPrefix||"",y=t.sessionStorageKey||"apiToken",_=t.sessionManager||new l(t.rta,t.domain,t.baseUrl),v={isHttpOnly:!0};e.state(a,Object.assign({},v,{isSameSite:"None",isSecure:!0})),e.state(r,Object.assign({},v,{isSameSite:"None",isSecure:!0})),e.state(a+"_compat",v),e.state(r+"_compat",v),e.route({method:"GET",path:g+"/login",options:{auth:!1},handler:function(e,n){const s=i.randomBytes(16).toString("hex"),o=i.randomBytes(16).toString("hex"),c=_.createAuthorizeUrl({redirectUri:f([p(e),g,"/login/callback"]),scopes:t.scopes,expiration:t.expiration,nonce:o,state:s});return n.redirect(c).state(a,o,{path:d(e)}).state(r,s,{path:d(e)}).state(a+"_compat",o,{path:d(e)}).state(r+"_compat",s,{path:d(e)})}}),e.route({method:"POST",path:g+"/login/callback",options:{auth:!1},handler:async function(i,c){var l;const g=n(o.verify),v=i.payload.id_token;try{l=o.decode(v,{complete:!0});const e=u.hapiJwt2Key({cache:!0,rateLimit:!0,jwksRequestsPerMinute:2,jwksUri:`${h("AUTH0_RTA")}/.well-known/jwks.json`}),t=n(e),r=await t(l);if(!r)return s.unauthorized("Invalid token");const a={audience:h("PUBLIC_WT_URL"),issuer:`${h("AUTH0_RTA")}/`,algorithms:["RS256"]};await g(v,r,a)}catch(e){l=null}if(!l)return s.unauthorized("Invalid token");if(i.state&&i.state[a]&&m(i.state[a],l.payload.nonce)||i.state&&i.state[a+"_compat"]&&m(i.state[a+"_compat"],l.payload.nonce))return s.badRequest("Nonce mismatch");if(i.state&&i.state[r]&&m(i.state[r],i.payload.state)||i.state&&i.state[r+"_compat"]&&m(i.state[r+"_compat"],i.payload.state))return s.badRequest("State mismatch");let b;try{b=await _.create(i.payload.id_token,i.payload.access_token,{secret:t.secret,issuer:t.baseUrl,audience:t.audience})}catch(t){return e.log(["error"],"Login callback failed",t),s.boomify(t)}return c.response('