diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 3fc4b17ec04..326b701e32a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index b0e0aa9bc78..e9e9fc10768 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -17,6 +17,6 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Checkout Repository' - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: 'Dependency Review' - uses: actions/dependency-review-action@6c5ccdad469c9f8a2996bfecaec55a631a347034 # v3.1.0 + uses: actions/dependency-review-action@fde92acd0840415674c16b39c7d703fc28bc511e # v3.1.2 diff --git a/.github/workflows/label_pr_on_title.yml b/.github/workflows/label_pr_on_title.yml index f4372931ea1..c83d729f6c3 100644 --- a/.github/workflows/label_pr_on_title.yml +++ b/.github/workflows/label_pr_on_title.yml @@ -50,7 +50,7 @@ jobs: pull-requests: write # label respective PR steps: - name: Checkout repository - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: "Label PR based on title" uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 env: diff --git a/.github/workflows/on_label_added.yml b/.github/workflows/on_label_added.yml index ebbb9f69e2f..00c2ee9f4cb 100644 --- a/.github/workflows/on_label_added.yml +++ b/.github/workflows/on_label_added.yml @@ -47,7 +47,7 @@ jobs: permissions: pull-requests: write # comment on PR steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 # Maintenance: Persist state per PR as an artifact to avoid spam on label add - name: "Suggest split large Pull Request" uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 diff --git a/.github/workflows/on_merged_pr.yml b/.github/workflows/on_merged_pr.yml index 26dd705cbc0..8308f258cf7 100644 --- a/.github/workflows/on_merged_pr.yml +++ b/.github/workflows/on_merged_pr.yml @@ -49,7 +49,7 @@ jobs: issues: write # label issue with pending-release if: needs.get_pr_details.outputs.prIsMerged == 'true' steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: "Label PR related issue for release" uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 env: diff --git a/.github/workflows/on_opened_pr.yml b/.github/workflows/on_opened_pr.yml index 771dc03b7fa..d7b3dc14356 100644 --- a/.github/workflows/on_opened_pr.yml +++ b/.github/workflows/on_opened_pr.yml @@ -47,7 +47,7 @@ jobs: needs: get_pr_details runs-on: ubuntu-latest steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: "Ensure related issue is present" uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 env: @@ -66,7 +66,7 @@ jobs: permissions: pull-requests: write # label and comment on PR if missing acknowledge section (requirement) steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: "Ensure acknowledgement section is present" uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 env: diff --git a/.github/workflows/ossf_scorecard.yml b/.github/workflows/ossf_scorecard.yml index d602d1846bc..b74a138f692 100644 --- a/.github/workflows/ossf_scorecard.yml +++ b/.github/workflows/ossf_scorecard.yml @@ -22,12 +22,12 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@483ef80eb98fb506c348f7d62e28055e49fe2398 # v2.3.0 + uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 with: results_file: results.sarif results_format: sarif diff --git a/.github/workflows/publish_v2_layer.yml b/.github/workflows/publish_v2_layer.yml index b7b89e6d60f..1080d08cdd1 100644 --- a/.github/workflows/publish_v2_layer.yml +++ b/.github/workflows/publish_v2_layer.yml @@ -88,7 +88,7 @@ jobs: working-directory: ./layer steps: - name: checkout - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: ref: ${{ env.RELEASE_COMMIT }} @@ -101,7 +101,7 @@ jobs: - name: Install poetry run: pipx install git+https://github.com/python-poetry/poetry@68b88e5390720a3dd84f02940ec5200bfce39ac6 # v1.5.0 - name: Setup Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 with: node-version: "16.12" - name: Setup python @@ -247,7 +247,7 @@ jobs: pages: none steps: - name: Checkout repository # reusable workflows start clean, so we need to checkout again - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: ref: ${{ env.RELEASE_COMMIT }} diff --git a/.github/workflows/quality_check.yml b/.github/workflows/quality_check.yml index f1dcab5730f..c98006c4adf 100644 --- a/.github/workflows/quality_check.yml +++ b/.github/workflows/quality_check.yml @@ -50,7 +50,7 @@ jobs: permissions: contents: read # checkout code only steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Install poetry run: pipx install poetry - name: Set up Python ${{ matrix.python-version }} diff --git a/.github/workflows/quality_check_pydanticv2.yml b/.github/workflows/quality_check_pydanticv2.yml index fd8e00fc990..b8fa0bebc10 100644 --- a/.github/workflows/quality_check_pydanticv2.yml +++ b/.github/workflows/quality_check_pydanticv2.yml @@ -50,7 +50,7 @@ jobs: permissions: contents: read # checkout code only steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Install poetry run: pipx install poetry - name: Set up Python ${{ matrix.python-version }} diff --git a/.github/workflows/record_pr.yml b/.github/workflows/record_pr.yml index 8b811ff9ec0..d52cc3e5ef2 100644 --- a/.github/workflows/record_pr.yml +++ b/.github/workflows/record_pr.yml @@ -46,7 +46,7 @@ jobs: permissions: contents: read # NOTE: treat as untrusted location steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: "Extract PR details" uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 with: diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 8781eba3bef..6d4ef78ecc1 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -27,6 +27,6 @@ jobs: permissions: contents: write # create release in draft mode steps: - - uses: release-drafter/release-drafter@65c5fb495d1e69aa8c08a3317bc44ff8aabe9772 # v5.20.1 + - uses: release-drafter/release-drafter@09c613e259eb8d4e7c81c2cb00618eb5fc4575a7 # v5.20.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 62f689382db..dfa207a4bc8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -80,7 +80,7 @@ jobs: RELEASE_VERSION="${RELEASE_TAG_VERSION:1}" echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "$GITHUB_OUTPUT" - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: ref: ${{ env.RELEASE_COMMIT }} @@ -115,7 +115,7 @@ jobs: contents: read steps: # NOTE: we need actions/checkout to configure git first (pre-commit hooks in make dev) - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: ref: ${{ env.RELEASE_COMMIT }} @@ -156,7 +156,7 @@ jobs: attestation_hashes: ${{ steps.encoded_hash.outputs.attestation_hashes }} steps: # NOTE: we need actions/checkout to configure git first (pre-commit hooks in make dev) - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: ref: ${{ env.RELEASE_COMMIT }} @@ -225,7 +225,7 @@ jobs: RELEASE_VERSION: ${{ needs.seal.outputs.RELEASE_VERSION }} steps: # NOTE: we need actions/checkout in order to use our local actions (e.g., ./.github/actions) - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: ref: ${{ env.RELEASE_COMMIT }} @@ -259,7 +259,7 @@ jobs: contents: write steps: # NOTE: we need actions/checkout to authenticate and configure git first - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: ref: ${{ env.RELEASE_COMMIT }} @@ -303,7 +303,7 @@ jobs: runs-on: ubuntu-latest steps: # NOTE: we need actions/checkout to authenticate and configure git first - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: ref: ${{ env.RELEASE_COMMIT }} @@ -357,7 +357,7 @@ jobs: env: RELEASE_VERSION: ${{ needs.seal.outputs.RELEASE_VERSION }} steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: ref: ${{ env.RELEASE_COMMIT }} diff --git a/.github/workflows/reusable_deploy_v2_layer_stack.yml b/.github/workflows/reusable_deploy_v2_layer_stack.yml index 4e817004f12..cd3e5df9809 100644 --- a/.github/workflows/reusable_deploy_v2_layer_stack.yml +++ b/.github/workflows/reusable_deploy_v2_layer_stack.yml @@ -138,7 +138,7 @@ jobs: has_arm64_support: "true" steps: - name: checkout - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: ref: ${{ env.RELEASE_COMMIT }} @@ -156,7 +156,7 @@ jobs: aws-region: ${{ matrix.region }} role-to-assume: ${{ secrets.AWS_LAYERS_ROLE_ARN }} - name: Setup Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 with: node-version: "16.12" - name: Setup python diff --git a/.github/workflows/reusable_deploy_v2_sar.yml b/.github/workflows/reusable_deploy_v2_sar.yml index e8f1dfd2a0d..ead8218b218 100644 --- a/.github/workflows/reusable_deploy_v2_sar.yml +++ b/.github/workflows/reusable_deploy_v2_sar.yml @@ -79,7 +79,7 @@ jobs: architecture: ["x86_64", "arm64"] steps: - name: checkout - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: ref: ${{ env.RELEASE_COMMIT }} @@ -111,7 +111,7 @@ jobs: aws-region: ${{ env.AWS_REGION }} role-to-assume: ${{ secrets.AWS_SAR_V2_ROLE_ARN }} - name: Setup Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 with: node-version: ${{ env.NODE_VERSION }} - name: Download artifact diff --git a/.github/workflows/reusable_export_pr_details.yml b/.github/workflows/reusable_export_pr_details.yml index 53ca43a884b..6bafd2fc0c9 100644 --- a/.github/workflows/reusable_export_pr_details.yml +++ b/.github/workflows/reusable_export_pr_details.yml @@ -76,7 +76,7 @@ jobs: prLabels: ${{ steps.prLabels.outputs.prLabels }} steps: - name: Checkout repository # in case caller workflow doesn't checkout thus failing with file not found - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: "Download previously saved PR" uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 env: diff --git a/.github/workflows/reusable_publish_changelog.yml b/.github/workflows/reusable_publish_changelog.yml index b8e2308ff8a..b7936f2c349 100644 --- a/.github/workflows/reusable_publish_changelog.yml +++ b/.github/workflows/reusable_publish_changelog.yml @@ -26,7 +26,7 @@ jobs: pull-requests: write # create PR steps: - name: Checkout repository # reusable workflows start clean, so we need to checkout again - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: fetch-depth: 0 - name: "Generate latest changelog" diff --git a/.github/workflows/reusable_publish_docs.yml b/.github/workflows/reusable_publish_docs.yml index 43656b7e17a..f44db75e2d2 100644 --- a/.github/workflows/reusable_publish_docs.yml +++ b/.github/workflows/reusable_publish_docs.yml @@ -44,7 +44,7 @@ jobs: id-token: write # trade JWT token for AWS credentials in AWS Docs account pages: write # uncomment if mike fails as we migrated to S3 hosting steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: fetch-depth: 0 ref: ${{ inputs.git_ref }} diff --git a/.github/workflows/run-e2e-tests.yml b/.github/workflows/run-e2e-tests.yml index 8306995a8ed..9639dcc0ae3 100644 --- a/.github/workflows/run-e2e-tests.yml +++ b/.github/workflows/run-e2e-tests.yml @@ -51,7 +51,7 @@ jobs: if: ${{ github.actor != 'dependabot[bot]' && github.repository == 'aws-powertools/powertools-lambda-python' }} steps: - name: "Checkout" - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Install poetry run: pipx install poetry - name: "Use Python" @@ -61,7 +61,7 @@ jobs: architecture: "x64" cache: "poetry" - name: Setup Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 with: node-version: "16.12" - name: Install CDK CLI diff --git a/.github/workflows/secure_workflows.yml b/.github/workflows/secure_workflows.yml index 279345cfc7b..8ae205df85f 100644 --- a/.github/workflows/secure_workflows.yml +++ b/.github/workflows/secure_workflows.yml @@ -30,8 +30,8 @@ jobs: contents: read # checkout code and subsequently GitHub action workflows steps: - name: Checkout code - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Ensure 3rd party workflows have SHA pinned - uses: zgosalvez/github-actions-ensure-sha-pinned-actions@f32435541e24cd6a4700a7f52bb2ec59e80603b1 # v2.1.4 + uses: zgosalvez/github-actions-ensure-sha-pinned-actions@b35f285b9bb7e80de0967367cee66d3b6d50ceca # v3.0.1 with: allowlist: slsa-framework/slsa-github-generator diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dffae83eb4..0a9178237f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,94 @@ # Unreleased +## Bug Fixes + +* **event_handler:** Router prefix mismatch regression after Middleware feat ([#3302](https://github.com/aws-powertools/powertools-lambda-python/issues/3302)) +* **event_source:** kinesis subsequenceNumber str type to int ([#3275](https://github.com/aws-powertools/powertools-lambda-python/issues/3275)) +* **parameters:** Respect POWERTOOLS_PARAMETERS_SSM_DECRYPT environment variable when getting multiple ssm parameters. ([#3241](https://github.com/aws-powertools/powertools-lambda-python/issues/3241)) + +## Documentation + +* **customer-reference:** add Vertex Pharmaceuticals as a customer reference ([#3210](https://github.com/aws-powertools/powertools-lambda-python/issues/3210)) +* **event-handler:** fixed SchemaValidationMiddleware link ([#3247](https://github.com/aws-powertools/powertools-lambda-python/issues/3247)) + +## Features + +* **data_classes:** add support for Bedrock Agents event ([#3262](https://github.com/aws-powertools/powertools-lambda-python/issues/3262)) +* **event_handler:** add Bedrock Agent event handler ([#3285](https://github.com/aws-powertools/powertools-lambda-python/issues/3285)) +* **event_handler:** add ability to expose a Swagger UI ([#3254](https://github.com/aws-powertools/powertools-lambda-python/issues/3254)) +* **event_handler:** generate OpenAPI specifications and validate input/output ([#3109](https://github.com/aws-powertools/powertools-lambda-python/issues/3109)) +* **parser:** add BedrockEventModel parser and envelope ([#3286](https://github.com/aws-powertools/powertools-lambda-python/issues/3286)) + +## Maintenance + +* **deps:** bump actions/dependency-review-action from 3.1.1 to 3.1.2 ([#3308](https://github.com/aws-powertools/powertools-lambda-python/issues/3308)) +* **deps:** bump squidfunk/mkdocs-material from `cb38dc2` to `df9409b` in /docs ([#3216](https://github.com/aws-powertools/powertools-lambda-python/issues/3216)) +* **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates ([#3282](https://github.com/aws-powertools/powertools-lambda-python/issues/3282)) +* **deps:** bump zgosalvez/github-actions-ensure-sha-pinned-actions from 2.1.4 to 2.1.5 ([#3281](https://github.com/aws-powertools/powertools-lambda-python/issues/3281)) +* **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 1 update ([#3287](https://github.com/aws-powertools/powertools-lambda-python/issues/3287)) +* **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates ([#3278](https://github.com/aws-powertools/powertools-lambda-python/issues/3278)) +* **deps:** bump release-drafter/release-drafter from 5.24.0 to 5.25.0 ([#3219](https://github.com/aws-powertools/powertools-lambda-python/issues/3219)) +* **deps:** bump zgosalvez/github-actions-ensure-sha-pinned-actions from 2.1.5 to 3.0.0 ([#3289](https://github.com/aws-powertools/powertools-lambda-python/issues/3289)) +* **deps:** bump actions/checkout from 4.1.0 to 4.1.1 ([#3220](https://github.com/aws-powertools/powertools-lambda-python/issues/3220)) +* **deps:** bump urllib3 from 1.26.17 to 1.26.18 ([#3222](https://github.com/aws-powertools/powertools-lambda-python/issues/3222)) +* **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 1 update ([#3215](https://github.com/aws-powertools/powertools-lambda-python/issues/3215)) +* **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 2 updates ([#3298](https://github.com/aws-powertools/powertools-lambda-python/issues/3298)) +* **deps:** bump datadog-lambda from 4.80.0 to 4.81.0 ([#3228](https://github.com/aws-powertools/powertools-lambda-python/issues/3228)) +* **deps:** bump squidfunk/mkdocs-material from `df9409b` to `772e14e` in /docs ([#3265](https://github.com/aws-powertools/powertools-lambda-python/issues/3265)) +* **deps:** bump squidfunk/mkdocs-material from `772e14e` to `f486dc9` in /docs ([#3299](https://github.com/aws-powertools/powertools-lambda-python/issues/3299)) +* **deps:** bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.0 to 3.0.1 ([#3300](https://github.com/aws-powertools/powertools-lambda-python/issues/3300)) +* **deps:** bump ossf/scorecard-action from 2.3.0 to 2.3.1 ([#3245](https://github.com/aws-powertools/powertools-lambda-python/issues/3245)) +* **deps:** bump actions/dependency-review-action from 3.1.0 to 3.1.1 ([#3301](https://github.com/aws-powertools/powertools-lambda-python/issues/3301)) +* **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 1 update ([#3305](https://github.com/aws-powertools/powertools-lambda-python/issues/3305)) +* **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 1 update ([#3310](https://github.com/aws-powertools/powertools-lambda-python/issues/3310)) +* **deps:** bump actions/setup-node from 3.8.1 to 4.0.0 ([#3244](https://github.com/aws-powertools/powertools-lambda-python/issues/3244)) +* **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates ([#3313](https://github.com/aws-powertools/powertools-lambda-python/issues/3313)) +* **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 2 updates ([#3248](https://github.com/aws-powertools/powertools-lambda-python/issues/3248)) +* **deps-dev:** bump the boto-typing group with 3 updates ([#3314](https://github.com/aws-powertools/powertools-lambda-python/issues/3314)) +* **deps-dev:** bump the boto-typing group with 2 updates ([#3242](https://github.com/aws-powertools/powertools-lambda-python/issues/3242)) +* **deps-dev:** bump ruff from 0.1.2 to 0.1.3 ([#3257](https://github.com/aws-powertools/powertools-lambda-python/issues/3257)) +* **deps-dev:** bump cfn-lint from 0.82.2 to 0.83.0 ([#3243](https://github.com/aws-powertools/powertools-lambda-python/issues/3243)) +* **deps-dev:** bump ruff from 0.1.1 to 0.1.2 ([#3250](https://github.com/aws-powertools/powertools-lambda-python/issues/3250)) +* **deps-dev:** bump pytest from 7.4.2 to 7.4.3 ([#3249](https://github.com/aws-powertools/powertools-lambda-python/issues/3249)) +* **deps-dev:** bump ruff from 0.1.0 to 0.1.1 ([#3235](https://github.com/aws-powertools/powertools-lambda-python/issues/3235)) +* **deps-dev:** bump aws-cdk-lib from 2.102.0 to 2.103.0 ([#3258](https://github.com/aws-powertools/powertools-lambda-python/issues/3258)) +* **deps-dev:** bump the boto-typing group with 1 update ([#3231](https://github.com/aws-powertools/powertools-lambda-python/issues/3231)) +* **deps-dev:** bump aws-cdk from 2.101.1 to 2.102.0 ([#3232](https://github.com/aws-powertools/powertools-lambda-python/issues/3232)) +* **deps-dev:** bump aws-cdk from 2.102.0 to 2.103.0 ([#3259](https://github.com/aws-powertools/powertools-lambda-python/issues/3259)) +* **deps-dev:** bump cfn-lint from 0.82.0 to 0.82.2 ([#3229](https://github.com/aws-powertools/powertools-lambda-python/issues/3229)) +* **deps-dev:** bump aws-cdk-lib from 2.103.0 to 2.103.1 ([#3263](https://github.com/aws-powertools/powertools-lambda-python/issues/3263)) +* **deps-dev:** bump aws-cdk from 2.103.0 to 2.103.1 ([#3264](https://github.com/aws-powertools/powertools-lambda-python/issues/3264)) +* **deps-dev:** bump cfn-lint from 0.81.0 to 0.82.0 ([#3224](https://github.com/aws-powertools/powertools-lambda-python/issues/3224)) +* **deps-dev:** bump aws-cdk from 2.101.0 to 2.101.1 ([#3223](https://github.com/aws-powertools/powertools-lambda-python/issues/3223)) +* **deps-dev:** bump cfn-lint from 0.83.0 to 0.83.1 ([#3274](https://github.com/aws-powertools/powertools-lambda-python/issues/3274)) +* **deps-dev:** bump urllib3 from 1.26.17 to 1.26.18 in /layer ([#3221](https://github.com/aws-powertools/powertools-lambda-python/issues/3221)) +* **deps-dev:** bump the boto-typing group with 1 update ([#3273](https://github.com/aws-powertools/powertools-lambda-python/issues/3273)) +* **deps-dev:** bump sentry-sdk from 1.32.0 to 1.33.1 ([#3277](https://github.com/aws-powertools/powertools-lambda-python/issues/3277)) +* **deps-dev:** bump aws-cdk from 2.103.1 to 2.104.0 ([#3288](https://github.com/aws-powertools/powertools-lambda-python/issues/3288)) +* **deps-dev:** bump aws-cdk-lib from 2.100.0 to 2.101.1 ([#3217](https://github.com/aws-powertools/powertools-lambda-python/issues/3217)) +* **deps-dev:** bump aws-cdk from 2.100.0 to 2.101.0 ([#3214](https://github.com/aws-powertools/powertools-lambda-python/issues/3214)) +* **deps-dev:** bump sentry-sdk from 1.33.1 to 1.34.0 ([#3290](https://github.com/aws-powertools/powertools-lambda-python/issues/3290)) +* **deps-dev:** bump aws-cdk-lib from 2.103.1 to 2.104.0 ([#3291](https://github.com/aws-powertools/powertools-lambda-python/issues/3291)) +* **deps-dev:** bump ruff from 0.1.3 to 0.1.4 ([#3297](https://github.com/aws-powertools/powertools-lambda-python/issues/3297)) +* **deps-dev:** bump the boto-typing group with 2 updates ([#3211](https://github.com/aws-powertools/powertools-lambda-python/issues/3211)) +* **deps-dev:** bump aws-cdk from 2.104.0 to 2.105.0 ([#3307](https://github.com/aws-powertools/powertools-lambda-python/issues/3307)) +* **deps-dev:** bump aws-cdk-lib from 2.104.0 to 2.105.0 ([#3309](https://github.com/aws-powertools/powertools-lambda-python/issues/3309)) +* **deps-dev:** bump ruff from 0.0.292 to 0.1.0 ([#3213](https://github.com/aws-powertools/powertools-lambda-python/issues/3213)) + + + +## [v2.26.0] - 2023-10-13 +## Bug Fixes + +* **logger:** force Logger to use local timezone when UTC flag is not set ([#3168](https://github.com/aws-powertools/powertools-lambda-python/issues/3168)) +* **parameter:** improve AppConfig cached configuration retrieval ([#3195](https://github.com/aws-powertools/powertools-lambda-python/issues/3195)) + +## Code Refactoring + +* **data-masking:** disable e2e tests. ([#3204](https://github.com/aws-powertools/powertools-lambda-python/issues/3204)) +* **data_masking:** move Data Masking utility to a private folder ([#3202](https://github.com/aws-powertools/powertools-lambda-python/issues/3202)) + ## Documentation * **contributing:** initial structure for revamped contributing guide ([#3133](https://github.com/aws-powertools/powertools-lambda-python/issues/3133)) @@ -19,42 +107,43 @@ ## Maintenance -* **deps:** bump gitpython from 3.1.35 to 3.1.37 in /docs ([#3188](https://github.com/aws-powertools/powertools-lambda-python/issues/3188)) +* version bump +* **deps:** bump squidfunk/mkdocs-material from `cbfecae` to `a4cfa88` in /docs ([#3175](https://github.com/aws-powertools/powertools-lambda-python/issues/3175)) * **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 1 update ([#3174](https://github.com/aws-powertools/powertools-lambda-python/issues/3174)) -* **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates ([#3198](https://github.com/aws-powertools/powertools-lambda-python/issues/3198)) * **deps:** bump squidfunk/mkdocs-material from `b41ba6d` to `06673a1` in /docs ([#3124](https://github.com/aws-powertools/powertools-lambda-python/issues/3124)) -* **deps:** bump aws-xray-sdk from 2.12.0 to 2.12.1 ([#3197](https://github.com/aws-powertools/powertools-lambda-python/issues/3197)) +* **deps:** bump ossf/scorecard-action from 2.2.0 to 2.3.0 ([#3178](https://github.com/aws-powertools/powertools-lambda-python/issues/3178)) +* **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates ([#3198](https://github.com/aws-powertools/powertools-lambda-python/issues/3198)) +* **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates ([#3177](https://github.com/aws-powertools/powertools-lambda-python/issues/3177)) * **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 1 update ([#3127](https://github.com/aws-powertools/powertools-lambda-python/issues/3127)) -* **deps:** bump actions/checkout from 4.0.0 to 4.1.0 ([#3128](https://github.com/aws-powertools/powertools-lambda-python/issues/3128)) * **deps:** bump urllib3 from 1.26.16 to 1.26.17 ([#3162](https://github.com/aws-powertools/powertools-lambda-python/issues/3162)) -* **deps:** bump squidfunk/mkdocs-material from `06673a1` to `e5f28aa` in /docs ([#3134](https://github.com/aws-powertools/powertools-lambda-python/issues/3134)) -* **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates ([#3177](https://github.com/aws-powertools/powertools-lambda-python/issues/3177)) +* **deps:** bump aws-xray-sdk from 2.12.0 to 2.12.1 ([#3197](https://github.com/aws-powertools/powertools-lambda-python/issues/3197)) +* **deps:** bump fastjsonschema from 2.18.0 to 2.18.1 ([#3159](https://github.com/aws-powertools/powertools-lambda-python/issues/3159)) * **deps:** bump actions/setup-python from 4.7.0 to 4.7.1 ([#3158](https://github.com/aws-powertools/powertools-lambda-python/issues/3158)) -* **deps:** bump squidfunk/mkdocs-material from `a4cfa88` to `cb38dc2` in /docs ([#3189](https://github.com/aws-powertools/powertools-lambda-python/issues/3189)) +* **deps:** bump actions/checkout from 4.0.0 to 4.1.0 ([#3128](https://github.com/aws-powertools/powertools-lambda-python/issues/3128)) * **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 1 update ([#3156](https://github.com/aws-powertools/powertools-lambda-python/issues/3156)) * **deps:** bump squidfunk/mkdocs-material from `e5f28aa` to `cbfecae` in /docs ([#3157](https://github.com/aws-powertools/powertools-lambda-python/issues/3157)) +* **deps:** bump squidfunk/mkdocs-material from `06673a1` to `e5f28aa` in /docs ([#3134](https://github.com/aws-powertools/powertools-lambda-python/issues/3134)) +* **deps:** bump squidfunk/mkdocs-material from `a4cfa88` to `cb38dc2` in /docs ([#3189](https://github.com/aws-powertools/powertools-lambda-python/issues/3189)) * **deps:** bump pydantic from 1.10.12 to 1.10.13 ([#3144](https://github.com/aws-powertools/powertools-lambda-python/issues/3144)) -* **deps:** bump fastjsonschema from 2.18.0 to 2.18.1 ([#3159](https://github.com/aws-powertools/powertools-lambda-python/issues/3159)) -* **deps:** bump squidfunk/mkdocs-material from `cbfecae` to `a4cfa88` in /docs ([#3175](https://github.com/aws-powertools/powertools-lambda-python/issues/3175)) -* **deps:** bump ossf/scorecard-action from 2.2.0 to 2.3.0 ([#3178](https://github.com/aws-powertools/powertools-lambda-python/issues/3178)) +* **deps:** bump gitpython from 3.1.35 to 3.1.37 in /docs ([#3188](https://github.com/aws-powertools/powertools-lambda-python/issues/3188)) +* **deps-dev:** bump types-requests from 2.31.0.5 to 2.31.0.6 ([#3145](https://github.com/aws-powertools/powertools-lambda-python/issues/3145)) * **deps-dev:** bump aws-cdk from 2.98.0 to 2.99.0 ([#3148](https://github.com/aws-powertools/powertools-lambda-python/issues/3148)) -* **deps-dev:** bump aws-cdk from 2.99.1 to 2.100.0 ([#3185](https://github.com/aws-powertools/powertools-lambda-python/issues/3185)) * **deps-dev:** bump the boto-typing group with 2 updates ([#3143](https://github.com/aws-powertools/powertools-lambda-python/issues/3143)) -* **deps-dev:** bump aws-cdk from 2.99.0 to 2.99.1 ([#3155](https://github.com/aws-powertools/powertools-lambda-python/issues/3155)) +* **deps-dev:** bump aws-cdk from 2.99.1 to 2.100.0 ([#3185](https://github.com/aws-powertools/powertools-lambda-python/issues/3185)) * **deps-dev:** bump aws-cdk from 2.97.0 to 2.98.0 ([#3139](https://github.com/aws-powertools/powertools-lambda-python/issues/3139)) * **deps-dev:** bump aws-cdk from 2.96.2 to 2.97.0 ([#3129](https://github.com/aws-powertools/powertools-lambda-python/issues/3129)) * **deps-dev:** bump types-requests from 2.31.0.3 to 2.31.0.5 ([#3136](https://github.com/aws-powertools/powertools-lambda-python/issues/3136)) * **deps-dev:** bump the boto-typing group with 1 update ([#3135](https://github.com/aws-powertools/powertools-lambda-python/issues/3135)) * **deps-dev:** bump ruff from 0.0.291 to 0.0.292 ([#3161](https://github.com/aws-powertools/powertools-lambda-python/issues/3161)) * **deps-dev:** bump ruff from 0.0.290 to 0.0.291 ([#3126](https://github.com/aws-powertools/powertools-lambda-python/issues/3126)) -* **deps-dev:** bump urllib3 from 1.26.16 to 1.26.17 in /layer ([#3163](https://github.com/aws-powertools/powertools-lambda-python/issues/3163)) +* **deps-dev:** bump aws-cdk from 2.99.0 to 2.99.1 ([#3155](https://github.com/aws-powertools/powertools-lambda-python/issues/3155)) * **deps-dev:** bump sentry-sdk from 1.31.0 to 1.32.0 ([#3192](https://github.com/aws-powertools/powertools-lambda-python/issues/3192)) -* **deps-dev:** bump the boto-typing group with 1 update ([#3196](https://github.com/aws-powertools/powertools-lambda-python/issues/3196)) +* **deps-dev:** bump urllib3 from 1.26.16 to 1.26.17 in /layer ([#3163](https://github.com/aws-powertools/powertools-lambda-python/issues/3163)) * **deps-dev:** bump cfn-lint from 0.80.3 to 0.80.4 ([#3166](https://github.com/aws-powertools/powertools-lambda-python/issues/3166)) * **deps-dev:** bump cfn-lint from 0.80.2 to 0.80.3 ([#3125](https://github.com/aws-powertools/powertools-lambda-python/issues/3125)) * **deps-dev:** bump cfn-lint from 0.80.4 to 0.81.0 ([#3179](https://github.com/aws-powertools/powertools-lambda-python/issues/3179)) +* **deps-dev:** bump the boto-typing group with 1 update ([#3196](https://github.com/aws-powertools/powertools-lambda-python/issues/3196)) * **deps-dev:** bump the boto-typing group with 1 update ([#3170](https://github.com/aws-powertools/powertools-lambda-python/issues/3170)) -* **deps-dev:** bump types-requests from 2.31.0.5 to 2.31.0.6 ([#3145](https://github.com/aws-powertools/powertools-lambda-python/issues/3145)) @@ -3883,7 +3972,8 @@ * Merge pull request [#5](https://github.com/aws-powertools/powertools-lambda-python/issues/5) from jfuss/feat/python38 -[Unreleased]: https://github.com/aws-powertools/powertools-lambda-python/compare/v2.25.1...HEAD +[Unreleased]: https://github.com/aws-powertools/powertools-lambda-python/compare/v2.26.0...HEAD +[v2.26.0]: https://github.com/aws-powertools/powertools-lambda-python/compare/v2.25.1...v2.26.0 [v2.25.1]: https://github.com/aws-powertools/powertools-lambda-python/compare/v2.25.0...v2.25.1 [v2.25.0]: https://github.com/aws-powertools/powertools-lambda-python/compare/v2.24.0...v2.25.0 [v2.24.0]: https://github.com/aws-powertools/powertools-lambda-python/compare/v2.23.1...v2.24.0 diff --git a/README.md b/README.md index e04f2b99375..6ffcb731d85 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ The following companies, among others, use Powertools: * [Propellor.ai](https://www.propellor.ai/) * [TopSport](https://www.topsport.com.au/) * [Trek10](https://www.trek10.com/) +* [Vertex Pharmaceuticals](https://www.vrtx.com/) ### Sharing your work diff --git a/aws_lambda_powertools/event_handler/__init__.py b/aws_lambda_powertools/event_handler/__init__.py index 7bdd9a97f72..ffbb2abe4ae 100644 --- a/aws_lambda_powertools/event_handler/__init__.py +++ b/aws_lambda_powertools/event_handler/__init__.py @@ -11,6 +11,7 @@ Response, ) from aws_lambda_powertools.event_handler.appsync import AppSyncResolver +from aws_lambda_powertools.event_handler.bedrock_agent import BedrockAgentResolver from aws_lambda_powertools.event_handler.lambda_function_url import ( LambdaFunctionUrlResolver, ) @@ -22,6 +23,7 @@ "APIGatewayHttpResolver", "ALBResolver", "ApiGatewayResolver", + "BedrockAgentResolver", "CORSConfig", "LambdaFunctionUrlResolver", "Response", diff --git a/aws_lambda_powertools/event_handler/api_gateway.py b/aws_lambda_powertools/event_handler/api_gateway.py index 46cb5587135..535d79e5874 100644 --- a/aws_lambda_powertools/event_handler/api_gateway.py +++ b/aws_lambda_powertools/event_handler/api_gateway.py @@ -9,17 +9,45 @@ from enum import Enum from functools import partial from http import HTTPStatus -from typing import Any, Callable, Dict, List, Match, Optional, Pattern, Set, Tuple, Type, Union +from pathlib import Path +from typing import ( + TYPE_CHECKING, + Any, + Callable, + Dict, + Generic, + List, + Match, + Optional, + Pattern, + Sequence, + Set, + Tuple, + Type, + TypeVar, + Union, + cast, +) from aws_lambda_powertools.event_handler import content_types from aws_lambda_powertools.event_handler.exceptions import NotFoundError, ServiceError +from aws_lambda_powertools.event_handler.openapi.constants import DEFAULT_API_VERSION, DEFAULT_OPENAPI_VERSION +from aws_lambda_powertools.event_handler.openapi.swagger_ui.html import generate_swagger_html +from aws_lambda_powertools.event_handler.openapi.types import ( + COMPONENT_REF_PREFIX, + METHODS_WITH_BODY, + validation_error_definition, + validation_error_response_definition, +) from aws_lambda_powertools.shared.cookies import Cookie from aws_lambda_powertools.shared.functions import powertools_dev_is_set from aws_lambda_powertools.shared.json_encoder import Encoder +from aws_lambda_powertools.shared.types import Literal from aws_lambda_powertools.utilities.data_classes import ( ALBEvent, APIGatewayProxyEvent, APIGatewayProxyEventV2, + BedrockAgentEvent, LambdaFunctionUrlEvent, VPCLatticeEvent, VPCLatticeEventV2, @@ -34,8 +62,27 @@ # API GW/ALB decode non-safe URI chars; we must support them too _UNSAFE_URI = r"%<> \[\]{}|^" _NAMED_GROUP_BOUNDARY_PATTERN = rf"(?P\1[{_SAFE_URI}{_UNSAFE_URI}\\w]+)" +_DEFAULT_OPENAPI_RESPONSE_DESCRIPTION = "Successful Response" _ROUTE_REGEX = "^{}$" +ResponseEventT = TypeVar("ResponseEventT", bound=BaseProxyEvent) + +if TYPE_CHECKING: + from aws_lambda_powertools.event_handler.openapi.compat import ( + JsonSchemaValue, + ModelField, + ) + from aws_lambda_powertools.event_handler.openapi.models import ( + Contact, + License, + OpenAPI, + Server, + ) + from aws_lambda_powertools.event_handler.openapi.params import Dependant + from aws_lambda_powertools.event_handler.openapi.types import ( + TypeModelOrEnum, + ) + class ProxyEventType(Enum): """An enumerations of the supported proxy event types.""" @@ -43,6 +90,7 @@ class ProxyEventType(Enum): APIGatewayProxyEvent = "APIGatewayProxyEvent" APIGatewayProxyEventV2 = "APIGatewayProxyEventV2" ALBEvent = "ALBEvent" + BedrockAgentEvent = "BedrockAgentEvent" VPCLatticeEvent = "VPCLatticeEvent" VPCLatticeEventV2 = "VPCLatticeEventV2" LambdaFunctionUrlEvent = "LambdaFunctionUrlEvent" @@ -166,7 +214,7 @@ def __init__( self, status_code: int, content_type: Optional[str] = None, - body: Union[str, bytes, None] = None, + body: Any = None, headers: Optional[Dict[str, Union[str, List[str]]]] = None, cookies: Optional[List[Cookie]] = None, compress: Optional[bool] = None, @@ -193,9 +241,19 @@ def __init__( self.headers: Dict[str, Union[str, List[str]]] = headers if headers else {} self.cookies = cookies or [] self.compress = compress + self.content_type = content_type if content_type: self.headers.setdefault("Content-Type", content_type) + def is_json(self) -> bool: + """ + Returns True if the response is JSON, based on the Content-Type. + """ + content_type = self.headers.get("Content-Type", "") + if isinstance(content_type, list): + content_type = content_type[0] + return content_type.startswith("application/json") + class Route: """Internally used Route Configuration""" @@ -203,11 +261,19 @@ class Route: def __init__( self, method: str, + path: str, rule: Pattern, func: Callable, cors: bool, compress: bool, cache_control: Optional[str], + summary: Optional[str], + description: Optional[str], + responses: Optional[Dict[int, Dict[str, Any]]], + response_description: Optional[str], + tags: Optional[List[str]], + operation_id: Optional[str], + include_in_schema: bool, middlewares: Optional[List[Callable[..., Response]]], ): """ @@ -217,6 +283,8 @@ def __init__( method: str The HTTP method, example "GET" + path: str + The path of the route rule: Pattern The route rule, example "/my/path" func: Callable @@ -227,21 +295,49 @@ def __init__( Whether or not to enable gzip compression for this route cache_control: Optional[str] The cache control header value, example "max-age=3600" + summary: Optional[str] + The OpenAPI summary for this route + description: Optional[str] + The OpenAPI description for this route + responses: Optional[Dict[int, Dict[str, Any]]] + The OpenAPI responses for this route + response_description: Optional[str] + The OpenAPI response description for this route + tags: Optional[List[str]] + The list of OpenAPI tags to be used for this route + operation_id: Optional[str] + The OpenAPI operationId for this route + include_in_schema: bool + Whether or not to include this route in the OpenAPI schema middlewares: Optional[List[Callable[..., Response]]] The list of route middlewares to be called in order. """ self.method = method.upper() + self.path = "/" if path.strip() == "" else path self.rule = rule self.func = func self._middleware_stack = func self.cors = cors self.compress = compress self.cache_control = cache_control + self.summary = summary + self.description = description + self.responses = responses + self.response_description = response_description + self.tags = tags or [] + self.include_in_schema = include_in_schema self.middlewares = middlewares or [] + self.operation_id = operation_id or self._generate_operation_id() # _middleware_stack_built is used to ensure the middleware stack is only built once. self._middleware_stack_built = False + # _dependant is used to cache the dependant model for the handler function + self._dependant: Optional["Dependant"] = None + + # _body_field is used to cache the dependant model for the body field + self._body_field: Optional["ModelField"] = None + def __call__( self, router_middlewares: List[Callable], @@ -332,15 +428,282 @@ def _build_middleware_stack(self, router_middlewares: List[Callable[..., Any]]) self._middleware_stack_built = True + @property + def dependant(self) -> "Dependant": + if self._dependant is None: + from aws_lambda_powertools.event_handler.openapi.dependant import get_dependant + + self._dependant = get_dependant(path=self.path, call=self.func) + + return self._dependant + + @property + def body_field(self) -> Optional["ModelField"]: + if self._body_field is None: + from aws_lambda_powertools.event_handler.openapi.dependant import get_body_field + + self._body_field = get_body_field(dependant=self.dependant, name=self.operation_id) -class ResponseBuilder: + return self._body_field + + def _get_openapi_path( + self, + *, + dependant: "Dependant", + operation_ids: Set[str], + model_name_map: Dict["TypeModelOrEnum", str], + field_mapping: Dict[Tuple["ModelField", Literal["validation", "serialization"]], "JsonSchemaValue"], + ) -> Tuple[Dict[str, Any], Dict[str, Any]]: + """ + Returns the OpenAPI path and definitions for the route. + """ + from aws_lambda_powertools.event_handler.openapi.dependant import get_flat_params + + path = {} + definitions: Dict[str, Any] = {} + + # Gather all the route parameters + operation = self._openapi_operation_metadata(operation_ids=operation_ids) + parameters: List[Dict[str, Any]] = [] + all_route_params = get_flat_params(dependant) + operation_params = self._openapi_operation_parameters( + all_route_params=all_route_params, + model_name_map=model_name_map, + field_mapping=field_mapping, + ) + parameters.extend(operation_params) + + # Add the parameters to the OpenAPI operation + if parameters: + all_parameters = {(param["in"], param["name"]): param for param in parameters} + required_parameters = {(param["in"], param["name"]): param for param in parameters if param.get("required")} + all_parameters.update(required_parameters) + operation["parameters"] = list(all_parameters.values()) + + # Add the request body to the OpenAPI operation, if applicable + if self.method.upper() in METHODS_WITH_BODY: + request_body_oai = self._openapi_operation_request_body( + body_field=self.body_field, + model_name_map=model_name_map, + field_mapping=field_mapping, + ) + if request_body_oai: + operation["requestBody"] = request_body_oai + + # Add the response to the OpenAPI operation + if self.responses: + # If the user supplied responses, we use them and don't set a default 200 response + operation["responses"] = self.responses + else: + # Set the default 200 response + responses = operation.setdefault("responses", self.responses or {}) + success_response = responses.setdefault(200, {}) + success_response["description"] = self.response_description or _DEFAULT_OPENAPI_RESPONSE_DESCRIPTION + success_response["content"] = {"application/json": {"schema": {}}} + json_response = success_response["content"].setdefault("application/json", {}) + + # Add the response schema to the OpenAPI 200 response + json_response.update( + self._openapi_operation_return( + param=dependant.return_param, + model_name_map=model_name_map, + field_mapping=field_mapping, + ), + ) + + # Add validation failure response (422) + operation["responses"][422] = { + "description": "Validation Error", + "content": { + "application/json": { + "schema": {"$ref": COMPONENT_REF_PREFIX + "HTTPValidationError"}, + }, + }, + } + + # Add the validation error schema to the definitions, but only if it hasn't been added yet + if "ValidationError" not in definitions: + definitions.update( + { + "ValidationError": validation_error_definition, + "HTTPValidationError": validation_error_response_definition, + }, + ) + + path[self.method.lower()] = operation + + # Generate the response schema + return path, definitions + + def _openapi_operation_summary(self) -> str: + """ + Returns the OpenAPI operation summary. If the user has not provided a summary, we + generate one based on the route path and method. + """ + return self.summary or f"{self.method.upper()} {self.path}" + + def _openapi_operation_metadata(self, operation_ids: Set[str]) -> Dict[str, Any]: + """ + Returns the OpenAPI operation metadata. If the user has not provided a description, we + generate one based on the route path and method. + """ + operation: Dict[str, Any] = {} + + # Ensure tags is added to the operation + if self.tags: + operation["tags"] = [{"name": tag for tag in self.tags}] + + # Ensure summary is added to the operation + operation["summary"] = self._openapi_operation_summary() + + # Ensure description is added to the operation + if self.description: + operation["description"] = self.description + + # Ensure operationId is unique + if self.operation_id in operation_ids: + message = f"Duplicate Operation ID {self.operation_id} for function {self.func.__name__}" + file_name = getattr(self.func, "__globals__", {}).get("__file__") + if file_name: + message += f" in {file_name}" + warnings.warn(message, stacklevel=1) + + # Adds the operation + operation_ids.add(self.operation_id) + operation["operationId"] = self.operation_id + + return operation + + @staticmethod + def _openapi_operation_request_body( + *, + body_field: Optional["ModelField"], + model_name_map: Dict["TypeModelOrEnum", str], + field_mapping: Dict[Tuple["ModelField", Literal["validation", "serialization"]], "JsonSchemaValue"], + ) -> Optional[Dict[str, Any]]: + """ + Returns the OpenAPI operation request body. + """ + from aws_lambda_powertools.event_handler.openapi.compat import ModelField, get_schema_from_model_field + from aws_lambda_powertools.event_handler.openapi.params import Body + + # Check that there is a body field and it's a Pydantic's model field + if not body_field: + return None + + if not isinstance(body_field, ModelField): + raise AssertionError(f"Expected ModelField, got {body_field}") + + # Generate the request body schema + body_schema = get_schema_from_model_field( + field=body_field, + model_name_map=model_name_map, + field_mapping=field_mapping, + ) + + field_info = cast(Body, body_field.field_info) + request_media_type = field_info.media_type + required = body_field.required + request_body_oai: Dict[str, Any] = {} + if required: + request_body_oai["required"] = required + + # Generate the request body media type + request_media_content: Dict[str, Any] = {"schema": body_schema} + request_body_oai["content"] = {request_media_type: request_media_content} + return request_body_oai + + @staticmethod + def _openapi_operation_parameters( + *, + all_route_params: Sequence["ModelField"], + model_name_map: Dict["TypeModelOrEnum", str], + field_mapping: Dict[ + Tuple["ModelField", Literal["validation", "serialization"]], + "JsonSchemaValue", + ], + ) -> List[Dict[str, Any]]: + """ + Returns the OpenAPI operation parameters. + """ + from aws_lambda_powertools.event_handler.openapi.compat import ( + get_schema_from_model_field, + ) + from aws_lambda_powertools.event_handler.openapi.params import Param + + parameters = [] + for param in all_route_params: + field_info = param.field_info + field_info = cast(Param, field_info) + if not field_info.include_in_schema: + continue + + param_schema = get_schema_from_model_field( + field=param, + model_name_map=model_name_map, + field_mapping=field_mapping, + ) + + parameter = { + "name": param.alias, + "in": field_info.in_.value, + "required": param.required, + "schema": param_schema, + } + + if field_info.description: + parameter["description"] = field_info.description + + if field_info.deprecated: + parameter["deprecated"] = field_info.deprecated + + parameters.append(parameter) + + return parameters + + @staticmethod + def _openapi_operation_return( + *, + param: Optional["ModelField"], + model_name_map: Dict["TypeModelOrEnum", str], + field_mapping: Dict[ + Tuple["ModelField", Literal["validation", "serialization"]], + "JsonSchemaValue", + ], + ) -> Dict[str, Any]: + """ + Returns the OpenAPI operation return. + """ + if param is None: + return {} + + from aws_lambda_powertools.event_handler.openapi.compat import ( + get_schema_from_model_field, + ) + + return_schema = get_schema_from_model_field( + field=param, + model_name_map=model_name_map, + field_mapping=field_mapping, + ) + + return {"schema": return_schema} + + def _generate_operation_id(self) -> str: + operation_id = self.func.__name__ + self.path + operation_id = re.sub(r"\W", "_", operation_id) + operation_id = operation_id + "_" + self.method.lower() + return operation_id + + +class ResponseBuilder(Generic[ResponseEventT]): """Internally used Response builder""" def __init__(self, response: Response, route: Optional[Route] = None): self.response = response self.route = route - def _add_cors(self, event: BaseProxyEvent, cors: CORSConfig): + def _add_cors(self, event: ResponseEventT, cors: CORSConfig): """Update headers to include the configured Access-Control headers""" self.response.headers.update(cors.to_dict(event.get_header_value("Origin"))) @@ -353,7 +716,7 @@ def _add_cache_control(self, cache_control: str): def _has_compression_enabled( route_compression: bool, response_compression: Optional[bool], - event: BaseProxyEvent, + event: ResponseEventT, ) -> bool: """ Checks if compression is enabled. @@ -366,7 +729,7 @@ def _has_compression_enabled( A boolean indicating whether compression is enabled or not in the route setting. response_compression: bool, optional A boolean indicating whether compression is enabled or not in the response setting. - event: BaseProxyEvent + event: ResponseEventT The event object containing the request details. Returns @@ -396,7 +759,7 @@ def _compress(self): gzip = zlib.compressobj(9, zlib.DEFLATED, zlib.MAX_WBITS | 16) self.response.body = gzip.compress(self.response.body) + gzip.flush() - def _route(self, event: BaseProxyEvent, cors: Optional[CORSConfig]): + def _route(self, event: ResponseEventT, cors: Optional[CORSConfig]): """Optionally handle any of the route's configure response handling""" if self.route is None: return @@ -411,7 +774,7 @@ def _route(self, event: BaseProxyEvent, cors: Optional[CORSConfig]): ): self._compress() - def build(self, event: BaseProxyEvent, cors: Optional[CORSConfig] = None) -> Dict[str, Any]: + def build(self, event: ResponseEventT, cors: Optional[CORSConfig] = None) -> Dict[str, Any]: """Build the full response dict to be returned by the lambda""" self._route(event, cors) @@ -443,6 +806,13 @@ def route( cors: Optional[bool] = None, compress: bool = False, cache_control: Optional[str] = None, + summary: Optional[str] = None, + description: Optional[str] = None, + responses: Optional[Dict[int, Dict[str, Any]]] = None, + response_description: str = _DEFAULT_OPENAPI_RESPONSE_DESCRIPTION, + tags: Optional[List[str]] = None, + operation_id: Optional[str] = None, + include_in_schema: bool = True, middlewares: Optional[List[Callable[..., Any]]] = None, ): raise NotImplementedError() @@ -494,6 +864,13 @@ def get( cors: Optional[bool] = None, compress: bool = False, cache_control: Optional[str] = None, + summary: Optional[str] = None, + description: Optional[str] = None, + responses: Optional[Dict[int, Dict[str, Any]]] = None, + response_description: str = _DEFAULT_OPENAPI_RESPONSE_DESCRIPTION, + tags: Optional[List[str]] = None, + operation_id: Optional[str] = None, + include_in_schema: bool = True, middlewares: Optional[List[Callable[..., Any]]] = None, ): """Get route decorator with GET `method` @@ -518,7 +895,21 @@ def lambda_handler(event, context): return app.resolve(event, context) ``` """ - return self.route(rule, "GET", cors, compress, cache_control, middlewares) + return self.route( + rule, + "GET", + cors, + compress, + cache_control, + summary, + description, + responses, + response_description, + tags, + operation_id, + include_in_schema, + middlewares, + ) def post( self, @@ -526,6 +917,13 @@ def post( cors: Optional[bool] = None, compress: bool = False, cache_control: Optional[str] = None, + summary: Optional[str] = None, + description: Optional[str] = None, + responses: Optional[Dict[int, Dict[str, Any]]] = None, + response_description: str = _DEFAULT_OPENAPI_RESPONSE_DESCRIPTION, + tags: Optional[List[str]] = None, + operation_id: Optional[str] = None, + include_in_schema: bool = True, middlewares: Optional[List[Callable[..., Any]]] = None, ): """Post route decorator with POST `method` @@ -551,7 +949,21 @@ def lambda_handler(event, context): return app.resolve(event, context) ``` """ - return self.route(rule, "POST", cors, compress, cache_control, middlewares) + return self.route( + rule, + "POST", + cors, + compress, + cache_control, + summary, + description, + responses, + response_description, + tags, + operation_id, + include_in_schema, + middlewares, + ) def put( self, @@ -559,6 +971,13 @@ def put( cors: Optional[bool] = None, compress: bool = False, cache_control: Optional[str] = None, + summary: Optional[str] = None, + description: Optional[str] = None, + responses: Optional[Dict[int, Dict[str, Any]]] = None, + response_description: str = _DEFAULT_OPENAPI_RESPONSE_DESCRIPTION, + tags: Optional[List[str]] = None, + operation_id: Optional[str] = None, + include_in_schema: bool = True, middlewares: Optional[List[Callable[..., Any]]] = None, ): """Put route decorator with PUT `method` @@ -584,7 +1003,21 @@ def lambda_handler(event, context): return app.resolve(event, context) ``` """ - return self.route(rule, "PUT", cors, compress, cache_control, middlewares) + return self.route( + rule, + "PUT", + cors, + compress, + cache_control, + summary, + description, + responses, + response_description, + tags, + operation_id, + include_in_schema, + middlewares, + ) def delete( self, @@ -592,6 +1025,13 @@ def delete( cors: Optional[bool] = None, compress: bool = False, cache_control: Optional[str] = None, + summary: Optional[str] = None, + description: Optional[str] = None, + responses: Optional[Dict[int, Dict[str, Any]]] = None, + response_description: str = _DEFAULT_OPENAPI_RESPONSE_DESCRIPTION, + tags: Optional[List[str]] = None, + operation_id: Optional[str] = None, + include_in_schema: bool = True, middlewares: Optional[List[Callable[..., Any]]] = None, ): """Delete route decorator with DELETE `method` @@ -616,7 +1056,21 @@ def lambda_handler(event, context): return app.resolve(event, context) ``` """ - return self.route(rule, "DELETE", cors, compress, cache_control, middlewares) + return self.route( + rule, + "DELETE", + cors, + compress, + cache_control, + summary, + description, + responses, + response_description, + tags, + operation_id, + include_in_schema, + middlewares, + ) def patch( self, @@ -624,6 +1078,13 @@ def patch( cors: Optional[bool] = None, compress: bool = False, cache_control: Optional[str] = None, + summary: Optional[str] = None, + description: Optional[str] = None, + responses: Optional[Dict[int, Dict[str, Any]]] = None, + response_description: str = _DEFAULT_OPENAPI_RESPONSE_DESCRIPTION, + tags: Optional[List[str]] = None, + operation_id: Optional[str] = None, + include_in_schema: bool = True, middlewares: Optional[List[Callable]] = None, ): """Patch route decorator with PATCH `method` @@ -651,7 +1112,21 @@ def lambda_handler(event, context): return app.resolve(event, context) ``` """ - return self.route(rule, "PATCH", cors, compress, cache_control, middlewares) + return self.route( + rule, + "PATCH", + cors, + compress, + cache_control, + summary, + description, + responses, + response_description, + tags, + operation_id, + include_in_schema, + middlewares, + ) def _push_processed_stack_frame(self, frame: str): """ @@ -676,7 +1151,7 @@ def clear_context(self): class MiddlewareFrame: """ - creates a Middle Stack Wrapper instance to be used as a "Frame" in the overall stack of + Creates a Middle Stack Wrapper instance to be used as a "Frame" in the overall stack of middleware functions. Each instance contains the current middleware and the next middleware function to be called in the stack. @@ -813,6 +1288,7 @@ def __init__( debug: Optional[bool] = None, serializer: Optional[Callable[[Dict], str]] = None, strip_prefixes: Optional[List[Union[str, Pattern]]] = None, + enable_validation: bool = False, ): """ Parameters @@ -824,12 +1300,14 @@ def __init__( debug: Optional[bool] Enables debug mode, by default False. Can be also be enabled by "POWERTOOLS_DEV" environment variable - serializer : Callable, optional + serializer: Callable, optional function to serialize `obj` to a JSON formatted `str`, by default json.dumps strip_prefixes: List[Union[str, Pattern]], optional optional list of prefixes to be removed from the request path before doing the routing. This is often used with api gateways with multiple custom mappings. Each prefix can be a static string or a compiled regex pattern + enable_validation: Optional[bool] + Enables validation of the request body against the route schema, by default False. """ self._proxy_type = proxy_type self._dynamic_routes: List[Route] = [] @@ -840,13 +1318,320 @@ def __init__( self._cors_enabled: bool = cors is not None self._cors_methods: Set[str] = {"OPTIONS"} self._debug = self._has_debug(debug) + self._enable_validation = enable_validation self._strip_prefixes = strip_prefixes self.context: Dict = {} # early init as customers might add context before event resolution self.processed_stack_frames = [] + self._response_builder_class = ResponseBuilder[BaseProxyEvent] # Allow for a custom serializer or a concise json serialization self._serializer = serializer or partial(json.dumps, separators=(",", ":"), cls=Encoder) + if self._enable_validation: + from aws_lambda_powertools.event_handler.middlewares.openapi_validation import OpenAPIValidationMiddleware + + self.use([OpenAPIValidationMiddleware()]) + + # When using validation, we need to skip the serializer, as the middleware is doing it automatically. + # However, if the user is using a custom serializer, we need to abort. + if serializer: + raise ValueError("Cannot use a custom serializer when using validation") + + # Install a dummy serializer + self._serializer = lambda args: args # type: ignore + + def get_openapi_schema( + self, + *, + title: str = "Powertools API", + version: str = DEFAULT_API_VERSION, + openapi_version: str = DEFAULT_OPENAPI_VERSION, + summary: Optional[str] = None, + description: Optional[str] = None, + tags: Optional[List[str]] = None, + servers: Optional[List["Server"]] = None, + terms_of_service: Optional[str] = None, + contact: Optional["Contact"] = None, + license_info: Optional["License"] = None, + ) -> "OpenAPI": + """ + Returns the OpenAPI schema as a pydantic model. + + Parameters + ---------- + title: str + The title of the application. + version: str + The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API + openapi_version: str, default = "3.1.0" + The version of the OpenAPI Specification (which the document uses). + summary: str, optional + A short summary of what the application does. + description: str, optional + A verbose explanation of the application behavior. + tags: List[str], optional + A list of tags used by the specification with additional metadata. + servers: List[Server], optional + An array of Server Objects, which provide connectivity information to a target server. + terms_of_service: str, optional + A URL to the Terms of Service for the API. MUST be in the format of a URL. + contact: Contact, optional + The contact information for the exposed API. + license_info: License, optional + The license information for the exposed API. + + Returns + ------- + OpenAPI: pydantic model + The OpenAPI schema as a pydantic model. + """ + + from aws_lambda_powertools.event_handler.openapi.compat import ( + GenerateJsonSchema, + get_compat_model_name_map, + get_definitions, + ) + from aws_lambda_powertools.event_handler.openapi.models import OpenAPI, PathItem, Server + from aws_lambda_powertools.event_handler.openapi.types import ( + COMPONENT_REF_TEMPLATE, + ) + + # Start with the bare minimum required for a valid OpenAPI schema + info: Dict[str, Any] = {"title": title, "version": version} + + optional_fields = { + "summary": summary, + "description": description, + "termsOfService": terms_of_service, + "contact": contact, + "license": license_info, + } + + info.update({field: value for field, value in optional_fields.items() if value}) + + output: Dict[str, Any] = {"openapi": openapi_version, "info": info} + if servers: + output["servers"] = servers + else: + # If the servers property is not provided, or is an empty array, the default value would be a Server Object + # with an url value of /. + output["servers"] = [Server(url="/")] + + components: Dict[str, Dict[str, Any]] = {} + paths: Dict[str, Dict[str, Any]] = {} + operation_ids: Set[str] = set() + + all_routes = self._dynamic_routes + self._static_routes + all_fields = self._get_fields_from_routes(all_routes) + model_name_map = get_compat_model_name_map(all_fields) + + # Collect all models and definitions + schema_generator = GenerateJsonSchema(ref_template=COMPONENT_REF_TEMPLATE) + field_mapping, definitions = get_definitions( + fields=all_fields, + schema_generator=schema_generator, + model_name_map=model_name_map, + ) + + # Add routes to the OpenAPI schema + for route in all_routes: + if not route.include_in_schema: + continue + + result = route._get_openapi_path( + dependant=route.dependant, + operation_ids=operation_ids, + model_name_map=model_name_map, + field_mapping=field_mapping, + ) + if result: + path, path_definitions = result + if path: + paths.setdefault(route.path, {}).update(path) + if path_definitions: + definitions.update(path_definitions) + + if definitions: + components["schemas"] = {k: definitions[k] for k in sorted(definitions)} + if components: + output["components"] = components + if tags: + output["tags"] = [{"name": tag} for tag in tags] + + output["paths"] = {k: PathItem(**v) for k, v in paths.items()} + + return OpenAPI(**output) + + def get_openapi_json_schema( + self, + *, + title: str = "Powertools API", + version: str = DEFAULT_API_VERSION, + openapi_version: str = DEFAULT_OPENAPI_VERSION, + summary: Optional[str] = None, + description: Optional[str] = None, + tags: Optional[List[str]] = None, + servers: Optional[List["Server"]] = None, + terms_of_service: Optional[str] = None, + contact: Optional["Contact"] = None, + license_info: Optional["License"] = None, + ) -> str: + """ + Returns the OpenAPI schema as a JSON serializable dict + + Parameters + ---------- + title: str + The title of the application. + version: str + The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API + openapi_version: str, default = "3.1.0" + The version of the OpenAPI Specification (which the document uses). + summary: str, optional + A short summary of what the application does. + description: str, optional + A verbose explanation of the application behavior. + tags: List[str], optional + A list of tags used by the specification with additional metadata. + servers: List[Server], optional + An array of Server Objects, which provide connectivity information to a target server. + terms_of_service: str, optional + A URL to the Terms of Service for the API. MUST be in the format of a URL. + contact: Contact, optional + The contact information for the exposed API. + license_info: License, optional + The license information for the exposed API. + + Returns + ------- + str + The OpenAPI schema as a JSON serializable dict. + """ + from aws_lambda_powertools.event_handler.openapi.compat import model_json + + return model_json( + self.get_openapi_schema( + title=title, + version=version, + openapi_version=openapi_version, + summary=summary, + description=description, + tags=tags, + servers=servers, + terms_of_service=terms_of_service, + contact=contact, + license_info=license_info, + ), + by_alias=True, + exclude_none=True, + indent=2, + ) + + def enable_swagger( + self, + *, + path: str = "/swagger", + title: str = "Powertools for AWS Lambda (Python) API", + version: str = DEFAULT_API_VERSION, + openapi_version: str = DEFAULT_OPENAPI_VERSION, + summary: Optional[str] = None, + description: Optional[str] = None, + tags: Optional[List[str]] = None, + servers: Optional[List["Server"]] = None, + terms_of_service: Optional[str] = None, + contact: Optional["Contact"] = None, + license_info: Optional["License"] = None, + swagger_base_url: Optional[str] = None, + middlewares: Optional[List[Callable[..., Response]]] = None, + ): + """ + Returns the OpenAPI schema as a JSON serializable dict + + Parameters + ---------- + path: str, default = "/swagger" + The path to the swagger UI. + title: str + The title of the application. + version: str + The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API + openapi_version: str, default = "3.1.0" + The version of the OpenAPI Specification (which the document uses). + summary: str, optional + A short summary of what the application does. + description: str, optional + A verbose explanation of the application behavior. + tags: List[str], optional + A list of tags used by the specification with additional metadata. + servers: List[Server], optional + An array of Server Objects, which provide connectivity information to a target server. + terms_of_service: str, optional + A URL to the Terms of Service for the API. MUST be in the format of a URL. + contact: Contact, optional + The contact information for the exposed API. + license_info: License, optional + The license information for the exposed API. + swagger_base_url: str, optional + The base url for the swagger UI. If not provided, we will serve a recent version of the Swagger UI. + middlewares: List[Callable[..., Response]], optional + List of middlewares to be used for the swagger route. + """ + from aws_lambda_powertools.event_handler.openapi.models import Server + + if not swagger_base_url: + + @self.get("/swagger.js", include_in_schema=False) + def swagger_js(): + body = Path.open(Path(__file__).parent / "openapi" / "swagger_ui" / "swagger-ui-bundle.min.js").read() + return Response( + status_code=200, + content_type="text/javascript", + body=body, + ) + + @self.get("/swagger.css", include_in_schema=False) + def swagger_css(): + body = Path.open(Path(__file__).parent / "openapi" / "swagger_ui" / "swagger-ui.min.css").read() + return Response( + status_code=200, + content_type="text/css", + body=body, + ) + + @self.get(path, middlewares=middlewares, include_in_schema=False) + def swagger_handler(): + base_path = self._get_base_path() + + if swagger_base_url: + swagger_js = f"{swagger_base_url}/swagger-ui-bundle.min.js" + swagger_css = f"{swagger_base_url}/swagger-ui.min.css" + else: + swagger_js = f"{base_path}/swagger.js" + swagger_css = f"{base_path}/swagger.css" + + openapi_servers = servers or [Server(url=(base_path or "/"))] + + spec = self.get_openapi_json_schema( + title=title, + version=version, + openapi_version=openapi_version, + summary=summary, + description=description, + tags=tags, + servers=openapi_servers, + terms_of_service=terms_of_service, + contact=contact, + license_info=license_info, + ) + + body = generate_swagger_html(spec, swagger_js, swagger_css) + + return Response( + status_code=200, + content_type="text/html", + body=body, + ) + def route( self, rule: str, @@ -854,6 +1639,13 @@ def route( cors: Optional[bool] = None, compress: bool = False, cache_control: Optional[str] = None, + summary: Optional[str] = None, + description: Optional[str] = None, + responses: Optional[Dict[int, Dict[str, Any]]] = None, + response_description: str = _DEFAULT_OPENAPI_RESPONSE_DESCRIPTION, + tags: Optional[List[str]] = None, + operation_id: Optional[str] = None, + include_in_schema: bool = True, middlewares: Optional[List[Callable[..., Any]]] = None, ): """Route decorator includes parameter `method`""" @@ -861,19 +1653,25 @@ def route( def register_resolver(func: Callable): methods = (method,) if isinstance(method, str) else method logger.debug(f"Adding route using rule {rule} and methods: {','.join((m.upper() for m in methods))}") - if cors is None: - cors_enabled = self._cors_enabled - else: - cors_enabled = cors + + cors_enabled = self._cors_enabled if cors is None else cors for item in methods: _route = Route( item, + rule, self._compile_regex(rule), func, cors_enabled, compress, cache_control, + summary, + description, + responses, + response_description, + tags, + operation_id, + include_in_schema, middlewares, ) @@ -886,13 +1684,8 @@ def register_resolver(func: Callable): else: self._static_routes.append(_route) - route_key = item + rule - if route_key in self._route_keys: - warnings.warn( - f"A route like this was already registered. method: '{item}' rule: '{rule}'", - stacklevel=2, - ) - self._route_keys.append(route_key) + self._create_route_key(item, rule) + if cors_enabled: logger.debug(f"Registering method {item.upper()} to Allow Methods in CORS") self._cors_methods.add(item.upper()) @@ -946,6 +1739,18 @@ def resolve(self, event, context) -> Dict[str, Any]: def __call__(self, event, context) -> Any: return self.resolve(event, context) + def _create_route_key(self, item: str, rule: str): + route_key = item + rule + if route_key in self._route_keys: + warnings.warn( + f"A route like this was already registered. method: '{item}' rule: '{rule}'", + stacklevel=2, + ) + self._route_keys.append(route_key) + + def _get_base_path(self) -> str: + raise NotImplementedError() + @staticmethod def _has_debug(debug: Optional[bool] = None) -> bool: # It might have been explicitly switched off (debug=False) @@ -987,7 +1792,7 @@ def _compile_regex(rule: str, base_regex: str = _ROUTE_REGEX): rule_regex: str = re.sub(_DYNAMIC_ROUTE_PATTERN, _NAMED_GROUP_BOUNDARY_PATTERN, rule) return re.compile(base_regex.format(rule_regex)) - def _to_proxy_event(self, event: Dict) -> BaseProxyEvent: + def _to_proxy_event(self, event: Dict) -> BaseProxyEvent: # noqa: PLR0911 # ignore many returns """Convert the event dict to the corresponding data class""" if self._proxy_type == ProxyEventType.APIGatewayProxyEvent: logger.debug("Converting event to API Gateway REST API contract") @@ -995,6 +1800,9 @@ def _to_proxy_event(self, event: Dict) -> BaseProxyEvent: if self._proxy_type == ProxyEventType.APIGatewayProxyEventV2: logger.debug("Converting event to API Gateway HTTP API contract") return APIGatewayProxyEventV2(event) + if self._proxy_type == ProxyEventType.BedrockAgentEvent: + logger.debug("Converting event to Bedrock Agent contract") + return BedrockAgentEvent(event) if self._proxy_type == ProxyEventType.LambdaFunctionUrlEvent: logger.debug("Converting event to Lambda Function URL contract") return LambdaFunctionUrlEvent(event) @@ -1021,7 +1829,8 @@ def _resolve(self) -> ResponseBuilder: # Add matched Route reference into the Resolver context self.append_context(_route=route, _path=path) - return self._call_route(route, match_results.groupdict()) # pass fn args + route_keys = self._convert_matches_into_route_keys(match_results) + return self._call_route(route, route_keys) # pass fn args logger.debug(f"No match found for path {path} and method {method}") return self._not_found(method) @@ -1050,6 +1859,10 @@ def _remove_prefix(self, path: str) -> str: return path + def _convert_matches_into_route_keys(self, match: Match) -> Dict[str, str]: + """Converts the regex match into a dict of route keys""" + return match.groupdict() + @staticmethod def _path_starts_with(path: str, prefix: str): """Returns true if the `path` starts with a prefix plus a `/`""" @@ -1072,9 +1885,9 @@ def _not_found(self, method: str) -> ResponseBuilder: handler = self._lookup_exception_handler(NotFoundError) if handler: - return ResponseBuilder(handler(NotFoundError())) + return self._response_builder_class(handler(NotFoundError())) - return ResponseBuilder( + return self._response_builder_class( Response( status_code=HTTPStatus.NOT_FOUND.value, content_type=content_types.APPLICATION_JSON, @@ -1089,7 +1902,7 @@ def _call_route(self, route: Route, route_arguments: Dict[str, str]) -> Response # Reset Processed stack for Middleware (for debugging purposes) self._reset_processed_stack() - return ResponseBuilder( + return self._response_builder_class( self._to_response( route(router_middlewares=self._router_middlewares, app=self, route_arguments=route_arguments), ), @@ -1104,9 +1917,9 @@ def _call_route(self, route: Route, route_arguments: Dict[str, str]) -> Response logger.exception(exc) if self._debug: # If the user has turned on debug mode, - # we'll let the original exception propagate so + # we'll let the original exception propagate, so # they get more information about what went wrong. - return ResponseBuilder( + return self._response_builder_class( Response( status_code=500, content_type=content_types.TEXT_PLAIN, @@ -1145,12 +1958,12 @@ def _call_exception_handler(self, exp: Exception, route: Route) -> Optional[Resp handler = self._lookup_exception_handler(type(exp)) if handler: try: - return ResponseBuilder(handler(exp), route) + return self._response_builder_class(handler(exp), route) except ServiceError as service_error: exp = service_error if isinstance(exp, ServiceError): - return ResponseBuilder( + return self._response_builder_class( Response( status_code=exp.status_code, content_type=content_types.APPLICATION_JSON, @@ -1211,6 +2024,7 @@ def include_router(self, router: "Router", prefix: Optional[str] = None) -> None # use pointer to allow context clearance after event is processed e.g., resolve(evt, ctx) router.context = self.context + # Iterate through the routes defined in the router to configure and apply middlewares for each route for route, func in router._routes.items(): new_route = route @@ -1220,7 +2034,8 @@ def include_router(self, router: "Router", prefix: Optional[str] = None) -> None new_route = (rule, *route[1:]) # Middlewares are stored by route separately - must grab them to include - middlewares = router._routes_with_middleware.get(new_route) + # Middleware store the route without prefix, so we must not include prefix when grabbing + middlewares = router._routes_with_middleware.get(route) # Need to use "type: ignore" here since mypy does not like a named parameter after # tuple expansion since may cause duplicate named parameters in the function signature. @@ -1229,6 +2044,36 @@ def include_router(self, router: "Router", prefix: Optional[str] = None) -> None # Still need to ignore for mypy checks or will cause failures (false-positive) self.route(*new_route, middlewares=middlewares)(func) # type: ignore + @staticmethod + def _get_fields_from_routes(routes: Sequence[Route]) -> List["ModelField"]: + """ + Returns a list of fields from the routes + """ + + from aws_lambda_powertools.event_handler.openapi.compat import ModelField + from aws_lambda_powertools.event_handler.openapi.dependant import ( + get_flat_params, + ) + + body_fields_from_routes: List["ModelField"] = [] + responses_from_routes: List["ModelField"] = [] + request_fields_from_routes: List["ModelField"] = [] + + for route in routes: + if route.body_field: + if not isinstance(route.body_field, ModelField): + raise AssertionError("A request body myst be a Pydantic Field") + body_fields_from_routes.append(route.body_field) + + params = get_flat_params(route.dependant) + request_fields_from_routes.extend(params) + + if route.dependant.return_param: + responses_from_routes.append(route.dependant.return_param) + + flat_models = list(responses_from_routes + request_fields_from_routes + body_fields_from_routes) + return flat_models + class Router(BaseRouter): """Router helper class to allow splitting ApiGatewayResolver into multiple files""" @@ -1246,13 +2091,33 @@ def route( cors: Optional[bool] = None, compress: bool = False, cache_control: Optional[str] = None, + summary: Optional[str] = None, + description: Optional[str] = None, + responses: Optional[Dict[int, Dict[str, Any]]] = None, + response_description: Optional[str] = _DEFAULT_OPENAPI_RESPONSE_DESCRIPTION, + tags: Optional[List[str]] = None, + operation_id: Optional[str] = None, + include_in_schema: bool = True, middlewares: Optional[List[Callable[..., Any]]] = None, ): def register_route(func: Callable): # Convert methods to tuple. It needs to be hashable as its part of the self._routes dict key methods = (method,) if isinstance(method, str) else tuple(method) - route_key = (rule, methods, cors, compress, cache_control) + route_key = ( + rule, + methods, + cors, + compress, + cache_control, + summary, + description, + responses, + response_description, + tags, + operation_id, + include_in_schema, + ) # Collate Middleware for routes if middlewares is not None: @@ -1280,9 +2145,30 @@ def __init__( debug: Optional[bool] = None, serializer: Optional[Callable[[Dict], str]] = None, strip_prefixes: Optional[List[Union[str, Pattern]]] = None, + enable_validation: bool = False, ): """Amazon API Gateway REST and HTTP API v1 payload resolver""" - super().__init__(ProxyEventType.APIGatewayProxyEvent, cors, debug, serializer, strip_prefixes) + super().__init__( + ProxyEventType.APIGatewayProxyEvent, + cors, + debug, + serializer, + strip_prefixes, + enable_validation, + ) + + def _get_base_path(self) -> str: + # 3 different scenarios: + # + # 1. SAM local: even though a stage variable is sent to the Lambda function, it's not used in the path + # 2. API Gateway REST API: stage variable is used in the path + # 3. API Gateway REST Custom Domain: stage variable is not used in the path + # + # To solve the 3 scenarios, we try to match the beginning of the path with the stage variable + stage = self.current_event.request_context.stage + if stage and stage != "$default" and self.current_event.request_context.path.startswith(f"/{stage}"): + return f"/{stage}" + return "" # override route to ignore trailing "/" in routes for REST API def route( @@ -1292,10 +2178,31 @@ def route( cors: Optional[bool] = None, compress: bool = False, cache_control: Optional[str] = None, + summary: Optional[str] = None, + description: Optional[str] = None, + responses: Optional[Dict[int, Dict[str, Any]]] = None, + response_description: str = _DEFAULT_OPENAPI_RESPONSE_DESCRIPTION, + tags: Optional[List[str]] = None, + operation_id: Optional[str] = None, + include_in_schema: bool = True, middlewares: Optional[List[Callable[..., Any]]] = None, ): # NOTE: see #1552 for more context. - return super().route(rule.rstrip("/"), method, cors, compress, cache_control, middlewares) + return super().route( + rule.rstrip("/"), + method, + cors, + compress, + cache_control, + summary, + description, + responses, + response_description, + tags, + operation_id, + include_in_schema, + middlewares, + ) # Override _compile_regex to exclude trailing slashes for route resolution @staticmethod @@ -1312,9 +2219,30 @@ def __init__( debug: Optional[bool] = None, serializer: Optional[Callable[[Dict], str]] = None, strip_prefixes: Optional[List[Union[str, Pattern]]] = None, + enable_validation: bool = False, ): """Amazon API Gateway HTTP API v2 payload resolver""" - super().__init__(ProxyEventType.APIGatewayProxyEventV2, cors, debug, serializer, strip_prefixes) + super().__init__( + ProxyEventType.APIGatewayProxyEventV2, + cors, + debug, + serializer, + strip_prefixes, + enable_validation, + ) + + def _get_base_path(self) -> str: + # 3 different scenarios: + # + # 1. SAM local: even though a stage variable is sent to the Lambda function, it's not used in the path + # 2. API Gateway HTTP API: stage variable is used in the path + # 3. API Gateway HTTP Custom Domain: stage variable is not used in the path + # + # To solve the 3 scenarios, we try to match the beginning of the path with the stage variable + stage = self.current_event.request_context.stage + if stage and stage != "$default" and self.current_event.request_context.http.path.startswith(f"/{stage}"): + return f"/{stage}" + return "" class ALBResolver(ApiGatewayResolver): @@ -1326,6 +2254,11 @@ def __init__( debug: Optional[bool] = None, serializer: Optional[Callable[[Dict], str]] = None, strip_prefixes: Optional[List[Union[str, Pattern]]] = None, + enable_validation: bool = False, ): """Amazon Application Load Balancer (ALB) resolver""" - super().__init__(ProxyEventType.ALBEvent, cors, debug, serializer, strip_prefixes) + super().__init__(ProxyEventType.ALBEvent, cors, debug, serializer, strip_prefixes, enable_validation) + + def _get_base_path(self) -> str: + # ALB doesn't have a stage variable, so we just return an empty string + return "" diff --git a/aws_lambda_powertools/event_handler/bedrock_agent.py b/aws_lambda_powertools/event_handler/bedrock_agent.py new file mode 100644 index 00000000000..f3a21958d60 --- /dev/null +++ b/aws_lambda_powertools/event_handler/bedrock_agent.py @@ -0,0 +1,87 @@ +from re import Match +from typing import Any, Dict + +from typing_extensions import override + +from aws_lambda_powertools.event_handler import ApiGatewayResolver +from aws_lambda_powertools.event_handler.api_gateway import ( + ProxyEventType, + ResponseBuilder, +) +from aws_lambda_powertools.utilities.data_classes import BedrockAgentEvent + + +class BedrockResponseBuilder(ResponseBuilder): + """ + Bedrock Response Builder. This builds the response dict to be returned by Lambda when using Bedrock Agents. + + Since the payload format is different from the standard API Gateway Proxy event, we override the build method. + """ + + @override + def build(self, event: BedrockAgentEvent, *args) -> Dict[str, Any]: + """Build the full response dict to be returned by the lambda""" + self._route(event, None) + + return { + "messageVersion": "1.0", + "response": { + "actionGroup": event.action_group, + "apiPath": event.api_path, + "httpMethod": event.http_method, + "httpStatusCode": self.response.status_code, + "responseBody": { + self.response.content_type: { + "body": self.response.body, + }, + }, + }, + } + + +class BedrockAgentResolver(ApiGatewayResolver): + """Bedrock Agent Resolver + + See https://aws.amazon.com/bedrock/agents/ for more information. + + Examples + -------- + Simple example with a custom lambda handler using the Tracer capture_lambda_handler decorator + + ```python + from aws_lambda_powertools import Tracer + from aws_lambda_powertools.event_handler import BedrockAgentResolver + + tracer = Tracer() + app = BedrockAgentResolver() + + @app.get("/claims") + def simple_get(): + return "You have 3 claims" + + @tracer.capture_lambda_handler + def lambda_handler(event, context): + return app.resolve(event, context) + """ + + current_event: BedrockAgentEvent + + def __init__(self, debug: bool = False, enable_validation: bool = True): + super().__init__( + proxy_type=ProxyEventType.BedrockAgentEvent, + cors=None, + debug=debug, + serializer=None, + strip_prefixes=None, + enable_validation=enable_validation, + ) + self._response_builder_class = BedrockResponseBuilder + + @override + def _convert_matches_into_route_keys(self, match: Match) -> Dict[str, str]: + # In Bedrock Agents, all the parameters come inside the "parameters" key, not on the apiPath + # So we have to search for route parameters in the parameters key + parameters: Dict[str, str] = {} + if match.groupdict() and self.current_event.parameters: + parameters = {parameter["name"]: parameter["value"] for parameter in self.current_event.parameters} + return parameters diff --git a/aws_lambda_powertools/event_handler/lambda_function_url.py b/aws_lambda_powertools/event_handler/lambda_function_url.py index 433a013ab0b..b69c8fc8087 100644 --- a/aws_lambda_powertools/event_handler/lambda_function_url.py +++ b/aws_lambda_powertools/event_handler/lambda_function_url.py @@ -52,5 +52,19 @@ def __init__( debug: Optional[bool] = None, serializer: Optional[Callable[[Dict], str]] = None, strip_prefixes: Optional[List[Union[str, Pattern]]] = None, + enable_validation: bool = False, ): - super().__init__(ProxyEventType.LambdaFunctionUrlEvent, cors, debug, serializer, strip_prefixes) + super().__init__( + ProxyEventType.LambdaFunctionUrlEvent, + cors, + debug, + serializer, + strip_prefixes, + enable_validation, + ) + + def _get_base_path(self) -> str: + stage = self.current_event.request_context.stage + if stage and stage != "$default" and self.current_event.request_context.http.method.startswith(f"/{stage}"): + return f"/{stage}" + return "" diff --git a/aws_lambda_powertools/event_handler/middlewares/openapi_validation.py b/aws_lambda_powertools/event_handler/middlewares/openapi_validation.py new file mode 100644 index 00000000000..c162eeb4ce1 --- /dev/null +++ b/aws_lambda_powertools/event_handler/middlewares/openapi_validation.py @@ -0,0 +1,353 @@ +import dataclasses +import json +import logging +from copy import deepcopy +from typing import Any, Dict, List, Mapping, Optional, Sequence, Tuple + +from pydantic import BaseModel + +from aws_lambda_powertools.event_handler import Response +from aws_lambda_powertools.event_handler.api_gateway import Route +from aws_lambda_powertools.event_handler.middlewares import BaseMiddlewareHandler, NextMiddleware +from aws_lambda_powertools.event_handler.openapi.compat import ( + ModelField, + _model_dump, + _normalize_errors, + _regenerate_error_with_loc, + get_missing_field_error, +) +from aws_lambda_powertools.event_handler.openapi.encoders import jsonable_encoder +from aws_lambda_powertools.event_handler.openapi.exceptions import RequestValidationError +from aws_lambda_powertools.event_handler.openapi.params import Param +from aws_lambda_powertools.event_handler.openapi.types import IncEx +from aws_lambda_powertools.event_handler.types import EventHandlerInstance + +logger = logging.getLogger(__name__) + + +class OpenAPIValidationMiddleware(BaseMiddlewareHandler): + """ + OpenAPIValidationMiddleware is a middleware that validates the request against the OpenAPI schema defined by the + Lambda handler. It also validates the response against the OpenAPI schema defined by the Lambda handler. It + should not be used directly, but rather through the `enable_validation` parameter of the `ApiGatewayResolver`. + + Examples + -------- + + ```python + from typing import List + + from pydantic import BaseModel + + from aws_lambda_powertools.event_handler.api_gateway import ( + APIGatewayRestResolver, + ) + + class Todo(BaseModel): + name: str + + app = APIGatewayRestResolver(enable_validation=True) + + @app.get("/todos") + def get_todos(): List[Todo]: + return [Todo(name="hello world")] + ``` + """ + + def handler(self, app: EventHandlerInstance, next_middleware: NextMiddleware) -> Response: + logger.debug("OpenAPIValidationMiddleware handler") + + route: Route = app.context["_route"] + + values: Dict[str, Any] = {} + errors: List[Any] = [] + + try: + # Process path values, which can be found on the route_args + path_values, path_errors = _request_params_to_args( + route.dependant.path_params, + app.context["_route_args"], + ) + + # Process query values + query_values, query_errors = _request_params_to_args( + route.dependant.query_params, + app.current_event.query_string_parameters or {}, + ) + + values.update(path_values) + values.update(query_values) + errors += path_errors + query_errors + + # Process the request body, if it exists + if route.dependant.body_params: + (body_values, body_errors) = _request_body_to_args( + required_params=route.dependant.body_params, + received_body=self._get_body(app), + ) + values.update(body_values) + errors.extend(body_errors) + + if errors: + # Raise the validation errors + raise RequestValidationError(_normalize_errors(errors)) + else: + # Re-write the route_args with the validated values, and call the next middleware + app.context["_route_args"] = values + + # Call the handler by calling the next middleware + response = next_middleware(app) + + # Process the response + return self._handle_response(route=route, response=response) + except RequestValidationError as e: + return Response( + status_code=422, + content_type="application/json", + body=json.dumps({"detail": e.errors()}), + ) + + def _handle_response(self, *, route: Route, response: Response): + # Process the response body if it exists + if response.body: + # Validate and serialize the response, if it's JSON + if response.is_json(): + response.body = json.dumps( + self._serialize_response(field=route.dependant.return_param, response_content=response.body), + sort_keys=True, + ) + + return response + + def _serialize_response( + self, + *, + field: Optional[ModelField] = None, + response_content: Any, + include: Optional[IncEx] = None, + exclude: Optional[IncEx] = None, + by_alias: bool = True, + exclude_unset: bool = False, + exclude_defaults: bool = False, + exclude_none: bool = False, + ) -> Any: + """ + Serialize the response content according to the field type. + """ + if field: + errors: List[Dict[str, Any]] = [] + # MAINTENANCE: remove this when we drop pydantic v1 + if not hasattr(field, "serializable"): + response_content = self._prepare_response_content( + response_content, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + ) + + value = _validate_field(field=field, value=response_content, loc=("response",), existing_errors=errors) + if errors: + raise RequestValidationError(errors=_normalize_errors(errors), body=response_content) + + if hasattr(field, "serialize"): + return field.serialize( + value, + include=include, + exclude=exclude, + by_alias=by_alias, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + ) + + return jsonable_encoder( + value, + include=include, + exclude=exclude, + by_alias=by_alias, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + ) + else: + # Just serialize the response content returned from the handler + return jsonable_encoder(response_content) + + def _prepare_response_content( + self, + res: Any, + *, + exclude_unset: bool, + exclude_defaults: bool = False, + exclude_none: bool = False, + ) -> Any: + """ + Prepares the response content for serialization. + """ + if isinstance(res, BaseModel): + return _model_dump( + res, + by_alias=True, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + ) + elif isinstance(res, list): + return [ + self._prepare_response_content(item, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults) + for item in res + ] + elif isinstance(res, dict): + return { + k: self._prepare_response_content(v, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults) + for k, v in res.items() + } + elif dataclasses.is_dataclass(res): + return dataclasses.asdict(res) + return res + + def _get_body(self, app: EventHandlerInstance) -> Dict[str, Any]: + """ + Get the request body from the event, and parse it as JSON. + """ + + content_type_value = app.current_event.get_header_value("content-type") + if not content_type_value or content_type_value.startswith("application/json"): + try: + return app.current_event.json_body + except json.JSONDecodeError as e: + raise RequestValidationError( + [ + { + "type": "json_invalid", + "loc": ("body", e.pos), + "msg": "JSON decode error", + "input": {}, + "ctx": {"error": e.msg}, + }, + ], + body=e.doc, + ) from e + else: + raise NotImplementedError("Only JSON body is supported") + + +def _request_params_to_args( + required_params: Sequence[ModelField], + received_params: Mapping[str, Any], +) -> Tuple[Dict[str, Any], List[Any]]: + """ + Convert the request params to a dictionary of values using validation, and returns a list of errors. + """ + values = {} + errors = [] + + for field in required_params: + value = received_params.get(field.alias) + + field_info = field.field_info + if not isinstance(field_info, Param): + raise AssertionError(f"Expected Param field_info, got {field_info}") + + loc = (field_info.in_.value, field.alias) + + # If we don't have a value, see if it's required or has a default + if value is None: + if field.required: + errors.append(get_missing_field_error(loc=loc)) + else: + values[field.name] = deepcopy(field.default) + continue + + # Finally, validate the value + values[field.name] = _validate_field(field=field, value=value, loc=loc, existing_errors=errors) + + return values, errors + + +def _request_body_to_args( + required_params: List[ModelField], + received_body: Optional[Dict[str, Any]], +) -> Tuple[Dict[str, Any], List[Dict[str, Any]]]: + """ + Convert the request body to a dictionary of values using validation, and returns a list of errors. + """ + values: Dict[str, Any] = {} + errors: List[Dict[str, Any]] = [] + + received_body, field_alias_omitted = _get_embed_body( + field=required_params[0], + required_params=required_params, + received_body=received_body, + ) + + for field in required_params: + # This sets the location to: + # { "user": { object } } if field.alias == user + # { { object } if field_alias is omitted + loc: Tuple[str, ...] = ("body", field.alias) + if field_alias_omitted: + loc = ("body",) + + value: Optional[Any] = None + + # Now that we know what to look for, try to get the value from the received body + if received_body is not None: + try: + value = received_body.get(field.alias) + except AttributeError: + errors.append(get_missing_field_error(loc)) + continue + + # Determine if the field is required + if value is None: + if field.required: + errors.append(get_missing_field_error(loc)) + else: + values[field.name] = deepcopy(field.default) + continue + + # MAINTENANCE: Handle byte and file fields + + # Finally, validate the value + values[field.name] = _validate_field(field=field, value=value, loc=loc, existing_errors=errors) + + return values, errors + + +def _validate_field( + *, + field: ModelField, + value: Any, + loc: Tuple[str, ...], + existing_errors: List[Dict[str, Any]], +): + """ + Validate a field, and append any errors to the existing_errors list. + """ + validated_value, errors = field.validate(value, value, loc=loc) + + if isinstance(errors, list): + processed_errors = _regenerate_error_with_loc(errors=errors, loc_prefix=()) + existing_errors.extend(processed_errors) + elif errors: + existing_errors.append(errors) + + return validated_value + + +def _get_embed_body( + *, + field: ModelField, + required_params: List[ModelField], + received_body: Optional[Dict[str, Any]], +) -> Tuple[Optional[Dict[str, Any]], bool]: + field_info = field.field_info + embed = getattr(field_info, "embed", None) + + # If the field is an embed, and the field alias is omitted, we need to wrap the received body in the field alias. + field_alias_omitted = len(required_params) == 1 and not embed + if field_alias_omitted: + received_body = {field.alias: received_body} + + return received_body, field_alias_omitted diff --git a/aws_lambda_powertools/event_handler/openapi/__init__.py b/aws_lambda_powertools/event_handler/openapi/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/aws_lambda_powertools/event_handler/openapi/compat.py b/aws_lambda_powertools/event_handler/openapi/compat.py new file mode 100644 index 00000000000..54b78f7e5f6 --- /dev/null +++ b/aws_lambda_powertools/event_handler/openapi/compat.py @@ -0,0 +1,497 @@ +# mypy: ignore-errors +# flake8: noqa +from collections import deque +from copy import copy + +# MAINTENANCE: remove when deprecating Pydantic v1. Mypy doesn't handle two different code paths that import different +# versions of a module, so we need to ignore errors here. + +from dataclasses import dataclass, is_dataclass +from enum import Enum +from typing import Any, Dict, List, Set, Tuple, Type, Union, FrozenSet, Deque, Sequence, Mapping + +from typing_extensions import Annotated, Literal, get_origin, get_args + +from pydantic import BaseModel, create_model +from pydantic.fields import FieldInfo + +from aws_lambda_powertools.event_handler.openapi.types import ( + COMPONENT_REF_PREFIX, + PYDANTIC_V2, + ModelNameMap, + UnionType, +) + +sequence_annotation_to_type = { + Sequence: list, + List: list, + list: list, + Tuple: tuple, + tuple: tuple, + Set: set, + set: set, + FrozenSet: frozenset, + frozenset: frozenset, + Deque: deque, + deque: deque, +} + +sequence_types = tuple(sequence_annotation_to_type.keys()) + +RequestErrorModel: Type[BaseModel] = create_model("Request") + +if PYDANTIC_V2: + from pydantic import TypeAdapter, ValidationError + from pydantic._internal._typing_extra import eval_type_lenient + from pydantic.fields import FieldInfo + from pydantic._internal._utils import lenient_issubclass + from pydantic.json_schema import GenerateJsonSchema, JsonSchemaValue + from pydantic_core import PydanticUndefined, PydanticUndefinedType + + from aws_lambda_powertools.event_handler.openapi.types import IncEx + + Undefined = PydanticUndefined + Required = PydanticUndefined + UndefinedType = PydanticUndefinedType + + evaluate_forwardref = eval_type_lenient + + class ErrorWrapper(Exception): + pass + + @dataclass + class ModelField: + field_info: FieldInfo + name: str + mode: Literal["validation", "serialization"] = "validation" + + @property + def alias(self) -> str: + value = self.field_info.alias + return value if value is not None else self.name + + @property + def required(self) -> bool: + return self.field_info.is_required() + + @property + def default(self) -> Any: + return self.get_default() + + @property + def type_(self) -> Any: + return self.field_info.annotation + + def __post_init__(self) -> None: + self._type_adapter: TypeAdapter[Any] = TypeAdapter( + Annotated[self.field_info.annotation, self.field_info], + ) + + def get_default(self) -> Any: + if self.field_info.is_required(): + return Undefined + return self.field_info.get_default(call_default_factory=True) + + def serialize( + self, + value: Any, + *, + mode: Literal["json", "python"] = "json", + include: Union[IncEx, None] = None, + exclude: Union[IncEx, None] = None, + by_alias: bool = True, + exclude_unset: bool = False, + exclude_defaults: bool = False, + exclude_none: bool = False, + ) -> Any: + return self._type_adapter.dump_python( + value, + mode=mode, + include=include, + exclude=exclude, + by_alias=by_alias, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + ) + + def validate( + self, value: Any, values: Dict[str, Any] = {}, *, loc: Tuple[Union[int, str], ...] = () + ) -> Tuple[Any, Union[List[Dict[str, Any]], None]]: + try: + return (self._type_adapter.validate_python(value, from_attributes=True), None) + except ValidationError as exc: + return None, _regenerate_error_with_loc(errors=exc.errors(), loc_prefix=loc) + + def __hash__(self) -> int: + # Each ModelField is unique for our purposes + return id(self) + + def get_schema_from_model_field( + *, + field: ModelField, + model_name_map: ModelNameMap, + field_mapping: Dict[ + Tuple[ModelField, Literal["validation", "serialization"]], + JsonSchemaValue, + ], + ) -> Dict[str, Any]: + json_schema = field_mapping[(field, field.mode)] + if "$ref" not in json_schema: + # MAINTENANCE: remove when deprecating Pydantic v1 + # Ref: https://github.com/pydantic/pydantic/blob/d61792cc42c80b13b23e3ffa74bc37ec7c77f7d1/pydantic/schema.py#L207 + json_schema["title"] = field.field_info.title or field.alias.title().replace("_", " ") + return json_schema + + def get_definitions( + *, + fields: List[ModelField], + schema_generator: GenerateJsonSchema, + model_name_map: ModelNameMap, + ) -> Tuple[ + Dict[ + Tuple[ModelField, Literal["validation", "serialization"]], + Dict[str, Any], + ], + Dict[str, Dict[str, Any]], + ]: + inputs = [(field, field.mode, field._type_adapter.core_schema) for field in fields] + field_mapping, definitions = schema_generator.generate_definitions(inputs=inputs) + + return field_mapping, definitions + + def get_compat_model_name_map(fields: List[ModelField]) -> ModelNameMap: + return {} + + def get_annotation_from_field_info(annotation: Any, field_info: FieldInfo, field_name: str) -> Any: + return annotation + + def model_rebuild(model: Type[BaseModel]) -> None: + model.model_rebuild() + + def copy_field_info(*, field_info: FieldInfo, annotation: Any) -> FieldInfo: + return type(field_info).from_annotation(annotation) + + def get_missing_field_error(loc: Tuple[str, ...]) -> Dict[str, Any]: + error = ValidationError.from_exception_data( + "Field required", [{"type": "missing", "loc": loc, "input": {}}] + ).errors()[0] + error["input"] = None + return error + + def is_scalar_field(field: ModelField) -> bool: + from aws_lambda_powertools.event_handler.openapi.params import Body + + return field_annotation_is_scalar(field.field_info.annotation) and not isinstance(field.field_info, Body) + + def is_scalar_sequence_field(field: ModelField) -> bool: + return field_annotation_is_scalar_sequence(field.field_info.annotation) + + def is_sequence_field(field: ModelField) -> bool: + return field_annotation_is_sequence(field.field_info.annotation) + + def is_bytes_field(field: ModelField) -> bool: + return is_bytes_or_nonable_bytes_annotation(field.type_) + + def is_bytes_sequence_field(field: ModelField) -> bool: + return is_bytes_sequence_annotation(field.type_) + + def serialize_sequence_value(*, field: ModelField, value: Any) -> Sequence[Any]: + origin_type = get_origin(field.field_info.annotation) or field.field_info.annotation + if not issubclass(origin_type, sequence_types): # type: ignore[arg-type] + raise AssertionError(f"Expected sequence type, got {origin_type}") + return sequence_annotation_to_type[origin_type](value) # type: ignore[no-any-return] + + def _normalize_errors(errors: Sequence[Any]) -> List[Dict[str, Any]]: + return errors # type: ignore[return-value] + + def create_body_model(*, fields: Sequence[ModelField], model_name: str) -> Type[BaseModel]: + field_params = {f.name: (f.field_info.annotation, f.field_info) for f in fields} + model: Type[BaseModel] = create_model(model_name, **field_params) + return model + + def _model_dump(model: BaseModel, mode: Literal["json", "python"] = "json", **kwargs: Any) -> Any: + return model.model_dump(mode=mode, **kwargs) + + def model_json(model: BaseModel, **kwargs: Any) -> Any: + return model.model_dump_json(**kwargs) + +else: + from pydantic import BaseModel, ValidationError + from pydantic.fields import ( + ModelField, + Required, + Undefined, + UndefinedType, + SHAPE_LIST, + SHAPE_SET, + SHAPE_FROZENSET, + SHAPE_TUPLE, + SHAPE_SEQUENCE, + SHAPE_TUPLE_ELLIPSIS, + SHAPE_SINGLETON, + ) + from pydantic.schema import ( + field_schema, + get_annotation_from_field_info, + get_flat_models_from_fields, + get_model_name_map, + model_process_schema, + ) + from pydantic.errors import MissingError + from pydantic.error_wrappers import ErrorWrapper + from pydantic.utils import lenient_issubclass + from pydantic.typing import evaluate_forwardref + + JsonSchemaValue = Dict[str, Any] + + sequence_shapes = [ + SHAPE_LIST, + SHAPE_SET, + SHAPE_FROZENSET, + SHAPE_TUPLE, + SHAPE_SEQUENCE, + SHAPE_TUPLE_ELLIPSIS, + ] + sequence_shape_to_type = { + SHAPE_LIST: list, + SHAPE_SET: set, + SHAPE_TUPLE: tuple, + SHAPE_SEQUENCE: list, + SHAPE_TUPLE_ELLIPSIS: list, + } + + @dataclass + class GenerateJsonSchema: + ref_template: str + + def get_schema_from_model_field( + *, + field: ModelField, + model_name_map: ModelNameMap, + field_mapping: Dict[ + Tuple[ModelField, Literal["validation", "serialization"]], + JsonSchemaValue, + ], + ) -> Dict[str, Any]: + return field_schema( + field, + model_name_map=model_name_map, + ref_prefix=COMPONENT_REF_PREFIX, + )[0] + + def get_definitions( + *, + fields: List[ModelField], + schema_generator: GenerateJsonSchema, + model_name_map: ModelNameMap, + ) -> Tuple[ + Dict[Tuple[ModelField, Literal["validation", "serialization"]], JsonSchemaValue], + Dict[str, Dict[str, Any]], + ]: + models = get_flat_models_from_fields(fields, known_models=set()) + return {}, get_model_definitions(flat_models=models, model_name_map=model_name_map) + + def get_model_definitions( + *, + flat_models: Set[Union[Type[BaseModel], Type[Enum]]], + model_name_map: ModelNameMap, + ) -> Dict[str, Any]: + definitions: Dict[str, Dict[str, Any]] = {} + for model in flat_models: + m_schema, m_definitions, _ = model_process_schema( + model, + model_name_map=model_name_map, + ref_prefix=COMPONENT_REF_PREFIX, + ) + definitions.update(m_definitions) + model_name = model_name_map[model] + if "description" in m_schema: + m_schema["description"] = m_schema["description"].split("\f")[0] + definitions[model_name] = m_schema + return definitions + + def get_compat_model_name_map(fields: List[ModelField]) -> ModelNameMap: + models = get_flat_models_from_fields(fields, known_models=set()) + return get_model_name_map(models) + + def model_rebuild(model: Type[BaseModel]) -> None: + model.update_forward_refs() + + def copy_field_info(*, field_info: FieldInfo, annotation: Any) -> FieldInfo: + return copy(field_info) + + def is_pv1_scalar_field(field: ModelField) -> bool: + from aws_lambda_powertools.event_handler.openapi.params import Body + + if not ( + field.shape == SHAPE_SINGLETON + and not lenient_issubclass(field.type_, BaseModel) + and not lenient_issubclass(field.type_, dict) + and not field_annotation_is_sequence(field.type_) + and not is_dataclass(field.type_) + and not isinstance(field.field_info, Body) + ): + return False + + if field.sub_fields: + if not all(is_pv1_scalar_sequence_field(f) for f in field.sub_fields): + return False + + return True + + def is_pv1_scalar_sequence_field(field: ModelField) -> bool: + if (field.shape in sequence_shapes) and not lenient_issubclass(field.type_, BaseModel): + if field.sub_fields is not None: + for sub_field in field.sub_fields: + if not is_pv1_scalar_field(sub_field): + return False + return True + if _annotation_is_sequence(field.type_): + return True + return False + + def is_scalar_field(field: ModelField) -> bool: + return is_pv1_scalar_field(field) + + def is_scalar_sequence_field(field: ModelField) -> bool: + return is_pv1_scalar_sequence_field(field) + + def is_sequence_field(field: ModelField) -> bool: + return field.shape in sequence_shapes or _annotation_is_sequence(field.type_) + + def is_bytes_field(field: ModelField) -> bool: + return lenient_issubclass(field.type_, bytes) + + def is_bytes_sequence_field(field: ModelField) -> bool: + return field.shape in sequence_shapes and lenient_issubclass(field.type_, bytes) # type: ignore[attr-defined] + + def _annotation_is_sequence(annotation: Union[Type[Any], None]) -> bool: + if lenient_issubclass(annotation, (str, bytes)): + return False + return lenient_issubclass(annotation, sequence_types) + + def get_missing_field_error(loc: Tuple[str, ...]) -> Dict[str, Any]: + missing_field_error = ErrorWrapper(MissingError(), loc=loc) + new_error = ValidationError([missing_field_error], RequestErrorModel) + return new_error.errors()[0] + + def _normalize_errors(errors: Sequence[Any]) -> List[Dict[str, Any]]: + use_errors: List[Any] = [] + for error in errors: + if isinstance(error, ErrorWrapper): + new_errors = ValidationError(errors=[error], model=RequestErrorModel).errors() # type: ignore[call-arg] + use_errors.extend(new_errors) + elif isinstance(error, list): + use_errors.extend(_normalize_errors(error)) + else: + use_errors.append(error) + return use_errors + + def create_body_model(*, fields: Sequence[ModelField], model_name: str) -> Type[BaseModel]: + body_model = create_model(model_name) + for f in fields: + body_model.__fields__[f.name] = f # type: ignore[index] + return body_model + + def serialize_sequence_value(*, field: ModelField, value: Any) -> Sequence[Any]: + return sequence_shape_to_type[field.shape](value) + + def _model_dump(model: BaseModel, mode: Literal["json", "python"] = "json", **kwargs: Any) -> Any: + return model.dict(**kwargs) + + def model_json(model: BaseModel, **kwargs: Any) -> Any: + return model.json(**kwargs) + + +# Common code for both versions + + +def field_annotation_is_complex(annotation: Union[Type[Any], None]) -> bool: + origin = get_origin(annotation) + if origin is Union or origin is UnionType: + return any(field_annotation_is_complex(arg) for arg in get_args(annotation)) + + return ( + _annotation_is_complex(annotation) + or _annotation_is_complex(origin) + or hasattr(origin, "__pydantic_core_schema__") + or hasattr(origin, "__get_pydantic_core_schema__") + ) + + +def field_annotation_is_scalar(annotation: Any) -> bool: + return annotation is Ellipsis or not field_annotation_is_complex(annotation) + + +def field_annotation_is_sequence(annotation: Union[Type[Any], None]) -> bool: + return _annotation_is_sequence(annotation) or _annotation_is_sequence(get_origin(annotation)) + + +def field_annotation_is_scalar_sequence(annotation: Union[Type[Any], None]) -> bool: + origin = get_origin(annotation) + if origin is Union or origin is UnionType: + at_least_one_scalar_sequence = False + for arg in get_args(annotation): + if field_annotation_is_scalar_sequence(arg): + at_least_one_scalar_sequence = True + continue + elif not field_annotation_is_scalar(arg): + return False + return at_least_one_scalar_sequence + return field_annotation_is_sequence(annotation) and all( + field_annotation_is_scalar(sub_annotation) for sub_annotation in get_args(annotation) + ) + + +def is_bytes_or_nonable_bytes_annotation(annotation: Any) -> bool: + if lenient_issubclass(annotation, bytes): + return True + origin = get_origin(annotation) + if origin is Union or origin is UnionType: + for arg in get_args(annotation): + if lenient_issubclass(arg, bytes): + return True + return False + + +def is_bytes_sequence_annotation(annotation: Any) -> bool: + origin = get_origin(annotation) + if origin is Union or origin is UnionType: + at_least_one = False + for arg in get_args(annotation): + if is_bytes_sequence_annotation(arg): + at_least_one = True + break + return at_least_one + return field_annotation_is_sequence(annotation) and all( + is_bytes_or_nonable_bytes_annotation(sub_annotation) for sub_annotation in get_args(annotation) + ) + + +def value_is_sequence(value: Any) -> bool: + return isinstance(value, sequence_types) and not isinstance(value, (str, bytes)) # type: ignore[arg-type] + + +def _annotation_is_complex(annotation: Union[Type[Any], None]) -> bool: + return ( + lenient_issubclass(annotation, (BaseModel, Mapping)) # TODO: UploadFile + or _annotation_is_sequence(annotation) + or is_dataclass(annotation) + ) + + +def _annotation_is_sequence(annotation: Union[Type[Any], None]) -> bool: + if lenient_issubclass(annotation, (str, bytes)): + return False + return lenient_issubclass(annotation, sequence_types) + + +def _regenerate_error_with_loc( + *, errors: Sequence[Any], loc_prefix: Tuple[Union[str, int], ...] +) -> List[Dict[str, Any]]: + updated_loc_errors: List[Any] = [ + {**err, "loc": loc_prefix + err.get("loc", ())} for err in _normalize_errors(errors) + ] + + return updated_loc_errors diff --git a/aws_lambda_powertools/event_handler/openapi/constants.py b/aws_lambda_powertools/event_handler/openapi/constants.py new file mode 100644 index 00000000000..e41063f5282 --- /dev/null +++ b/aws_lambda_powertools/event_handler/openapi/constants.py @@ -0,0 +1,2 @@ +DEFAULT_API_VERSION = "1.0.0" +DEFAULT_OPENAPI_VERSION = "3.0.0" diff --git a/aws_lambda_powertools/event_handler/openapi/dependant.py b/aws_lambda_powertools/event_handler/openapi/dependant.py new file mode 100644 index 00000000000..87e0c7dfb3d --- /dev/null +++ b/aws_lambda_powertools/event_handler/openapi/dependant.py @@ -0,0 +1,344 @@ +import inspect +import re +from typing import Any, Callable, Dict, ForwardRef, List, Optional, Set, Tuple, Type, cast + +from pydantic import BaseModel + +from aws_lambda_powertools.event_handler.openapi.compat import ( + ModelField, + create_body_model, + evaluate_forwardref, + is_scalar_field, + is_scalar_sequence_field, +) +from aws_lambda_powertools.event_handler.openapi.params import ( + Body, + Dependant, + Param, + ParamTypes, + Query, + _File, + _Form, + _Header, + analyze_param, + create_response_field, + get_flat_dependant, +) + +""" +This turns the opaque function signature into typed, validated models. + +It relies on Pydantic's typing and validation to achieve this in a declarative way. +This enables traits like autocompletion, validation, and declarative structure vs imperative parsing. + +This code parses an OpenAPI operation handler function signature into Pydantic models. It uses inspect to get the +signature and regex to parse path parameters. Each parameter is analyzed to extract its type annotation and generate +a corresponding Pydantic field, which are added to a Dependant model. Return values are handled similarly. + +This modeling allows for type checking, automatic parameter name/location/type extraction, and input validation - +turning the opaque signature into validated models. It relies on Pydantic's typing and validation for a declarative +approach over imperative parsing, enabling autocompletion, validation and structure. +""" + + +def add_param_to_fields( + *, + field: ModelField, + dependant: Dependant, +) -> None: + """ + Adds a parameter to the list of parameters in the dependant model. + + Parameters + ---------- + field: ModelField + The field to add + dependant: Dependant + The dependant model to add the field to + + """ + field_info = cast(Param, field.field_info) + if field_info.in_ == ParamTypes.path: + dependant.path_params.append(field) + elif field_info.in_ == ParamTypes.query: + dependant.query_params.append(field) + elif field_info.in_ == ParamTypes.header: + dependant.header_params.append(field) + else: + if field_info.in_ != ParamTypes.cookie: + raise AssertionError(f"Unsupported param type: {field_info.in_}") + dependant.cookie_params.append(field) + + +def get_typed_annotation(annotation: Any, globalns: Dict[str, Any]) -> Any: + """ + Evaluates a type annotation, which can be a string or a ForwardRef. + """ + if isinstance(annotation, str): + annotation = ForwardRef(annotation) + annotation = evaluate_forwardref(annotation, globalns, globalns) + return annotation + + +def get_typed_signature(call: Callable[..., Any]) -> inspect.Signature: + """ + Returns a typed signature for a callable, resolving forward references. + + Parameters + ---------- + call: Callable[..., Any] + The callable to get the signature for + + Returns + ------- + inspect.Signature + The typed signature + """ + signature = inspect.signature(call) + + # Gets the global namespace for the call. This is used to resolve forward references. + globalns = getattr(call, "__global__", {}) + + typed_params = [ + inspect.Parameter( + name=param.name, + kind=param.kind, + default=param.default, + annotation=get_typed_annotation(param.annotation, globalns), + ) + for param in signature.parameters.values() + ] + + # If the return annotation is not empty, add it to the signature. + if signature.return_annotation is not inspect.Signature.empty: + return_param = inspect.Parameter( + name="Return", + kind=inspect.Parameter.POSITIONAL_OR_KEYWORD, + default=None, + annotation=get_typed_annotation(signature.return_annotation, globalns), + ) + return inspect.Signature(typed_params, return_annotation=return_param.annotation) + else: + return inspect.Signature(typed_params) + + +def get_path_param_names(path: str) -> Set[str]: + """ + Returns the path parameter names from a path template. Those are the strings between < and >. + + Parameters + ---------- + path: str + The path template + + Returns + ------- + Set[str] + The path parameter names + + """ + return set(re.findall("<(.*?)>", path)) + + +def get_dependant( + *, + path: str, + call: Callable[..., Any], + name: Optional[str] = None, +) -> Dependant: + """ + Returns a dependant model for a handler function. A dependant model is a model that contains + the parameters and return value of a handler function. + + Parameters + ---------- + path: str + The path template + call: Callable[..., Any] + The handler function + name: str, optional + The name of the handler function + + Returns + ------- + Dependant + The dependant model for the handler function + """ + path_param_names = get_path_param_names(path) + endpoint_signature = get_typed_signature(call) + signature_params = endpoint_signature.parameters + + dependant = Dependant( + call=call, + name=name, + path=path, + ) + + # Add each parameter to the dependant model + for param_name, param in signature_params.items(): + # If the parameter is a path parameter, we need to set the in_ field to "path". + is_path_param = param_name in path_param_names + + # Analyze the parameter to get the Pydantic field. + param_field = analyze_param( + param_name=param_name, + annotation=param.annotation, + value=param.default, + is_path_param=is_path_param, + is_response_param=False, + ) + if param_field is None: + raise AssertionError(f"Parameter field is None for param: {param_name}") + + if is_body_param(param_field=param_field, is_path_param=is_path_param): + dependant.body_params.append(param_field) + else: + add_param_to_fields(field=param_field, dependant=dependant) + + # If the return annotation is not empty, add it to the dependant model. + return_annotation = endpoint_signature.return_annotation + if return_annotation is not inspect.Signature.empty: + param_field = analyze_param( + param_name="return", + annotation=return_annotation, + value=None, + is_path_param=False, + is_response_param=True, + ) + if param_field is None: + raise AssertionError("Param field is None for return annotation") + + dependant.return_param = param_field + + return dependant + + +def is_body_param(*, param_field: ModelField, is_path_param: bool) -> bool: + """ + Returns whether a parameter is a request body parameter, by checking if it is a scalar field or a body field. + + Parameters + ---------- + param_field: ModelField + The parameter field + is_path_param: bool + Whether the parameter is a path parameter + + Returns + ------- + bool + Whether the parameter is a request body parameter + """ + if is_path_param: + if not is_scalar_field(field=param_field): + raise AssertionError("Path params must be of one of the supported types") + return False + elif is_scalar_field(field=param_field): + return False + elif isinstance(param_field.field_info, (Query, _Header)) and is_scalar_sequence_field(param_field): + return False + else: + if not isinstance(param_field.field_info, Body): + raise AssertionError(f"Param: {param_field.name} can only be a request body, use Body()") + return True + + +def get_flat_params(dependant: Dependant) -> List[ModelField]: + """ + Get a list of all the parameters from a Dependant object. + + Parameters + ---------- + dependant : Dependant + The Dependant object containing the parameters. + + Returns + ------- + List[ModelField] + A list of ModelField objects containing the flat parameters from the Dependant object. + + """ + flat_dependant = get_flat_dependant(dependant) + return ( + flat_dependant.path_params + + flat_dependant.query_params + + flat_dependant.header_params + + flat_dependant.cookie_params + ) + + +def get_body_field(*, dependant: Dependant, name: str) -> Optional[ModelField]: + """ + Get the Body field for a given Dependant object. + """ + + flat_dependant = get_flat_dependant(dependant) + if not flat_dependant.body_params: + return None + + first_param = flat_dependant.body_params[0] + field_info = first_param.field_info + + # Handle the case where there is only one body parameter and it is embedded + embed = getattr(field_info, "embed", None) + body_param_names_set = {param.name for param in flat_dependant.body_params} + if len(body_param_names_set) == 1 and not embed: + return first_param + + # If one field requires to embed, all have to be embedded + for param in flat_dependant.body_params: + setattr(param.field_info, "embed", True) # noqa: B010 + + # Generate a custom body model for this endpoint + model_name = "Body_" + name + body_model = create_body_model(fields=flat_dependant.body_params, model_name=model_name) + + required = any(True for f in flat_dependant.body_params if f.required) + + body_field_info, body_field_info_kwargs = get_body_field_info( + body_model=body_model, + flat_dependant=flat_dependant, + required=required, + ) + + final_field = create_response_field( + name="body", + type_=body_model, + required=required, + alias="body", + field_info=body_field_info(**body_field_info_kwargs), + ) + return final_field + + +def get_body_field_info( + *, + body_model: Type[BaseModel], + flat_dependant: Dependant, + required: bool, +) -> Tuple[Type[Body], Dict[str, Any]]: + """ + Get the Body field info and kwargs for a given body model. + """ + + body_field_info_kwargs: Dict[str, Any] = {"annotation": body_model, "alias": "body"} + + if not required: + body_field_info_kwargs["default"] = None + + if any(isinstance(f.field_info, _File) for f in flat_dependant.body_params): + # MAINTENANCE: body_field_info: Type[Body] = _File + raise NotImplementedError("_File fields are not supported in request bodies") + elif any(isinstance(f.field_info, _Form) for f in flat_dependant.body_params): + # MAINTENANCE: body_field_info: Type[Body] = _Form + raise NotImplementedError("_Form fields are not supported in request bodies") + else: + body_field_info = Body + + body_param_media_types = [ + f.field_info.media_type for f in flat_dependant.body_params if isinstance(f.field_info, Body) + ] + if len(set(body_param_media_types)) == 1: + body_field_info_kwargs["media_type"] = body_param_media_types[0] + + return body_field_info, body_field_info_kwargs diff --git a/aws_lambda_powertools/event_handler/openapi/encoders.py b/aws_lambda_powertools/event_handler/openapi/encoders.py new file mode 100644 index 00000000000..94c1cb5d659 --- /dev/null +++ b/aws_lambda_powertools/event_handler/openapi/encoders.py @@ -0,0 +1,344 @@ +import dataclasses +import datetime +from collections import defaultdict, deque +from decimal import Decimal +from enum import Enum +from pathlib import Path, PurePath +from re import Pattern +from types import GeneratorType +from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union +from uuid import UUID + +from pydantic import BaseModel +from pydantic.color import Color +from pydantic.types import SecretBytes, SecretStr + +from aws_lambda_powertools.event_handler.openapi.compat import _model_dump +from aws_lambda_powertools.event_handler.openapi.types import IncEx + +""" +This module contains the encoders used by jsonable_encoder to convert Python objects to JSON serializable data types. +""" + + +def jsonable_encoder( # noqa: PLR0911 + obj: Any, + include: Optional[IncEx] = None, + exclude: Optional[IncEx] = None, + by_alias: bool = True, + exclude_unset: bool = False, + exclude_defaults: bool = False, + exclude_none: bool = False, +) -> Any: + """ + JSON encodes an arbitrary Python object into JSON serializable data types. + + This is a modified version of fastapi.encoders.jsonable_encoder that supports + encoding of pydantic.BaseModel objects. + + Parameters + ---------- + obj : Any + The object to encode + include : Optional[IncEx], optional + A set or dictionary of strings that specifies which properties should be included, by default None, + meaning everything is included + exclude : Optional[IncEx], optional + A set or dictionary of strings that specifies which properties should be excluded, by default None, + meaning nothing is excluded + by_alias : bool, optional + Whether field aliases should be respected, by default True + exclude_unset : bool, optional + Whether fields that are not set should be excluded, by default False + exclude_defaults : bool, optional + Whether fields that are equal to their default value (as specified in the model) should be excluded, + by default False + exclude_none : bool, optional + Whether fields that are equal to None should be excluded, by default False + + Returns + ------- + Any + The JSON serializable data types + """ + if include is not None and not isinstance(include, (set, dict)): + include = set(include) + if exclude is not None and not isinstance(exclude, (set, dict)): + exclude = set(exclude) + + # Pydantic models + if isinstance(obj, BaseModel): + return _dump_base_model( + obj=obj, + include=include, + exclude=exclude, + by_alias=by_alias, + exclude_unset=exclude_unset, + exclude_none=exclude_none, + exclude_defaults=exclude_defaults, + ) + + # Dataclasses + if dataclasses.is_dataclass(obj): + obj_dict = dataclasses.asdict(obj) + return jsonable_encoder( + obj_dict, + include=include, + exclude=exclude, + by_alias=by_alias, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + ) + + # Enums + if isinstance(obj, Enum): + return obj.value + + # Paths + if isinstance(obj, PurePath): + return str(obj) + + # Scalars + if isinstance(obj, (str, int, float, type(None))): + return obj + + # Dictionaries + if isinstance(obj, dict): + return _dump_dict( + obj=obj, + include=include, + exclude=exclude, + by_alias=by_alias, + exclude_none=exclude_none, + exclude_unset=exclude_unset, + ) + + # Sequences + if isinstance(obj, (list, set, frozenset, GeneratorType, tuple, deque)): + return _dump_sequence( + obj=obj, + include=include, + exclude=exclude, + by_alias=by_alias, + exclude_none=exclude_none, + exclude_defaults=exclude_defaults, + exclude_unset=exclude_unset, + ) + + # Other types + if type(obj) in ENCODERS_BY_TYPE: + return ENCODERS_BY_TYPE[type(obj)](obj) + + for encoder, classes_tuple in encoders_by_class_tuples.items(): + if isinstance(obj, classes_tuple): + return encoder(obj) + + # Default + return _dump_other( + obj=obj, + include=include, + exclude=exclude, + by_alias=by_alias, + exclude_none=exclude_none, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + ) + + +def _dump_base_model( + *, + obj: Any, + include: Optional[IncEx] = None, + exclude: Optional[IncEx] = None, + by_alias: bool = True, + exclude_unset: bool = False, + exclude_none: bool = False, + exclude_defaults: bool = False, +): + """ + Dump a BaseModel object to a dict, using the same parameters as jsonable_encoder + """ + obj_dict = _model_dump( + obj, + mode="json", + include=include, + exclude=exclude, + by_alias=by_alias, + exclude_unset=exclude_unset, + exclude_none=exclude_none, + exclude_defaults=exclude_defaults, + ) + if "__root__" in obj_dict: + obj_dict = obj_dict["__root__"] + + return jsonable_encoder( + obj_dict, + exclude_none=exclude_none, + exclude_defaults=exclude_defaults, + ) + + +def _dump_dict( + *, + obj: Any, + include: Optional[IncEx] = None, + exclude: Optional[IncEx] = None, + by_alias: bool = True, + exclude_unset: bool = False, + exclude_none: bool = False, +) -> Dict[str, Any]: + """ + Dump a dict to a dict, using the same parameters as jsonable_encoder + """ + encoded_dict = {} + allowed_keys = set(obj.keys()) + if include is not None: + allowed_keys &= set(include) + if exclude is not None: + allowed_keys -= set(exclude) + for key, value in obj.items(): + if ( + (not isinstance(key, str) or not key.startswith("_sa")) + and (value is not None or not exclude_none) + and key in allowed_keys + ): + encoded_key = jsonable_encoder( + key, + by_alias=by_alias, + exclude_unset=exclude_unset, + exclude_none=exclude_none, + ) + encoded_value = jsonable_encoder( + value, + by_alias=by_alias, + exclude_unset=exclude_unset, + exclude_none=exclude_none, + ) + encoded_dict[encoded_key] = encoded_value + return encoded_dict + + +def _dump_sequence( + *, + obj: Any, + include: Optional[IncEx] = None, + exclude: Optional[IncEx] = None, + by_alias: bool = True, + exclude_unset: bool = False, + exclude_none: bool = False, + exclude_defaults: bool = False, +) -> List[Any]: + """ + Dump a sequence to a list, using the same parameters as jsonable_encoder + """ + encoded_list = [] + for item in obj: + encoded_list.append( + jsonable_encoder( + item, + include=include, + exclude=exclude, + by_alias=by_alias, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + ), + ) + return encoded_list + + +def _dump_other( + *, + obj: Any, + include: Optional[IncEx] = None, + exclude: Optional[IncEx] = None, + by_alias: bool = True, + exclude_unset: bool = False, + exclude_none: bool = False, + exclude_defaults: bool = False, +) -> Any: + """ + Dump an object to ah hashable object, using the same parameters as jsonable_encoder + """ + try: + data = dict(obj) + except Exception as e: + errors: List[Exception] = [e] + try: + data = vars(obj) + except Exception as e: + errors.append(e) + raise ValueError(errors) from e + return jsonable_encoder( + data, + include=include, + exclude=exclude, + by_alias=by_alias, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + ) + + +def iso_format(o: Union[datetime.date, datetime.time]) -> str: + """ + ISO format for date and time + """ + return o.isoformat() + + +def decimal_encoder(dec_value: Decimal) -> Union[int, float]: + """ + Encodes a Decimal as int of there's no exponent, otherwise float + + This is useful when we use ConstrainedDecimal to represent Numeric(x,0) + where an integer (but not int typed) is used. Encoding this as a float + results in failed round-tripping between encode and parse. + + >>> decimal_encoder(Decimal("1.0")) + 1.0 + + >>> decimal_encoder(Decimal("1")) + 1 + """ + if dec_value.as_tuple().exponent >= 0: # type: ignore[operator] + return int(dec_value) + else: + return float(dec_value) + + +# Encoders for types that are not JSON serializable +ENCODERS_BY_TYPE: Dict[Type[Any], Callable[[Any], Any]] = { + bytes: lambda o: o.decode(), + Color: str, + datetime.date: iso_format, + datetime.datetime: iso_format, + datetime.time: iso_format, + datetime.timedelta: lambda td: td.total_seconds(), + Decimal: decimal_encoder, + Enum: lambda o: o.value, + frozenset: list, + deque: list, + GeneratorType: list, + Path: str, + Pattern: lambda o: o.pattern, + SecretBytes: str, + SecretStr: str, + set: list, + UUID: str, +} + + +# Generates a mapping of encoders to a tuple of classes that they can encode +def generate_encoders_by_class_tuples( + type_encoder_map: Dict[Any, Callable[[Any], Any]], +) -> Dict[Callable[[Any], Any], Tuple[Any, ...]]: + encoders: Dict[Callable[[Any], Any], Tuple[Any, ...]] = defaultdict(tuple) + for type_, encoder in type_encoder_map.items(): + encoders[encoder] += (type_,) + return encoders + + +# Mapping of encoders to a tuple of classes that they can encode +encoders_by_class_tuples = generate_encoders_by_class_tuples(ENCODERS_BY_TYPE) diff --git a/aws_lambda_powertools/event_handler/openapi/exceptions.py b/aws_lambda_powertools/event_handler/openapi/exceptions.py new file mode 100644 index 00000000000..fdd829ba9b1 --- /dev/null +++ b/aws_lambda_powertools/event_handler/openapi/exceptions.py @@ -0,0 +1,23 @@ +from typing import Any, Sequence + + +class ValidationException(Exception): + """ + Base exception for all validation errors + """ + + def __init__(self, errors: Sequence[Any]) -> None: + self._errors = errors + + def errors(self) -> Sequence[Any]: + return self._errors + + +class RequestValidationError(ValidationException): + """ + Raised when the request body does not match the OpenAPI schema + """ + + def __init__(self, errors: Sequence[Any], *, body: Any = None) -> None: + super().__init__(errors) + self.body = body diff --git a/aws_lambda_powertools/event_handler/openapi/models.py b/aws_lambda_powertools/event_handler/openapi/models.py new file mode 100644 index 00000000000..bbbc160f1e6 --- /dev/null +++ b/aws_lambda_powertools/event_handler/openapi/models.py @@ -0,0 +1,583 @@ +from enum import Enum +from typing import Any, Dict, List, Optional, Set, Union + +from pydantic import AnyUrl, BaseModel, Field + +from aws_lambda_powertools.event_handler.openapi.compat import model_rebuild +from aws_lambda_powertools.event_handler.openapi.types import PYDANTIC_V2 +from aws_lambda_powertools.shared.types import Annotated, Literal + +""" +The code defines Pydantic models for the various OpenAPI objects like OpenAPI, PathItem, Operation, Parameter etc. +These models can be used to parse OpenAPI JSON/YAML files into Python objects, or generate OpenAPI from Python data. +""" + + +# https://swagger.io/specification/#contact-object +class Contact(BaseModel): + name: Optional[str] = None + url: Optional[AnyUrl] = None + email: Optional[str] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + else: + + class Config: + extra = "allow" + + +# https://swagger.io/specification/#license-object +class License(BaseModel): + name: str + identifier: Optional[str] = None + url: Optional[AnyUrl] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +# https://swagger.io/specification/#info-object +class Info(BaseModel): + title: str + summary: Optional[str] = None + description: Optional[str] = None + termsOfService: Optional[str] = None + contact: Optional[Contact] = None + license: Optional[License] = None # noqa: A003 + version: str + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +# https://swagger.io/specification/#server-variable-object +class ServerVariable(BaseModel): + enum: Annotated[Optional[List[str]], Field(min_length=1)] = None + default: str + description: Optional[str] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +# https://swagger.io/specification/#server-object +class Server(BaseModel): + url: Union[AnyUrl, str] + description: Optional[str] = None + variables: Optional[Dict[str, ServerVariable]] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +# https://swagger.io/specification/#reference-object +class Reference(BaseModel): + ref: str = Field(alias="$ref") + + +# https://swagger.io/specification/#discriminator-object +class Discriminator(BaseModel): + propertyName: str + mapping: Optional[Dict[str, str]] = None + + +# https://swagger.io/specification/#xml-object +class XML(BaseModel): + name: Optional[str] = None + namespace: Optional[str] = None + prefix: Optional[str] = None + attribute: Optional[bool] = None + wrapped: Optional[bool] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +# https://swagger.io/specification/#external-documentation-object +class ExternalDocumentation(BaseModel): + description: Optional[str] = None + url: AnyUrl + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +# https://swagger.io/specification/#schema-object +class Schema(BaseModel): + # Ref: JSON Schema 2020-12: https://json-schema.org/draft/2020-12/json-schema-core.html#name-the-json-schema-core-vocabu + # Core Vocabulary + schema_: Optional[str] = Field(default=None, alias="$schema") + vocabulary: Optional[str] = Field(default=None, alias="$vocabulary") + id: Optional[str] = Field(default=None, alias="$id") # noqa: A003 + anchor: Optional[str] = Field(default=None, alias="$anchor") + dynamicAnchor: Optional[str] = Field(default=None, alias="$dynamicAnchor") + ref: Optional[str] = Field(default=None, alias="$ref") + dynamicRef: Optional[str] = Field(default=None, alias="$dynamicRef") + defs: Optional[Dict[str, "SchemaOrBool"]] = Field(default=None, alias="$defs") + comment: Optional[str] = Field(default=None, alias="$comment") + # Ref: JSON Schema 2020-12: https://json-schema.org/draft/2020-12/json-schema-core.html#name-a-vocabulary-for-applying-s + # A Vocabulary for Applying Subschemas + allOf: Optional[List["SchemaOrBool"]] = None + anyOf: Optional[List["SchemaOrBool"]] = None + oneOf: Optional[List["SchemaOrBool"]] = None + not_: Optional["SchemaOrBool"] = Field(default=None, alias="not") + if_: Optional["SchemaOrBool"] = Field(default=None, alias="if") + then: Optional["SchemaOrBool"] = None + else_: Optional["SchemaOrBool"] = Field(default=None, alias="else") + dependentSchemas: Optional[Dict[str, "SchemaOrBool"]] = None + prefixItems: Optional[List["SchemaOrBool"]] = None + # MAINTENANCE: uncomment and remove below when deprecating Pydantic v1 + # MAINTENANCE: It generates a list of schemas for tuples, before prefixItems was available + # MAINTENANCE: items: Optional["SchemaOrBool"] = None + items: Optional[Union["SchemaOrBool", List["SchemaOrBool"]]] = None + contains: Optional["SchemaOrBool"] = None + properties: Optional[Dict[str, "SchemaOrBool"]] = None + patternProperties: Optional[Dict[str, "SchemaOrBool"]] = None + additionalProperties: Optional["SchemaOrBool"] = None + propertyNames: Optional["SchemaOrBool"] = None + unevaluatedItems: Optional["SchemaOrBool"] = None + unevaluatedProperties: Optional["SchemaOrBool"] = None + # Ref: JSON Schema Validation 2020-12: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-a-vocabulary-for-structural + # A Vocabulary for Structural Validation + type: Optional[str] = None # noqa: A003 + enum: Optional[List[Any]] = None + const: Optional[Any] = None + multipleOf: Optional[float] = Field(default=None, gt=0) + maximum: Optional[float] = None + exclusiveMaximum: Optional[float] = None + minimum: Optional[float] = None + exclusiveMinimum: Optional[float] = None + maxLength: Optional[int] = Field(default=None, ge=0) + minLength: Optional[int] = Field(default=None, ge=0) + pattern: Optional[str] = None + maxItems: Optional[int] = Field(default=None, ge=0) + minItems: Optional[int] = Field(default=None, ge=0) + uniqueItems: Optional[bool] = None + maxContains: Optional[int] = Field(default=None, ge=0) + minContains: Optional[int] = Field(default=None, ge=0) + maxProperties: Optional[int] = Field(default=None, ge=0) + minProperties: Optional[int] = Field(default=None, ge=0) + required: Optional[List[str]] = None + dependentRequired: Optional[Dict[str, Set[str]]] = None + # Ref: JSON Schema Validation 2020-12: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-vocabularies-for-semantic-c + # Vocabularies for Semantic Content With "format" + format: Optional[str] = None # noqa: A003 + # Ref: JSON Schema Validation 2020-12: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-a-vocabulary-for-the-conten + # A Vocabulary for the Contents of String-Encoded Data + contentEncoding: Optional[str] = None + contentMediaType: Optional[str] = None + contentSchema: Optional["SchemaOrBool"] = None + # Ref: JSON Schema Validation 2020-12: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-a-vocabulary-for-basic-meta + # A Vocabulary for Basic Meta-Data Annotations + title: Optional[str] = None + description: Optional[str] = None + default: Optional[Any] = None + deprecated: Optional[bool] = None + readOnly: Optional[bool] = None + writeOnly: Optional[bool] = None + examples: Optional[List["Example"]] = None + # Ref: OpenAPI 3.1.0: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object + # Schema Object + discriminator: Optional[Discriminator] = None + xml: Optional[XML] = None + externalDocs: Optional[ExternalDocumentation] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +# Ref: https://json-schema.org/draft/2020-12/json-schema-core.html#name-json-schema-documents +# A JSON Schema MUST be an object or a boolean. +SchemaOrBool = Union[Schema, bool] + + +# https://swagger.io/specification/#example-object +class Example(BaseModel): + summary: Optional[str] = None + description: Optional[str] = None + value: Optional[Any] = None + externalValue: Optional[AnyUrl] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +class ParameterInType(Enum): + query = "query" + header = "header" + path = "path" + cookie = "cookie" + + +# https://swagger.io/specification/#encoding-object +class Encoding(BaseModel): + contentType: Optional[str] = None + headers: Optional[Dict[str, Union["Header", Reference]]] = None + style: Optional[str] = None + explode: Optional[bool] = None + allowReserved: Optional[bool] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +# https://swagger.io/specification/#media-type-object +class MediaType(BaseModel): + schema_: Optional[Union[Schema, Reference]] = Field(default=None, alias="schema") + examples: Optional[Dict[str, Union[Example, Reference]]] = None + encoding: Optional[Dict[str, Encoding]] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +# https://swagger.io/specification/#parameter-object +class ParameterBase(BaseModel): + description: Optional[str] = None + required: Optional[bool] = None + deprecated: Optional[bool] = None + # Serialization rules for simple scenarios + style: Optional[str] = None + explode: Optional[bool] = None + allowReserved: Optional[bool] = None + schema_: Optional[Union[Schema, Reference]] = Field(default=None, alias="schema") + examples: Optional[Dict[str, Union[Example, Reference]]] = None + # Serialization rules for more complex scenarios + content: Optional[Dict[str, MediaType]] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +class Parameter(ParameterBase): + name: str + in_: ParameterInType = Field(alias="in") + + +class Header(ParameterBase): + pass + + +# https://swagger.io/specification/#request-body-object +class RequestBody(BaseModel): + description: Optional[str] = None + content: Dict[str, MediaType] + required: Optional[bool] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +# https://swagger.io/specification/#link-object +class Link(BaseModel): + operationRef: Optional[str] = None + operationId: Optional[str] = None + parameters: Optional[Dict[str, Union[Any, str]]] = None + requestBody: Optional[Union[Any, str]] = None + description: Optional[str] = None + server: Optional[Server] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +# https://swagger.io/specification/#response-object +class Response(BaseModel): + description: str + headers: Optional[Dict[str, Union[Header, Reference]]] = None + content: Optional[Dict[str, MediaType]] = None + links: Optional[Dict[str, Union[Link, Reference]]] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +# https://swagger.io/specification/#tag-object +class Tag(BaseModel): + name: str + description: Optional[str] = None + externalDocs: Optional[ExternalDocumentation] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +# https://swagger.io/specification/#operation-object +class Operation(BaseModel): + tags: Optional[List[Tag]] = None + summary: Optional[str] = None + description: Optional[str] = None + externalDocs: Optional[ExternalDocumentation] = None + operationId: Optional[str] = None + parameters: Optional[List[Union[Parameter, Reference]]] = None + requestBody: Optional[Union[RequestBody, Reference]] = None + # Using Any for Specification Extensions + responses: Optional[Dict[int, Union[Response, Any]]] = None + callbacks: Optional[Dict[str, Union[Dict[str, "PathItem"], Reference]]] = None + deprecated: Optional[bool] = None + security: Optional[List[Dict[str, List[str]]]] = None + servers: Optional[List[Server]] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +# https://swagger.io/specification/#path-item-object +class PathItem(BaseModel): + ref: Optional[str] = Field(default=None, alias="$ref") + summary: Optional[str] = None + description: Optional[str] = None + get: Optional[Operation] = None + put: Optional[Operation] = None + post: Optional[Operation] = None + delete: Optional[Operation] = None + options: Optional[Operation] = None + head: Optional[Operation] = None + patch: Optional[Operation] = None + trace: Optional[Operation] = None + servers: Optional[List[Server]] = None + parameters: Optional[List[Union[Parameter, Reference]]] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +# https://swagger.io/specification/#security-scheme-object +class SecuritySchemeType(Enum): + apiKey = "apiKey" + http = "http" + oauth2 = "oauth2" + openIdConnect = "openIdConnect" + + +class SecurityBase(BaseModel): + type_: SecuritySchemeType = Field(alias="type") + description: Optional[str] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +class APIKeyIn(Enum): + query = "query" + header = "header" + cookie = "cookie" + + +class APIKey(SecurityBase): + type_: SecuritySchemeType = Field(default=SecuritySchemeType.apiKey, alias="type") + in_: APIKeyIn = Field(alias="in") + name: str + + +class HTTPBase(SecurityBase): + type_: SecuritySchemeType = Field(default=SecuritySchemeType.http, alias="type") + scheme: str + + +class HTTPBearer(HTTPBase): + scheme: Literal["bearer"] = "bearer" + bearerFormat: Optional[str] = None + + +class OAuthFlow(BaseModel): + refreshUrl: Optional[str] = None + scopes: Dict[str, str] = {} + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +class OAuthFlowImplicit(OAuthFlow): + authorizationUrl: str + + +class OAuthFlowPassword(OAuthFlow): + tokenUrl: str + + +class OAuthFlowClientCredentials(OAuthFlow): + tokenUrl: str + + +class OAuthFlowAuthorizationCode(OAuthFlow): + authorizationUrl: str + tokenUrl: str + + +class OAuthFlows(BaseModel): + implicit: Optional[OAuthFlowImplicit] = None + password: Optional[OAuthFlowPassword] = None + clientCredentials: Optional[OAuthFlowClientCredentials] = None + authorizationCode: Optional[OAuthFlowAuthorizationCode] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +class OAuth2(SecurityBase): + type_: SecuritySchemeType = Field(default=SecuritySchemeType.oauth2, alias="type") + flows: OAuthFlows + + +class OpenIdConnect(SecurityBase): + type_: SecuritySchemeType = Field( + default=SecuritySchemeType.openIdConnect, + alias="type", + ) + openIdConnectUrl: str + + +SecurityScheme = Union[APIKey, HTTPBase, OAuth2, OpenIdConnect, HTTPBearer] + + +# https://swagger.io/specification/#components-object +class Components(BaseModel): + schemas: Optional[Dict[str, Union[Schema, Reference]]] = None + responses: Optional[Dict[str, Union[Response, Reference]]] = None + parameters: Optional[Dict[str, Union[Parameter, Reference]]] = None + examples: Optional[Dict[str, Union[Example, Reference]]] = None + requestBodies: Optional[Dict[str, Union[RequestBody, Reference]]] = None + headers: Optional[Dict[str, Union[Header, Reference]]] = None + securitySchemes: Optional[Dict[str, Union[SecurityScheme, Reference]]] = None + links: Optional[Dict[str, Union[Link, Reference]]] = None + # Using Any for Specification Extensions + callbacks: Optional[Dict[str, Union[Dict[str, PathItem], Reference, Any]]] = None + pathItems: Optional[Dict[str, Union[PathItem, Reference]]] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +# https://swagger.io/specification/#openapi-object +class OpenAPI(BaseModel): + openapi: str + info: Info + jsonSchemaDialect: Optional[str] = None + servers: Optional[List[Server]] = None + # Using Any for Specification Extensions + paths: Optional[Dict[str, Union[PathItem, Any]]] = None + webhooks: Optional[Dict[str, Union[PathItem, Reference]]] = None + components: Optional[Components] = None + security: Optional[List[Dict[str, List[str]]]] = None + tags: Optional[List[Tag]] = None + externalDocs: Optional[ExternalDocumentation] = None + + if PYDANTIC_V2: + model_config = {"extra": "allow"} + + else: + + class Config: + extra = "allow" + + +model_rebuild(Schema) +model_rebuild(Operation) +model_rebuild(Encoding) diff --git a/aws_lambda_powertools/event_handler/openapi/params.py b/aws_lambda_powertools/event_handler/openapi/params.py new file mode 100644 index 00000000000..c8099d20404 --- /dev/null +++ b/aws_lambda_powertools/event_handler/openapi/params.py @@ -0,0 +1,841 @@ +import inspect +from enum import Enum +from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union + +from pydantic import BaseConfig +from pydantic.fields import FieldInfo + +from aws_lambda_powertools.event_handler.openapi.compat import ( + ModelField, + Required, + Undefined, + UndefinedType, + copy_field_info, + field_annotation_is_scalar, + get_annotation_from_field_info, +) +from aws_lambda_powertools.event_handler.openapi.types import PYDANTIC_V2, CacheKey +from aws_lambda_powertools.shared.types import Annotated, Literal, get_args, get_origin + +""" +This turns the low-level function signature into typed, validated Pydantic models for consumption. +""" + + +class ParamTypes(Enum): + query = "query" + header = "header" + path = "path" + cookie = "cookie" + + +# MAINTENANCE: update when deprecating Pydantic v1, remove this alias +_Unset: Any = Undefined + + +class Dependant: + """ + A class used internally to represent a dependency between path operation decorators and the path operation function. + """ + + def __init__( + self, + *, + path_params: Optional[List[ModelField]] = None, + query_params: Optional[List[ModelField]] = None, + header_params: Optional[List[ModelField]] = None, + cookie_params: Optional[List[ModelField]] = None, + body_params: Optional[List[ModelField]] = None, + return_param: Optional[ModelField] = None, + name: Optional[str] = None, + call: Optional[Callable[..., Any]] = None, + request_param_name: Optional[str] = None, + websocket_param_name: Optional[str] = None, + http_connection_param_name: Optional[str] = None, + response_param_name: Optional[str] = None, + background_tasks_param_name: Optional[str] = None, + path: Optional[str] = None, + ) -> None: + self.path_params = path_params or [] + self.query_params = query_params or [] + self.header_params = header_params or [] + self.cookie_params = cookie_params or [] + self.body_params = body_params or [] + self.return_param = return_param or None + self.request_param_name = request_param_name + self.websocket_param_name = websocket_param_name + self.http_connection_param_name = http_connection_param_name + self.response_param_name = response_param_name + self.background_tasks_param_name = background_tasks_param_name + self.name = name + self.call = call + # Store the path to be able to re-generate a dependable from it in overrides + self.path = path + # Save the cache key at creation to optimize performance + self.cache_key: CacheKey = self.call + + +class Param(FieldInfo): + """ + A class used internally to represent a parameter in a path operation. + """ + + in_: ParamTypes + + def __init__( + self, + default: Any = Undefined, + *, + default_factory: Union[Callable[[], Any], None] = _Unset, + annotation: Optional[Any] = None, + alias: Optional[str] = None, + alias_priority: Union[int, None] = _Unset, + # MAINTENANCE: update when deprecating Pydantic v1, import these types + # MAINTENANCE: validation_alias: str | AliasPath | AliasChoices | None + validation_alias: Union[str, None] = None, + serialization_alias: Union[str, None] = None, + title: Optional[str] = None, + description: Optional[str] = None, + gt: Optional[float] = None, + ge: Optional[float] = None, + lt: Optional[float] = None, + le: Optional[float] = None, + min_length: Optional[int] = None, + max_length: Optional[int] = None, + pattern: Optional[str] = None, + discriminator: Union[str, None] = None, + strict: Union[bool, None] = _Unset, + multiple_of: Union[float, None] = _Unset, + allow_inf_nan: Union[bool, None] = _Unset, + max_digits: Union[int, None] = _Unset, + decimal_places: Union[int, None] = _Unset, + examples: Optional[List[Any]] = None, + deprecated: Optional[bool] = None, + include_in_schema: bool = True, + json_schema_extra: Union[Dict[str, Any], None] = None, + **extra: Any, + ): + self.deprecated = deprecated + self.include_in_schema = include_in_schema + + kwargs = dict( + default=default, + default_factory=default_factory, + alias=alias, + title=title, + description=description, + gt=gt, + ge=ge, + lt=lt, + le=le, + min_length=min_length, + max_length=max_length, + discriminator=discriminator, + multiple_of=multiple_of, + allow_nan=allow_inf_nan, + max_digits=max_digits, + decimal_places=decimal_places, + **extra, + ) + if examples is not None: + kwargs["examples"] = examples + + current_json_schema_extra = json_schema_extra or extra + if PYDANTIC_V2: + kwargs.update( + { + "annotation": annotation, + "alias_priority": alias_priority, + "validation_alias": validation_alias, + "serialization_alias": serialization_alias, + "strict": strict, + "json_schema_extra": current_json_schema_extra, + "pattern": pattern, + }, + ) + else: + kwargs["regex"] = pattern + kwargs.update(**current_json_schema_extra) + + use_kwargs = {k: v for k, v in kwargs.items() if v is not _Unset} + + super().__init__(**use_kwargs) + + def __repr__(self) -> str: + return f"{self.__class__.__name__}({self.default})" + + +class Path(Param): + """ + A class used internally to represent a path parameter in a path operation. + """ + + in_ = ParamTypes.path + + def __init__( + self, + default: Any = ..., + *, + default_factory: Union[Callable[[], Any], None] = _Unset, + annotation: Optional[Any] = None, + alias: Optional[str] = None, + alias_priority: Union[int, None] = _Unset, + # MAINTENANCE: update when deprecating Pydantic v1, import these types + # MAINTENANCE: validation_alias: str | AliasPath | AliasChoices | None + validation_alias: Union[str, None] = None, + serialization_alias: Union[str, None] = None, + title: Optional[str] = None, + description: Optional[str] = None, + gt: Optional[float] = None, + ge: Optional[float] = None, + lt: Optional[float] = None, + le: Optional[float] = None, + min_length: Optional[int] = None, + max_length: Optional[int] = None, + pattern: Optional[str] = None, + discriminator: Union[str, None] = None, + strict: Union[bool, None] = _Unset, + multiple_of: Union[float, None] = _Unset, + allow_inf_nan: Union[bool, None] = _Unset, + max_digits: Union[int, None] = _Unset, + decimal_places: Union[int, None] = _Unset, + examples: Optional[List[Any]] = None, + deprecated: Optional[bool] = None, + include_in_schema: bool = True, + json_schema_extra: Union[Dict[str, Any], None] = None, + **extra: Any, + ): + if default is not ...: + raise AssertionError("Path parameters cannot have a default value") + + super(Path, self).__init__( + default=default, + default_factory=default_factory, + annotation=annotation, + alias=alias, + alias_priority=alias_priority, + validation_alias=validation_alias, + serialization_alias=serialization_alias, + title=title, + description=description, + gt=gt, + ge=ge, + lt=lt, + le=le, + min_length=min_length, + max_length=max_length, + pattern=pattern, + discriminator=discriminator, + strict=strict, + multiple_of=multiple_of, + allow_inf_nan=allow_inf_nan, + max_digits=max_digits, + decimal_places=decimal_places, + deprecated=deprecated, + examples=examples, + include_in_schema=include_in_schema, + json_schema_extra=json_schema_extra, + **extra, + ) + + +class Query(Param): + """ + A class used internally to represent a query parameter in a path operation. + """ + + in_ = ParamTypes.query + + def __init__( + self, + default: Any = _Unset, + *, + default_factory: Union[Callable[[], Any], None] = _Unset, + annotation: Optional[Any] = None, + alias: Optional[str] = None, + alias_priority: Union[int, None] = _Unset, + validation_alias: Union[str, None] = None, + serialization_alias: Union[str, None] = None, + title: Optional[str] = None, + description: Optional[str] = None, + gt: Optional[float] = None, + ge: Optional[float] = None, + lt: Optional[float] = None, + le: Optional[float] = None, + min_length: Optional[int] = None, + max_length: Optional[int] = None, + pattern: Optional[str] = None, + discriminator: Union[str, None] = None, + strict: Union[bool, None] = _Unset, + multiple_of: Union[float, None] = _Unset, + allow_inf_nan: Union[bool, None] = _Unset, + max_digits: Union[int, None] = _Unset, + decimal_places: Union[int, None] = _Unset, + examples: Optional[List[Any]] = None, + deprecated: Optional[bool] = None, + include_in_schema: bool = True, + json_schema_extra: Union[Dict[str, Any], None] = None, + **extra: Any, + ): + super().__init__( + default=default, + default_factory=default_factory, + annotation=annotation, + alias=alias, + alias_priority=alias_priority, + validation_alias=validation_alias, + serialization_alias=serialization_alias, + title=title, + description=description, + gt=gt, + ge=ge, + lt=lt, + le=le, + min_length=min_length, + max_length=max_length, + pattern=pattern, + discriminator=discriminator, + strict=strict, + multiple_of=multiple_of, + allow_inf_nan=allow_inf_nan, + max_digits=max_digits, + decimal_places=decimal_places, + deprecated=deprecated, + examples=examples, + include_in_schema=include_in_schema, + json_schema_extra=json_schema_extra, + **extra, + ) + + +class _Header(Param): + """ + A class used internally to represent a header parameter in a path operation. + """ + + in_ = ParamTypes.header + + def __init__( + self, + default: Any = Undefined, + *, + default_factory: Union[Callable[[], Any], None] = _Unset, + annotation: Optional[Any] = None, + alias: Optional[str] = None, + alias_priority: Union[int, None] = _Unset, + # MAINTENANCE: update when deprecating Pydantic v1, import these types + # str | AliasPath | AliasChoices | None + validation_alias: Union[str, None] = None, + serialization_alias: Union[str, None] = None, + convert_underscores: bool = True, + title: Optional[str] = None, + description: Optional[str] = None, + gt: Optional[float] = None, + ge: Optional[float] = None, + lt: Optional[float] = None, + le: Optional[float] = None, + min_length: Optional[int] = None, + max_length: Optional[int] = None, + pattern: Optional[str] = None, + discriminator: Union[str, None] = None, + strict: Union[bool, None] = _Unset, + multiple_of: Union[float, None] = _Unset, + allow_inf_nan: Union[bool, None] = _Unset, + max_digits: Union[int, None] = _Unset, + decimal_places: Union[int, None] = _Unset, + examples: Optional[List[Any]] = None, + deprecated: Optional[bool] = None, + include_in_schema: bool = True, + json_schema_extra: Union[Dict[str, Any], None] = None, + **extra: Any, + ): + self.convert_underscores = convert_underscores + super().__init__( + default=default, + default_factory=default_factory, + annotation=annotation, + alias=alias, + alias_priority=alias_priority, + validation_alias=validation_alias, + serialization_alias=serialization_alias, + title=title, + description=description, + gt=gt, + ge=ge, + lt=lt, + le=le, + min_length=min_length, + max_length=max_length, + pattern=pattern, + discriminator=discriminator, + strict=strict, + multiple_of=multiple_of, + allow_inf_nan=allow_inf_nan, + max_digits=max_digits, + decimal_places=decimal_places, + deprecated=deprecated, + examples=examples, + include_in_schema=include_in_schema, + json_schema_extra=json_schema_extra, + **extra, + ) + + +class Body(FieldInfo): + """ + A class used internally to represent a body parameter in a path operation. + """ + + def __init__( + self, + default: Any = Undefined, + *, + default_factory: Union[Callable[[], Any], None] = _Unset, + annotation: Optional[Any] = None, + embed: bool = False, + media_type: str = "application/json", + alias: Optional[str] = None, + alias_priority: Union[int, None] = _Unset, + # MAINTENANCE: update when deprecating Pydantic v1, import these types + # str | AliasPath | AliasChoices | None + validation_alias: Union[str, None] = None, + serialization_alias: Union[str, None] = None, + title: Optional[str] = None, + description: Optional[str] = None, + gt: Optional[float] = None, + ge: Optional[float] = None, + lt: Optional[float] = None, + le: Optional[float] = None, + min_length: Optional[int] = None, + max_length: Optional[int] = None, + pattern: Optional[str] = None, + discriminator: Union[str, None] = None, + strict: Union[bool, None] = _Unset, + multiple_of: Union[float, None] = _Unset, + allow_inf_nan: Union[bool, None] = _Unset, + max_digits: Union[int, None] = _Unset, + decimal_places: Union[int, None] = _Unset, + examples: Optional[List[Any]] = None, + deprecated: Optional[bool] = None, + include_in_schema: bool = True, + json_schema_extra: Union[Dict[str, Any], None] = None, + **extra: Any, + ): + self.embed = embed + self.media_type = media_type + self.deprecated = deprecated + self.include_in_schema = include_in_schema + kwargs = dict( + default=default, + default_factory=default_factory, + alias=alias, + title=title, + description=description, + gt=gt, + ge=ge, + lt=lt, + le=le, + min_length=min_length, + max_length=max_length, + discriminator=discriminator, + multiple_of=multiple_of, + allow_nan=allow_inf_nan, + max_digits=max_digits, + decimal_places=decimal_places, + **extra, + ) + if examples is not None: + kwargs["examples"] = examples + current_json_schema_extra = json_schema_extra or extra + if PYDANTIC_V2: + kwargs.update( + { + "annotation": annotation, + "alias_priority": alias_priority, + "validation_alias": validation_alias, + "serialization_alias": serialization_alias, + "strict": strict, + "json_schema_extra": current_json_schema_extra, + "pattern": pattern, + }, + ) + else: + kwargs["regex"] = pattern + kwargs.update(**current_json_schema_extra) + + use_kwargs = {k: v for k, v in kwargs.items() if v is not _Unset} + + super().__init__(**use_kwargs) + + def __repr__(self) -> str: + return f"{self.__class__.__name__}({self.default})" + + +class _Form(Body): + """ + A class used internally to represent a form parameter in a path operation. + """ + + def __init__( + self, + default: Any = Undefined, + *, + default_factory: Union[Callable[[], Any], None] = _Unset, + annotation: Optional[Any] = None, + media_type: str = "application/x-www-form-urlencoded", + alias: Optional[str] = None, + alias_priority: Union[int, None] = _Unset, + # MAINTENANCE: update when deprecating Pydantic v1, import these types + # str | AliasPath | AliasChoices | None + validation_alias: Union[str, None] = None, + serialization_alias: Union[str, None] = None, + title: Optional[str] = None, + description: Optional[str] = None, + gt: Optional[float] = None, + ge: Optional[float] = None, + lt: Optional[float] = None, + le: Optional[float] = None, + min_length: Optional[int] = None, + max_length: Optional[int] = None, + pattern: Optional[str] = None, + discriminator: Union[str, None] = None, + strict: Union[bool, None] = _Unset, + multiple_of: Union[float, None] = _Unset, + allow_inf_nan: Union[bool, None] = _Unset, + max_digits: Union[int, None] = _Unset, + decimal_places: Union[int, None] = _Unset, + examples: Optional[List[Any]] = None, + deprecated: Optional[bool] = None, + include_in_schema: bool = True, + json_schema_extra: Union[Dict[str, Any], None] = None, + **extra: Any, + ): + super().__init__( + default=default, + default_factory=default_factory, + annotation=annotation, + embed=True, + media_type=media_type, + alias=alias, + alias_priority=alias_priority, + validation_alias=validation_alias, + serialization_alias=serialization_alias, + title=title, + description=description, + gt=gt, + ge=ge, + lt=lt, + le=le, + min_length=min_length, + max_length=max_length, + pattern=pattern, + discriminator=discriminator, + strict=strict, + multiple_of=multiple_of, + allow_inf_nan=allow_inf_nan, + max_digits=max_digits, + decimal_places=decimal_places, + deprecated=deprecated, + examples=examples, + include_in_schema=include_in_schema, + json_schema_extra=json_schema_extra, + **extra, + ) + + +class _File(_Form): + """ + A class used internally to represent a file parameter in a path operation. + """ + + def __init__( + self, + default: Any = Undefined, + *, + default_factory: Union[Callable[[], Any], None] = _Unset, + annotation: Optional[Any] = None, + media_type: str = "multipart/form-data", + alias: Optional[str] = None, + alias_priority: Union[int, None] = _Unset, + # MAINTENANCE: update when deprecating Pydantic v1, import these types + # str | AliasPath | AliasChoices | None + validation_alias: Union[str, None] = None, + serialization_alias: Union[str, None] = None, + title: Optional[str] = None, + description: Optional[str] = None, + gt: Optional[float] = None, + ge: Optional[float] = None, + lt: Optional[float] = None, + le: Optional[float] = None, + min_length: Optional[int] = None, + max_length: Optional[int] = None, + pattern: Optional[str] = None, + discriminator: Union[str, None] = None, + strict: Union[bool, None] = _Unset, + multiple_of: Union[float, None] = _Unset, + allow_inf_nan: Union[bool, None] = _Unset, + max_digits: Union[int, None] = _Unset, + decimal_places: Union[int, None] = _Unset, + examples: Optional[List[Any]] = None, + deprecated: Optional[bool] = None, + include_in_schema: bool = True, + json_schema_extra: Union[Dict[str, Any], None] = None, + **extra: Any, + ): + super().__init__( + default=default, + default_factory=default_factory, + annotation=annotation, + media_type=media_type, + alias=alias, + alias_priority=alias_priority, + validation_alias=validation_alias, + serialization_alias=serialization_alias, + title=title, + description=description, + gt=gt, + ge=ge, + lt=lt, + le=le, + min_length=min_length, + max_length=max_length, + pattern=pattern, + discriminator=discriminator, + strict=strict, + multiple_of=multiple_of, + allow_inf_nan=allow_inf_nan, + max_digits=max_digits, + decimal_places=decimal_places, + deprecated=deprecated, + examples=examples, + include_in_schema=include_in_schema, + json_schema_extra=json_schema_extra, + **extra, + ) + + +def get_flat_dependant( + dependant: Dependant, + visited: Optional[List[CacheKey]] = None, +) -> Dependant: + """ + Flatten a recursive Dependant model structure. + + This function recursively concatenates the parameter fields of a Dependant model and its dependencies into a flat + Dependant structure. This is useful for scenarios like parameter validation where the nested structure is not + relevant. + + Parameters + ---------- + dependant: Dependant + The dependant model to flatten + skip_repeats: bool + If True, child Dependents already visited will be skipped to avoid duplicates + visited: List[CacheKey], optional + Keeps track of visited Dependents to avoid infinite recursion. Defaults to empty list. + + Returns + ------- + Dependant + The flattened Dependant model + """ + if visited is None: + visited = [] + visited.append(dependant.cache_key) + + return Dependant( + path_params=dependant.path_params.copy(), + query_params=dependant.query_params.copy(), + header_params=dependant.header_params.copy(), + cookie_params=dependant.cookie_params.copy(), + body_params=dependant.body_params.copy(), + path=dependant.path, + ) + + +def analyze_param( + *, + param_name: str, + annotation: Any, + value: Any, + is_path_param: bool, + is_response_param: bool, +) -> Optional[ModelField]: + """ + Analyze a parameter annotation and value to determine the type and default value of the parameter. + + Parameters + ---------- + param_name: str + The name of the parameter + annotation + The annotation of the parameter + value + The value of the parameter + is_path_param + Whether the parameter is a path parameter + is_response_param + Whether the parameter is the return annotation + + Returns + ------- + Optional[ModelField] + The type annotation and the Pydantic field representing the parameter + """ + field_info, type_annotation = get_field_info_and_type_annotation(annotation, value, is_path_param) + + # If the value is a FieldInfo, we use it as the FieldInfo for the parameter + if isinstance(value, FieldInfo): + if field_info is not None: + raise AssertionError("Cannot use a FieldInfo as a parameter annotation and pass a FieldInfo as a value") + field_info = value + + if PYDANTIC_V2: + field_info.annotation = type_annotation # type: ignore[attr-defined,unused-ignore] + + # If we didn't determine the FieldInfo yet, we create a default one + if field_info is None: + default_value = value if value is not inspect.Signature.empty else Required + + # Check if the parameter is part of the path. Otherwise, defaults to query. + if is_path_param: + field_info = Path(annotation=type_annotation) + elif not field_annotation_is_scalar(annotation=type_annotation): + field_info = Body(annotation=type_annotation, default=default_value) + else: + field_info = Query(annotation=type_annotation, default=default_value) + + # When we have a response field, we need to set the default value to Required + if is_response_param: + field_info.default = Required + + field = _create_model_field(field_info, type_annotation, param_name, is_path_param) + return field + + +def get_field_info_and_type_annotation(annotation, value, is_path_param: bool) -> Tuple[Optional[FieldInfo], Any]: + """ + Get the FieldInfo and type annotation from an annotation and value. + """ + field_info: Optional[FieldInfo] = None + type_annotation: Any = Any + + if annotation is not inspect.Signature.empty: + # If the annotation is an Annotated type, we need to extract the type annotation and the FieldInfo + if get_origin(annotation) is Annotated: + field_info, type_annotation = get_field_info_annotated_type(annotation, value, is_path_param) + # If the annotation is not an Annotated type, we use it as the type annotation + else: + type_annotation = annotation + + return field_info, type_annotation + + +def get_field_info_annotated_type(annotation, value, is_path_param: bool) -> Tuple[Optional[FieldInfo], Any]: + """ + Get the FieldInfo and type annotation from an Annotated type. + """ + field_info: Optional[FieldInfo] = None + annotated_args = get_args(annotation) + type_annotation = annotated_args[0] + powertools_annotations = [arg for arg in annotated_args[1:] if isinstance(arg, FieldInfo)] + + if len(powertools_annotations) > 1: + raise AssertionError("Only one FieldInfo can be used per parameter") + + powertools_annotation = next(iter(powertools_annotations), None) + + if isinstance(powertools_annotation, FieldInfo): + # Copy `field_info` because we mutate `field_info.default` later + field_info = copy_field_info( + field_info=powertools_annotation, + annotation=annotation, + ) + if field_info.default not in [Undefined, Required]: + raise AssertionError("FieldInfo needs to have a default value of Undefined or Required") + + if value is not inspect.Signature.empty: + if is_path_param: + raise AssertionError("Cannot use a FieldInfo as a path parameter and pass a value") + field_info.default = value + else: + field_info.default = Required + + return field_info, type_annotation + + +def create_response_field( + name: str, + type_: Type[Any], + default: Optional[Any] = Undefined, + required: Union[bool, UndefinedType] = Undefined, + model_config: Type[BaseConfig] = BaseConfig, + field_info: Optional[FieldInfo] = None, + alias: Optional[str] = None, + mode: Literal["validation", "serialization"] = "validation", +) -> ModelField: + """ + Create a new response field. Raises if type_ is invalid. + """ + if PYDANTIC_V2: + field_info = field_info or FieldInfo( + annotation=type_, + default=default, + alias=alias, + ) + else: + field_info = field_info or FieldInfo() + kwargs = {"name": name, "field_info": field_info} + + if PYDANTIC_V2: + kwargs.update({"mode": mode}) + else: + kwargs.update( + { + "type_": type_, + "class_validators": {}, + "default": default, + "required": required, + "model_config": model_config, + "alias": alias, + }, + ) + return ModelField(**kwargs) # type: ignore[arg-type] + + +def _create_model_field( + field_info: Optional[FieldInfo], + type_annotation: Any, + param_name: str, + is_path_param: bool, +) -> Optional[ModelField]: + """ + Create a new ModelField from a FieldInfo and type annotation. + """ + if field_info is None: + return None + + if is_path_param: + if not isinstance(field_info, Path): + raise AssertionError("Path parameters must be of type Path") + elif isinstance(field_info, Param) and getattr(field_info, "in_", None) is None: + field_info.in_ = ParamTypes.query + + # If the field_info is a Param, we use the `in_` attribute to determine the type annotation + use_annotation = get_annotation_from_field_info(type_annotation, field_info, param_name) + + # If the field doesn't have a defined alias, we use the param name + if not field_info.alias and getattr(field_info, "convert_underscores", None): + alias = param_name.replace("_", "-") + else: + alias = field_info.alias or param_name + field_info.alias = alias + + return create_response_field( + name=param_name, + type_=use_annotation, + default=field_info.default, + alias=alias, + required=field_info.default in (Required, Undefined), + field_info=field_info, + ) diff --git a/aws_lambda_powertools/event_handler/openapi/swagger_ui/__init__.py b/aws_lambda_powertools/event_handler/openapi/swagger_ui/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/aws_lambda_powertools/event_handler/openapi/swagger_ui/html.py b/aws_lambda_powertools/event_handler/openapi/swagger_ui/html.py new file mode 100644 index 00000000000..fdb38599f30 --- /dev/null +++ b/aws_lambda_powertools/event_handler/openapi/swagger_ui/html.py @@ -0,0 +1,52 @@ +def generate_swagger_html(spec: str, js_url: str, css_url: str) -> str: + """ + Generate Swagger UI HTML page + + Parameters + ---------- + spec: str + The OpenAPI spec in the JSON format + js_url: str + The URL to the Swagger UI JavaScript file + css_url: str + The URL to the Swagger UI CSS file + """ + return f""" + + + + + Swagger UI + + + + +
+ Loading... +
+ + + + + + + """.strip() diff --git a/aws_lambda_powertools/event_handler/openapi/swagger_ui/swagger-ui-bundle.min.js b/aws_lambda_powertools/event_handler/openapi/swagger_ui/swagger-ui-bundle.min.js new file mode 100644 index 00000000000..62659a19dc3 --- /dev/null +++ b/aws_lambda_powertools/event_handler/openapi/swagger_ui/swagger-ui-bundle.min.js @@ -0,0 +1,12 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SwaggerUIBundle=t():e.SwaggerUIBundle=t()}(this,()=>{var n={17967:(e,n)=>{"use strict";n.Nm=n.Rq=void 0;var r=/^([^\w]*)(javascript|data|vbscript)/im,o=/&#(\w+)(^\w|;)?/g,s=/&(newline|tab);/gi,i=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,a=/^.+(:|:)/gim,l=[".","/"];n.Rq="about:blank",n.Nm=function(e){if(!e)return n.Rq;e=e.replace(i,"").replace(o,function(e,t){return String.fromCharCode(t)}).replace(s,"").replace(i,"").trim();if(!e)return n.Rq;if(-1{"use strict";t.byteLength=function(e){var e=u(e),t=e[0],e=e[1];return 3*(t+e)/4-e},t.toByteArray=function(e){for(var t,n=u(e),r=n[0],n=n[1],o=new c(3*(r+n)/4-n),s=0,i=0>16&255,o[s++]=t>>8&255,o[s++]=255&t;return 2===n&&(t=l[e.charCodeAt(a)]<<2|l[e.charCodeAt(a+1)]>>4,o[s++]=255&t),1===n&&(t=l[e.charCodeAt(a)]<<10|l[e.charCodeAt(a+1)]<<4|l[e.charCodeAt(a+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t),o},t.fromByteArray=function(e){for(var t,n=e.length,r=n%3,o=[],s=0,i=n-r;s>18&63]+a[r>>12&63]+a[r>>6&63]+a[63&r]);return o.join("")}(e,s,i>2]+a[t<<4&63]+"==")):2==r&&(t=(e[n-2]<<8)+e[n-1],o.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"=")),o.join("")};for(var a=[],l=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0;r<64;++r)a[r]=n[r],l[n.charCodeAt(r)]=r;function u(e){var t=e.length;if(0{"use strict";const g=e(79742),s=e(80645),t="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null,r=(n.Buffer=u,n.SlowBuffer=function(e){return u.alloc(+(e=+e!=e?0:e))},n.INSPECT_MAX_BYTES=50,2147483647);function c(e){if(e>r)throw new RangeError('The value "'+e+'" is invalid for option "size"');e=new Uint8Array(e);return Object.setPrototypeOf(e,u.prototype),e}function u(e,t,n){if("number"!=typeof e)return o(e,t,n);if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return a(e)}function o(t,n,e){if("string"==typeof t){var r=t,o=n;if(!u.isEncoding(o="string"==typeof o&&""!==o?o:"utf8"))throw new TypeError("Unknown encoding: "+o);var s=0|f(r,o);let e=c(s);return r=e.write(r,o),e=r!==s?e.slice(0,r):e}if(ArrayBuffer.isView(t))return T(o=t,Uint8Array)?h((s=new Uint8Array(o)).buffer,s.byteOffset,s.byteLength):p(o);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(T(t,ArrayBuffer)||t&&T(t.buffer,ArrayBuffer))return h(t,n,e);if("undefined"!=typeof SharedArrayBuffer&&(T(t,SharedArrayBuffer)||t&&T(t.buffer,SharedArrayBuffer)))return h(t,n,e);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return u.from(r,n,e);var i,a,l=u.isBuffer(i=t)?(0!==(a=c(l=0|d(i.length))).length&&i.copy(a,0,0,l),a):void 0!==i.length?"number"!=typeof i.length||R(i.length)?c(0):p(i):"Buffer"===i.type&&Array.isArray(i.data)?p(i.data):void 0;if(l)return l;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),n,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function i(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 a(e){return i(e),c(e<0?0:0|d(e))}function p(t){const n=t.length<0?0:0|d(t.length),r=c(n);for(let e=0;e=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function f(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||T(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 n=e.length,r=2>>1;case"base64":return $(e).length;default:if(o)return r?-1:N(e).length;t=(""+t).toLowerCase(),o=!0}}function L(e,n,r){let t=!1;if((n=void 0===n||n<0?0:n)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(n>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":{var o=this;var s=n;var i=r;var a=o.length;(!s||s<0)&&(s=0),(!i||i<0||a=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(o?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,n):y(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function y(n,r,t,e,o){let s,i=1,a=n.length,l=r.length;if(void 0!==e&&("ucs2"===(e=String(e).toLowerCase())||"ucs-2"===e||"utf16le"===e||"utf-16le"===e)){if(n.length<2||r.length<2)return-1;i=2,a/=2,l/=2,t/=2}function c(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(o){let e=-1;for(s=t;sa&&(t=a-l),s=t;0<=s;s--){let t=!0;for(let e=0;e>>10&1023|55296),o=56320|1023&o),n.push(o),l+=s}{var r=n,o=r.length;if(o<=b)return String.fromCharCode.apply(String,r);let e="",t=0;for(;tr.length?(e=u.isBuffer(e)?e:u.from(e)).copy(r,o):Uint8Array.prototype.set.call(r,e,o);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,o)}o+=e.length}return r},u.byteLength=f,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;et&&(e+=" ... "),""},t&&(u.prototype[t]=u.prototype.inspect),u.prototype.compare=function(e,t,n,r,o){if(T(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),(t=void 0===t?0:t)<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(o<=r&&n<=t)return 0;if(o<=r)return-1;if(n<=t)return 1;if(this===e)return 0;let s=(o>>>=0)-(r>>>=0),i=(n>>>=0)-(t>>>=0);var a=Math.min(s,i),l=this.slice(r,o),c=e.slice(t,n);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===e&&(e="utf8")):(e=r,r=void 0)}var o,s,i,a,l,c,u=this.length-n;if((void 0===r||uthis.length)throw new RangeError("Attempt to write outside buffer bounds");e=e||"utf8";let p=!1;for(;;)switch(e){case"hex":{var h=this;var d=t;var f=n;var m=r;f=Number(f)||0;var g=h.length-f,g=((!m||(m=Number(m))>g)&&(m=g),d.length);let e;for(g/2>8,s.push(r%256),s.push(o);return s}(t,(o=this).length-s),o,s,i);default:if(p)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),p=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const b=4096;function E(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(ne.length)throw new RangeError("Index out of range")}function S(e,t,n,r,o){B(t,r,o,e,n,7);r=Number(t&BigInt(4294967295)),e[n++]=r,e[n++]=r>>=8,e[n++]=r>>=8,e[n++]=r>>=8,o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,e[n++]=o>>=8,e[n++]=o>>=8,e[n++]=o>>=8,n}function x(e,t,n,r,o){B(t,r,o,e,n,7);r=Number(t&BigInt(4294967295)),e[n+7]=r,e[n+6]=r>>=8,e[n+5]=r>>=8,e[n+4]=r>>=8,o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,e[n+2]=o>>=8,e[n+1]=o>>=8,e[n]=o>>=8,n+8}function _(e,t,n,r){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function k(e,t,n,r,o){return t=+t,n>>>=0,o||_(e,0,n,4),s.write(e,t,n,r,23,4),n+4}function O(e,t,n,r,o){return t=+t,n>>>=0,o||_(e,0,n,8),s.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n=this.length,n=((e=~~e)<0?(e+=n)<0&&(e=0):n>>=0,t>>>=0,n||E(e,t,this.length);let r=this[e],o=1,s=0;for(;++s>>=0,t>>>=0,n||E(e,t,this.length);let r=this[e+--t],o=1;for(;0>>=0,t||E(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||E(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||E(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||E(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||E(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=M(function(e){j(e>>>=0,"offset");var t=this[e],n=this[e+7],t=(void 0!==t&&void 0!==n||P(e,this.length-8),t+256*this[++e]+65536*this[++e]+this[++e]*2**24),e=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(t)+(BigInt(e)<>>=0,"offset");var t=this[e],n=this[e+7],t=(void 0!==t&&void 0!==n||P(e,this.length-8),t*2**24+65536*this[++e]+256*this[++e]+this[++e]),e=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(t)<>>=0,t>>>=0,n||E(e,t,this.length);let r=this[e],o=1,s=0;for(;++s=o&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||E(e,t,this.length);let r=t,o=1,s=this[e+--r];for(;0=o&&(s-=Math.pow(2,8*t)),s},u.prototype.readInt8=function(e,t){return e>>>=0,t||E(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||E(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},u.prototype.readInt16BE=function(e,t){e>>>=0,t||E(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||E(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||E(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=M(function(e){j(e>>>=0,"offset");var t=this[e],n=this[e+7],n=(void 0!==t&&void 0!==n||P(e,this.length-8),this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24));return(BigInt(n)<>>=0,"offset");var t=this[e],n=this[e+7],t=(void 0!==t&&void 0!==n||P(e,this.length-8),(t<<24)+65536*this[++e]+256*this[++e]+this[++e]);return(BigInt(t)<>>=0,t||E(e,4,this.length),s.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||E(e,4,this.length),s.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||E(e,8,this.length),s.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||E(e,8,this.length),s.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||w(this,e,t,n,Math.pow(2,8*n)-1,0);let o=1,s=0;for(this[t]=255&e;++s>>=0,n>>>=0,r||w(this,e,t,n,Math.pow(2,8*n)-1,0);let o=n-1,s=1;for(this[t+o]=255&e;0<=--o&&(s*=256);)this[t+o]=e/s&255;return t+n},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||w(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||w(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||w(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||w(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},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||w(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},u.prototype.writeBigUInt64LE=M(function(e,t=0){return S(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=M(function(e,t=0){return x(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);w(this,e,t,n,r-1,-r)}let o=0,s=1,i=0;for(this[t]=255&e;++o>0)-i&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);w(this,e,t,n,r-1,-r)}let o=n-1,s=1,i=0;for(this[t+o]=255&e;0<=--o&&(s*=256);)e<0&&0===i&&0!==this[t+o+1]&&(i=1),this[t+o]=(e/s>>0)-i&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||w(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||w(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||w(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||w(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},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||w(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigInt64LE=M(function(e,t=0){return S(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=M(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeFloatLE=function(e,t,n){return k(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return k(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return O(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return O(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n=n||0,r||0===r||(r=this.length),t>=e.length&&(t=e.length),(r=0=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length);var o=(r=e.length-t>>=0,n=void 0===n?this.length:n>>>0,"number"==typeof(e=e||0))for(o=t;o=4+r;n-=3)t="_"+e.slice(n-3,n)+t;return""+e.slice(0,n)+t}function B(e,t,n,r,o,s){if(n= 0${r} and < 2${r} ** `+8*(s+1)+r:`>= -(2${r} ** ${8*(s+1)-1}${r}) and < 2 ** `+(8*(s+1)-1)+r:`>= ${t}${r} and <= `+n+r;throw new A.ERR_OUT_OF_RANGE("value",t,e)}n=r,t=s,j(e=o,"offset"),void 0!==n[e]&&void 0!==n[e+t]||P(e,n.length-(t+1))}function j(e,t){if("number"!=typeof e)throw new A.ERR_INVALID_ARG_TYPE(t,"number",e)}function P(e,t,n){if(Math.floor(e)!==e)throw j(e,n),new A.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new A.ERR_BUFFER_OUT_OF_BOUNDS;throw new A.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= `+t,e)}C("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?e+" is outside of buffer bounds":"Attempt to access memory outside buffer bounds"},RangeError),C("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type `+typeof t},TypeError),C("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=F(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=F(o)),o+="n"),r+=` It must be ${t}. Received `+o},RangeError);const q=/[^+/0-9A-Za-z-_]/g;function N(t,n){let r;n=n||1/0;var o=t.length;let s=null;const i=[];for(let e=0;e>6|192,63&r|128)}else if(r<65536){if((n-=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((n-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function $(e){return g.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 I(e,t,n,r){let o;for(o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function T(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function R(e){return e!=e}const z=function(){const n="0123456789abcdef",r=new Array(256);for(let t=0;t<16;++t){var o=16*t;for(let e=0;e<16;++e)r[o+e]=n[t]+n[e]}return r}();function M(e){return"undefined"==typeof BigInt?U:e}function U(){throw new Error("BigInt not supported")}},21924:(e,t,n)=>{"use strict";var r=n(40210),o=n(55559),s=o(r("String.prototype.indexOf"));e.exports=function(e,t){t=r(e,!!t);return"function"==typeof t&&-1{"use strict";var r=n(58612),n=n(40210),o=n("%Function.prototype.apply%"),s=n("%Function.prototype.call%"),i=n("%Reflect.apply%",!0)||r.call(s,o),a=n("%Object.getOwnPropertyDescriptor%",!0),l=n("%Object.defineProperty%",!0),c=n("%Math.max%");if(l)try{l({},"a",{value:1})}catch(e){l=null}e.exports=function(e){var t=i(r,s,arguments);return a&&l&&a(t,"length").configurable&&l(t,"length",{value:1+c(0,e.length-(arguments.length-1))}),t};function u(){return i(r,o,arguments)}l?l(e.exports,"apply",{value:u}):e.exports.apply=u},94184:(e,t)=>{var n;!function(){"use strict";var i={}.hasOwnProperty;function a(){for(var e=[],t=0;t{"use strict";t.parse=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var n={},r=(t||{}).decode||l,o=0;o{"use strict";var p=n(11742),h={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(n,r){var t,e,o,s,i,a,l,c=!1,u=(r=r||{}).debug||!1;try{if(e=p(),o=document.createRange(),s=document.getSelection(),(i=document.createElement("span")).textContent=n,i.ariaHidden="true",i.style.all="unset",i.style.position="fixed",i.style.top=0,i.style.clip="rect(0, 0, 0, 0)",i.style.whiteSpace="pre",i.style.webkitUserSelect="text",i.style.MozUserSelect="text",i.style.msUserSelect="text",i.style.userSelect="text",i.addEventListener("copy",function(e){var t;e.stopPropagation(),r.format&&(e.preventDefault(),void 0===e.clipboardData?(u&&console.warn("unable to use e.clipboardData"),u&&console.warn("trying IE specific stuff"),window.clipboardData.clearData(),t=h[r.format]||h.default,window.clipboardData.setData(t,n)):(e.clipboardData.clearData(),e.clipboardData.setData(r.format,n))),r.onCopy&&(e.preventDefault(),r.onCopy(e.clipboardData))}),document.body.appendChild(i),o.selectNodeContents(i),s.addRange(o),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!0}catch(e){u&&console.error("unable to copy using execCommand: ",e),u&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(r.format||"text",n),r.onCopy&&r.onCopy(window.clipboardData),c=!0}catch(e){u&&console.error("unable to copy using clipboardData: ",e),u&&console.error("falling back to prompt"),a="message"in r?r.message:"Copy to clipboard: #{key}, Enter",l=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C",t=a.replace(/#{\s*key\s*}/g,l),window.prompt(t,n)}}finally{s&&("function"==typeof s.removeRange?s.removeRange(o):s.removeAllRanges()),i&&document.body.removeChild(i),e()}return c}},44101:(e,t,n)=>{n=n(18957);e.exports=n},90093:(e,t,n)=>{n=n(28196);e.exports=n},65362:(e,t,n)=>{n=n(63383);e.exports=n},50415:(e,t,n)=>{n(61181),n(47627),n(24415),n(66274),n(77971);n=n(54058);e.exports=n.AggregateError},27700:(e,t,n)=>{n(73381);n=n(35703);e.exports=n("Function").bind},16246:(e,t,n)=>{var r=n(7046),o=n(27700),s=Function.prototype;e.exports=function(e){var t=e.bind;return e===s||r(s,e)&&t===s.bind?o:t}},45999:(e,t,n)=>{n(49221);n=n(54058);e.exports=n.Object.assign},16121:(e,t,n)=>{e.exports=n(38644)},14122:(e,t,n)=>{e.exports=n(89097)},60269:(e,t,n)=>{e.exports=n(76936)},38644:(e,t,n)=>{n(89731);n=n(44101);e.exports=n},89097:(e,t,n)=>{n=n(90093);e.exports=n},76936:(e,t,n)=>{n=n(65362);e.exports=n},24883:(e,t,n)=>{var r=n(57475),o=n(69826),s=TypeError;e.exports=function(e){if(r(e))return e;throw s(o(e)+" is not a function")}},11851:(e,t,n)=>{var r=n(57475),o=String,s=TypeError;e.exports=function(e){if("object"==typeof e||r(e))return e;throw s("Can't set "+o(e)+" as a prototype")}},18479:e=>{e.exports=function(){}},96059:(e,t,n)=>{var r=n(10941),o=String,s=TypeError;e.exports=function(e){if(r(e))return e;throw s(o(e)+" is not an object")}},31692:(e,t,n)=>{function r(a){return function(e,t,n){var r,o=l(e),s=u(o),i=c(n,s);if(a&&t!=t){for(;i{n=n(95329);e.exports=n([].slice)},82532:(e,t,n)=>{var n=n(95329),r=n({}.toString),o=n("".slice);e.exports=function(e){return o(r(e),8,-1)}},9697:(e,t,n)=>{var r=n(22885),o=n(57475),s=n(82532),i=n(99813)("toStringTag"),a=Object,l="Arguments"==s(function(){return arguments}());e.exports=r?s:function(e){var t;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(t=function(e,t){try{return e[t]}catch(e){}}(e=a(e),i))?t:l?s(e):"Object"==(t=s(e))&&o(e.callee)?"Arguments":t}},23489:(e,t,n)=>{var l=n(90953),c=n(31136),u=n(49677),p=n(65988);e.exports=function(e,t,n){for(var r=c(t),o=p.f,s=u.f,i=0;i{n=n(95981);e.exports=!n(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})},23538:e=>{e.exports=function(e,t){return{value:e,done:t}}},32029:(e,t,n)=>{var r=n(55746),o=n(65988),s=n(31887);e.exports=r?function(e,t,n){return o.f(e,t,s(1,n))}:function(e,t,n){return e[t]=n,e}},31887:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},95929:(e,t,n)=>{var o=n(32029);e.exports=function(e,t,n,r){return r&&r.enumerable?e[t]=n:o(e,t,n),e}},75609:(e,t,n)=>{var r=n(21899),o=Object.defineProperty;e.exports=function(t,n){try{o(r,t,{value:n,configurable:!0,writable:!0})}catch(e){r[t]=n}return n}},55746:(e,t,n)=>{n=n(95981);e.exports=!n(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})},76616:e=>{var t="object"==typeof document&&document.all;e.exports={all:t,IS_HTMLDDA:void 0===t&&void 0!==t}},61333:(e,t,n)=>{var r=n(21899),n=n(10941),o=r.document,s=n(o)&&n(o.createElement);e.exports=function(e){return s?o.createElement(e):{}}},63281:e=>{e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},2861:e=>{e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},53385:(e,t,n)=>{var r,o,s=n(21899),n=n(2861),i=s.process,s=s.Deno,i=i&&i.versions||s&&s.version,s=i&&i.v8;!(o=s?0<(r=s.split("."))[0]&&r[0]<4?1:+(r[0]+r[1]):o)&&n&&(!(r=n.match(/Edge\/(\d+)/))||74<=r[1])&&(r=n.match(/Chrome\/(\d+)/))&&(o=+r[1]),e.exports=o},35703:(e,t,n)=>{var r=n(54058);e.exports=function(e){return r[e+"Prototype"]}},56759:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},53995:(e,t,n)=>{var n=n(95329),r=Error,o=n("".replace),n=String(r("zxcasd").stack),s=/\n\s*at [^:]*:[^\n]*/,i=s.test(n);e.exports=function(e,t){if(i&&"string"==typeof e&&!r.prepareStackTrace)for(;t--;)e=o(e,s,"");return e}},79585:(e,t,n)=>{var o=n(32029),s=n(53995),i=n(18780),a=Error.captureStackTrace;e.exports=function(e,t,n,r){i&&(a?a(e,t):o(e,"stack",s(n,r)))}},18780:(e,t,n)=>{var r=n(95981),o=n(31887);e.exports=!r(function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",o(1,7)),7!==e.stack)})},76887:(e,t,n)=>{"use strict";function m(r){function o(e,t,n){if(this instanceof o){switch(arguments.length){case 0:return new r;case 1:return new r(e);case 2:return new r(e,t)}return new r(e,t,n)}return s(r,this,arguments)}return o.prototype=r.prototype,o}var g=n(21899),s=n(79730),y=n(97484),v=n(57475),b=n(49677).f,E=n(37252),w=n(54058),S=n(86843),x=n(32029),_=n(90953);e.exports=function(e,t){var n,r,o,s,i,a,l=e.target,c=e.global,u=e.stat,p=e.proto,h=c?g:u?g[l]:(g[l]||{}).prototype,d=c?w:w[l]||x(w,l,{})[l],f=d.prototype;for(r in t)i=!(n=E(c?r:l+(u?".":"#")+r,e.forced))&&h&&_(h,r),s=d[r],i&&(a=e.dontCallGetSet?(a=b(h,r))&&a.value:h[r]),o=i&&a?a:t[r],i&&typeof s==typeof o||(i=e.bind&&i?S(o,g):e.wrap&&i?m(o):p&&v(o)?y(o):o,(e.sham||o&&o.sham||s&&s.sham)&&x(i,"sham",!0),x(d,r,i),p&&(_(w,s=l+"Prototype")||x(w,s,{}),x(w[s],r,o),e.real&&f&&(n||!f[r])&&x(f,r,o)))}},95981:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},79730:(e,t,n)=>{var n=n(18285),r=Function.prototype,o=r.apply,s=r.call;e.exports="object"==typeof Reflect&&Reflect.apply||(n?s.bind(o):function(){return s.apply(o,arguments)})},86843:(e,t,n)=>{var r=n(97484),o=n(24883),s=n(18285),i=r(r.bind);e.exports=function(e,t){return o(e),void 0===t?e:s?i(e,t):function(){return e.apply(t,arguments)}}},18285:(e,t,n)=>{n=n(95981);e.exports=!n(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})},98308:(e,t,n)=>{"use strict";var r=n(95329),o=n(24883),s=n(10941),u=n(90953),p=n(93765),n=n(18285),h=Function,d=r([].concat),f=r([].join),m={};e.exports=n?h.bind:function(i){var a=o(this),e=a.prototype,l=p(arguments,1),c=function(){var e=d(l,p(arguments));if(this instanceof c){var t=a,n=e.length,r=e;if(!u(m,n)){for(var o=[],s=0;s{var n=n(18285),r=Function.prototype.call;e.exports=n?r.bind(r):function(){return r.apply(r,arguments)}},79417:(e,t,n)=>{var r=n(55746),n=n(90953),o=Function.prototype,s=r&&Object.getOwnPropertyDescriptor,n=n(o,"name"),i=n&&"something"===function(){}.name,r=n&&(!r||s(o,"name").configurable);e.exports={EXISTS:n,PROPER:i,CONFIGURABLE:r}},45526:(e,t,n)=>{var r=n(95329),o=n(24883);e.exports=function(e,t,n){try{return r(o(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},97484:(e,t,n)=>{var r=n(82532),o=n(95329);e.exports=function(e){if("Function"===r(e))return o(e)}},95329:(e,t,n)=>{var n=n(18285),r=Function.prototype,o=r.call,r=n&&r.bind.bind(o,o);e.exports=n?r:function(e){return function(){return o.apply(e,arguments)}}},626:(e,t,n)=>{function r(e){return i(e)?e:void 0}var o=n(54058),s=n(21899),i=n(57475);e.exports=function(e,t){return arguments.length<2?r(o[e])||r(s[e]):o[e]&&o[e][t]||s[e]&&s[e][t]}},22902:(e,t,n)=>{var r=n(9697),o=n(14229),s=n(82119),i=n(12077),a=n(99813)("iterator");e.exports=function(e){if(!s(e))return o(e,a)||o(e,"@@iterator")||i[r(e)]}},53476:(e,t,n)=>{var r=n(78834),o=n(24883),s=n(96059),i=n(69826),a=n(22902),l=TypeError;e.exports=function(e,t){var n=arguments.length<2?a(e):t;if(o(n))return s(r(n,e));throw l(i(e)+" is not iterable")}},14229:(e,t,n)=>{var r=n(24883),o=n(82119);e.exports=function(e,t){e=e[t];return o(e)?void 0:r(e)}},21899:function(e,t,n){function r(e){return e&&e.Math==Math&&e}e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||function(){return this}()||this||Function("return this")()},90953:(e,t,n)=>{var r=n(95329),o=n(89678),s=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return s(o(e),t)}},27748:e=>{e.exports={}},15463:(e,t,n)=>{n=n(626);e.exports=n("document","documentElement")},2840:(e,t,n)=>{var r=n(55746),o=n(95981),s=n(61333);e.exports=!r&&!o(function(){return 7!=Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a})},37026:(e,t,n)=>{var r=n(95329),o=n(95981),s=n(82532),i=Object,a=r("".split);e.exports=o(function(){return!i("z").propertyIsEnumerable(0)})?function(e){return"String"==s(e)?a(e,""):i(e)}:i},70926:(e,t,n)=>{var r=n(57475),o=n(10941),s=n(88929);e.exports=function(e,t,n){return s&&r(t=t.constructor)&&t!==n&&o(t=t.prototype)&&t!==n.prototype&&s(e,t),e}},53794:(e,t,n)=>{var r=n(10941),o=n(32029);e.exports=function(e,t){r(t)&&"cause"in t&&o(e,"cause",t.cause)}},45402:(e,t,n)=>{var r,o,s,i,a=n(47093),l=n(21899),c=n(10941),u=n(32029),p=n(90953),h=n(63030),d=n(44262),n=n(27748),f="Object already initialized",m=l.TypeError,l=l.WeakMap,g=a||h.state?((s=h.state||(h.state=new l)).get=s.get,s.has=s.has,s.set=s.set,r=function(e,t){if(s.has(e))throw m(f);return t.facade=e,s.set(e,t),t},o=function(e){return s.get(e)||{}},function(e){return s.has(e)}):(n[i=d("state")]=!0,r=function(e,t){if(p(e,i))throw m(f);return t.facade=e,u(e,i,t),t},o=function(e){return p(e,i)?e[i]:{}},function(e){return p(e,i)});e.exports={set:r,get:o,has:g,enforce:function(e){return g(e)?o(e):r(e,{})},getterFor:function(t){return function(e){if(c(e)&&(e=o(e)).type===t)return e;throw m("Incompatible receiver, "+t+" required")}}}},6782:(e,t,n)=>{var r=n(99813),o=n(12077),s=r("iterator"),i=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||i[s]===e)}},57475:(e,t,n)=>{var n=n(76616),r=n.all;e.exports=n.IS_HTMLDDA?function(e){return"function"==typeof e||e===r}:function(e){return"function"==typeof e}},37252:(e,t,n)=>{function r(e,t){return(e=l[a(e)])==u||e!=c&&(s(t)?o(t):!!t)}var o=n(95981),s=n(57475),i=/#|\.prototype\./,a=r.normalize=function(e){return String(e).replace(i,".").toLowerCase()},l=r.data={},c=r.NATIVE="N",u=r.POLYFILL="P";e.exports=r},82119:e=>{e.exports=function(e){return null==e}},10941:(e,t,n)=>{var r=n(57475),n=n(76616),o=n.all;e.exports=n.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:r(e)||e===o}:function(e){return"object"==typeof e?null!==e:r(e)}},82529:e=>{e.exports=!0},56664:(e,t,n)=>{var r=n(626),o=n(57475),s=n(7046),n=n(32302),i=Object;e.exports=n?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return o(t)&&s(t.prototype,i(e))}},93091:(e,t,n)=>{function y(e,t){this.stopped=e,this.result=t}var v=n(86843),b=n(78834),E=n(96059),w=n(69826),S=n(6782),x=n(10623),_=n(7046),k=n(53476),O=n(22902),A=n(7609),C=TypeError,j=y.prototype;e.exports=function(e,t,n){function r(e){return s&&A(s,"normal",e),new y(!0,e)}function o(e){return h?(E(e),m?g(e[0],e[1],r):g(e[0],e[1])):m?g(e,r):g(e)}var s,i,a,l,c,u,p=n&&n.that,h=!(!n||!n.AS_ENTRIES),d=!(!n||!n.IS_RECORD),f=!(!n||!n.IS_ITERATOR),m=!(!n||!n.INTERRUPTED),g=v(t,p);if(d)s=e.iterator;else if(f)s=e;else{if(!(n=O(e)))throw C(w(e)+" is not iterable");if(S(n)){for(i=0,a=x(e);i{var s=n(78834),i=n(96059),a=n(14229);e.exports=function(e,t,n){var r,o;i(e);try{if(!(r=a(e,"return"))){if("throw"===t)throw n;return n}r=s(r,e)}catch(e){o=!0,r=e}if("throw"===t)throw n;if(o)throw r;return i(r),n}},53847:(e,t,n)=>{"use strict";function o(){return this}var s=n(35143).IteratorPrototype,i=n(29290),a=n(31887),l=n(90904),c=n(12077);e.exports=function(e,t,n,r){t+=" Iterator";return e.prototype=i(s,{next:a(+!r,n)}),l(e,t,!1,!0),c[t]=o,e}},75105:(e,t,n)=>{"use strict";function m(){return this}var g=n(76887),y=n(78834),v=n(82529),r=n(79417),b=n(57475),E=n(53847),w=n(249),S=n(88929),x=n(90904),_=n(32029),k=n(95929),o=n(99813),O=n(12077),n=n(35143),A=r.PROPER,C=r.CONFIGURABLE,j=n.IteratorPrototype,P=n.BUGGY_SAFARI_ITERATORS,N=o("iterator"),I="values",T="entries";e.exports=function(e,t,n,r,o,s,i){E(n,t,r);function a(e){if(e===o&&d)return d;if(!P&&e in p)return p[e];switch(e){case"keys":case I:case T:return function(){return new n(this,e)}}return function(){return new n(this)}}var l,c,r=t+" Iterator",u=!1,p=e.prototype,h=p[N]||p["@@iterator"]||o&&p[o],d=!P&&h||a(o),f="Array"==t&&p.entries||h;if(f&&(f=w(f.call(new e)))!==Object.prototype&&f.next&&(v||w(f)===j||(S?S(f,j):b(f[N])||k(f,N,m)),x(f,r,!0,!0),v&&(O[r]=m)),A&&o==I&&h&&h.name!==I&&(!v&&C?_(p,"name",I):(u=!0,d=function(){return y(h,this)})),o)if(l={values:a(I),keys:s?d:a("keys"),entries:a(T)},i)for(c in l)!P&&!u&&c in p||k(p,c,l[c]);else g({target:t,proto:!0,forced:P||u},l);return v&&!i||p[N]===d||k(p,N,d,{name:o}),O[t]=d,l}},35143:(e,t,n)=>{"use strict";var r,o,s=n(95981),i=n(57475),a=n(10941),l=n(29290),c=n(249),u=n(95929),p=n(99813),n=n(82529),h=p("iterator"),p=!1;[].keys&&("next"in(o=[].keys())?(c=c(c(o)))!==Object.prototype&&(r=c):p=!0),!a(r)||s(function(){var e={};return r[h].call(e)!==e})?r={}:n&&(r=l(r)),i(r[h])||u(r,h,function(){return this}),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:p}},12077:e=>{e.exports={}},10623:(e,t,n)=>{var r=n(43057);e.exports=function(e){return r(e.length)}},35331:e=>{var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){e=+e;return(0{var r=n(85803);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:r(e)}},24420:(e,t,n)=>{"use strict";var h=n(55746),r=n(95329),d=n(78834),o=n(95981),f=n(14771),m=n(87857),g=n(36760),y=n(89678),v=n(37026),s=Object.assign,i=Object.defineProperty,b=r([].concat);e.exports=!s||o(function(){if(h&&1!==s({b:1},s(i({},"a",{enumerable:!0,get:function(){i(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=s({},e)[n]||f(s({},t)).join("")!=r})?function(e,t){for(var n=y(e),r=arguments.length,o=1,s=m.f,i=g.f;o{function r(){}function o(e){e.write(m("")),e.close();var t=e.parentWindow.Object;return e=null,t}var s,i=n(96059),a=n(59938),l=n(56759),c=n(27748),u=n(15463),p=n(61333),n=n(44262),h="prototype",d="script",f=n("IE_PROTO"),m=function(e){return"<"+d+">"+e+""},g=function(){try{s=new ActiveXObject("htmlfile")}catch(e){}var e,t,n;g="undefined"==typeof document||document.domain&&s?o(s):(t=p("iframe"),n="java"+d+":",t.style.display="none",u.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(m("document.F=Object")),e.close(),e.F);for(var r=l.length;r--;)delete g[h][l[r]];return g()};c[f]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(r[h]=i(e),n=new r,r[h]=null,n[f]=e):n=g(),void 0===t?n:a.f(n,t)}},59938:(e,t,n)=>{var r=n(55746),o=n(83937),a=n(65988),l=n(96059),c=n(74529),u=n(14771);t.f=r&&!o?Object.defineProperties:function(e,t){l(e);for(var n,r=c(t),o=u(t),s=o.length,i=0;i{var r=n(55746),o=n(2840),s=n(83937),i=n(96059),a=n(83894),l=TypeError,c=Object.defineProperty,u=Object.getOwnPropertyDescriptor,p="enumerable",h="configurable",d="writable";t.f=r?s?function(e,t,n){var r;return i(e),t=a(t),i(n),"function"==typeof e&&"prototype"===t&&"value"in n&&d in n&&!n[d]&&(r=u(e,t))&&r[d]&&(e[t]=n.value,n={configurable:(h in n?n:r)[h],enumerable:(p in n?n:r)[p],writable:!1}),c(e,t,n)}:c:function(e,t,n){if(i(e),t=a(t),i(n),o)try{return c(e,t,n)}catch(e){}if("get"in n||"set"in n)throw l("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},49677:(e,t,n)=>{var r=n(55746),o=n(78834),s=n(36760),i=n(31887),a=n(74529),l=n(83894),c=n(90953),u=n(2840),p=Object.getOwnPropertyDescriptor;t.f=r?p:function(e,t){if(e=a(e),t=l(t),u)try{return p(e,t)}catch(e){}if(c(e,t))return i(!o(s.f,e,t),e[t])}},10946:(e,t,n)=>{var r=n(55629),o=n(56759).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},87857:(e,t)=>{t.f=Object.getOwnPropertySymbols},249:(e,t,n)=>{var r=n(90953),o=n(57475),s=n(89678),i=n(44262),n=n(91310),a=i("IE_PROTO"),l=Object,c=l.prototype;e.exports=n?l.getPrototypeOf:function(e){e=s(e);if(r(e,a))return e[a];var t=e.constructor;return o(t)&&e instanceof t?t.prototype:e instanceof l?c:null}},7046:(e,t,n)=>{n=n(95329);e.exports=n({}.isPrototypeOf)},55629:(e,t,n)=>{var r=n(95329),i=n(90953),a=n(74529),l=n(31692).indexOf,c=n(27748),u=r([].push);e.exports=function(e,t){var n,r=a(e),o=0,s=[];for(n in r)!i(c,n)&&i(r,n)&&u(s,n);for(;t.length>o;)!i(r,n=t[o++])||~l(s,n)||u(s,n);return s}},14771:(e,t,n)=>{var r=n(55629),o=n(56759);e.exports=Object.keys||function(e){return r(e,o)}},36760:(e,t)=>{"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,o=r&&!n.call({1:2},1);t.f=o?function(e){e=r(this,e);return!!e&&e.enumerable}:n},88929:(e,t,n)=>{var o=n(45526),s=n(96059),i=n(11851);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var n,r=!1,e={};try{(n=o(Object.prototype,"__proto__","set"))(e,[]),r=e instanceof Array}catch(n){}return function(e,t){return s(e),i(t),r?n(e,t):e.__proto__=t,e}}():void 0)},95623:(e,t,n)=>{"use strict";var r=n(22885),o=n(9697);e.exports=r?{}.toString:function(){return"[object "+o(this)+"]"}},39811:(e,t,n)=>{var o=n(78834),s=n(57475),i=n(10941),a=TypeError;e.exports=function(e,t){var n,r;if("string"===t&&s(n=e.toString)&&!i(r=o(n,e)))return r;if(s(n=e.valueOf)&&!i(r=o(n,e)))return r;if("string"!==t&&s(n=e.toString)&&!i(r=o(n,e)))return r;throw a("Can't convert object to primitive value")}},31136:(e,t,n)=>{var r=n(626),o=n(95329),s=n(10946),i=n(87857),a=n(96059),l=o([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=s.f(a(e)),n=i.f;return n?l(t,n(e)):t}},54058:e=>{e.exports={}},9056:(e,t,n)=>{var r=n(65988).f;e.exports=function(e,t,n){n in e||r(e,n,{configurable:!0,get:function(){return t[n]},set:function(e){t[n]=e}})}},48219:(e,t,n)=>{var r=n(82119),o=TypeError;e.exports=function(e){if(r(e))throw o("Can't call method on "+e);return e}},90904:(e,t,n)=>{var o=n(22885),s=n(65988).f,i=n(32029),a=n(90953),l=n(95623),c=n(99813)("toStringTag");e.exports=function(e,t,n,r){e&&(n=n?e:e.prototype,a(n,c)||s(n,c,{configurable:!0,value:t}),r&&!o&&i(n,"toString",l))}},44262:(e,t,n)=>{var r=n(68726),o=n(99418),s=r("keys");e.exports=function(e){return s[e]||(s[e]=o(e))}},63030:(e,t,n)=>{var r=n(21899),n=n(75609),o="__core-js_shared__",r=r[o]||n(o,{});e.exports=r},68726:(e,t,n)=>{var r=n(82529),o=n(63030);(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.31.1",mode:r?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"})},64620:(e,t,n)=>{function r(o){return function(e,t){var n,e=i(a(e)),t=s(t),r=e.length;return t<0||r<=t?o?"":void 0:(n=c(e,t))<55296||56319{var r=n(53385),o=n(95981),s=n(21899).String;e.exports=!!Object.getOwnPropertySymbols&&!o(function(){var e=Symbol();return!s(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41})},59413:(e,t,n)=>{var r=n(62435),o=Math.max,s=Math.min;e.exports=function(e,t){e=r(e);return e<0?o(e+t,0):s(e,t)}},74529:(e,t,n)=>{var r=n(37026),o=n(48219);e.exports=function(e){return r(o(e))}},62435:(e,t,n)=>{var r=n(35331);e.exports=function(e){e=+e;return e!=e||0==e?0:r(e)}},43057:(e,t,n)=>{var r=n(62435),o=Math.min;e.exports=function(e){return 0{var r=n(48219),o=Object;e.exports=function(e){return o(r(e))}},46935:(e,t,n)=>{var r=n(78834),o=n(10941),s=n(56664),i=n(14229),a=n(39811),n=n(99813),l=TypeError,c=n("toPrimitive");e.exports=function(e,t){if(!o(e)||s(e))return e;var n=i(e,c);if(n){if(n=r(n,e,t=void 0===t?"default":t),!o(n)||s(n))return n;throw l("Can't convert object to primitive value")}return a(e,t=void 0===t?"number":t)}},83894:(e,t,n)=>{var r=n(46935),o=n(56664);e.exports=function(e){e=r(e,"string");return o(e)?e:e+""}},22885:(e,t,n)=>{var r={};r[n(99813)("toStringTag")]="z",e.exports="[object z]"===String(r)},85803:(e,t,n)=>{var r=n(9697),o=String;e.exports=function(e){if("Symbol"===r(e))throw TypeError("Cannot convert a Symbol value to a string");return o(e)}},69826:e=>{var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},99418:(e,t,n)=>{var n=n(95329),r=0,o=Math.random(),s=n(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+s(++r+o,36)}},32302:(e,t,n)=>{n=n(63405);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},83937:(e,t,n)=>{var r=n(55746),n=n(95981);e.exports=r&&n(function(){return 42!=Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},47093:(e,t,n)=>{var r=n(21899),n=n(57475),r=r.WeakMap;e.exports=n(r)&&/native code/.test(String(r))},99813:(e,t,n)=>{var r=n(21899),o=n(68726),s=n(90953),i=n(99418),a=n(63405),n=n(32302),l=r.Symbol,c=o("wks"),u=n?l.for||l:l&&l.withoutSetter||i;e.exports=function(e){return s(c,e)||(c[e]=a&&s(l,e)?l[e]:u("Symbol."+e)),c[e]}},62864:(e,t,n)=>{"use strict";var p=n(626),h=n(90953),d=n(32029),f=n(7046),m=n(88929),g=n(23489),y=n(9056),v=n(70926),b=n(14649),E=n(53794),w=n(79585),S=n(55746),x=n(82529);e.exports=function(e,t,n,r){var o="stackTraceLimit",s=r?2:1,i=e.split("."),a=i[i.length-1],l=p.apply(null,i);if(l){var c=l.prototype;if(!x&&h(c,"cause")&&delete c.cause,!n)return l;var i=p("Error"),u=t(function(e,t){t=b(r?t:e,void 0),e=r?new l(e):new l;return void 0!==t&&d(e,"message",t),w(e,u,e.stack,2),this&&f(c,this)&&v(e,this,u),s{var r=n(76887),o=n(626),s=n(79730),i=n(95981),n=n(62864),a="AggregateError",l=o(a),o=!i(function(){return 1!==l([1]).errors[0]})&&i(function(){return 7!==l([1],a,{cause:7}).cause});r({global:!0,constructor:!0,arity:2,forced:o},{AggregateError:n(a,function(n){return function(e,t){return s(n,this,arguments)}},o,!0)})},49812:(e,t,n)=>{"use strict";function o(e,t){var n,r=s(b,this);return a?n=a(y(),r?i(this):b):(n=r?this:c(b),u(n,g,"Error")),void 0!==t&&u(n,"message",m(t)),d(n,o,n.stack,1),2{n(49812)},66274:(e,t,n)=>{"use strict";var r=n(74529),o=n(18479),s=n(12077),i=n(45402),a=n(65988).f,l=n(75105),c=n(23538),u=n(82529),n=n(55746),p="Array Iterator",h=i.set,d=i.getterFor(p),i=(e.exports=l(Array,"Array",function(e,t){h(this,{type:p,target:r(e),index:0,kind:t})},function(){var e=d(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,c(void 0,!0)):c("keys"==n?r:"values"==n?t[r]:[r,t[r]],!1)},"values"),s.Arguments=s.Array);if(o("keys"),o("values"),o("entries"),!u&&n&&"values"!==i.name)try{a(i,"name",{value:"values"})}catch(e){}},61181:(e,t,n)=>{function r(e,t){var n={};n[e]=l(e,t,p),s({global:!0,constructor:!0,arity:1,forced:p},n)}function o(e,t){var n;u&&u[e]&&((n={})[e]=l(c+"."+e,t,p),s({target:c,stat:!0,constructor:!0,arity:1,forced:p},n))}var s=n(76887),i=n(21899),a=n(79730),l=n(62864),c="WebAssembly",u=i[c],p=7!==Error("e",{cause:7}).cause;r("Error",function(t){return function(e){return a(t,this,arguments)}}),r("EvalError",function(t){return function(e){return a(t,this,arguments)}}),r("RangeError",function(t){return function(e){return a(t,this,arguments)}}),r("ReferenceError",function(t){return function(e){return a(t,this,arguments)}}),r("SyntaxError",function(t){return function(e){return a(t,this,arguments)}}),r("TypeError",function(t){return function(e){return a(t,this,arguments)}}),r("URIError",function(t){return function(e){return a(t,this,arguments)}}),o("CompileError",function(t){return function(e){return a(t,this,arguments)}}),o("LinkError",function(t){return function(e){return a(t,this,arguments)}}),o("RuntimeError",function(t){return function(e){return a(t,this,arguments)}})},73381:(e,t,n)=>{var r=n(76887),n=n(98308);r({target:"Function",proto:!0,forced:Function.bind!==n},{bind:n})},49221:(e,t,n)=>{var r=n(76887),n=n(24420);r({target:"Object",stat:!0,arity:2,forced:Object.assign!==n},{assign:n})},77971:(e,t,n)=>{"use strict";var r=n(64620).charAt,o=n(85803),s=n(45402),i=n(75105),a=n(23538),l="String Iterator",c=s.set,u=s.getterFor(l);i(String,"String",function(e){c(this,{type:l,string:o(e),index:0})},function(){var e=u(this),t=e.string,n=e.index;return n>=t.length?a(void 0,!0):(t=r(t,n),e.index+=t.length,a(t,!1))})},89731:(e,t,n)=>{n(47627)},7634:(e,t,n)=>{n(66274);var r,o=n(63281),s=n(21899),i=n(9697),a=n(32029),l=n(12077),c=n(99813)("toStringTag");for(r in o){var u=s[r],u=u&&u.prototype;u&&i(u)!==c&&a(u,c,r),l[r]=l.Array}},18957:(e,t,n)=>{n(89731);var r=n(50415);n(7634),e.exports=r},28196:(e,t,n)=>{n=n(16246);e.exports=n},63383:(e,t,n)=>{n=n(45999);e.exports=n},8269:function(e,t,n){n=void 0!==n.g?n.g:this;e.exports=function(e){if(e.CSS&&e.CSS.escape)return e.CSS.escape;function t(e){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var t,n=String(e),r=n.length,o=-1,s="",i=n.charCodeAt(0);++o{"use strict";var r=n(48764).Buffer;function s(e){return e instanceof r||e instanceof Date||e instanceof RegExp}function i(e){var t;if(e instanceof r)return t=r.alloc?r.alloc(e.length):new r(e.length),e.copy(t),t;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);throw new Error("Unexpected situation")}function a(e,t){return"__proto__"===t?void 0:e[t]}var l=e.exports=function(){if(arguments.length<1||"object"!=typeof arguments[0])return!1;if(arguments.length<2)return arguments[0];var n,r,o=arguments[0];return Array.prototype.slice.call(arguments,1).forEach(function(t){"object"!=typeof t||null===t||Array.isArray(t)||Object.keys(t).forEach(function(e){return r=a(o,e),(n=a(t,e))===o?void 0:"object"!=typeof n||null===n?void(o[e]=n):Array.isArray(n)?void(o[e]=function n(e){var r=[];return e.forEach(function(e,t){"object"==typeof e&&null!==e?Array.isArray(e)?r[t]=n(e):s(e)?r[t]=i(e):r[t]=l({},e):r[t]=e}),r}(n)):s(n)?void(o[e]=i(n)):"object"!=typeof r||null===r||Array.isArray(r)?void(o[e]=l({},n)):void(o[e]=l(r,n))})}),o}},9996:e=>{"use strict";function o(e){return!(!(t=e)||"object"!=typeof t||(t=e,"[object RegExp]"===(e=Object.prototype.toString.call(t))||"[object Date]"===e||t.$$typeof===n));var t}var n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function a(e,t){return!1!==t.clone&&t.isMergeableObject(e)?c(Array.isArray(e)?[]:{},e,t):e}function s(e,t,n){return e.concat(t).map(function(e){return a(e,n)})}function t(e){return Object.keys(e).concat((t=e,Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[]));var t}function l(e,t){try{return t in e}catch(e){return!1}}function i(r,o,s){var i={};return s.isMergeableObject(r)&&t(r).forEach(function(e){i[e]=a(r[e],s)}),t(o).forEach(function(e){var t,n;(!l(t=r,n=e)||Object.hasOwnProperty.call(t,n)&&Object.propertyIsEnumerable.call(t,n))&&(l(r,e)&&s.isMergeableObject(o[e])?i[e]=function(e,t){if(!t.customMerge)return c;t=t.customMerge(e);return"function"==typeof t?t:c}(e,s)(r[e],o[e],s):i[e]=a(o[e],s))}),i}function c(e,t,n){(n=n||{}).arrayMerge=n.arrayMerge||s,n.isMergeableObject=n.isMergeableObject||o,n.cloneUnlessOtherwiseSpecified=a;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):i(e,t,n):a(t,n)}c.all=function(e,n){if(Array.isArray(e))return e.reduce(function(e,t){return c(e,t,n)},{});throw new Error("first argument should be an array")},e.exports=c},27856:function(e){e.exports=function(){"use strict";const{entries:ze,setPrototypeOf:s,isFrozen:i,getPrototypeOf:r,getOwnPropertyDescriptor:o}=Object;let{freeze:Ue,seal:e,create:Ve}=Object,{apply:a,construct:l}="undefined"!=typeof Reflect&&Reflect;Ue=Ue||function(e){return e},e=e||function(e){return e},a=a||function(e,t,n){return e.apply(t,n)},l=l||function(e,t){return new e(...t)};const Ke=u(Array.prototype.forEach),We=u(Array.prototype.pop),Je=u(Array.prototype.push),He=u(String.prototype.toLowerCase),Ge=u(String.prototype.toString),Ye=u(String.prototype.match),Xe=u(String.prototype.replace),mt=u(String.prototype.indexOf),gt=u(String.prototype.trim),Qe=u(RegExp.prototype.test),Ze=(c=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n/gm),p=e(/\${[\w\W]*}/gm),h=e(/^data-[\-\w.\u00B7-\uFFFF]/),d=e(/^aria-[\-\w]+$/),ht=e(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),f=e(/^(?:\w+script|data):/i),m=e(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),dt=e(/^html$/i);var ft=Object.freeze({__proto__:null,MUSTACHE_EXPR:t,ERB_EXPR:n,TMPLIT_EXPR:p,DATA_ATTR:h,ARIA_ATTR:d,IS_ALLOWED_URI:ht,IS_SCRIPT_OR_DATA:f,ATTR_WHITESPACE:m,DOCTYPE_NAME:dt});return function D(e){e=0D(e);if(c.version="3.0.6",c.removed=[],!e||!e.document||9!==e.document.nodeType)return c.isSupported=!1,c;let s=e.document;const l=s,L=l.currentScript,{DocumentFragment:F,HTMLTemplateElement:B,Node:u,Element:q,NodeFilter:t,NamedNodeMap:$=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:z,DOMParser:U,trustedTypes:p}=e,n=q.prototype,V=nt(n,"cloneNode"),K=nt(n,"nextSibling"),W=nt(n,"childNodes"),o=nt(n,"parentNode");if("function"==typeof B){const ze=s.createElement("template");ze.content&&ze.content.ownerDocument&&(s=ze.content.ownerDocument)}let h,d="";const{implementation:i,createNodeIterator:J,createDocumentFragment:H,getElementsByTagName:G}=s,Y=l.importNode;let r={};c.isSupported="function"==typeof ze&&"function"==typeof o&&i&&void 0!==i.createHTMLDocument;const{MUSTACHE_EXPR:f,ERB_EXPR:X,TMPLIT_EXPR:Q,DATA_ATTR:Z,ARIA_ATTR:ee,IS_SCRIPT_OR_DATA:te,ATTR_WHITESPACE:ne}=ft;let re=ft.IS_ALLOWED_URI,m=null;const oe=et({},[...rt,...ot,...st,...it,...at]);let g=null;const se=et({},[...lt,...ct,...ut,...pt]);let a=Object.seal(Ve(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),y=null,ie=null,ae=!0,le=!0,ce=!1,ue=!0,v=!1,b=!1,pe=!1,he=!1,E=!1,w=!1,S=!1,de=!0,fe=!1;const me="user-content-";let ge=!0,x=!1,_={},k=null;const ye=et({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ve=null;const be=et({},["audio","video","img","source","image","track"]);let Ee=null;const we=et({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),O="http://www.w3.org/1998/Math/MathML",A="http://www.w3.org/2000/svg",C="http://www.w3.org/1999/xhtml";let j=C,Se,xe=null;const _e=et({},[O,A,C],Ge);let P=null;const ke=["application/xhtml+xml","text/html"];let N=null,I=null;function Oe(e){return e instanceof RegExp||e instanceof Function}function Ae(){let e=0e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+t+" could not be created."),null}}(p,L):h)&&"string"==typeof d&&(d=h.createHTML(""));Ue&&Ue(e),I=e}}function T(t){Je(c.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){t.remove()}}function Ce(e){let t=null,n=null;if(he)e=""+e;else{const t=Ye(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===P&&j===C&&(e=''+e+"");var r=h?h.createHTML(e):e;if(j===C)try{t=(new U).parseFromString(r,P)}catch(e){}if(!t||!t.documentElement){t=i.createDocument(j,"template",null);try{t.documentElement.innerHTML=Se?d:r}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(s.createTextNode(n),o.childNodes[0]||null),j===C?G.call(t,b?"html":"body")[0]:b?t.documentElement:o}function je(e){return J.call(e.ownerDocument||e,e,t.SHOW_ELEMENT|t.SHOW_COMMENT|t.SHOW_TEXT,null)}function Pe(e){return"function"==typeof u&&e instanceof u}function Ne(t){let n=null;if(M("beforeSanitizeElements",t,null),(e=t)instanceof z&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof $)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes))return T(t),1;var e;const r=N(t.nodeName);if(M("uponSanitizeElement",t,{tagName:r,allowedTags:m}),t.hasChildNodes()&&!Pe(t.firstElementChild)&&Qe(/<[/\w]/g,t.innerHTML)&&Qe(/<[/\w]/g,t.textContent))return T(t),1;if(m[r]&&!y[r])return t instanceof q&&!function(e){let t=o(e);t&&t.tagName||(t={namespaceURI:j,tagName:"template"});var n=He(e.tagName),r=He(t.tagName);return xe[e.namespaceURI]&&(e.namespaceURI===A?t.namespaceURI===C?"svg"===n:t.namespaceURI===O?"svg"===n&&("annotation-xml"===r||De[r]):Boolean(R[n]):e.namespaceURI===O?t.namespaceURI===C?"math"===n:t.namespaceURI===A?"math"===n&&Le[r]:Boolean(Be[n]):e.namespaceURI===C?(t.namespaceURI!==A||Le[r])&&(t.namespaceURI!==O||De[r])&&!Be[n]&&(Fe[n]||!R[n]):"application/xhtml+xml"===P&&xe[e.namespaceURI])}(t)||("noscript"===r||"noembed"===r||"noframes"===r)&&Qe(/<\/no(script|embed|frames)/i,t.innerHTML)?(T(t),!0):(v&&3===t.nodeType&&(n=t.textContent,Ke([f,X,Q],e=>{n=Xe(n,e," ")}),t.textContent!==n&&(Je(c.removed,{element:t.cloneNode()}),t.textContent=n)),M("afterSanitizeElements",t,null),!1);if(!y[r]&&Ie(r)){if(a.tagNameCheck instanceof RegExp&&Qe(a.tagNameCheck,r))return;if(a.tagNameCheck instanceof Function&&a.tagNameCheck(r))return}if(ge&&!k[r]){const n=o(t)||t.parentNode,r=W(t)||t.childNodes;if(r&&n)for(let e=r.length-1;0<=e;--e)n.insertBefore(V(r[e],!0),K(t))}return T(t),1}function Ie(e){return 0/i,t))qe(o,n);else if(v&&Ke([f,X,Q],e=>{t=Xe(t,e," ")}),i=N(n.nodeName),$e(i,a,t)){if(!fe||"id"!==a&&"name"!==a||(qe(o,n),t=me+t),h&&"object"==typeof p&&"function"==typeof p.getAttributeType&&!s)switch(p.getAttributeType(i,a)){case"TrustedHTML":t=h.createHTML(t);break;case"TrustedScriptURL":t=h.createScriptURL(t)}try{s?n.setAttributeNS(s,o,t):n.setAttribute(o,t),We(c.removed)}catch(n){}}}M("afterSanitizeAttributes",n,null)}}function Re(e){var t;const n=je(e);for(M("beforeSanitizeShadowDOM",e,null);t=n.nextNode();)M("uponSanitizeShadowNode",t,null),Ne(t)||(t.content instanceof F&&Re(t.content),Te(t));M("afterSanitizeShadowDOM",e,null)}const Me=s.createElement("form"),De=et({},["mi","mo","mn","ms","mtext"]),Le=et({},["foreignobject","desc","title","annotation-xml"]),Fe=et({},["title","style","font","a","script"]),R=et({},ot),Be=(et(R,st),et(R,yt),et({},it)),qe=(et(Be,vt),function(e,t){try{Je(c.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Je(c.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!g[e])if(E||w)try{T(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}}),M=function(e,t,n){r[e]&&Ke(r[e],e=>{e.call(c,t,n,I)})},$e=function(e,t,n){if(de&&("id"===t||"name"===t)&&(n in s||n in Me))return!1;if((!le||ie[t]||!Qe(Z,t))&&(!ae||!Qe(ee,t)))if(!g[t]||ie[t]){if(!(Ie(e)&&(a.tagNameCheck instanceof RegExp&&Qe(a.tagNameCheck,e)||a.tagNameCheck instanceof Function&&a.tagNameCheck(e))&&(a.attributeNameCheck instanceof RegExp&&Qe(a.attributeNameCheck,t)||a.attributeNameCheck instanceof Function&&a.attributeNameCheck(t))||"is"===t&&a.allowCustomizedBuiltInElements&&(a.tagNameCheck instanceof RegExp&&Qe(a.tagNameCheck,n)||a.tagNameCheck instanceof Function&&a.tagNameCheck(n))))return!1}else if(!Ee[t]&&!Qe(re,Xe(n,ne,""))&&("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==mt(n,"data:")||!ve[e])&&(!ce||Qe(te,Xe(n,ne,"")))&&n)return!1;return!0};return c.sanitize=function(e){let t=1\n"+a),v&&Ke([f,X,Q],e=>{a=Xe(a,e," ")}),h&&S?h.createHTML(a):a},c.setConfig=function(){Ae(0{"use strict";class s{constructor(e,t){this.low=e,this.high=t,this.length=1+t-e}overlaps(e){return!(this.highe.high)}touches(e){return!(this.high+1e.high)}add(e){return new s(Math.min(this.low,e.low),Math.max(this.high,e.high))}subtract(e){return e.low<=this.low&&e.high>=this.high?[]:e.low>this.low&&e.highe+t.length,0)}add(e,t){var n=e=>{for(var t=0;t{for(var t=0;t{for(var t=0;t{for(var n=t.low;n<=t.high;)e.push(n),n++;return e},[])}subranges(){return this.ranges.map(e=>({low:e.low,high:e.high,length:1+e.high-e.low}))}}},17187:e=>{"use strict";var t="object"==typeof Reflect?Reflect:null,l=t&&"function"==typeof t.apply?t.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},n=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)},r=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(a,l){return new Promise(function(e,t){function n(e){a.removeListener(l,r),t(e)}function r(){"function"==typeof a.removeListener&&a.removeListener("error",n),e([].slice.call(arguments))}var o,s,i;f(a,l,r,{once:!0}),"error"!==l&&(s=n,i={once:!0},"function"==typeof(o=a).on&&f(o,"error",s,i))})},(o.EventEmitter=o).prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function i(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function a(e,t,n,r){var o,s;return c(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener||n),o=e._events),s=o[t]),void 0===s?(s=o[t]=n,++e._eventsCount):("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),0<(o=i(e))&&s.length>o&&!s.warned&&(s.warned=!0,(r=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",r.emitter=e,r.type=t,r.count=s.length,n=r,console&&console.warn&&console.warn(n))),e}function u(e,t,n){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},t=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=n,e.wrapFn=t}function p(e,t,n){e=e._events;if(void 0===e)return[];e=e[t];{if(void 0===e)return[];if("function"==typeof e)return n?[e.listener||e]:[e];if(n){for(var r=e,o=new Array(r.length),s=0;s{"use strict";var r=n(46291),n=o(Error);function o(t){return e.displayName=t.displayName||t.name,e;function e(e){return e=e&&r.apply(null,arguments),new t(e)}}(e.exports=n).eval=o(EvalError),n.range=o(RangeError),n.reference=o(ReferenceError),n.syntax=o(SyntaxError),n.type=o(TypeError),n.uri=o(URIError),n.create=o},46291:e=>{function n(t){function e(){return i[s++]}for(var n,r,o,s=1,i=[].slice.call(arguments),a=0,l=t.length,c="",u=!1,p=!1;a{"use strict";var l=Array.prototype.slice,c=Object.prototype.toString;e.exports=function(t){var n=this;if("function"!=typeof n||"[object Function]"!==c.call(n))throw new TypeError("Function.prototype.bind called on incompatible "+n);for(var r=l.call(arguments,1),e=Math.max(0,n.length-r.length),o=[],s=0;s{"use strict";n=n(17648);e.exports=Function.prototype.bind||n},40210:(e,t,n)=>{"use strict";var r,h=SyntaxError,o=Function,d=TypeError,s=function(e){try{return o('"use strict"; return ('+e+").constructor;")()}catch(e){}},f=Object.getOwnPropertyDescriptor;if(f)try{f({},"")}catch(e){f=null}function i(){throw new d}var a=f?function(){try{return i}catch(e){try{return f(arguments,"callee").get}catch(e){return i}}}():i,l=n(41405)(),c=n(28185)(),u=Object.getPrototypeOf||(c?function(e){return e.__proto__}:null),m={},c="undefined"!=typeof Uint8Array&&u?u(Uint8Array):r,g={"%AggregateError%":"undefined"==typeof AggregateError?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?r:ArrayBuffer,"%ArrayIteratorPrototype%":l&&u?u([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":m,"%AsyncGenerator%":m,"%AsyncGeneratorFunction%":m,"%AsyncIteratorPrototype%":m,"%Atomics%":"undefined"==typeof Atomics?r:Atomics,"%BigInt%":"undefined"==typeof BigInt?r:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?r:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?r:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?r:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?r:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":m,"%Int8Array%":"undefined"==typeof Int8Array?r:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?r:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":l&&u?u(u([][Symbol.iterator]())):r,"%JSON%":"object"==typeof JSON?JSON:r,"%Map%":"undefined"==typeof Map?r:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&l&&u?u((new Map)[Symbol.iterator]()):r,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?r:Promise,"%Proxy%":"undefined"==typeof Proxy?r:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?r:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?r:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&l&&u?u((new Set)[Symbol.iterator]()):r,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":l&&u?u(""[Symbol.iterator]()):r,"%Symbol%":l?Symbol:r,"%SyntaxError%":h,"%ThrowTypeError%":a,"%TypedArray%":c,"%TypeError%":d,"%Uint8Array%":"undefined"==typeof Uint8Array?r:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?r:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?r:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?r:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?r:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?r:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?r:WeakSet};if(u)try{null.error}catch(e){l=u(u(e));g["%Error.prototype%"]=l}function y(e){var t,n;return"%AsyncFunction%"===e?t=s("async function () {}"):"%GeneratorFunction%"===e?t=s("function* () {}"):"%AsyncGeneratorFunction%"===e?t=s("async function* () {}"):"%AsyncGenerator%"===e?(n=y("%AsyncGeneratorFunction%"))&&(t=n.prototype):"%AsyncIteratorPrototype%"===e&&(n=y("%AsyncGenerator%"))&&u&&(t=u(n.prototype)),g[e]=t}var v={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},a=n(58612),b=n(17642),E=a.call(Function.call,Array.prototype.concat),w=a.call(Function.apply,Array.prototype.splice),S=a.call(Function.call,String.prototype.replace),x=a.call(Function.call,String.prototype.slice),_=a.call(Function.call,RegExp.prototype.exec),k=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,O=/\\(\\)?/g;e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new d("intrinsic name must be a non-empty string");if(1=n.length?(l=!!(p=f(s,c)))&&"get"in p&&!("originalValue"in p.get)?p.get:s[c]:(l=b(s,c),s[c]),l&&!i&&(g[u]=s)}}return s}},28185:e=>{"use strict";var t={foo:{}},n=Object;e.exports=function(){return{__proto__:t}.foo===t.foo&&!({__proto__:null}instanceof n)}},41405:(e,t,n)=>{"use strict";var r="undefined"!=typeof Symbol&&Symbol,o=n(55419);e.exports=function(){return"function"==typeof r&&"function"==typeof Symbol&&"symbol"==typeof r("foo")&&"symbol"==typeof Symbol("bar")&&o()}},55419:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){n=Object.getOwnPropertyDescriptor(e,t);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},17642:(e,t,n)=>{"use strict";n=n(58612);e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},47802:e=>{function n(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(function(e){e=t[e];"object"!=typeof e||Object.isFrozen(e)||n(e)}),t}var g=n;g.default=n;class P{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function u(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function l(e,...t){const n=Object.create(null);for(const t in e)n[t]=e[t];return t.forEach(function(e){for(const t in e)n[t]=e[t]}),n}const r=e=>!!e.kind;class t{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=u(e)}openNode(t){if(r(t)){let e=t.kind;t.sublanguage||(e=""+this.classPrefix+e),this.span(e)}}closeNode(e){r(e)&&(this.buffer+="")}value(){return this.buffer}span(e){this.buffer+=``}}class o{constructor(){this.rootNode={children:[]},this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){e={kind:e,children:[]};this.add(e),this.stack.push(e)}closeNode(){if(1this._walk(t,e)),t.closeNode(e)),t}static _collapse(e){"string"!=typeof e&&e.children&&(e.children.every(e=>"string"==typeof e)?e.children=[e.children.join("")]:e.children.forEach(e=>{o._collapse(e)}))}}class y extends o{constructor(e){super(),this.options=e}addKeyword(e,t){""!==e&&(this.openNode(t),this.addText(e),this.closeNode())}addText(e){""!==e&&this.add(e)}addSublanguage(e,t){const n=e.root;n.kind=t,n.sublanguage=!0,this.add(n)}toHTML(){return new t(this,this.options).value()}finalize(){return!0}}function c(e){return e?"string"==typeof e?e:e.source:null}function s(e,t,n={}){const r=l({className:"comment",begin:e,end:t,contains:[]},n);return r.contains.push(E),r.contains.push({className:"doctag",begin:"(?:TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):",relevance:0}),r}const p=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./,i="[a-zA-Z]\\w*",a="[a-zA-Z_]\\w*",h="\\b\\d+(\\.\\d+)?",d="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",f="\\b(0b[01]+)",m={begin:"\\\\[\\s\\S]",relevance:0},v={className:"string",begin:"'",end:"'",illegal:"\\n",contains:[m]},b={className:"string",begin:'"',end:'"',illegal:"\\n",contains:[m]},E={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},w=s("//","$"),S=s("/\\*","\\*/"),x=s("#","$"),C={className:"number",begin:h,relevance:0},j={className:"number",begin:d,relevance:0},F={className:"number",begin:f,relevance:0},B={className:"number",begin:h+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},q={begin:/(?=\/[^/\n]*\/)/,contains:[{className:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[m,{begin:/\[/,end:/\]/,relevance:0,contains:[m]}]}]},$={className:"title",begin:i,relevance:0},z={className:"title",begin:a,relevance:0},U={begin:"\\.\\s*"+a,relevance:0};var N=Object.freeze({__proto__:null,MATCH_NOTHING_RE:/\b\B/,IDENT_RE:i,UNDERSCORE_IDENT_RE:a,NUMBER_RE:h,C_NUMBER_RE:d,BINARY_NUMBER_RE:f,RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{var t=/^#![ ]*\//;return e.binary&&(e.begin=[t,/.*\b/,e.binary,/\b.*/].map(e=>c(e)).join("")),l({className:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},BACKSLASH_ESCAPE:m,APOS_STRING_MODE:v,QUOTE_STRING_MODE:b,PHRASAL_WORDS_MODE:E,COMMENT:s,C_LINE_COMMENT_MODE:w,C_BLOCK_COMMENT_MODE:S,HASH_COMMENT_MODE:x,NUMBER_MODE:C,C_NUMBER_MODE:j,BINARY_NUMBER_MODE:F,CSS_NUMBER_MODE:B,REGEXP_MODE:q,TITLE_MODE:$,UNDERSCORE_TITLE_MODE:z,METHOD_GUARD:U,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})}});function V(e,t){"."===e.input[e.index-1]&&t.ignoreMatch()}const K=["of","and","for","in","not","or","if","then","parent","list","value"],W="keyword";function _(t,r,e=W){const o={};return"string"==typeof t?n(e,t.split(" ")):Array.isArray(t)?n(e,t):Object.keys(t).forEach(function(e){Object.assign(o,_(t[e],r,e))}),o;function n(n,e){(e=r?e.map(e=>e.toLowerCase()):e).forEach(function(e){var t,e=e.split("|");o[e[0]]=[n,(t=e[0],(e=e[1])?Number(e):function(e){return K.includes(e.toLowerCase())}(t)?0:1)]})}}function J(s,{}){function i(e,t){return new RegExp(c(e),"m"+(s.case_insensitive?"i":"")+(t?"g":""))}class t{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=new RegExp(e.toString()+"|").exec("").length-1+1}compile(){0===this.regexes.length&&(this.exec=()=>null);var e=this.regexes.map(e=>e[1]);this.matcherRe=i(function(e,t="|"){let o=0;return e.map(e=>{var t=o+=1;let n=c(e),r="";for(;0`(${e})`).join(t)}(e),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e);if(!t)return null;var e=t.findIndex((e,t)=>0n.addRule(e,t)),n.compile(),this.multiRegexes[e]=n}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&(!n||n.index!==this.lastIndex)){const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}if(s.compilerExtensions||(s.compilerExtensions=[]),s.contains&&s.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return s.classNameAliases=l(s.classNameAliases||{}),function t(n,r){const o=n;if(n.isCompiled)return o;[function(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}].forEach(e=>e(n,r)),s.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[function(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=V,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))},function(e,t){Array.isArray(e.illegal)&&(e.illegal=([...e]=[...e.illegal],"("+e.map(e=>c(e)).join("|")+")"))},function(e,t){void 0===e.relevance&&(e.relevance=1)}].forEach(e=>e(n,r)),n.isCompiled=!0;let e=null;if("object"==typeof n.keywords&&(e=n.keywords.$pattern,delete n.keywords.$pattern),n.keywords&&(n.keywords=_(n.keywords,s.case_insensitive)),n.lexemes&&e)throw new Error("ERR: Prefer `keywords.$pattern` to `mode.lexemes`, BOTH are not allowed. (see mode reference) ");return e=e||n.lexemes||/\w+/,o.keywordPatternRe=i(e,!0),r&&(n.begin||(n.begin=/\B|\b/),o.beginRe=i(n.begin),n.endSameAsBegin&&(n.end=n.begin),n.end||n.endsWithParent||(n.end=/\B|\b/),n.end&&(o.endRe=i(n.end)),o.terminatorEnd=c(n.end)||"",n.endsWithParent&&r.terminatorEnd&&(o.terminatorEnd+=(n.end?"|":"")+r.terminatorEnd)),n.illegal&&(o.illegalRe=i(n.illegal)),n.contains||(n.contains=[]),n.contains=[].concat(...n.contains.map(function(e){return(t="self"===e?n:e).variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return l(t,{variants:null},e)})),t.cachedVariants||(function e(t){return!!t&&(t.endsWithParent||e(t.starts))}(t)?l(t,{starts:t.starts?l(t.starts):null}):Object.isFrozen(t)?l(t):t);var t})),n.contains.forEach(function(e){t(e,o)}),n.starts&&t(n.starts,r),o.matcher=function(e){const t=new a;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:"begin"})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t}(o),o}(s)}function H(t){const n={props:["language","code","autodetect"],data:function(){return{detectedLanguage:"",unknownLanguage:!1}},computed:{className(){return this.unknownLanguage?"":"hljs "+this.detectedLanguage},highlighted(){if(!this.autoDetect&&!t.getLanguage(this.language))return console.warn(`The language "${this.language}" you specified could not be found.`),this.unknownLanguage=!0,u(this.code);let e={};return this.autoDetect?(e=t.highlightAuto(this.code),this.detectedLanguage=e.language):(e=t.highlight(this.language,this.code,this.ignoreIllegals),this.detectedLanguage=this.language),e.value},autoDetect(){return!this.language||(e=this.autodetect,Boolean(e||""===e));var e},ignoreIllegals:()=>!0},render(e){return e("pre",{},[e("code",{class:this.className,domProps:{innerHTML:this.highlighted}})])}};return{Component:n,VuePlugin:{install(e){e.component("highlightjs",n)}}}}const G={"after:highlightElement":({el:e,result:t,text:n})=>{e=O(e);if(e.length){const r=document.createElement("div");r.innerHTML=t.value,t.value=function(t,e,n){let r=0,o="";const s=[];function i(){return t.length&&e.length?t[0].offset!==e[0].offset?t[0].offset"}function l(e){o+=""}function c(e){("start"===e.event?a:l)(e.node)}for(;t.length||e.length;){let e=i();if(o+=u(n.substring(r,e[0].offset)),r=e[0].offset,e===t){for(s.reverse().forEach(l);c(e.splice(0,1)[0]),(e=i())===t&&e.length&&e[0].offset===r;);s.reverse().forEach(a)}else"start"===e[0].event?s.push(e[0].node):s.pop(),c(e.splice(0,1)[0])}return o+u(n.substr(r))}(e,O(r),n)}}};function k(e){return e.nodeName.toLowerCase()}function O(e){const o=[];return function t(n,r){for(let e=n.firstChild;e;e=e.nextSibling)3===e.nodeType?r+=e.nodeValue.length:1===e.nodeType&&(o.push({event:"start",offset:r,node:e}),r=t(e,r),k(e).match(/br|hr|img|input/)||o.push({event:"stop",offset:r,node:e}));return r}(e,0),o}const A={},I=e=>{console.error(e)},T=(e,...t)=>{console.log("WARN: "+e,...t)},R=(e,t)=>{A[e+"/"+t]||(console.log(`Deprecated as of ${e}. `+t),A[e+"/"+t]=!0)},M=u,D=l,L=Symbol("nomatch");var Y=function(r){const S=Object.create(null),s=Object.create(null),x=[];let _=!0;const t=/(^(<[^>]+>|\t|)+|\n)/gm,k="Could not find the language '{}', did you forget to load/include a language module?",l={disableAutodetect:!0,name:"Plain text",contains:[]};let O={noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:null,__emitter:y};function i(e){return O.noHighlightRe.test(e)}function a(e,t,n,r){let o="",s="";"object"==typeof t?(o=e,n=t.ignoreIllegals,s=t.language,r=void 0):(R("10.7.0","highlight(lang, code, ...args) has been deprecated."),R("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),s=e,o=t);e={code:o,language:s};m("before:highlight",e);const i=e.result||A(e.language,e.code,n,r);return i.code=e.code,m("after:highlight",i),i}function A(r,o,s,e){function i(){(null!=d.subLanguage?function(){if(""!==g){let e=null;if("string"==typeof d.subLanguage){if(!S[d.subLanguage])return m.addText(g);e=A(d.subLanguage,g,!0,f[d.subLanguage]),f[d.subLanguage]=e.top}else e=C(g,d.subLanguage.length?d.subLanguage:null);0")+'"');throw r.mode=d,r}if("end"===t.type){const r=c(t);if(r!==L)return r}if("illegal"===t.type&&""===n)return 1;if(1e53*t.index)throw new Error("potential infinite loop, way more iterations than matches");return g+=n,n.length}const p=j(r);if(!p)throw I(k.replace("{}",r)),new Error('Unknown language: "'+r+'"');var n=J(p,{plugins:x});let h="",d=e||n;const f={},m=new O.__emitter(O);{const w=[];for(let e=d;e!==p;e=e.parent)e.className&&w.unshift(e.className);w.forEach(e=>m.openNode(e))}let g="",y=0,v=0,b=0,E=!1;try{for(d.matcher.considerAll();;){b++,E?E=!1:d.matcher.considerAll(),d.matcher.lastIndex=v;const r=d.matcher.exec(o);if(!r)break;const S=t(o.substring(v,r.index),r);v=r.index+S}return t(o.substr(v)),m.closeAllNodes(),m.finalize(),h=m.toHTML(),{relevance:Math.floor(y),value:h,language:r,illegal:!1,emitter:m,top:d}}catch(e){if(e.message&&e.message.includes("Illegal"))return{illegal:!0,illegalBy:{msg:e.message,context:o.slice(v-100,v+100),mode:e.mode},sofar:h,relevance:0,value:M(o),emitter:m};if(_)return{illegal:!1,relevance:0,value:M(o),emitter:m,language:r,top:d,errorRaised:e};throw e}}function C(t,e){e=e||O.languages||Object.keys(S);const n=function(e){const t={relevance:0,emitter:new O.__emitter(O),value:M(e),illegal:!1,top:l};return t.emitter.addText(e),t}(t),r=e.filter(j).filter(f).map(e=>A(e,t,!1)),o=(r.unshift(n),r.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(j(e.language).supersetOf===t.language)return 1;if(j(t.language).supersetOf===e.language)return-1}return 0})),[s,i]=o,a=s;return a.second_best=i,a}const e={"before:highlightElement":({el:e})=>{O.useBR&&(e.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n"))},"after:highlightElement":({result:e})=>{O.useBR&&(e.value=e.value.replace(/\n/g,"
"))}},n=/^(<[^>]+>|\t)+/gm,o={"after:highlightElement":({result:e})=>{O.tabReplace&&(e.value=e.value.replace(n,e=>e.replace(/\t/g,O.tabReplace)))}};function c(e){var t,n,r,o=function(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";var n=O.languageDetectRe.exec(t);if(n){const t=j(n[1]);return t||(T(k.replace("{}",n[1])),T("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"}return t.split(/\s+/).find(e=>i(e)||j(e))}(e);i(o)||(m("before:highlightElement",{el:e,language:o}),n=e.textContent,m("after:highlightElement",{el:e,result:t=o?a(n,{language:o,ignoreIllegals:!0}):C(n),text:n}),e.innerHTML=t.value,n=e,o=o,r=t.language,o=o?s[o]:r,n.classList.add("hljs"),o&&n.classList.add(o),e.result={language:t.language,re:t.relevance,relavance:t.relevance},t.second_best&&(e.second_best={language:t.second_best.language,re:t.second_best.relevance,relavance:t.second_best.relevance}))}const u=()=>{u.called||(u.called=!0,R("10.6.0","initHighlighting() is deprecated. Use highlightAll() instead."),document.querySelectorAll("pre code").forEach(c))};let p=!1;function h(){"loading"===document.readyState?p=!0:document.querySelectorAll("pre code").forEach(c)}function j(e){return e=(e||"").toLowerCase(),S[e]||S[s[e]]}function d(e,{languageName:t}){(e="string"==typeof e?[e]:e).forEach(e=>{s[e.toLowerCase()]=t})}function f(e){e=j(e);return e&&!e.disableAutodetect}function m(e,t){const n=e;x.forEach(function(e){e[n]&&e[n](t)})}"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",function(){p&&h()},!1),Object.assign(r,{highlight:a,highlightAuto:C,highlightAll:h,fixMarkup:function(e){return R("10.2.0","fixMarkup will be removed entirely in v11.0"),R("10.2.0","Please see https://github.com/highlightjs/highlight.js/issues/2534"),e=e,O.tabReplace||O.useBR?e.replace(t,e=>"\n"===e?O.useBR?"
":e:O.tabReplace?e.replace(/\t/g,O.tabReplace):e):e},highlightElement:c,highlightBlock:function(e){return R("10.7.0","highlightBlock will be removed entirely in v12.0"),R("10.7.0","Please use highlightElement now."),c(e)},configure:function(e){e.useBR&&(R("10.3.0","'useBR' will be removed entirely in v11.0"),R("10.3.0","Please see https://github.com/highlightjs/highlight.js/issues/2559")),O=D(O,e)},initHighlighting:u,initHighlightingOnLoad:function(){R("10.6.0","initHighlightingOnLoad() is deprecated. Use highlightAll() instead."),p=!0},registerLanguage:function(t,e){let n=null;try{n=e(r)}catch(e){if(I("Language definition for '{}' could not be registered.".replace("{}",t)),!_)throw e;I(e),n=l}n.name||(n.name=t),(S[t]=n).rawDefinition=e.bind(null,r),n.aliases&&d(n.aliases,{languageName:t})},unregisterLanguage:function(e){delete S[e];for(const t of Object.keys(s))s[t]===e&&delete s[t]},listLanguages:function(){return Object.keys(S)},getLanguage:j,registerAliases:d,requireLanguage:function(e){R("10.4.0","requireLanguage will be removed entirely in v11."),R("10.4.0","Please see https://github.com/highlightjs/highlight.js/pull/2844");var t=j(e);if(t)return t;throw new Error("The '{}' language is required, but not loaded.".replace("{}",e))},autoDetection:f,inherit:D,addPlugin:function(e){var t;(t=e)["before:highlightBlock"]&&!t["before:highlightElement"]&&(t["before:highlightElement"]=e=>{t["before:highlightBlock"](Object.assign({block:e.el},e))}),t["after:highlightBlock"]&&!t["after:highlightElement"]&&(t["after:highlightElement"]=e=>{t["after:highlightBlock"](Object.assign({block:e.el},e))}),x.push(e)},vuePlugin:H(r).VuePlugin}),r.debugMode=function(){_=!1},r.safeMode=function(){_=!0},r.versionString="10.7.3";for(const r in N)"object"==typeof N[r]&&g(N[r]);return Object.assign(r,N),r.addPlugin(e),r.addPlugin(G),r.addPlugin(o),r}({});e.exports=Y},61519:e=>{e.exports=function(e){var t={},n={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]};Object.assign(t,{className:"variable",variants:[{begin:[/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])"].map(e=>{return e?"string"==typeof e?e:e.source:null}).join("")},n]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},s={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t,r]};r.contains.push(s);var n={begin:/\$\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,t]},i=e.SHEBANG({binary:`(${["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"].join("|")})`,relevance:10}),a={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z._-]+\b/,keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp"},contains:[i,e.SHEBANG(),a,n,e.HASH_COMMENT_MODE,o,s,{className:"",begin:/\\"/},{className:"string",begin:/'/,end:/'/},t]}}},30786:e=>{e.exports=function(e){var t="HTTP/(2|1\\.[01])",n={className:"attribute",begin:["^",/[A-Za-z][A-Za-z0-9-]*/,"(?=\\:\\s)"].map(e=>{return e?"string"==typeof e?e:e.source:null}).join(""),starts:{contains:[{className:"punctuation",begin:/: /,relevance:0,starts:{end:"$",relevance:0}}]}},r=[n,{begin:"\\n\\n",starts:{subLanguage:[],endsWithParent:!0}}];return{name:"HTTP",aliases:["https"],illegal:/\S/,contains:[{begin:"^(?="+t+" \\d{3})",end:/$/,contains:[{className:"meta",begin:t},{className:"number",begin:"\\b\\d{3}\\b"}],starts:{end:/\b\B/,illegal:/\S/,contains:r}},{begin:"(?=^[A-Z]+ (.*?) "+t+"$)",end:/$/,contains:[{className:"string",begin:" ",end:" ",excludeBegin:!0,excludeEnd:!0},{className:"meta",begin:t},{className:"keyword",begin:"[A-Z]+"}],starts:{end:/\b\B/,illegal:/\S/,contains:r}},e.inherit(n,{relevance:0})]}}},96344:e=>{const b="[A-Za-z$_][0-9A-Za-z$_]*",E=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],w=["true","false","null","undefined","NaN","Infinity"],S=[].concat(["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],["arguments","this","super","console","window","document","localStorage","module","global"],["Intl","DataView","Number","Math","Date","String","RegExp","Object","Function","Boolean","Error","Symbol","Set","Map","WeakSet","WeakMap","Proxy","Reflect","JSON","Promise","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Float32Array","Array","Uint8Array","Uint8ClampedArray","ArrayBuffer","BigInt64Array","BigUint64Array","BigInt"],["EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"]);function x(e){return _("(?=",e,")")}function _(...e){return e.map(e=>{return e?"string"==typeof e?e:e.source:null}).join("")}e.exports=function(e){const t=b,n=/<[A-Za-z0-9\\._:-]+/,r=/\/[A-Za-z0-9\\._:-]+>|\/>/,o=(e,t)=>{var n=e[0].length+e.index,r=e.input[n];"<"!==r?">"===r&&([r,e]=[e,{after:n}["after"]],n="",returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:y}]}]},{begin:/,/,relevance:0},{className:"",begin:/\s/,end:/\s*/,skip:!0},{variants:[{begin:"<>",end:""},{begin:n,"on:begin":o,end:r}],subLanguage:"xml",contains:[{begin:n,end:r,skip:!0,contains:["self"]}]}],relevance:0},{className:"function",beginKeywords:"function",end:/[{;]/,excludeEnd:!0,keywords:s,contains:["self",e.inherit(e.TITLE_MODE,{begin:t}),v],illegal:/%/},{beginKeywords:"while if switch catch for"},{className:"function",begin:e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,contains:[v,e.inherit(e.TITLE_MODE,{begin:t})]},{variants:[{begin:"\\."+t},{begin:"\\$"+t}],relevance:0},{className:"class",beginKeywords:"class",end:/[{;=]/,excludeEnd:!0,illegal:/[:"[\]]/,contains:[{beginKeywords:"extends"},e.UNDERSCORE_TITLE_MODE]},{begin:/\b(?=constructor)/,end:/[{;]/,excludeEnd:!0,contains:[e.inherit(e.TITLE_MODE,{begin:t}),"self",v]},{begin:"(get|set)\\s+(?="+t+"\\()",end:/\{/,keywords:"get set",contains:[e.inherit(e.TITLE_MODE,{begin:t}),{begin:/\(\)/},v]},{begin:/\$[(.]/}]}}},82026:e=>{e.exports=function(e){const t={literal:"true false null"},n=[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],r=[e.QUOTE_STRING_MODE,e.C_NUMBER_MODE],o={end:",",endsWithParent:!0,excludeEnd:!0,contains:r,keywords:t},s={begin:/\{/,end:/\}/,contains:[{className:"attr",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE],illegal:"\\n"},e.inherit(o,{begin:/:/})].concat(n),illegal:"\\S"},i={begin:"\\[",end:"\\]",contains:[e.inherit(o)],illegal:"\\S"};return r.push(s,i),n.forEach(function(e){r.push(e)}),{name:"JSON",contains:r,keywords:t,illegal:"\\S"}}},66336:e=>{e.exports=function(e){const t={$pattern:/-?[A-z\.\-]+\b/,keyword:"if else foreach return do while until elseif begin for trap data dynamicparam end break throw param continue finally in switch exit filter try process catch hidden static parameter",built_in:"ac asnp cat cd CFS chdir clc clear clhy cli clp cls clv cnsn compare copy cp cpi cpp curl cvpa dbp del diff dir dnsn ebp echo|0 epal epcsv epsn erase etsn exsn fc fhx fl ft fw gal gbp gc gcb gci gcm gcs gdr gerr ghy gi gin gjb gl gm gmo gp gps gpv group gsn gsnp gsv gtz gu gv gwmi h history icm iex ihy ii ipal ipcsv ipmo ipsn irm ise iwmi iwr kill lp ls man md measure mi mount move mp mv nal ndr ni nmo npssc nsn nv ogv oh popd ps pushd pwd r rbp rcjb rcsn rd rdr ren ri rjb rm rmdir rmo rni rnp rp rsn rsnp rujb rv rvpa rwmi sajb sal saps sasv sbp sc scb select set shcm si sl sleep sls sort sp spjb spps spsv start stz sujb sv swmi tee trcm type wget where wjb write"},n={begin:"`[\\s\\S]",relevance:0},r={className:"variable",variants:[{begin:/\$\B/},{className:"keyword",begin:/\$this/},{begin:/\$[\w\d][\w\d_:]*/}]},o={className:"string",variants:[{begin:/"/,end:/"/},{begin:/@"/,end:/^"@/}],contains:[n,r,{className:"variable",begin:/\$[A-z]/,end:/[^A-z]/}]},s={className:"string",variants:[{begin:/'/,end:/'/},{begin:/@'/,end:/^'@/}]},i=e.inherit(e.COMMENT(null,null),{variants:[{begin:/#/,end:/$/},{begin:/<#/,end:/#>/}],contains:[{className:"doctag",variants:[{begin:/\.(synopsis|description|example|inputs|outputs|notes|link|component|role|functionality)/},{begin:/\.(parameter|forwardhelptargetname|forwardhelpcategory|remotehelprunspace|externalhelp)\s+\S+/}]}]}),a={className:"built_in",variants:[{begin:"(".concat("Add|Clear|Close|Copy|Enter|Exit|Find|Format|Get|Hide|Join|Lock|Move|New|Open|Optimize|Pop|Push|Redo|Remove|Rename|Reset|Resize|Search|Select|Set|Show|Skip|Split|Step|Switch|Undo|Unlock|Watch|Backup|Checkpoint|Compare|Compress|Convert|ConvertFrom|ConvertTo|Dismount|Edit|Expand|Export|Group|Import|Initialize|Limit|Merge|Mount|Out|Publish|Restore|Save|Sync|Unpublish|Update|Approve|Assert|Build|Complete|Confirm|Deny|Deploy|Disable|Enable|Install|Invoke|Register|Request|Restart|Resume|Start|Stop|Submit|Suspend|Uninstall|Unregister|Wait|Debug|Measure|Ping|Repair|Resolve|Test|Trace|Connect|Disconnect|Read|Receive|Send|Write|Block|Grant|Protect|Revoke|Unblock|Unprotect|Use|ForEach|Sort|Tee|Where",")+(-)[\\w\\d]+")}]},l={className:"class",beginKeywords:"class enum",end:/\s*[{]/,excludeEnd:!0,relevance:0,contains:[e.TITLE_MODE]},c={className:"function",begin:/function\s+/,end:/\s*\{|$/,excludeEnd:!0,returnBegin:!0,relevance:0,contains:[{begin:"function",relevance:0,className:"keyword"},{className:"title",begin:/\w[\w\d]*((-)[\w\d]+)*/,relevance:0},{begin:/\(/,end:/\)/,className:"params",relevance:0,contains:[r]}]},u={begin:/using\s/,end:/$/,returnBegin:!0,contains:[o,s,{className:"keyword",begin:/(using|assembly|command|module|namespace|type)/}]},p={variants:[{className:"operator",begin:"(".concat("-and|-as|-band|-bnot|-bor|-bxor|-casesensitive|-ccontains|-ceq|-cge|-cgt|-cle|-clike|-clt|-cmatch|-cne|-cnotcontains|-cnotlike|-cnotmatch|-contains|-creplace|-csplit|-eq|-exact|-f|-file|-ge|-gt|-icontains|-ieq|-ige|-igt|-ile|-ilike|-ilt|-imatch|-in|-ine|-inotcontains|-inotlike|-inotmatch|-ireplace|-is|-isnot|-isplit|-join|-le|-like|-lt|-match|-ne|-not|-notcontains|-notin|-notlike|-notmatch|-or|-regex|-replace|-shl|-shr|-split|-wildcard|-xor",")\\b")},{className:"literal",begin:/(-)[\w\d]+/,relevance:0}]},h={className:"function",begin:/\[.*\]\s*[\w]+[ ]??\(/,end:/$/,returnBegin:!0,relevance:0,contains:[{className:"keyword",begin:"(".concat(t.keyword.toString().replace(/\s/g,"|"),")\\b"),endsParent:!0,relevance:0},e.inherit(e.TITLE_MODE,{endsParent:!0})]},d=[h,i,n,e.NUMBER_MODE,o,s,a,r,{className:"literal",begin:/\$(null|true|false)\b/},{className:"selector-tag",begin:/@\B/,relevance:0}],f={begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0,relevance:0,contains:[].concat("self",d,{begin:"("+["string","char","byte","int","long","bool","decimal","single","double","DateTime","xml","array","hashtable","void"].join("|")+")",className:"built_in",relevance:0},{className:"type",begin:/[\.\w\d]+/,relevance:0})};return h.contains.unshift(f),{name:"PowerShell",aliases:["ps","ps1"],case_insensitive:!0,keywords:t,contains:d.concat(l,c,u,p,f)}}},42157:e=>{function l(e){return e?"string"==typeof e?e:e.source:null}function c(e){return u("(?=",e,")")}function u(...e){return e.map(e=>l(e)).join("")}e.exports=function(e){var t=u(/[A-Z_]/,u("(",/[A-Z0-9_.-]*:/,")?"),/[A-Z0-9_.-]*/),n={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},r={begin:/\s/,contains:[{className:"meta-keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(r,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:"meta-string"}),i=e.inherit(e.QUOTE_STRING_MODE,{className:"meta-string"}),a={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,contains:[{className:"meta",begin://,relevance:10,contains:[r,i,s,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[r,o,i,s]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},n,{className:"meta",begin:/<\?xml/,end:/\?>/,relevance:10},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[a],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[a],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:u(//,/>/,/\s/].map(e=>l(e)).join("|")+")"))),end:/\/?>/,contains:[{className:"name",begin:t,relevance:0,starts:a}]},{className:"tag",begin:u(/<\//,c(u(t,/>/))),contains:[{className:"name",begin:t,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}},54587:e=>{e.exports=function(e){var t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"string",relevance:0,variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,{className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]}]},o=e.inherit(r,{variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),s={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},n=[{className:"attr",variants:[{begin:"\\w[\\w :\\/.-]*:(?=[ \t]|$)"},{begin:'"\\w[\\w :\\/.-]*":(?=[ \t]|$)'},{begin:"'\\w[\\w :\\/.-]*':(?=[ \t]|$)"}]},{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},{className:"number",begin:"\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b"},{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},{begin:/\{/,end:/\}/,contains:[s],illegal:"\\n",relevance:0},{begin:"\\[",end:"\\]",contains:[s],illegal:"\\n",relevance:0},r],t=[...n];return t.pop(),t.push(o),s.contains=t,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:n}}},8679:(e,t,n)=>{"use strict";var r=n(59864),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},p={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},i={};function h(e){return r.isMemo(e)?s:i[e.$$typeof]||o}i[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},i[r.Memo]=s;var d=Object.defineProperty,f=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols,g=Object.getOwnPropertyDescriptor,y=Object.getPrototypeOf,v=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){!v||(o=y(n))&&o!==v&&e(t,o,r);var o,s=f(n);m&&(s=s.concat(m(n)));for(var i=h(t),a=h(n),l=0;l{t.read=function(e,t,n,r,o){var s,i,a=8*o-r-1,l=(1<>1,u=-7,p=n?o-1:0,h=n?-1:1,o=e[t+p];for(p+=h,s=o&(1<<-u)-1,o>>=-u,u+=a;0>=-u,u+=r;0>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:s-1,d=r?1:-1,s=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=c):(i=Math.floor(Math.log(t)/Math.LN2),t*(r=Math.pow(2,-i))<1&&(i--,r*=2),2<=(t+=1<=i+u?p/r:p*Math.pow(2,1-u))*r&&(i++,r/=2),c<=i+u?(a=0,i=c):1<=i+u?(a=(t*r-1)*Math.pow(2,o),i+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,o),i=0));8<=o;e[n+h]=255&a,h+=d,a/=256,o-=8);for(i=i<>>0;if(""+n!==t||4294967295==n)return NaN;t=n}return t<0?H(e)+t:t}function Y(){return!0}function X(e,t,n){return(0===e||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&n<=t)}function Q(e,t){return ee(e,t,0)}function Z(e,t){return ee(e,t,t)}function ee(e,t,n){return void 0===e?n:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}var te=0,h=1,ne=2,re="function"==typeof Symbol&&Symbol.iterator,oe="@@iterator",se=re||oe;function d(e){this.next=e}function f(e,t,n,r){e=0===e?t:1===e?n:[t,n];return r?r.value=e:r={value:e,done:!1},r}function m(){return{value:void 0,done:!0}}function ie(e){return ce(e)}function ae(e){return e&&"function"==typeof e.next}function le(e){var t=ce(e);return t&&t.call(e)}function ce(e){e=e&&(re&&e[re]||e[oe]);if("function"==typeof e)return e}function ue(e){return e&&"number"==typeof e.length}function n(e){{if(null==e)return Se();if(u(e))return e.toSeq();var t=ke(e)||"object"==typeof e&&new ve(e);if(t)return t;throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e)}}function pe(e){return null==e?Se().toKeyedSeq():u(e)?c(e)?e.toSeq():e.fromEntrySeq():xe(e)}function g(e){return null==e?Se():u(e)?c(e)?e.entrySeq():e.toIndexedSeq():_e(e)}function he(e){return(null==e?Se():u(e)?c(e)?e.entrySeq():e:_e(e)).toSetSeq()}d.prototype.toString=function(){return"[Iterator]"},d.KEYS=te,d.VALUES=h,d.ENTRIES=ne,d.prototype.inspect=d.prototype.toSource=function(){return this.toString()},d.prototype[se]=function(){return this},e(n,l),n.of=function(){return n(arguments)},n.prototype.toSeq=function(){return this},n.prototype.toString=function(){return this.__toString("Seq {","}")},n.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},n.prototype.__iterate=function(e,t){return Oe(this,e,t,!0)},n.prototype.__iterator=function(e,t){return Ae(this,e,t,!0)},e(pe,n),pe.prototype.toKeyedSeq=function(){return this},e(g,n),g.of=function(){return g(arguments)},g.prototype.toIndexedSeq=function(){return this},g.prototype.toString=function(){return this.__toString("Seq [","]")},g.prototype.__iterate=function(e,t){return Oe(this,e,t,!1)},g.prototype.__iterator=function(e,t){return Ae(this,e,t,!1)},e(he,n),he.of=function(){return he(arguments)},he.prototype.toSetSeq=function(){return this},n.isSeq=we,n.Keyed=pe,n.Set=he,n.Indexed=g;var de,fe,me,ge="@@__IMMUTABLE_SEQ__@@";function ye(e){this._array=e,this.size=e.length}function ve(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function be(e){this._iterable=e,this.size=e.length||e.size}function Ee(e){this._iterator=e,this._iteratorCache=[]}function we(e){return!(!e||!e[ge])}function Se(){return de=de||new ye([])}function xe(e){var t=Array.isArray(e)?new ye(e).fromEntrySeq():ae(e)?new Ee(e).fromEntrySeq():ie(e)?new be(e).fromEntrySeq():"object"==typeof e?new ve(e):void 0;if(t)return t;throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e)}function _e(e){var t=ke(e);if(t)return t;throw new TypeError("Expected Array or iterable object of values: "+e)}function ke(e){return ue(e)?new ye(e):ae(e)?new Ee(e):ie(e)?new be(e):void 0}function Oe(e,t,n,r){var o=e._cache;if(o){for(var s=o.length-1,i=0;i<=s;i++){var a=o[n?s-i:i];if(!1===t(a[1],r?a[0]:i,e))return i+1}return i}return e.__iterateUncached(t,n)}function Ae(e,t,n,r){var o,s,i=e._cache;return i?(o=i.length-1,s=0,new d(function(){var e=i[n?o-s:s];return s++>o?m():f(t,r?e[0]:s-1,e[1])})):e.__iteratorUncached(t,n)}function Ce(e,t){return t?function n(r,o,e,t){return Array.isArray(o)?r.call(t,e,g(o).map(function(e,t){return n(r,e,t,o)})):Pe(o)?r.call(t,e,pe(o).map(function(e,t){return n(r,e,t,o)})):o}(t,e,"",{"":e}):je(e)}function je(e){return Array.isArray(e)?g(e).map(je).toList():Pe(e)?pe(e).map(je).toMap():e}function Pe(e){return e&&(e.constructor===Object||void 0===e.constructor)}function v(e,t){if(e===t||e!=e&&t!=t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if((e=e.valueOf())===(t=t.valueOf())||e!=e&&t!=t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function Ne(n,e){if(n===e)return!0;if(!u(e)||void 0!==n.size&&void 0!==e.size&&n.size!==e.size||void 0!==n.__hash&&void 0!==e.__hash&&n.__hash!==e.__hash||c(n)!==c(e)||p(n)!==p(e)||F(n)!==F(e))return!1;if(0===n.size&&0===e.size)return!0;var r,o=!L(n);if(F(n))return r=n.entries(),e.every(function(e,t){var n=r.next().value;return n&&v(n[1],e)&&(o||v(n[0],t))})&&r.next().done;var s=!1,i=(void 0===n.size&&(void 0===e.size?"function"==typeof n.cacheResult&&n.cacheResult():(s=!0,t=n,n=e,e=t)),!0),t=e.__iterate(function(e,t){if(o?!n.has(e):s?!v(e,n.get(t,x)):!v(n.get(t,x),e))return i=!1});return i&&n.size===t}function s(e,t){if(!(this instanceof s))return new s(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(fe)return fe;fe=this}}function Ie(e,t){if(!e)throw new Error(t)}function i(e,t,n){if(!(this instanceof i))return new i(e,t,n);if(Ie(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),n=void 0===n?1:Math.abs(n),ts?m():f(t,e,r[e])})},ve.prototype[z]=!0,e(be,g),be.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n,r=le(this._iterable),o=0;if(ae(r))for(;!(n=r.next()).done&&!1!==e(n.value,o++,this););return o},be.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var n=le(this._iterable);if(!ae(n))return new d(m);var r=0;return new d(function(){var e=n.next();return e.done?e:f(t,r++,e.value)})},e(Ee,g),Ee.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var n=this._iterator,r=this._iteratorCache,o=0;o=r.length){var e=n.next();if(e.done)return e;r[o]=e.value}return f(t,o,r[o++])})},e(s,g),s.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},s.prototype.get=function(e,t){return this.has(e)?this._value:t},s.prototype.includes=function(e){return v(this._value,e)},s.prototype.slice=function(e,t){var n=this.size;return X(e,t,n)?this:new s(this._value,Z(t,n)-Q(e,n))},s.prototype.reverse=function(){return this},s.prototype.indexOf=function(e){return v(this._value,e)?0:-1},s.prototype.lastIndexOf=function(e){return v(this._value,e)?this.size:-1},s.prototype.__iterate=function(e,t){for(var n=0;n>>16)*r+n*(t>>>16)<<16>>>0)|0};function Fe(e){return e>>>1&1073741824|3221225471&e}function _(e){if(!1===e||null==e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null==e))return 0;if(!0===e)return 1;var t,n,r=typeof e;if("number"==r){if(e!=e||e===1/0)return 0;var o=0|e;for(o!==e&&(o^=4294967295*e);4294967295We?(void 0===(t=Ge[s=e])&&(t=Be(s),He===Je&&(He=0,Ge={}),He++,Ge[s]=t),t):Be(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"==r){var s=e;if(Ue&&void 0!==(n=ze.get(s)))return n;if(void 0!==(n=s[Ke]))return n;if(!$e){if(void 0!==(n=s.propertyIsEnumerable&&s.propertyIsEnumerable[Ke]))return n;if(void 0!==(n=function(e){if(e&&0=n.length)throw new Error("Missing value for key: "+n[t]);e.set(n[t],n[t+1])}})},k.prototype.toString=function(){return this.__toString("Map {","}")},k.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},k.prototype.set=function(e,t){return ct(this,e,t)},k.prototype.setIn=function(e,t){return this.updateIn(e,x,function(){return t})},k.prototype.remove=function(e){return ct(this,e,x)},k.prototype.deleteIn=function(e){return this.updateIn(e,function(){return x})},k.prototype.update=function(e,t,n){return 1===arguments.length?e(this):this.updateIn([e],t,n)},k.prototype.updateIn=function(e,t,n){n||(n=t,t=void 0);e=function e(t,n,r,o){var s=t===x,i=n.next();if(i.done)return(l=o(a=s?r:t))===a?t:l;Ie(s||t&&t.set,"invalid keyPath");var a=i.value,l=s?x:t.get(a,x),i=e(l,n,r,o);return i===l?t:i===x?t.remove(a):(s?lt():t).set(a,i)}(this,cn(e),t,n);return e===x?void 0:e},k.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):lt()},k.prototype.merge=function(){return dt(this,void 0,arguments)},k.prototype.mergeWith=function(e){return dt(this,e,r.call(arguments,1))},k.prototype.mergeIn=function(e){var t=r.call(arguments,1);return this.updateIn(e,lt(),function(e){return"function"==typeof e.merge?e.merge.apply(e,t):t[t.length-1]})},k.prototype.mergeDeep=function(){return dt(this,ft,arguments)},k.prototype.mergeDeepWith=function(e){return dt(this,mt(e),r.call(arguments,1))},k.prototype.mergeDeepIn=function(e){var t=r.call(arguments,1);return this.updateIn(e,lt(),function(e){return"function"==typeof e.mergeDeep?e.mergeDeep.apply(e,t):t[t.length-1]})},k.prototype.sort=function(e){return j(Qt(this,e))},k.prototype.sortBy=function(e,t){return j(Qt(this,t,e))},k.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},k.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new W)},k.prototype.asImmutable=function(){return this.__ensureOwner()},k.prototype.wasAltered=function(){return this.__altered},k.prototype.__iterator=function(e,t){return new ot(this,e,t)},k.prototype.__iterate=function(t,e){var n=this,r=0;return this._root&&this._root.iterate(function(e){return r++,t(e[1],e[0],n)},e),r},k.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?at(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},k.isMap=Ye;var Xe,Qe="@@__IMMUTABLE_MAP__@@",O=k.prototype;function Ze(e,t){this.ownerID=e,this.entries=t}function et(e,t,n){this.ownerID=e,this.bitmap=t,this.nodes=n}function tt(e,t,n){this.ownerID=e,this.count=t,this.nodes=n}function nt(e,t,n){this.ownerID=e,this.keyHash=t,this.entries=n}function rt(e,t,n){this.ownerID=e,this.keyHash=t,this.entry=n}function ot(e,t,n){this._type=t,this._reverse=n,this._stack=e._root&&it(e._root)}function st(e,t){return f(e,t[0],t[1])}function it(e,t){return{node:e,index:0,__prev:t}}function at(e,t,n,r){var o=Object.create(O);return o.size=e,o._root=t,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function lt(){return Xe=Xe||at(0)}function ct(e,t,n){if(e._root){var r=K(U),o=K(V),s=ut(e._root,e.__ownerID,0,void 0,t,n,r,o);if(!o.value)return e;o=e.size+(r.value?n===x?-1:1:0)}else{if(n===x)return e;o=1,s=new Ze(e.__ownerID,[[t,n]])}return e.__ownerID?(e.size=o,e._root=s,e.__hash=void 0,e.__altered=!0,e):s?at(o,s):lt()}function ut(e,t,n,r,o,s,i,a){return e?e.update(t,n,r,o,s,i,a):s===x?e:(y(a),y(i),new rt(t,r,[o,s]))}function pt(e){return e.constructor===rt||e.constructor===nt}function ht(e,t,n,r,o){if(e.keyHash===r)return new nt(t,r,[e.entry,o]);var s=(0===n?e.keyHash:e.keyHash>>>n)&S,i=(0===n?r:r>>>n)&S;return new et(t,1<>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,127&(e+=e>>8)+(e>>16)}function vt(e,t,n,r){r=r?e:J(e);return r[t]=n,r}O[Qe]=!0,O[t]=O.remove,O.removeIn=O.deleteIn,Ze.prototype.get=function(e,t,n,r){for(var o=this.entries,s=0,i=o.length;s=bt){for(var h=e,d=l,i=r,s=o,f=new rt(h=h||new W,_(i),[i,s]),m=0;m>>e)&S),s=this.bitmap;return 0==(s&o)?r:this.nodes[yt(s&o-1)].get(e+E,t,n,r)},et.prototype.update=function(e,t,n,r,o,s,i){void 0===n&&(n=_(r));var a=(0===t?n:n>>>t)&S,l=1<=Et){for(var n=e,f=h,m=c,r=a,o=t,g=0,y=new Array(w),v=0;0!==m;v++,m>>>=1)y[v]=1&m?f[g++]:void 0;return y[r]=o,new tt(n,g+1,y)}if(u&&!t&&2===h.length&&pt(h[1^p]))return h[1^p];if(u&&t&&1===h.length&&pt(t))return t;s=e&&e===this.ownerID,i=u?t?c:c^l:c|l,d=u?t?vt(h,p,t,s):function(e,t,n){var r=e.length-1;if(n&&t===r)return e.pop(),e;for(var o=new Array(r),s=0,i=0;i>>e)&S];return o?o.get(e+E,t,n,r):r},tt.prototype.update=function(e,t,n,r,o,s,i){void 0===n&&(n=_(r));var a=(0===t?n:n>>>t)&S,l=o===x,c=this.nodes,u=c[a];if(l&&!u)return this;l=ut(u,e,t+E,n,r,o,s,i);if(l===u)return this;t=this.count;if(u){if(!l&&--t=n.size||r<0)return n.withMutations(function(e){r<0?Rt(e,r).set(0,o):Rt(e,0,r+1).set(r,o)});r+=n._origin;var e=n._tail,t=n._root,s=K(V);return r>=Dt(n._capacity)?e=Nt(e,n.__ownerID,0,r,o,s):t=Nt(t,n.__ownerID,n._level,r,o,s),s.value?n.__ownerID?(n._root=t,n._tail=e,n.__hash=void 0,n.__altered=!0,n):jt(n._origin,n._capacity,n._level,t,e):n},A.prototype.remove=function(e){return this.has(e)?0===e?this.shift():e===this.size-1?this.pop():this.splice(e,1):this},A.prototype.insert=function(e,t){return this.splice(e,0,t)},A.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=E,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Pt()},A.prototype.push=function(){var n=arguments,r=this.size;return this.withMutations(function(e){Rt(e,0,r+n.length);for(var t=0;t>>t&S;if(r>=this.array.length)return new _t([],e);var o,s=0==r;if(0>>t&S;if(o>=this.array.length)return this;if(0>r,w<(l=1+(g-o>>r))&&(l=w),function(){for(;;){if(s){var e=s();if(e!==At)return e;s=null}if(a===l)return At;e=f?--l:a++;s=b(i&&i[e],r-E,o+(e<>>n&S,c=e&&l=Dt(e._capacity))return e._tail;if(t<1<>>r&S],r-=E;return n}}function Rt(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new W,o=e._origin,s=e._capacity,i=o+t,t=void 0===n?s:n<0?s+n:o+n;if(i===o&&t===s)return e;if(t<=i)return e.clear();for(var a=e._level,l=e._root,c=0;i+c<0;)l=new _t(l&&l.array.length?[void 0,l]:[],r),c+=1<<(a+=E);c&&(i+=c,o+=c,t+=c,s+=c);for(var u=Dt(s),p=Dt(t);1<>>f&S,d=d.array[m]=It(d.array[m],r);d.array[u>>>E&S]=n}if(t>>a&S;if(g!=p>>>a&S)break;g&&(c+=(1<o&&(o=a.size),u(i)||(a=a.map(function(e){return Ce(e)})),r.push(a)}return gt(e=o>e.size?e.setSize(o):e,t,r)}function Dt(e){return e>>E<=w&&i.size>=2*s.size?(r=(o=i.filter(function(e,t){return void 0!==e&&a!==t})).toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(r.__ownerID=o.__ownerID=e.__ownerID)):(r=s.remove(t),o=a===i.size-1?i.pop():i.set(a,void 0))}else if(l){if(n===i.get(a)[1])return e;r=s,o=i.set(a,[t,n])}else r=s.set(t,i.size),o=i.set(i.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=o,e.__hash=void 0,e):Ft(r,o)}function $t(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function zt(e){this._iter=e,this.size=e.size}function Ut(e){this._iter=e,this.size=e.size}function Vt(e){this._iter=e,this.size=e.size}function Kt(o){var e=sn(o);return e._iter=o,e.size=o.size,e.flip=function(){return o},e.reverse=function(){var e=o.reverse.apply(this);return e.flip=function(){return o.reverse()},e},e.has=function(e){return o.includes(e)},e.includes=function(e){return o.has(e)},e.cacheResult=an,e.__iterateUncached=function(n,e){var r=this;return o.__iterate(function(e,t){return!1!==n(t,e,r)},e)},e.__iteratorUncached=function(e,t){var n;return e===ne?(n=o.__iterator(e,t),new d(function(){var e,t=n.next();return t.done||(e=t.value[0],t.value[0]=t.value[1],t.value[1]=e),t})):o.__iterator(e===h?te:h,t)},e}function Wt(s,i,a){var e=sn(s);return e.size=s.size,e.has=function(e){return s.has(e)},e.get=function(e,t){var n=s.get(e,x);return n===x?t:i.call(a,n,e,s)},e.__iterateUncached=function(r,e){var o=this;return s.__iterate(function(e,t,n){return!1!==r(i.call(a,e,t,n),t,o)},e)},e.__iteratorUncached=function(r,e){var o=s.__iterator(ne,e);return new d(function(){var e=o.next();if(e.done)return e;var t=e.value,n=t[0];return f(r,n,i.call(a,t[1],n,s),e)})},e}function Jt(o,n){var e=sn(o);return e._iter=o,e.size=o.size,e.reverse=function(){return o},o.flip&&(e.flip=function(){var e=Kt(o);return e.reverse=function(){return o.flip()},e}),e.get=function(e,t){return o.get(n?e:-1-e,t)},e.has=function(e){return o.has(n?e:-1-e)},e.includes=function(e){return o.includes(e)},e.cacheResult=an,e.__iterate=function(n,e){var r=this;return o.__iterate(function(e,t){return n(e,t,r)},!e)},e.__iterator=function(e,t){return o.__iterator(e,!t)},e}function Ht(i,a,l,c){var e=sn(i);return c&&(e.has=function(e){var t=i.get(e,x);return t!==x&&!!a.call(l,t,e,i)},e.get=function(e,t){var n=i.get(e,x);return n!==x&&a.call(l,n,e,i)?n:t}),e.__iterateUncached=function(r,e){var o=this,s=0;return i.__iterate(function(e,t,n){if(a.call(l,e,t,n))return s++,r(e,c?t:s-1,o)},e),s},e.__iteratorUncached=function(r,e){var o=i.__iterator(ne,e),s=0;return new d(function(){for(;;){var e=o.next();if(e.done)return e;var t=e.value,n=t[0],t=t[1];if(a.call(l,t,n,i))return f(r,c?n:s++,t,e)}})},e}function Gt(a,e,t,l){var n=a.size;if(void 0!==e&&(e|=0),void 0!==t&&(t===1/0?t=n:t|=0),X(e,t,n))return a;var c=Q(e,n),n=Z(t,n);if(c!=c||n!=n)return Gt(a.toSeq().cacheResult(),e,t,l);var u,e=n-c,t=(e==e&&(u=e<0?0:e),sn(a));return t.size=0===u?u:a.size&&u||void 0,!l&&we(a)&&0<=u&&(t.get=function(e,t){return 0<=(e=G(this,e))&&eu)return m();var e=n.next();return l||t===h?e:f(t,o-1,t===te?void 0:e.value[1],e)})},t}function Yt(t,c,u,p){var e=sn(t);return e.__iterateUncached=function(r,e){var o=this;if(e)return this.cacheResult().__iterate(r,e);var s=!0,i=0;return t.__iterate(function(e,t,n){if(!s||!(s=c.call(u,e,t,n)))return i++,r(e,p?t:i-1,o)}),i},e.__iteratorUncached=function(o,e){var s=this;if(e)return this.cacheResult().__iterator(o,e);var i=t.__iterator(ne,e),a=!0,l=0;return new d(function(){var e;do{if((e=i.next()).done)return p||o===h?e:f(o,l++,o===te?void 0:e.value[1],e);var t=e.value,n=t[0],r=t[1]}while(a=a&&c.call(u,r,n,s));return o===ne?e:f(o,n,r,e)})},e}function Xt(e,l,c){var t=sn(e);return t.__iterateUncached=function(s,t){var i=0,a=!1;return function n(e,r){var o=this;e.__iterate(function(e,t){return(!l||r>>-15,461845907),t=Le(t<<13|t>>>-13,5),t=Le((t=(t+3864292196|0)^e)^t>>>16,2246822507),t=Fe((t=Le(t^t>>>13,3266489909))^t>>>16)}(e.__iterate(n?t?function(e,t){r=31*r+Bn(_(e),_(t))|0}:function(e,t){r=r+Bn(_(e),_(t))|0}:t?function(e){r=31*r+_(e)|0}:function(e){r=r+_(e)|0}),r)}(this))}});var t=l.prototype,Nn=(t[B]=!0,t[se]=t.values,t.__toJS=t.toArray,t.__toStringMapper=Dn,t.inspect=t.toSource=function(){return this.toString()},t.chain=t.flatMap,t.contains=t.includes,Pn(a,{flip:function(){return P(this,Kt(this))},mapEntries:function(n,r){var o=this,s=0;return P(this,this.toSeq().map(function(e,t){return n.call(r,[t,e],s++,o)}).fromEntrySeq())},mapKeys:function(n,r){var o=this;return P(this,this.toSeq().flip().map(function(e,t){return n.call(r,e,t,o)}).flip())}}),a.prototype);function In(e,t){return t}function Tn(e,t){return[t,e]}function Rn(e){return function(){return!e.apply(this,arguments)}}function Mn(e){return function(){return-e.apply(this,arguments)}}function Dn(e){return"string"==typeof e?JSON.stringify(e):String(e)}function Ln(){return J(arguments)}function Fn(e,t){return e>2)|0}return Nn[q]=!0,Nn[se]=t.entries,Nn.__toJS=t.toObject,Nn.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+Dn(e)},Pn(D,{toKeyedSeq:function(){return new $t(this,!1)},filter:function(e,t){return P(this,Ht(this,e,t,!1))},findIndex:function(e,t){e=this.findEntry(e,t);return e?e[0]:-1},indexOf:function(e){e=this.keyOf(e);return void 0===e?-1:e},lastIndexOf:function(e){e=this.lastKeyOf(e);return void 0===e?-1:e},reverse:function(){return P(this,Jt(this,!1))},slice:function(e,t){return P(this,Gt(this,e,t,!1))},splice:function(e,t){var n=arguments.length;if(t=Math.max(0|t,0),0===n||2===n&&!t)return this;e=Q(e,e<0?this.count():this.size);var r=this.slice(0,e);return P(this,1===n?r:r.concat(J(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){e=this.findLastEntry(e,t);return e?e[0]:-1},first:function(){return this.get(0)},flatten:function(e){return P(this,Xt(this,e,!1))},get:function(n,e){return(n=G(this,n))<0||this.size===1/0||void 0!==this.size&&n>this.size?e:this.find(function(e,t){return t===n},void 0,e)},has:function(e){return 0<=(e=G(this,e))&&(void 0!==this.size?this.size===1/0||e{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){var n;t&&(e.super_=t,(n=function(){}).prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e)}},35823:e=>{e.exports=function(e,t,n,r){var o,s,r=new Blob(void 0!==r?[r,e]:[e],{type:n||"application/octet-stream"});void 0!==window.navigator.msSaveBlob?window.navigator.msSaveBlob(r,t):(o=(window.URL&&window.URL.createObjectURL?window.URL:window.webkitURL).createObjectURL(r),(s=document.createElement("a")).style.display="none",s.href=o,s.setAttribute("download",t),void 0===s.download&&s.setAttribute("target","_blank"),document.body.appendChild(s),s.click(),setTimeout(function(){document.body.removeChild(s),window.URL.revokeObjectURL(o)},200))}},91296:(e,t,n)=>{function v(){return c.Date.now()}var r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt,n="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,l="object"==typeof self&&self&&self.Object===Object&&self,c=n||l||Function("return this")(),u=Object.prototype.toString,b=Math.max,E=Math.min;function w(e){var t=typeof e;return e&&("object"==t||"function"==t)}function S(e){if("number"==typeof e)return e;if("symbol"==typeof(n=e)||(t=n)&&"object"==typeof t&&"[object Symbol]"==u.call(n))return NaN;var t;if("string"!=typeof(e=w(e)?w(t="function"==typeof e.valueOf?e.valueOf():e)?t+"":t:e))return 0===e?e:+e;e=e.replace(r,"");var n=s.test(e);return n||i.test(e)?a(e.slice(2),n?2:8):o.test(e)?NaN:+e}e.exports=function(r,n,e){var o,s,i,a,l,c,u=0,p=!1,h=!1,t=!0;if("function"!=typeof r)throw new TypeError("Expected a function");function d(e){var t=o,n=s;return o=s=void 0,u=e,a=r.apply(n,t)}function f(e){var t=e-c;return void 0===c||n<=t||t<0||h&&i<=e-u}function m(){var e,t=v();if(f(t))return g(t);l=setTimeout(m,(e=n-((t=t)-c),h?E(e,i-(t-u)):e))}function g(e){return l=void 0,t&&o?d(e):(o=s=void 0,a)}function y(){var e=v(),t=f(e);if(o=arguments,s=this,c=e,t){if(void 0===l)return u=e=c,l=setTimeout(m,n),p?d(e):a;if(h)return l=setTimeout(m,n),d(c)}return void 0===l&&(l=setTimeout(m,n)),a}return n=S(n)||0,w(e)&&(p=!!e.leading,i=(h="maxWait"in e)?b(S(e.maxWait)||0,n):i,t="trailing"in e?!!e.trailing:t),y.cancel=function(){void 0!==l&&clearTimeout(l),o=c=s=l=void(u=0)},y.flush=function(){return void 0===l?a:g(v())},y}},18552:(e,t,n)=>{n=n(10852)(n(55639),"DataView");e.exports=n},1989:(e,t,n)=>{var r=n(51789),o=n(80401),s=n(57667),i=n(21327),n=n(81866);function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var r=n(3118),n=n(9435);function o(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}o.prototype=r(n.prototype),e.exports=o.prototype.constructor=o},38407:(e,t,n)=>{var r=n(27040),o=n(14125),s=n(82117),i=n(67518),n=n(54705);function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var r=n(3118),n=n(9435);function o(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}o.prototype=r(n.prototype),e.exports=o.prototype.constructor=o},57071:(e,t,n)=>{n=n(10852)(n(55639),"Map");e.exports=n},83369:(e,t,n)=>{var r=n(24785),o=n(11285),s=n(96e3),i=n(49916),n=n(95265);function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{n=n(10852)(n(55639),"Promise");e.exports=n},58525:(e,t,n)=>{n=n(10852)(n(55639),"Set");e.exports=n},88668:(e,t,n)=>{var r=n(83369),o=n(90619),n=n(72385);function s(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t{var r=n(38407),o=n(37465),s=n(63779),i=n(67599),a=n(44758),n=n(34309);function l(e){e=this.__data__=new r(e);this.size=e.size}l.prototype.clear=o,l.prototype.delete=s,l.prototype.get=i,l.prototype.has=a,l.prototype.set=n,e.exports=l},62705:(e,t,n)=>{n=n(55639).Symbol;e.exports=n},11149:(e,t,n)=>{n=n(55639).Uint8Array;e.exports=n},70577:(e,t,n)=>{n=n(10852)(n(55639),"WeakMap");e.exports=n},96874:e=>{e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},77412:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,s=[];++n{var r=n(42118);e.exports=function(e,t){return!(null==e||!e.length)&&-1{var u=n(22545),p=n(35694),h=n(1469),d=n(44144),f=n(65776),m=n(36719),g=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n,r=h(e),o=!r&&p(e),s=!r&&!o&&d(e),i=!r&&!o&&!s&&m(e),a=r||o||s||i,l=a?u(e.length,String):[],c=l.length;for(n in e)!t&&!g.call(e,n)||a&&("length"==n||s&&("offset"==n||"parent"==n)||i&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||f(n,c))||l.push(n);return l}},29932:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n{e.exports=function(e,t){for(var n=-1,r=t.length,o=e.length;++n{e.exports=function(e,t,n,r){var o=-1,s=null==e?0:e.length;for(r&&s&&(n=e[++o]);++o{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n{e.exports=function(e){return e.split("")}},49029:e=>{var t=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;e.exports=function(e){return e.match(t)||[]}},86556:(e,t,n)=>{var r=n(89465),o=n(77813);e.exports=function(e,t,n){(void 0===n||o(e[t],n))&&(void 0!==n||t in e)||r(e,t,n)}},34865:(e,t,n)=>{var o=n(89465),s=n(77813),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var r=e[t];i.call(e,t)&&s(r,n)&&(void 0!==n||t in e)||o(e,t,n)}},18470:(e,t,n)=>{var r=n(77813);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},44037:(e,t,n)=>{var r=n(98363),o=n(3674);e.exports=function(e,t){return e&&r(t,o(t),e)}},63886:(e,t,n)=>{var r=n(98363),o=n(81704);e.exports=function(e,t){return e&&r(t,o(t),e)}},89465:(e,t,n)=>{var r=n(38777);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},85990:(e,t,n)=>{var f=n(46384),m=n(77412),g=n(34865),y=n(44037),v=n(63886),b=n(64626),E=n(278),w=n(18805),S=n(1911),x=n(58234),_=n(46904),k=n(64160),O=n(43824),A=n(29148),C=n(38517),j=n(1469),P=n(44144),N=n(56688),I=n(13218),T=n(72928),R=n(3674),M=n(81704),D="[object Arguments]",L="[object Function]",F="[object Object]",B={};B[D]=B["[object Array]"]=B["[object ArrayBuffer]"]=B["[object DataView]"]=B["[object Boolean]"]=B["[object Date]"]=B["[object Float32Array]"]=B["[object Float64Array]"]=B["[object Int8Array]"]=B["[object Int16Array]"]=B["[object Int32Array]"]=B["[object Map]"]=B["[object Number]"]=B[F]=B["[object RegExp]"]=B["[object Set]"]=B["[object String]"]=B["[object Symbol]"]=B["[object Uint8Array]"]=B["[object Uint8ClampedArray]"]=B["[object Uint16Array]"]=B["[object Uint32Array]"]=!0,B["[object Error]"]=B[L]=B["[object WeakMap]"]=!1,e.exports=function n(r,o,s,e,t,i){var a,l=1&o,c=2&o,u=4&o;if(void 0!==(a=s?t?s(r,e,t,i):s(r):a))return a;if(!I(r))return r;e=j(r);if(e){if(a=O(r),!l)return E(r,a)}else{var p=k(r),h=p==L||"[object GeneratorFunction]"==p;if(P(r))return b(r,l);if(p==F||p==D||h&&!t){if(a=c||h?{}:C(r),!l)return c?S(r,v(a,r)):w(r,y(a,r))}else{if(!B[p])return t?r:{};a=A(r,p,l)}}h=(i=i||new f).get(r);if(h)return h;i.set(r,a),T(r)?r.forEach(function(e){a.add(n(e,o,s,e,r,i))}):N(r)&&r.forEach(function(e,t){a.set(t,n(e,o,s,t,r,i))});var d=e?void 0:(u?c?_:x:c?M:R)(r);return m(d||r,function(e,t){d&&(e=r[t=e]),g(a,t,n(e,o,s,t,r,i))}),a}},3118:(e,t,n)=>{var r=n(13218),o=Object.create;function s(){}e.exports=function(e){if(!r(e))return{};if(o)return o(e);s.prototype=e;e=new s;return s.prototype=void 0,e}},89881:(e,t,n)=>{var r=n(47816),n=n(99291)(r);e.exports=n},41848:e=>{e.exports=function(e,t,n,r){for(var o=e.length,s=n+(r?1:-1);r?s--:++s{var c=n(62488),u=n(37285);e.exports=function e(t,n,r,o,s){var i=-1,a=t.length;for(r=r||u,s=s||[];++i{n=n(25063)();e.exports=n},47816:(e,t,n)=>{var r=n(28483),o=n(3674);e.exports=function(e,t){return e&&r(e,t,o)}},97786:(e,t,n)=>{var o=n(71811),s=n(40327);e.exports=function(e,t){for(var n=0,r=(t=o(t,e)).length;null!=e&&n{var r=n(62488),o=n(1469);e.exports=function(e,t,n){t=t(e);return o(e)?t:r(t,n(e))}},44239:(e,t,n)=>{var r=n(62705),o=n(89607),s=n(2333),i=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":(i&&i in Object(e)?o:s)(e)}},13:e=>{e.exports=function(e,t){return null!=e&&t in Object(e)}},42118:(e,t,n)=>{var r=n(41848),o=n(62722),s=n(42351);e.exports=function(e,t,n){return t==t?s(e,t,n):r(e,o,n)}},9454:(e,t,n)=>{var r=n(44239),o=n(37005);e.exports=function(e){return o(e)&&"[object Arguments]"==r(e)}},90939:(e,t,n)=>{var i=n(2492),a=n(37005);e.exports=function e(t,n,r,o,s){return t===n||(null==t||null==n||!a(t)&&!a(n)?t!=t&&n!=n:i(t,n,r,o,e,s))}},2492:(e,t,n)=>{var p=n(46384),h=n(67114),d=n(18351),f=n(16096),m=n(64160),g=n(1469),y=n(44144),v=n(36719),b="[object Arguments]",E="[object Array]",w="[object Object]",S=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,r,o,s){var i=g(e),a=g(t),l=i?E:m(e),a=a?E:m(t),c=(l=l==b?w:l)==w,u=(a=a==b?w:a)==w,a=l==a;if(a&&y(e)){if(!y(t))return!1;c=!(i=!0)}if(a&&!c)return s=s||new p,i||v(e)?h(e,t,n,r,o,s):d(e,t,l,n,r,o,s);if(!(1&n)){i=c&&S.call(e,"__wrapped__"),l=u&&S.call(t,"__wrapped__");if(i||l)return o(i?e.value():e,l?t.value():t,n,r,s=s||new p)}return!!a&&(s=s||new p,f(e,t,n,r,o,s))}},25588:(e,t,n)=>{var r=n(64160),o=n(37005);e.exports=function(e){return o(e)&&"[object Map]"==r(e)}},2958:(e,t,n)=>{var d=n(46384),f=n(90939);e.exports=function(e,t,n,r){var o=n.length,s=o,i=!r;if(null==e)return!s;for(e=Object(e);o--;){var a=n[o];if(i&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++o{e.exports=function(e){return e!=e}},28458:(e,t,n)=>{var r=n(23560),o=n(15346),s=n(13218),i=n(80346),a=/^\[object .+?Constructor\]$/,n=Function.prototype,l=Object.prototype,n=n.toString,l=l.hasOwnProperty,c=RegExp("^"+n.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!s(e)||o(e))&&(r(e)?c:a).test(i(e))}},29221:(e,t,n)=>{var r=n(64160),o=n(37005);e.exports=function(e){return o(e)&&"[object Set]"==r(e)}},38749:(e,t,n)=>{var r=n(44239),o=n(41780),s=n(37005),i={};i["[object Float32Array]"]=i["[object Float64Array]"]=i["[object Int8Array]"]=i["[object Int16Array]"]=i["[object Int32Array]"]=i["[object Uint8Array]"]=i["[object Uint8ClampedArray]"]=i["[object Uint16Array]"]=i["[object Uint32Array]"]=!0,i["[object Arguments]"]=i["[object Array]"]=i["[object ArrayBuffer]"]=i["[object Boolean]"]=i["[object DataView]"]=i["[object Date]"]=i["[object Error]"]=i["[object Function]"]=i["[object Map]"]=i["[object Number]"]=i["[object Object]"]=i["[object RegExp]"]=i["[object Set]"]=i["[object String]"]=i["[object WeakMap]"]=!1,e.exports=function(e){return s(e)&&o(e.length)&&!!i[r(e)]}},67206:(e,t,n)=>{var r=n(91573),o=n(16432),s=n(6557),i=n(1469),a=n(39601);e.exports=function(e){return"function"==typeof e?e:null==e?s:"object"==typeof e?i(e)?o(e[0],e[1]):r(e):a(e)}},280:(e,t,n)=>{var r=n(25726),o=n(86916),s=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return o(e);var t,n=[];for(t in Object(e))s.call(e,t)&&"constructor"!=t&&n.push(t);return n}},10313:(e,t,n)=>{var o=n(13218),s=n(25726),i=n(33498),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!o(e))return i(e);var t,n=s(e),r=[];for(t in e)("constructor"!=t||!n&&a.call(e,t))&&r.push(t);return r}},9435:e=>{e.exports=function(){}},91573:(e,t,n)=>{var r=n(2958),o=n(1499),s=n(42634);e.exports=function(t){var n=o(t);return 1==n.length&&n[0][2]?s(n[0][0],n[0][1]):function(e){return e===t||r(e,t,n)}}},16432:(e,t,n)=>{var o=n(90939),s=n(27361),i=n(79095),a=n(15403),l=n(89162),c=n(42634),u=n(40327);e.exports=function(n,r){return a(n)&&l(r)?c(u(n),r):function(e){var t=s(e,n);return void 0===t&&t===r?i(e,n):o(r,t,3)}}},42980:(e,t,n)=>{var c=n(46384),u=n(86556),p=n(28483),h=n(59783),d=n(13218),f=n(81704),m=n(36390);e.exports=function r(o,s,i,a,l){o!==s&&p(s,function(e,t){var n;l=l||new c,d(e)?h(o,s,t,i,r,a,l):(n=a?a(m(o,t),e,t+"",o,s,l):void 0,u(o,t,n=void 0===n?e:n))},f)}},59783:(e,t,n)=>{var d=n(86556),f=n(64626),m=n(77133),g=n(278),y=n(38517),v=n(35694),b=n(1469),E=n(29246),w=n(44144),S=n(23560),x=n(13218),_=n(68630),k=n(36719),O=n(36390),A=n(59881);e.exports=function(e,t,n,r,o,s,i){var a,l,c,u=O(e,n),p=O(t,n),h=i.get(p);h?d(e,n,h):((t=void 0===(h=s?s(u,p,n+"",e,t,i):void 0))&&(l=!(a=b(p))&&w(p),c=!a&&!l&&k(p),h=p,a||l||c?h=b(u)?u:E(u)?g(u):l?f(p,!(t=!1)):c?m(p,!(t=!1)):[]:_(p)||v(p)?v(h=u)?h=A(u):x(u)&&!S(u)||(h=y(p)):t=!1),t&&(i.set(p,h),o(h,p,r,s,i),i.delete(p)),d(e,n,h))}},40371:e=>{e.exports=function(t){return function(e){return null==e?void 0:e[t]}}},79152:(e,t,n)=>{var r=n(97786);e.exports=function(t){return function(e){return r(e,t)}}},18674:e=>{e.exports=function(t){return function(e){return null==t?void 0:t[e]}}},10107:e=>{e.exports=function(e,r,o,s,t){return t(e,function(e,t,n){o=s?(s=!1,e):r(o,e,t,n)}),o}},5976:(e,t,n)=>{var r=n(6557),o=n(45357),s=n(30061);e.exports=function(e,t){return s(o(e,t,r),e+"")}},10611:(e,t,n)=>{var p=n(34865),h=n(71811),d=n(65776),f=n(13218),m=n(40327);e.exports=function(e,t,n,r){if(!f(e))return e;for(var o=-1,s=(t=h(t,e)).length,i=s-1,a=e;null!=a&&++o{var r=n(6557),o=n(89250);e.exports=o?function(e,t){return o.set(e,t),e}:r},56560:(e,t,n)=>{var r=n(75703),o=n(38777),n=n(6557);e.exports=o?function(e,t){return o(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:n},14259:e=>{e.exports=function(e,t,n){var r=-1,o=e.length;(n=o>>0,t>>>=0;for(var s=Array(o);++r{var s=n(89881);e.exports=function(e,r){var o;return s(e,function(e,t,n){return!(o=r(e,t,n))}),!!o}},22545:e=>{e.exports=function(e,t){for(var n=-1,r=Array(e);++n{var r=n(62705),o=n(29932),s=n(1469),i=n(33448),n=r?r.prototype:void 0,a=n?n.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(s(t))return o(t,e)+"";if(i(t))return a?a.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},27561:(e,t,n)=>{var r=n(67990),o=/^\s+/;e.exports=function(e){return e&&e.slice(0,r(e)+1).replace(o,"")}},7518:e=>{e.exports=function(t){return function(e){return t(e)}}},57406:(e,t,n)=>{var r=n(71811),o=n(10928),s=n(40292),i=n(40327);e.exports=function(e,t){return t=r(t,e),null==(e=s(e,t))||delete e[i(o(t))]}},1757:e=>{e.exports=function(e,t,n){for(var r=-1,o=e.length,s=t.length,i={};++r{e.exports=function(e,t){return e.has(t)}},71811:(e,t,n)=>{var r=n(1469),o=n(15403),s=n(55514),i=n(79833);e.exports=function(e,t){return r(e)?e:o(e,t)?[e]:s(i(e))}},40180:(e,t,n)=>{var o=n(14259);e.exports=function(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&r<=n?e:o(e,t,n)}},74318:(e,t,n)=>{var r=n(11149);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},64626:(e,t,n)=>{e=n.nmd(e);var n=n(55639),t=t&&!t.nodeType&&t,r=t&&e&&!e.nodeType&&e,r=r&&r.exports===t?n.Buffer:void 0,o=r?r.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();t=e.length,t=o?o(t):new e.constructor(t);return e.copy(t),t}},57157:(e,t,n)=>{var r=n(74318);e.exports=function(e,t){t=t?r(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.byteLength)}},93147:e=>{var n=/\w*$/;e.exports=function(e){var t=new e.constructor(e.source,n.exec(e));return t.lastIndex=e.lastIndex,t}},40419:(e,t,n)=>{var n=n(62705),n=n?n.prototype:void 0,r=n?n.valueOf:void 0;e.exports=function(e){return r?Object(r.call(e)):{}}},77133:(e,t,n)=>{var r=n(74318);e.exports=function(e,t){t=t?r(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}},52157:e=>{var h=Math.max;e.exports=function(e,t,n,r){for(var o=-1,s=e.length,i=n.length,a=-1,l=t.length,c=h(s-i,0),u=Array(l+c),p=!r;++a{var f=Math.max;e.exports=function(e,t,n,r){for(var o=-1,s=e.length,i=-1,a=n.length,l=-1,c=t.length,u=f(s-a,0),p=Array(u+c),h=!r;++o{e.exports=function(e,t){var n=-1,r=e.length;for(t=t||Array(r);++n{var c=n(34865),u=n(89465);e.exports=function(e,t,n,r){var o=!n;n=n||{};for(var s=-1,i=t.length;++s{var r=n(98363),o=n(99551);e.exports=function(e,t){return r(e,o(e),t)}},1911:(e,t,n)=>{var r=n(98363),o=n(51442);e.exports=function(e,t){return r(e,o(e),t)}},14429:(e,t,n)=>{n=n(55639)["__core-js_shared__"];e.exports=n},97991:e=>{e.exports=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}},21463:(e,t,n)=>{var r=n(5976),l=n(16612);e.exports=function(a){return r(function(e,t){var n=-1,r=t.length,o=1{var a=n(98612);e.exports=function(s,i){return function(e,t){if(null==e)return e;if(!a(e))return s(e,t);for(var n=e.length,r=i?n:-1,o=Object(e);(i?r--:++r{e.exports=function(l){return function(e,t,n){for(var r=-1,o=Object(e),s=n(e),i=s.length;i--;){var a=s[l?i:++r];if(!1===t(o[a],a,o))break}return e}}},22402:(e,t,n)=>{var s=n(71774),i=n(55639);e.exports=function(t,e,n){var r=1&e,o=s(t);return function e(){return(this&&this!==i&&this instanceof e?o:t).apply(r?n:this,arguments)}}},98805:(e,t,n)=>{var o=n(40180),s=n(62689),i=n(83140),a=n(79833);e.exports=function(r){return function(e){e=a(e);var t=s(e)?i(e):void 0,n=t?t[0]:e.charAt(0),t=t?o(t,1).join(""):e.slice(1);return n[r]()+t}}},35393:(e,t,n)=>{var r=n(62663),o=n(53816),s=n(58748),i=RegExp("['’]","g");e.exports=function(t){return function(e){return r(s(o(e).replace(i,"")),t,"")}}},71774:(e,t,n)=>{var o=n(3118),s=n(13218);e.exports=function(r){return function(){var e=arguments;switch(e.length){case 0:return new r;case 1:return new r(e[0]);case 2:return new r(e[0],e[1]);case 3:return new r(e[0],e[1],e[2]);case 4:return new r(e[0],e[1],e[2],e[3]);case 5:return new r(e[0],e[1],e[2],e[3],e[4]);case 6:return new r(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new r(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var t=o(r.prototype),n=r.apply(t,e);return s(n)?n:t}}},46347:(e,t,n)=>{var c=n(96874),r=n(71774),u=n(86935),p=n(94487),h=n(20893),d=n(46460),f=n(55639);e.exports=function(s,i,a){var l=r(s);return function e(){for(var t=arguments.length,n=Array(t),r=t,o=h(e);r--;)n[r]=arguments[r];o=t<3&&n[0]!==o&&n[t-1]!==o?[]:d(n,o);return(t-=o.length){var i=n(67206),a=n(98612),l=n(3674);e.exports=function(s){return function(e,t,n){var r,o=Object(e),t=(a(e)||(r=i(t,3),e=l(e),t=function(e){return r(o[e],e,o)}),s(e,t,n));return-1{var x=n(52157),_=n(14054),k=n(97991),O=n(71774),A=n(94487),C=n(20893),j=n(90451),P=n(46460),N=n(55639);e.exports=function i(a,l,c,u,p,h,d,f,m,g){var y=128&l,v=1&l,b=2&l,E=24&l,w=512&l,S=b?void 0:O(a);return function e(){for(var t=arguments.length,n=Array(t),r=t;r--;)n[r]=arguments[r];if(E&&(o=C(e),s=k(n,o)),u&&(n=x(n,u,p,E)),h&&(n=_(n,h,d,E)),t-=s,E&&t{var h=n(96874),r=n(71774),d=n(55639);e.exports=function(a,e,l,c){var u=1&e,p=r(a);return function e(){for(var t=-1,n=arguments.length,r=-1,o=c.length,s=Array(o+n),i=this&&this!==d&&this instanceof e?p:a;++r{var p=n(86528),h=n(258),d=n(69255);e.exports=function(e,t,n,r,o,s,i,a,l,c){var u=8&t,o=(4&(t=(t|(u?32:64))&~(u?64:32))||(t&=-4),[e,t,o,u?s:void 0,u?i:void 0,u?void 0:s,u?void 0:i,a,l,c]),s=n.apply(void 0,o);return p(e)&&h(s,o),s.placeholder=r,d(s,e,t)}},97727:(e,t,n)=>{var d=n(28045),f=n(22402),m=n(46347),g=n(86935),y=n(84375),v=n(66833),b=n(63833),E=n(258),w=n(69255),S=n(40554),x=Math.max;e.exports=function(e,t,n,r,o,s,i,a){var l=2&t;if(!l&&"function"!=typeof e)throw new TypeError("Expected a function");var c,u=r?r.length:0,p=(u||(t&=-97,r=o=void 0),i=void 0===i?i:x(S(i),0),a=void 0===a?a:S(a),u-=o?o.length:0,64&t&&(h=r,c=o,r=o=void 0),l?void 0:v(e)),h=[e,t,n,r,o,h,c,s,i,a];return p&&b(h,p),e=h[0],t=h[1],n=h[2],r=h[3],o=h[4],!(a=h[9]=void 0===h[9]?l?0:e.length:x(h[9]-u,0))&&24&t&&(t&=-25),c=t&&1!=t?8==t||16==t?m(e,t,a):32!=t&&33!=t||o.length?g.apply(void 0,h):y(e,t,n,r):f(e,t,n),w((p?d:E)(c,h),e,t)}},60696:(e,t,n)=>{var r=n(68630);e.exports=function(e){return r(e)?void 0:e}},69389:(e,t,n)=>{n=n(18674)({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"});e.exports=n},38777:(e,t,n)=>{var r=n(10852),n=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=n},67114:(e,t,n)=>{var g=n(88668),y=n(82908),v=n(74757);e.exports=function(e,t,n,r,o,s){var i=1&n,a=e.length,l=t.length;if(a!=l&&!(i&&a{var r=n(62705),c=n(11149),u=n(77813),p=n(67114),h=n(68776),d=n(21814),n=r?r.prototype:void 0,f=n?n.valueOf:void 0;e.exports=function(e,t,n,r,o,s,i){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!s(new c(e),new c(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return u(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=h;case"[object Set]":a=a||d;if(e.size!=t.size&&!(1&r))return!1;var l=i.get(e);if(l)return l==t;r|=2,i.set(e,t);l=p(a(e),a(t),r,o,s,i);return i.delete(e),l;case"[object Symbol]":if(f)return f.call(e)==f.call(t)}return!1}},16096:(e,t,n)=>{var v=n(58234),b=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,r,o,s){var i=1&n,a=v(e),l=a.length;if(l!=v(t).length&&!i)return!1;for(var c=l;c--;){var u=a[c];if(!(i?u in t:b.call(t,u)))return!1}var p=s.get(e),h=s.get(t);if(p&&h)return p==t&&h==e;var d=!0;s.set(e,t),s.set(t,e);for(var f=i;++c{var r=n(85564),o=n(45357),s=n(30061);e.exports=function(e){return s(o(e,void 0,r),e+"")}},31957:(e,t,n)=>{n="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=n},58234:(e,t,n)=>{var r=n(68866),o=n(99551),s=n(3674);e.exports=function(e){return r(e,s,o)}},46904:(e,t,n)=>{var r=n(68866),o=n(51442),s=n(81704);e.exports=function(e){return r(e,s,o)}},66833:(e,t,n)=>{var r=n(89250),n=n(50308);e.exports=r?function(e){return r.get(e)}:n},97658:(e,t,n)=>{var i=n(52060),a=Object.prototype.hasOwnProperty;e.exports=function(e){for(var t=e.name+"",n=i[t],r=a.call(i,t)?n.length:0;r--;){var o=n[r],s=o.func;if(null==s||s==e)return o.name}return t}},20893:e=>{e.exports=function(e){return e.placeholder}},45050:(e,t,n)=>{var r=n(37019);e.exports=function(e,t){e=e.__data__;return r(t)?e["string"==typeof t?"string":"hash"]:e.map}},1499:(e,t,n)=>{var s=n(89162),i=n(3674);e.exports=function(e){for(var t=i(e),n=t.length;n--;){var r=t[n],o=e[r];t[n]=[r,o,s(o)]}return t}},10852:(e,t,n)=>{var r=n(28458),o=n(47801);e.exports=function(e,t){e=o(e,t);return r(e)?e:void 0}},85924:(e,t,n)=>{n=n(5569)(Object.getPrototypeOf,Object);e.exports=n},89607:(e,t,n)=>{var n=n(62705),r=Object.prototype,s=r.hasOwnProperty,i=r.toString,a=n?n.toStringTag:void 0;e.exports=function(e){var t=s.call(e,a),n=e[a];try{var r=!(e[a]=void 0)}catch(e){}var o=i.call(e);return r&&(t?e[a]=n:delete e[a]),o}},99551:(e,t,n)=>{var r=n(34963),n=n(70479),o=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols;e.exports=s?function(t){return null==t?[]:(t=Object(t),r(s(t),function(e){return o.call(t,e)}))}:n},51442:(e,t,n)=>{var r=n(62488),o=n(85924),s=n(99551),n=n(70479),n=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,s(e)),e=o(e);return t}:n;e.exports=n},64160:(e,t,n)=>{var r=n(18552),o=n(57071),s=n(53818),i=n(58525),a=n(70577),l=n(44239),c=n(80346),u="[object Map]",p="[object Promise]",h="[object Set]",d="[object WeakMap]",f="[object DataView]",m=c(r),g=c(o),y=c(s),v=c(i),b=c(a),n=l;(r&&n(new r(new ArrayBuffer(1)))!=f||o&&n(new o)!=u||s&&n(s.resolve())!=p||i&&n(new i)!=h||a&&n(new a)!=d)&&(n=function(e){var t=l(e),e="[object Object]"==t?e.constructor:void 0,e=e?c(e):"";if(e)switch(e){case m:return f;case g:return u;case y:return p;case v:return h;case b:return d}return t}),e.exports=n},47801:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},58775:e=>{var t=/\{\n\/\* \[wrapped with (.+)\] \*/,n=/,? & /;e.exports=function(e){e=e.match(t);return e?e[1].split(n):[]}},222:(e,t,n)=>{var a=n(71811),l=n(35694),c=n(1469),u=n(65776),p=n(41780),h=n(40327);e.exports=function(e,t,n){for(var r=-1,o=(t=a(t,e)).length,s=!1;++r{var t=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");e.exports=function(e){return t.test(e)}},93157:e=>{var t=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;e.exports=function(e){return t.test(e)}},51789:(e,t,n)=>{var r=n(94536);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},80401:e=>{e.exports=function(e){e=this.has(e)&&delete this.__data__[e];return this.size-=e?1:0,e}},57667:(e,t,n)=>{var r=n(94536),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t,n=this.__data__;return r?"__lodash_hash_undefined__"===(t=n[e])?void 0:t:o.call(n,e)?n[e]:void 0}},21327:(e,t,n)=>{var r=n(94536),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:o.call(t,e)}},81866:(e,t,n)=>{var r=n(94536);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},43824:e=>{var r=Object.prototype.hasOwnProperty;e.exports=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&r.call(e,"index")&&(n.index=e.index,n.input=e.input),n}},29148:(e,t,n)=>{var o=n(74318),s=n(57157),i=n(93147),a=n(40419),l=n(77133);e.exports=function(e,t,n){var r=e.constructor;switch(t){case"[object ArrayBuffer]":return o(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return s(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return l(e,n);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return i(e);case"[object Symbol]":return a(e)}}},38517:(e,t,n)=>{var r=n(3118),o=n(85924),s=n(25726);e.exports=function(e){return"function"!=typeof e.constructor||s(e)?{}:r(o(e))}},83112:e=>{var o=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;e.exports=function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(1{var r=n(62705),o=n(35694),s=n(1469),i=r?r.isConcatSpreadable:void 0;e.exports=function(e){return s(e)||o(e)||!!(i&&e&&e[i])}},65776:e=>{var r=/^(?:0|[1-9]\d*)$/;e.exports=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&r.test(e))&&-1{var o=n(77813),s=n(98612),i=n(65776),a=n(13218);e.exports=function(e,t,n){if(!a(n))return!1;var r=typeof t;return!!("number"==r?s(n)&&i(t,n.length):"string"==r&&t in n)&&o(n[t],e)}},15403:(e,t,n)=>{var r=n(1469),o=n(33448),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!o(e))||i.test(e)||!s.test(e)||null!=t&&e in Object(t)}},37019:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},86528:(e,t,n)=>{var r=n(96425),o=n(66833),s=n(97658),i=n(8111);e.exports=function(e){var t=s(e),n=i[t];if("function"!=typeof n||!(t in r.prototype))return!1;if(e===n)return!0;t=o(n);return!!t&&e===t[0]}},15346:(e,t,n)=>{var n=n(14429),r=(n=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!r&&r in e}},25726:e=>{var n=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}},89162:(e,t,n)=>{var r=n(13218);e.exports=function(e){return e==e&&!r(e)}},27040:e=>{e.exports=function(){this.__data__=[],this.size=0}},14125:(e,t,n)=>{var r=n(18470),o=Array.prototype.splice;e.exports=function(e){var t=this.__data__,e=r(t,e);return!(e<0||(e==t.length-1?t.pop():o.call(t,e,1),--this.size,0))}},82117:(e,t,n)=>{var r=n(18470);e.exports=function(e){var t=this.__data__,e=r(t,e);return e<0?void 0:t[e][1]}},67518:(e,t,n)=>{var r=n(18470);e.exports=function(e){return-1{var o=n(18470);e.exports=function(e,t){var n=this.__data__,r=o(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}},24785:(e,t,n)=>{var r=n(1989),o=n(38407),s=n(57071);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(s||o),string:new r}}},11285:(e,t,n)=>{var r=n(45050);e.exports=function(e){e=r(this,e).delete(e);return this.size-=e?1:0,e}},96e3:(e,t,n)=>{var r=n(45050);e.exports=function(e){return r(this,e).get(e)}},49916:(e,t,n)=>{var r=n(45050);e.exports=function(e){return r(this,e).has(e)}},95265:(e,t,n)=>{var o=n(45050);e.exports=function(e,t){var n=o(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}},68776:e=>{e.exports=function(e){var n=-1,r=Array(e.size);return e.forEach(function(e,t){r[++n]=[t,e]}),r}},42634:e=>{e.exports=function(t,n){return function(e){return null!=e&&e[t]===n&&(void 0!==n||t in Object(e))}}},24523:(e,t,n)=>{var r=n(88306);e.exports=function(e){var e=r(e,function(e){return 500===t.size&&t.clear(),e}),t=e.cache;return e}},63833:(e,t,n)=>{var a=n(52157),l=n(14054),c=n(46460),u="__lodash_placeholder__",p=Math.min;e.exports=function(e,t){var n=e[1],r=t[1],o=n|r,s=128==r&&8==n||128==r&&256==n&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!(o<131)&&!s)return e;1&r&&(e[2]=t[2],o|=1&n?0:4);var i,s=t[3];return s&&(i=e[3],e[3]=i?a(i,s,t[4]):s,e[4]=i?c(e[3],u):t[4]),(s=t[5])&&(i=e[5],e[5]=i?l(i,s,t[6]):s,e[6]=i?c(e[5],u):t[6]),(s=t[7])&&(e[7]=s),128&r&&(e[8]=null==e[8]?t[8]:p(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o,e}},89250:(e,t,n)=>{n=n(70577),n=n&&new n;e.exports=n},94536:(e,t,n)=>{n=n(10852)(Object,"create");e.exports=n},86916:(e,t,n)=>{n=n(5569)(Object.keys,Object);e.exports=n},33498:e=>{e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},31167:(e,t,n)=>{e=n.nmd(e);var n=n(31957),t=t&&!t.nodeType&&t,r=t&&e&&!e.nodeType&&e,o=r&&r.exports===t&&n.process,t=function(){try{return r&&r.require&&r.require("util").types||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=t},2333:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},5569:e=>{e.exports=function(t,n){return function(e){return t(n(e))}}},45357:(e,t,n)=>{var l=n(96874),c=Math.max;e.exports=function(s,i,a){return i=c(void 0===i?s.length-1:i,0),function(){for(var e=arguments,t=-1,n=c(e.length-i,0),r=Array(n);++t{var r=n(97786),o=n(14259);e.exports=function(e,t){return t.length<2?e:r(e,o(t,0,-1))}},52060:e=>{e.exports={}},90451:(e,t,n)=>{var i=n(278),a=n(65776),l=Math.min;e.exports=function(e,t){for(var n=e.length,r=l(t.length,n),o=i(e);r--;){var s=t[r];e[r]=a(s,n)?o[s]:void 0}return e}},46460:e=>{var a="__lodash_placeholder__";e.exports=function(e,t){for(var n=-1,r=e.length,o=0,s=[];++n{var n=n(31957),r="object"==typeof self&&self&&self.Object===Object&&self,n=n||r||Function("return this")();e.exports=n},36390:e=>{e.exports=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}},90619:e=>{e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},72385:e=>{e.exports=function(e){return this.__data__.has(e)}},258:(e,t,n)=>{var r=n(28045),n=n(21275)(r);e.exports=n},21814:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}},30061:(e,t,n)=>{var r=n(56560),n=n(21275)(r);e.exports=n},69255:(e,t,n)=>{var r=n(58775),o=n(83112),s=n(30061),i=n(87241);e.exports=function(e,t,n){t+="";return s(e,o(t,i(r(t),n)))}},21275:e=>{var s=Date.now;e.exports=function(n){var r=0,o=0;return function(){var e=s(),t=16-(e-o);if(o=e,0{var r=n(38407);e.exports=function(){this.__data__=new r,this.size=0}},63779:e=>{e.exports=function(e){var t=this.__data__,e=t.delete(e);return this.size=t.size,e}},67599:e=>{e.exports=function(e){return this.__data__.get(e)}},44758:e=>{e.exports=function(e){return this.__data__.has(e)}},34309:(e,t,n)=>{var o=n(38407),s=n(57071),i=n(83369);e.exports=function(e,t){var n=this.__data__;if(n instanceof o){var r=n.__data__;if(!s||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(r)}return n.set(e,t),this.size=n.size,this}},42351:e=>{e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r{var r=n(44286),o=n(62689),s=n(676);e.exports=function(e){return(o(e)?s:r)(e)}},55514:(e,t,n)=>{var n=n(24523),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g,n=n(function(e){var o=[];return 46===e.charCodeAt(0)&&o.push(""),e.replace(r,function(e,t,n,r){o.push(n?r.replace(s,"$1"):t||e)}),o});e.exports=n},40327:(e,t,n)=>{var r=n(33448);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},80346:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},67990:e=>{var n=/\s/;e.exports=function(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}},676:e=>{var t="\\ud800-\\udfff",n="["+t+"]",r="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",o="\\ud83c[\\udffb-\\udfff]",t="[^"+t+"]",s="(?:\\ud83c[\\udde6-\\uddff]){2}",i="[\\ud800-\\udbff][\\udc00-\\udfff]",a="(?:"+r+"|"+o+")?",l="[\\ufe0e\\ufe0f]?",l=l+a+"(?:\\u200d(?:"+[t,s,i].join("|")+")"+l+a+")*",a="(?:"+[t+r+"?",r,s,i,n].join("|")+")",c=RegExp(o+"(?="+o+")|"+a+l,"g");e.exports=function(e){return e.match(c)||[]}},2757:e=>{var t="\\ud800-\\udfff",n="\\u2700-\\u27bf",r="a-z\\xdf-\\xf6\\xf8-\\xff",o="A-Z\\xc0-\\xd6\\xd8-\\xde",s="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",i="["+s+"]",a="["+n+"]",l="["+r+"]",s="[^"+t+s+"\\d+"+n+r+o+"]",n="(?:\\ud83c[\\udde6-\\uddff]){2}",r="[\\ud800-\\udbff][\\udc00-\\udfff]",o="["+o+"]",c="(?:"+l+"|"+s+")",s="(?:"+o+"|"+s+")",u="(?:['’](?:d|ll|m|re|s|t|ve))?",p="(?:['’](?:D|LL|M|RE|S|T|VE))?",h="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",d="[\\ufe0e\\ufe0f]?",t=d+h+"(?:\\u200d(?:"+["[^"+t+"]",n,r].join("|")+")"+d+h+")*",d="(?:"+[a,n,r].join("|")+")"+t,f=RegExp([o+"?"+l+"+"+u+"(?="+[i,o,"$"].join("|")+")",s+"+"+p+"(?="+[i,o+c,"$"].join("|")+")",o+"?"+c+"+"+u,o+"+"+p,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])","\\d+",d].join("|"),"g");e.exports=function(e){return e.match(f)||[]}},87241:(e,t,n)=>{var o=n(77412),s=n(47443),i=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];e.exports=function(n,r){return o(i,function(e){var t="_."+e[0];r&e[1]&&!s(n,t)&&n.push(t)}),n.sort()}},21913:(e,t,n)=>{var r=n(96425),o=n(7548),s=n(278);e.exports=function(e){if(e instanceof r)return e.clone();var t=new o(e.__wrapped__,e.__chain__);return t.__actions__=s(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}},39514:(e,t,n)=>{var r=n(97727);e.exports=function(e,t,n){return t=n?void 0:t,t=e&&null==t?e.length:t,r(e,128,void 0,void 0,void 0,void 0,t)}},68929:(e,t,n)=>{var r=n(48403),n=n(35393)(function(e,t,n){return t=t.toLowerCase(),e+(n?r(t):t)});e.exports=n},48403:(e,t,n)=>{var r=n(79833),o=n(11700);e.exports=function(e){return o(r(e).toLowerCase())}},66678:(e,t,n)=>{var r=n(85990);e.exports=function(e){return r(e,4)}},75703:e=>{e.exports=function(e){return function(){return e}}},40087:(e,t,n)=>{var r=n(97727);function o(e,t,n){e=r(e,8,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return e.placeholder=o.placeholder,e}o.placeholder={},e.exports=o},23279:(e,t,n)=>{var v=n(13218),b=n(7771),E=n(14841),w=Math.max,S=Math.min;e.exports=function(r,n,e){var o,s,i,a,l,c,u=0,p=!1,h=!1,t=!0;if("function"!=typeof r)throw new TypeError("Expected a function");function d(e){var t=o,n=s;return o=s=void 0,u=e,a=r.apply(n,t)}function f(e){var t=e-c;return void 0===c||n<=t||t<0||h&&i<=e-u}function m(){var e,t=b();if(f(t))return g(t);l=setTimeout(m,(e=n-((t=t)-c),h?S(e,i-(t-u)):e))}function g(e){return l=void 0,t&&o?d(e):(o=s=void 0,a)}function y(){var e=b(),t=f(e);if(o=arguments,s=this,c=e,t){if(void 0===l)return u=e=c,l=setTimeout(m,n),p?d(e):a;if(h)return clearTimeout(l),l=setTimeout(m,n),d(c)}return void 0===l&&(l=setTimeout(m,n)),a}return n=E(n)||0,v(e)&&(p=!!e.leading,i=(h="maxWait"in e)?w(E(e.maxWait)||0,n):i,t="trailing"in e?!!e.trailing:t),y.cancel=function(){void 0!==l&&clearTimeout(l),o=c=s=l=void(u=0)},y.flush=function(){return void 0===l?a:g(b())},y}},53816:(e,t,n)=>{var r=n(69389),o=n(79833),s=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,i=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");e.exports=function(e){return(e=o(e))&&e.replace(s,r).replace(i,"")}},77813:e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},13311:(e,t,n)=>{n=n(67740)(n(30998));e.exports=n},30998:(e,t,n)=>{var o=n(41848),s=n(67206),i=n(40554),a=Math.max;e.exports=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;n=null==n?0:i(n);return n<0&&(n=a(r+n,0)),o(e,s(t,3),n)}},85564:(e,t,n)=>{var r=n(21078);e.exports=function(e){return null!=e&&e.length?r(e,1):[]}},84599:(e,t,n)=>{var F=n(68836),B=n(69306),q=Array.prototype.push;function $(n,e){return 2==e?function(e,t){return n(e,t)}:function(e){return n(e)}}function z(e){for(var t=e?e.length:0,n=Array(t);t--;)n[t]=e[t];return n}function U(r,o){return function(){var e=arguments.length;if(e){for(var t=Array(e);e--;)t[e]=arguments[e];var n=t[0]=o.apply(void 0,t);return r.apply(void 0,t),n}}}e.exports=function a(n,e,t,l){var c="function"==typeof e,r=e===Object(e);if(r&&(l=t,t=e,e=void 0),null==t)throw new TypeError;var u={cap:!("cap"in(l=l||{}))||l.cap,curry:!("curry"in l)||l.curry,fixed:!("fixed"in l)||l.fixed,immutable:!("immutable"in l)||l.immutable,rearg:!("rearg"in l)||l.rearg},o=c?t:B,p="curry"in l&&l.curry,h="fixed"in l&&l.fixed,s="rearg"in l&&l.rearg,d=c?t.runInContext():void 0,f=c?t:{ary:n.ary,assign:n.assign,clone:n.clone,curry:n.curry,forEach:n.forEach,isArray:n.isArray,isError:n.isError,isFunction:n.isFunction,isWeakMap:n.isWeakMap,iteratee:n.iteratee,keys:n.keys,rearg:n.rearg,toInteger:n.toInteger,toPath:n.toPath},m=f.ary,g=f.assign,y=f.clone,v=f.curry,b=f.forEach,i=f.isArray,E=f.isError,w=f.isFunction,S=f.isWeakMap,x=f.keys,_=f.rearg,k=f.toInteger,O=f.toPath,A=x(F.aryMethod),C={castArray:function(t){return function(){var e=arguments[0];return i(e)?t(z(e)):t.apply(void 0,arguments)}},iteratee:function(r){return function(){var e=arguments[1],t=r(arguments[0],e),n=t.length;return u.cap&&"number"==typeof e?(e=2{s.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},s.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","rangeStep","rangeStepRight","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],4:["fill","setWith","updateWith"]},s.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},s.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},s.iterateeRearg={mapKeys:[1],reduceRight:[1,0]},s.methodRearg={assignInAllWith:[1,0],assignInWith:[1,2,0],assignAllWith:[1,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],rangeStep:[1,2,0],rangeStepRight:[1,2,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},s.methodSpread={assignAll:{start:0},assignAllWith:{start:0},assignInAll:{start:0},assignInAllWith:{start:0},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{start:0},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},s.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},s.realToAlias=function(){var e,t=Object.prototype.hasOwnProperty,n=s.aliasToReal,r={};for(e in n){var o=n[e];t.call(r,o)?r[o].push(e):r[o]=[e]}return r}(),s.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",rangeStep:"range",rangeStepRight:"rangeRight",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},s.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},s.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}},4269:(e,t,n)=>{e.exports={ary:n(39514),assign:n(44037),clone:n(66678),curry:n(40087),forEach:n(77412),isArray:n(1469),isError:n(64647),isFunction:n(23560),isWeakMap:n(81018),iteratee:n(72594),keys:n(280),rearg:n(4963),toInteger:n(40554),toPath:n(30084)}},72700:(e,t,n)=>{e.exports=n(28252)},92822:(e,t,n)=>{var r=n(84599),o=n(4269);e.exports=function(e,t,n){return r(o,e,t,n)}},69306:e=>{e.exports={}},28252:(e,t,n)=>{var r=n(92822)("set",n(36968));r.placeholder=n(69306),e.exports=r},27361:(e,t,n)=>{var r=n(97786);e.exports=function(e,t,n){e=null==e?void 0:r(e,t);return void 0===e?n:e}},79095:(e,t,n)=>{var r=n(13),o=n(222);e.exports=function(e,t){return null!=e&&o(e,t,r)}},6557:e=>{e.exports=function(e){return e}},35694:(e,t,n)=>{var r=n(9454),o=n(37005),n=Object.prototype,s=n.hasOwnProperty,i=n.propertyIsEnumerable,n=r(function(){return arguments}())?r:function(e){return o(e)&&s.call(e,"callee")&&!i.call(e,"callee")};e.exports=n},1469:e=>{var t=Array.isArray;e.exports=t},98612:(e,t,n)=>{var r=n(23560),o=n(41780);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},29246:(e,t,n)=>{var r=n(98612),o=n(37005);e.exports=function(e){return o(e)&&r(e)}},51584:(e,t,n)=>{var r=n(44239),o=n(37005);e.exports=function(e){return!0===e||!1===e||o(e)&&"[object Boolean]"==r(e)}},44144:(e,t,n)=>{e=n.nmd(e);var r=n(55639),n=n(95062),t=t&&!t.nodeType&&t,o=t&&e&&!e.nodeType&&e,o=o&&o.exports===t?r.Buffer:void 0,t=(o?o.isBuffer:void 0)||n;e.exports=t},41609:(e,t,n)=>{var r=n(280),o=n(64160),s=n(35694),i=n(1469),a=n(98612),l=n(44144),c=n(25726),u=n(36719),p=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(a(e)&&(i(e)||"string"==typeof e||"function"==typeof e.splice||l(e)||u(e)||s(e)))return!e.length;var t,n=o(e);if("[object Map]"==n||"[object Set]"==n)return!e.size;if(c(e))return!r(e).length;for(t in e)if(p.call(e,t))return!1;return!0}},18446:(e,t,n)=>{var r=n(90939);e.exports=function(e,t){return r(e,t)}},64647:(e,t,n)=>{var r=n(44239),o=n(37005),s=n(68630);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Error]"==t||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!s(e)}},23560:(e,t,n)=>{var r=n(44239),o=n(13218);e.exports=function(e){if(!o(e))return!1;e=r(e);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},41780:e=>{e.exports=function(e){return"number"==typeof e&&-1{var r=n(25588),o=n(7518),n=n(31167),n=n&&n.isMap,o=n?o(n):r;e.exports=o},45220:e=>{e.exports=function(e){return null===e}},81763:(e,t,n)=>{var r=n(44239),o=n(37005);e.exports=function(e){return"number"==typeof e||o(e)&&"[object Number]"==r(e)}},13218:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},37005:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},68630:(e,t,n)=>{var r=n(44239),o=n(85924),s=n(37005),n=Function.prototype,i=Object.prototype,a=n.toString,l=i.hasOwnProperty,c=a.call(Object);e.exports=function(e){if(!s(e)||"[object Object]"!=r(e))return!1;e=o(e);if(null===e)return!0;e=l.call(e,"constructor")&&e.constructor;return"function"==typeof e&&e instanceof e&&a.call(e)==c}},72928:(e,t,n)=>{var r=n(29221),o=n(7518),n=n(31167),n=n&&n.isSet,o=n?o(n):r;e.exports=o},47037:(e,t,n)=>{var r=n(44239),o=n(1469),s=n(37005);e.exports=function(e){return"string"==typeof e||!o(e)&&s(e)&&"[object String]"==r(e)}},33448:(e,t,n)=>{var r=n(44239),o=n(37005);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},36719:(e,t,n)=>{var r=n(38749),o=n(7518),n=n(31167),n=n&&n.isTypedArray,o=n?o(n):r;e.exports=o},81018:(e,t,n)=>{var r=n(64160),o=n(37005);e.exports=function(e){return o(e)&&"[object WeakMap]"==r(e)}},72594:(e,t,n)=>{var r=n(85990),o=n(67206);e.exports=function(e){return o("function"==typeof e?e:r(e,1))}},3674:(e,t,n)=>{var r=n(14636),o=n(280),s=n(98612);e.exports=function(e){return(s(e)?r:o)(e)}},81704:(e,t,n)=>{var r=n(14636),o=n(10313),s=n(98612);e.exports=function(e){return s(e)?r(e,!0):o(e)}},10928:e=>{e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},88306:(e,t,n)=>{var i=n(83369);function a(r,o){if("function"!=typeof r||null!=o&&"function"!=typeof o)throw new TypeError("Expected a function");function s(){var e=arguments,t=o?o.apply(this,e):e[0],n=s.cache;return n.has(t)?n.get(t):(e=r.apply(this,e),s.cache=n.set(t,e)||n,e)}return s.cache=new(a.Cache||i),s}a.Cache=i,e.exports=a},82492:(e,t,n)=>{var r=n(42980),n=n(21463)(function(e,t,n){r(e,t,n)});e.exports=n},94885:e=>{e.exports=function(t){if("function"!=typeof t)throw new TypeError("Expected a function");return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}},50308:e=>{e.exports=function(){}},7771:(e,t,n)=>{var r=n(55639);e.exports=function(){return r.Date.now()}},57557:(e,t,n)=>{var s=n(29932),i=n(85990),a=n(57406),l=n(71811),c=n(98363),u=n(60696),r=n(99021),p=n(46904),n=r(function(t,e){var n={};if(null==t)return n;var r=!1;e=s(e,function(e){return e=l(e,t),r=r||1{var r=n(40371),o=n(79152),s=n(15403),i=n(40327);e.exports=function(e){return s(e)?r(i(e)):o(e)}},4963:(e,t,n)=>{var r=n(97727),n=n(99021)(function(e,t){return r(e,256,void 0,void 0,void 0,t)});e.exports=n},54061:(e,t,n)=>{var s=n(62663),i=n(89881),a=n(67206),l=n(10107),c=n(1469);e.exports=function(e,t,n){var r=c(e)?s:l,o=arguments.length<3;return r(e,a(t,4),n,o,i)}},36968:(e,t,n)=>{var r=n(10611);e.exports=function(e,t,n){return null==e?e:r(e,t,n)}},59704:(e,t,n)=>{var o=n(82908),s=n(67206),i=n(5076),a=n(1469),l=n(16612);e.exports=function(e,t,n){var r=a(e)?o:i;return n&&l(e,t,n)&&(t=void 0),r(e,s(t,3))}},70479:e=>{e.exports=function(){return[]}},95062:e=>{e.exports=function(){return!1}},18601:(e,t,n)=>{var r=n(14841);e.exports=function(e){return e?(e=r(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},40554:(e,t,n)=>{var r=n(18601);e.exports=function(e){var e=r(e),t=e%1;return e==e?t?e-t:e:0}},7334:(e,t,n)=>{var r=n(79833);e.exports=function(e){return r(e).toLowerCase()}},14841:(e,t,n)=>{var r=n(27561),o=n(13218),s=n(33448),i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(s(e))return NaN;if(o(e)&&(t="function"==typeof e.valueOf?e.valueOf():e,e=o(t)?t+"":t),"string"!=typeof e)return 0===e?e:+e;e=r(e);var t=a.test(e);return t||l.test(e)?c(e.slice(2),t?2:8):i.test(e)?NaN:+e}},30084:(e,t,n)=>{var r=n(29932),o=n(278),s=n(1469),i=n(33448),a=n(55514),l=n(40327),c=n(79833);e.exports=function(e){return s(e)?r(e,l):i(e)?[e]:o(a(c(e)))}},59881:(e,t,n)=>{var r=n(98363),o=n(81704);e.exports=function(e){return r(e,o(e))}},79833:(e,t,n)=>{var r=n(80531);e.exports=function(e){return null==e?"":r(e)}},11700:(e,t,n)=>{n=n(98805)("toUpperCase");e.exports=n},58748:(e,t,n)=>{var r=n(49029),o=n(93157),s=n(79833),i=n(2757);e.exports=function(e,t,n){return e=s(e),void 0===(t=n?void 0:t)?(o(e)?i:r)(e):e.match(t)||[]}},8111:(e,t,n)=>{var r=n(96425),o=n(7548),s=n(9435),i=n(1469),a=n(37005),l=n(21913),c=Object.prototype.hasOwnProperty;function u(e){if(a(e)&&!i(e)&&!(e instanceof r)){if(e instanceof o)return e;if(c.call(e,"__wrapped__"))return l(e)}return new o(e)}u.prototype=s.prototype,e.exports=u.prototype.constructor=u},7287:(e,t,n)=>{var r=n(34865),o=n(1757);e.exports=function(e,t){return o(e||[],t||[],r)}},96470:(e,t,n)=>{"use strict";var u=n(47802),p=n(21102),o=(t.highlight=h,t.highlightAuto=function(e,t){var n,r,o,s,i=t||{},a=i.subset||u.listLanguages(),i=i.prefix,l=a.length,c=-1;if(null==i&&0,"string"!=typeof e)throw p("Expected `string` for value, got `%s`",e);for(r={relevance:0,language:null,value:[]},n={relevance:0,language:null,value:[]};++cr.relevance&&(r=o),o.relevance>n.relevance&&(r=n,n=o));return r.language&&(n.secondBest=r),n},t.registerLanguage=function(e,t){u.registerLanguage(e,t)},t.listLanguages=function(){return u.listLanguages()},t.registerAlias=function(e,t){var n,r=e;for(n in t&&((r={})[e]=t),r)u.registerAliases(r[n],{languageName:n})},s.prototype.addText=function(e){var t,n=this.stack;""!==e&&((t=(n=n[n.length-1]).children[n.children.length-1])&&"text"===t.type?t.value+=e:n.children.push({type:"text",value:e}))},s.prototype.addKeyword=function(e,t){this.openNode(t),this.addText(e),this.closeNode()},s.prototype.addSublanguage=function(e,t){var n=this.stack,n=n[n.length-1],e=e.rootNode.children;n.children=n.children.concat(t?{type:"element",tagName:"span",properties:{className:[t]},children:e}:e)},s.prototype.openNode=function(e){var t=this.stack,e={type:"element",tagName:"span",properties:{className:[this.options.classPrefix+e]},children:[]};t[t.length-1].children.push(e),t.push(e)},s.prototype.closeNode=function(){this.stack.pop()},s.prototype.closeAllNodes=r,s.prototype.finalize=r,s.prototype.toHTML=function(){return""},"hljs-");function h(e,t,n){var r=u.configure({}),n=(n||{}).prefix;if("string"!=typeof e)throw p("Expected `string` for name, got `%s`",e);if(!u.getLanguage(e))throw p("Unknown language: `%s` is not registered",e);if("string"!=typeof t)throw p("Expected `string` for value, got `%s`",t);if(u.configure({__emitter:s,classPrefix:n=null==n?o:n}),n=u.highlight(t,{language:e,ignoreIllegals:!0}),u.configure(r||{}),n.errorRaised)throw n.errorRaised;return{relevance:n.relevance,language:n.language,value:n.emitter.rootNode.children}}function s(e){this.options=e,this.rootNode={children:[]},this.stack=[this.rootNode]}function r(){}},42566:(e,t,n)=>{const r=n(94885);function o(t){return"string"==typeof t?e=>e.element===t:t.constructor&&t.extend?e=>e instanceof t:t}class s{constructor(e){this.elements=e||[]}toValue(){return this.elements.map(e=>e.toValue())}map(e,t){return this.elements.map(e,t)}flatMap(e,t){return this.map(e,t).reduce((e,t)=>e.concat(t),[])}compactMap(t,n){const r=[];return this.forEach(e=>{e=t.bind(n)(e);e&&r.push(e)}),r}filter(e,t){return e=o(e),new s(this.elements.filter(e,t))}reject(e,t){return e=o(e),new s(this.elements.filter(r(e),t))}find(e,t){return e=o(e),this.elements.find(e,t)}forEach(e,t){this.elements.forEach(e,t)}reduce(e,t){return this.elements.reduce(e,t)}includes(t){return this.elements.some(e=>e.equals(t))}shift(){return this.elements.shift()}unshift(e){this.elements.unshift(this.refract(e))}push(e){return this.elements.push(this.refract(e)),this}add(e){this.push(e)}get(e){return this.elements[e]}getValue(e){const t=this.elements[e];if(t)return t.toValue()}get length(){return this.elements.length}get isEmpty(){return 0===this.elements.length}get first(){return this.elements[0]}}"undefined"!=typeof Symbol&&(s.prototype[Symbol.iterator]=function(){return this.elements[Symbol.iterator]()}),e.exports=s},17645:e=>{e.exports=class t{constructor(e,t){this.key=e,this.value=t}clone(){const e=new t;return this.key&&(e.key=this.key.clone()),this.value&&(e.value=this.value.clone()),e}}},78520:(e,t,n)=>{const r=n(45220),o=n(47037),s=n(81763),i=n(51584),a=n(13218),l=n(28219),c=n(99829);class u{constructor(e){this.elementMap={},this.elementDetection=[],this.Element=c.Element,this.KeyValuePair=c.KeyValuePair,e&&e.noDefault||this.useDefault(),this._attributeElementKeys=[],this._attributeElementArrayKeys=[]}use(e){return e.namespace&&e.namespace({base:this}),e.load&&e.load({base:this}),this}useDefault(){return this.register("null",c.NullElement).register("string",c.StringElement).register("number",c.NumberElement).register("boolean",c.BooleanElement).register("array",c.ArrayElement).register("object",c.ObjectElement).register("member",c.MemberElement).register("ref",c.RefElement).register("link",c.LinkElement),this.detect(r,c.NullElement,!1).detect(o,c.StringElement,!1).detect(s,c.NumberElement,!1).detect(i,c.BooleanElement,!1).detect(Array.isArray,c.ArrayElement,!1).detect(a,c.ObjectElement,!1),this}register(e,t){return this._elements=void 0,this.elementMap[e]=t,this}unregister(e){return this._elements=void 0,delete this.elementMap[e],this}detect(e,t,n){return void 0===n||n?this.elementDetection.unshift([e,t]):this.elementDetection.push([e,t]),this}toElement(t){if(t instanceof this.Element)return t;let n;for(let e=0;e{var t=e[0].toUpperCase()+e.substr(1);this._elements[t]=this.elementMap[e]})),this._elements}get serialiser(){return new l(this)}}l.prototype.Namespace=u,e.exports=u},87526:(e,t,n)=>{const r=n(94885),o=n(42566);class s extends o{map(t,n){return this.elements.map(e=>t.bind(n)(e.value,e.key,e))}filter(t,n){return new s(this.elements.filter(e=>t.bind(n)(e.value,e.key,e)))}reject(e,t){return this.filter(r(e.bind(t)))}forEach(n,r){return this.elements.forEach((e,t)=>{n.bind(r)(e.value,e.key,e,t)})}keys(){return this.map((e,t)=>t.toValue())}values(){return this.map(e=>e.toValue())}}e.exports=s},99829:(e,t,n)=>{const r=n(3079),o=n(96295),s=n(16036),i=n(91090),a=n(18866),l=n(35804),c=n(5946),u=n(76735),p=n(59964),h=n(38588),d=n(42566),f=n(87526),m=n(17645);function g(e){return e instanceof r?e:"string"==typeof e?new s(e):"number"==typeof e?new i(e):"boolean"==typeof e?new a(e):null===e?new o:Array.isArray(e)?new l(e.map(g)):"object"==typeof e?new u(e):e}r.prototype.ObjectElement=u,r.prototype.RefElement=h,r.prototype.MemberElement=c,r.prototype.refract=g,d.prototype.refract=g,e.exports={Element:r,NullElement:o,StringElement:s,NumberElement:i,BooleanElement:a,ArrayElement:l,MemberElement:c,ObjectElement:u,LinkElement:p,RefElement:h,refract:g,ArraySlice:d,ObjectSlice:f,KeyValuePair:m}},59964:(e,t,n)=>{n=n(3079);e.exports=class extends n{constructor(e,t,n){super(e||[],t,n),this.element="link"}get relation(){return this.attributes.get("relation")}set relation(e){this.attributes.set("relation",e)}get href(){return this.attributes.get("href")}set href(e){this.attributes.set("href",e)}}},38588:(e,t,n)=>{n=n(3079);e.exports=class extends n{constructor(e,t,n){super(e||[],t,n),this.element="ref",this.path||(this.path="element")}get path(){return this.attributes.get("path")}set path(e){this.attributes.set("path",e)}}},43500:(e,t,n)=>{var r=n(78520),o=n(99829);t.lS=r,t.KeyValuePair=n(17645),t.O4=o.ArraySlice,t.rm=o.ObjectSlice,t.W_=o.Element,t.RP=o.StringElement,t.VL=o.NumberElement,t.hh=o.BooleanElement,t.zr=o.NullElement,t.ON=o.ArrayElement,t.Sb=o.ObjectElement,t.c6=o.MemberElement,t.tK=o.RefElement,t.EA=o.LinkElement,t.Qc=o.refract,n(28219),n(3414)},35804:(e,t,n)=>{const r=n(94885),o=n(3079),s=n(42566);class i extends o{constructor(e,t,n){super(e||[],t,n),this.element="array"}primitive(){return"array"}get(e){return this.content[e]}getValue(e){const t=this.get(e);if(t)return t.toValue()}getIndex(e){return this.content[e]}set(e,t){return this.content[e]=this.refract(t),this}remove(e){e=this.content.splice(e,1);return e.length?e[0]:null}map(e,t){return this.content.map(e,t)}flatMap(e,t){return this.map(e,t).reduce((e,t)=>e.concat(t),[])}compactMap(t,n){const r=[];return this.forEach(e=>{e=t.bind(n)(e);e&&r.push(e)}),r}filter(e,t){return new s(this.content.filter(e,t))}reject(e,t){return this.filter(r(e),t)}reduce(t,e){let n,r;r=void 0!==e?(n=0,this.refract(e)):(n=1,"object"===this.primitive()?this.first.value:this.first);for(let e=n;e{n.bind(r)(e,this.refract(t))})}shift(){return this.content.shift()}unshift(e){this.content.unshift(this.refract(e))}push(e){return this.content.push(this.refract(e)),this}add(e){this.push(e)}findElements(r,e){const t=e||{},o=!!t.recursive,s=void 0===t.results?[]:t.results;return this.forEach((e,t,n)=>{o&&void 0!==e.findElements&&e.findElements(r,{results:s,recursive:o}),r(e,t,n)&&s.push(e)}),s}find(e){return new s(this.findElements(e,{recursive:!0}))}findByElement(t){return this.find(e=>e.element===t)}findByClass(t){return this.find(e=>e.classes.includes(t))}getById(t){return this.find(e=>e.id.toValue()===t).first}includes(t){return this.content.some(e=>e.equals(t))}contains(e){return this.includes(e)}empty(){return new this.constructor([])}"fantasy-land/empty"(){return this.empty()}concat(e){return new this.constructor(this.content.concat(e.content))}"fantasy-land/concat"(e){return this.concat(e)}"fantasy-land/map"(e){return new this.constructor(this.map(e))}"fantasy-land/chain"(t){return this.map(e=>t(e),this).reduce((e,t)=>e.concat(t),this.empty())}"fantasy-land/filter"(e){return new this.constructor(this.content.filter(e))}"fantasy-land/reduce"(e,t){return this.content.reduce(e,t)}get length(){return this.content.length}get isEmpty(){return 0===this.content.length}get first(){return this.getIndex(0)}get second(){return this.getIndex(1)}get last(){return this.getIndex(this.length-1)}}i["fantasy-land/empty"]=i.empty=function(){return new this},"undefined"!=typeof Symbol&&(i.prototype[Symbol.iterator]=function(){return this.content[Symbol.iterator]()}),e.exports=i},18866:(e,t,n)=>{n=n(3079);e.exports=class extends n{constructor(e,t,n){super(e,t,n),this.element="boolean"}primitive(){return"boolean"}}},3079:(e,t,n)=>{const r=n(18446),a=n(17645),l=n(42566);e.exports=class o{constructor(e,t,n){t&&(this.meta=t),n&&(this.attributes=n),this.content=e}freeze(){Object.isFrozen(this)||(this._meta&&(this.meta.parent=this).meta.freeze(),this._attributes&&(this.attributes.parent=this).attributes.freeze(),this.children.forEach(e=>{e.parent=this,e.freeze()},this),this.content&&Array.isArray(this.content)&&Object.freeze(this.content),Object.freeze(this))}primitive(){}clone(){const e=new this.constructor;return e.element=this.element,this.meta.length&&(e._meta=this.meta.clone()),this.attributes.length&&(e._attributes=this.attributes.clone()),this.content?this.content.clone?e.content=this.content.clone():Array.isArray(this.content)?e.content=this.content.map(e=>e.clone()):e.content=this.content:e.content=this.content,e}toValue(){return this.content instanceof o?this.content.toValue():this.content instanceof a?{key:this.content.key.toValue(),value:this.content.value?this.content.value.toValue():void 0}:this.content&&this.content.map?this.content.map(e=>e.toValue(),this):this.content}toRef(e){if(""===this.id.toValue())throw Error("Cannot create reference to an element that does not contain an ID");const t=new this.RefElement(this.id.toValue());return e&&(t.path=e),t}findRecursive(...r){if(1(e.push(t),e),i=(e,t)=>{t.element===o&&e.push(t);const n=t.findRecursive(o);return n&&n.reduce(s,e),t.content instanceof a&&(t.content.key&&i(e,t.content.key),t.content.value&&i(e,t.content.value)),e};return this.content&&(this.content.element&&i(e,this.content),Array.isArray(this.content)&&this.content.reduce(i,e)),e=r.isEmpty?e:e.filter(e=>{let t=e.parents.map(e=>e.element);for(const e in r){var n=r[e];if(-1===(n=t.indexOf(n)))return!1;t=t.splice(0,n)}return!0})}set(e){return this.content=e,this}equals(e){return r(this.toValue(),e)}getMetaProperty(e,t){if(!this.meta.hasKey(e)){if(this.isFrozen){const e=this.refract(t);return e.freeze(),e}this.meta.set(e,t)}return this.meta.get(e)}setMetaProperty(e,t){this.meta.set(e,t)}get element(){return this._storedElement||"element"}set element(e){this._storedElement=e}get content(){return this._content}set content(t){if(t instanceof o)this._content=t;else if(t instanceof l)this.content=t.elements;else if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"null"===t||null==t)this._content=t;else if(t instanceof a)this._content=t;else if(Array.isArray(t))this._content=t.map(this.refract);else{if("object"!=typeof t)throw new Error("Cannot set content to given value");this._content=Object.keys(t).map(e=>new this.MemberElement(e,t[e]))}}get meta(){if(!this._meta){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._meta=new this.ObjectElement}return this._meta}set meta(e){e instanceof this.ObjectElement?this._meta=e:this.meta.set(e||{})}get attributes(){if(!this._attributes){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._attributes=new this.ObjectElement}return this._attributes}set attributes(e){e instanceof this.ObjectElement?this._attributes=e:this.attributes.set(e||{})}get id(){return this.getMetaProperty("id","")}set id(e){this.setMetaProperty("id",e)}get classes(){return this.getMetaProperty("classes",[])}set classes(e){this.setMetaProperty("classes",e)}get title(){return this.getMetaProperty("title","")}set title(e){this.setMetaProperty("title",e)}get description(){return this.getMetaProperty("description","")}set description(e){this.setMetaProperty("description",e)}get links(){return this.getMetaProperty("links",[])}set links(e){this.setMetaProperty("links",e)}get isFrozen(){return Object.isFrozen(this)}get parents(){let e=this.parent;const t=new l;for(;e;)t.push(e),e=e.parent;return t}get children(){if(Array.isArray(this.content))return new l(this.content);if(this.content instanceof a){const e=new l([this.content.key]);return this.content.value&&e.push(this.content.value),e}return this.content instanceof o?new l([this.content]):new l}get recursiveChildren(){const t=new l;return this.children.forEach(e=>{t.push(e),e.recursiveChildren.forEach(e=>{t.push(e)})}),t}}},5946:(e,t,n)=>{const o=n(17645),r=n(3079);e.exports=class extends r{constructor(e,t,n,r){super(new o,n,r),this.element="member",this.key=e,this.value=t}get key(){return this.content.key}set key(e){this.content.key=this.refract(e)}get value(){return this.content.value}set value(e){this.content.value=this.refract(e)}}},96295:(e,t,n)=>{n=n(3079);e.exports=class extends n{constructor(e,t,n){super(e||null,t,n),this.element="null"}primitive(){return"null"}set(){return new Error("Cannot set the value of null")}}},91090:(e,t,n)=>{n=n(3079);e.exports=class extends n{constructor(e,t,n){super(e,t,n),this.element="number"}primitive(){return"number"}}},76735:(e,t,n)=>{const r=n(94885),o=n(13218),s=n(35804),i=n(5946),a=n(87526);e.exports=class extends s{constructor(e,t,n){super(e||[],t,n),this.element="object"}primitive(){return"object"}toValue(){return this.content.reduce((e,t)=>(e[t.key.toValue()]=t.value?t.value.toValue():void 0,e),{})}get(e){e=this.getMember(e);if(e)return e.value}getMember(t){if(void 0!==t)return this.content.find(e=>e.key.toValue()===t)}remove(t){let n=null;return this.content=this.content.filter(e=>e.key.toValue()!==t||(n=e,!1)),n}getKey(e){e=this.getMember(e);if(e)return e.key}set(t,e){if(o(t))return Object.keys(t).forEach(e=>{this.set(e,t[e])}),this;const n=t,r=this.getMember(n);return r?r.value=e:this.content.push(new i(n,e)),this}keys(){return this.content.map(e=>e.key.toValue())}values(){return this.content.map(e=>e.value.toValue())}hasKey(t){return this.content.some(e=>e.key.equals(t))}items(){return this.content.map(e=>[e.key.toValue(),e.value.toValue()])}map(t,n){return this.content.map(e=>t.bind(n)(e.value,e.key,e))}compactMap(r,o){const s=[];return this.forEach((e,t,n)=>{e=r.bind(o)(e,t,n);e&&s.push(e)}),s}filter(e,t){return new a(this.content).filter(e,t)}reject(e,t){return this.filter(r(e),t)}forEach(t,n){return this.content.forEach(e=>t.bind(n)(e.value,e.key,e))}}},16036:(e,t,n)=>{n=n(3079);e.exports=class extends n{constructor(e,t,n){super(e,t,n),this.element="string"}primitive(){return"string"}get length(){return this.content.length}}},3414:(e,t,n)=>{n=n(28219);e.exports=class extends n{serialise(t){if(!(t instanceof this.namespace.elements.Element))throw new TypeError(`Given element \`${t}\` is not an Element instance`);let n;t._attributes&&t.attributes.get("variable")&&(n=t.attributes.get("variable"));const r={element:t.element};t._meta&&0{e.content&&e.content.element&&e.content.attributes.remove("typeAttributes")}),e.content&&0!==n.length&&o.unshift(e.content),(o=o.map(e=>e instanceof this.namespace.elements.Array?[e]:new this.namespace.elements.Array([e.content]))).length&&t.set("samples",o),0{const t=e.clone();return t.attributes.remove("typeAttributes"),this.serialise(t)})}if(e.content){const n=e.content.clone();return n.attributes.remove("typeAttributes"),[this.serialise(n)]}return[]}deserialise(t){if("string"==typeof t)return new this.namespace.elements.String(t);if("number"==typeof t)return new this.namespace.elements.Number(t);if("boolean"==typeof t)return new this.namespace.elements.Boolean(t);if(null===t)return new this.namespace.elements.Null;if(Array.isArray(t))return new this.namespace.elements.Array(t.map(this.deserialise,this));const r=this.namespace.getElementClass(t.element),o=new r,s=(o.element!==t.element&&(o.element=t.element),t.meta&&this.deserialiseObject(t.meta,o.meta),t.attributes&&this.deserialiseObject(t.attributes,o.attributes),this.deserialiseContent(t.content));if(void 0===s&&null!==o.content||(o.content=s),"enum"===o.element){o.content&&o.attributes.set("enumerations",o.content);let n=o.attributes.get("samples");if(o.attributes.remove("samples"),n){const s=n;n=new this.namespace.elements.Array,s.forEach(e=>{e.forEach(e=>{const t=new r(e);t.element=o.element,n.push(t)})});t=n.shift();o.content=t?t.content:void 0,o.attributes.set("samples",n)}else o.content=void 0;let e=o.attributes.get("default");if(e&&0this.shouldRefract(e)||"default"===t?this.serialise(e):"array"===e.element||"object"===e.element||"enum"===e.element?e.children.map(e=>this.serialise(e)):e.toValue()):"object"===e.element?(e.content||[]).map(this.serialise,this):e.toValue()}serialiseEnum(e){return e.children.map(e=>this.serialise(e))}serialiseObject(e){const n={};return e.forEach((e,t)=>{e&&(t=t.toValue(),n[t]=this.convertKeyToRefract(t,e))}),n}deserialiseObject(t,n){Object.keys(t).forEach(e=>{n.set(e,this.deserialise(t[e]))})}}},28219:e=>{e.exports=class{constructor(e){this.namespace=e||new this.Namespace}serialise(e){if(!(e instanceof this.namespace.elements.Element))throw new TypeError(`Given element \`${e}\` is not an Element instance`);const t={element:e.element};e._meta&&0{e&&(n[t.toValue()]=this.serialise(e))}),0!==Object.keys(n).length)return n}deserialiseObject(t,n){Object.keys(t).forEach(e=>{n.set(e,this.deserialise(t[e]))})}}},27418:e=>{"use strict";var l=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return}}()?Object.assign:function(e,t){for(var n,r=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),o=1;o{var e="function"==typeof Map&&Map.prototype,t=Object.getOwnPropertyDescriptor&&e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,E=e&&t&&"function"==typeof t.get?t.get:null,w=e&&Map.prototype.forEach,t="function"==typeof Set&&Set.prototype,e=Object.getOwnPropertyDescriptor&&t?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,S=t&&e&&"function"==typeof e.get?e.get:null,x=t&&Set.prototype.forEach,_="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,k="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,O="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,X=Boolean.prototype.valueOf,i=Object.prototype.toString,Q=Function.prototype.toString,Z=String.prototype.match,A=String.prototype.slice,C=String.prototype.replace,a=String.prototype.toUpperCase,j=String.prototype.toLowerCase,u=RegExp.prototype.test,P=Array.prototype.concat,N=Array.prototype.join,ee=Array.prototype.slice,o=Math.floor,I="function"==typeof BigInt?BigInt.prototype.valueOf:null,p=Object.getOwnPropertySymbols,T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,R="function"==typeof Symbol&&"object"==typeof Symbol.iterator,M="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,D=Object.prototype.propertyIsEnumerable,L=("function"==typeof Reflect?Reflect:Object).getPrototypeOf||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function F(e,t){if(e===1/0||e===-1/0||e!=e||e&&-1e3 0, or `null`');if(K(i,"numericSeparator")&&"boolean"!=typeof i.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var t=i.numericSeparator;if(void 0===n)return"undefined";if(null===n)return"null";if("boolean"==typeof n)return n?"true":"false";if("string"==typeof n)return function e(t,n){{var r;if(t.length>n.maxStringLength)return r=t.length-n.maxStringLength,r="... "+r+" more character"+(1"}if(z(n)){if(0===n.length)return"[]";var b=Y(n,m);return a&&!function(e){for(var t=0;t "+m(e,n))}),re("Map",E.call(n),u,a)):function(e){if(S&&e&&"object"==typeof e)try{S.call(e);try{E.call(e)}catch(e){return 1}return e instanceof Set}catch(e){}}(n)?(p=[],x&&x.call(n,function(e){p.push(m(e,n))}),re("Set",S.call(n),p,a)):function(e){if(_&&e&&"object"==typeof e)try{_.call(e,_);try{k.call(e,k)}catch(e){return 1}return e instanceof WeakMap}catch(e){}}(n)?H("WeakMap"):function(e){if(k&&e&&"object"==typeof e)try{k.call(e,k);try{_.call(e,_)}catch(e){return 1}return e instanceof WeakSet}catch(e){}}(n)?H("WeakSet"):function(e){if(O&&e&&"object"==typeof e)try{return O.call(e),1}catch(e){}}(n)?H("WeakRef"):"[object Number]"!==W(h=n)||M&&"object"==typeof h&&M in h?function(e){if(e&&"object"==typeof e&&I)try{return I.call(e),1}catch(e){}}(n)?J(m(I.call(n))):"[object Boolean]"!==W(t=n)||M&&"object"==typeof t&&M in t?"[object String]"!==W(e=n)||M&&"object"==typeof e&&M in e?("[object Date]"!==W(t=n)||M&&"object"==typeof t&&M in t)&&!U(n)?(e=Y(n,m),t=L?L(n)===Object.prototype:n instanceof Object||n.constructor===Object,d=n instanceof Object?"":"null prototype",f=!t&&M&&Object(n)===n&&M in n?A.call(W(n),8,-1):d?"Object":"",t=(!t&&"function"==typeof n.constructor&&n.constructor.name?n.constructor.name+" ":"")+(f||d?"["+N.call(P.call([],f||[],d||[]),": ")+"] ":""),0===e.length?t+"{}":a?t+"{"+G(e,a)+"}":t+"{ "+N.call(e,", ")+" }"):String(n):J(m(String(n))):J(X.call(n)):J(m(Number(n)))};var l=Object.prototype.hasOwnProperty||function(e){return e in this};function K(e,t){return l.call(e,t)}function W(e){return i.call(e)}function te(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n{var n,r,e=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function i(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return(n=setTimeout)(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}var a,l=[],c=!1,u=-1;function p(){c&&a&&(c=!1,a.length?l=a.concat(l):u=-1,l.length&&h())}function h(){if(!c){var e=i(p);c=!0;for(var t=l.length;t;){for(a=l,l=[];++u{"use strict";var i=n(50414);function r(){}function o(){}o.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,o,s){if(s!==i)throw(s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")).name="Invariant Violation",s}function t(){return e}var n={array:e.isRequired=e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:r};return n.PropTypes=n}},45697:(e,t,n)=>{e.exports=n(92703)()},50414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},55798:e=>{"use strict";var t=String.prototype.replace,n=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(e){return t.call(e,n,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},80129:(e,t,n)=>{"use strict";var r=n(58261),o=n(55235),n=n(55798);e.exports={formats:n,parse:o,stringify:r}},55235:(e,t,n)=>{"use strict";function y(e,t){return e&&"string"==typeof e&&t.comma&&-1{"use strict";function I(e,t){r.apply(e,D(t)?t:[t])}function T(e,t,n,r,o,s,i,a,l,c,u,p,h,d,f,m){for(var g=e,y=m,v=0,b=!1;void 0!==(y=y.get(B))&&!b;){var E=y.get(e);if(v+=1,void 0!==E){if(E===v)throw new RangeError("Cyclic object value");b=!0}void 0===y.get(B)&&(v=0)}if("function"==typeof a?g=a(t,g):g instanceof Date?g=u(g):"comma"===n&&D(g)&&(g=M.maybeMap(g,function(e){return e instanceof Date?u(e):e})),null===g){if(o)return i&&!d?i(t,F.encoder,f,"key",p):t;g=""}if("string"==typeof(w=g)||"number"==typeof w||"boolean"==typeof w||"symbol"==typeof w||"bigint"==typeof w||M.isBuffer(g)){if(i){var w=d?t:i(t,F.encoder,f,"key",p);if("comma"===n&&d){for(var S=L.call(String(g),","),x="",_=0;_{"use strict";function a(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},r=0;r>6]+u[128|63&l]:l<55296||57344<=l?i+=u[224|l>>12]+u[128|l>>6&63]+u[128|63&l]:(a+=1,l=65536+((1023&l)<<10|1023&s.charCodeAt(a)),i+=u[240|l>>18]+u[128|l>>12&63]+u[128|l>>6&63]+u[128|63&l])}return i},isBuffer:function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(m(e)){for(var n=[],r=0;r{"use strict";var s=Object.prototype.hasOwnProperty;function i(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function a(e){try{return encodeURIComponent(e)}catch(e){return null}}t.stringify=function(e,t){var n,r,o=[];for(r in"string"!=typeof(t=t||"")&&(t="?"),e)if(s.call(e,r)){if((n=e[r])||null!=n&&!isNaN(n)||(n=""),r=a(r),n=a(n),null===r||null===n)continue;o.push(r+"="+n)}return o.length?t+o.join("&"):""},t.parse=function(e){for(var t=/([^=?#&]+)=?([^&]*)/g,n={};o=t.exec(e);){var r=i(o[1]),o=i(o[2]);null===r||null===o||r in n||(n[r]=o)}return n}},14419:(e,t,n)=>{const i=n(60697),a=n(69450),l=i.types;e.exports=class r{constructor(e,t){if(this._setDefaults(e),e instanceof RegExp)this.ignoreCase=e.ignoreCase,this.multiline=e.multiline,e=e.source;else{if("string"!=typeof e)throw new Error("Expected a regexp or string");this.ignoreCase=t&&-1!==t.indexOf("i"),this.multiline=t&&-1!==t.indexOf("m")}this.tokens=i(e)}_setDefaults(e){this.max=null!=e.max?e.max:null!=r.prototype.max?r.prototype.max:100,this.defaultRange=e.defaultRange||this.defaultRange.clone(),e.randInt&&(this.randInt=e.randInt)}gen(){return this._gen(this.tokens,[])}_gen(e,t){var n,r,o,s,i;switch(e.type){case l.ROOT:case l.GROUP:if(e.followedBy||e.notFollowedBy)return"";for(e.remember&&void 0===e.groupNumber&&(e.groupNumber=t.push(null)-1),r="",s=0,i=(n=e.options?this._randSelect(e.options):e.stack).length;s{"use strict";var o=n(34155),s=n(89509).Buffer,i=n.g.crypto||n.g.msCrypto;i&&i.getRandomValues?e.exports=function(e,t){if(4294967295{"use strict";function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.CopyToClipboard=void 0;var l=r(n(67294)),c=r(n(20640)),u=["text","onCopy","options","children"];function r(e){return e&&e.__esModule?e:{default:e}}function o(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function p(t){for(var e=1;e{"use strict";n=n(74300).CopyToClipboard;n.CopyToClipboard=n,e.exports=n},53441:(e,t,n)=>{"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.DebounceInput=void 0;var l=r(n(67294)),c=r(n(91296)),u=["element","onChange","value","minLength","debounceTimeout","forceNotifyByEnter","forceNotifyOnBlur","onKeyDown","onBlur","inputRef"];function r(e){return e&&e.__esModule?e:{default:e}}function o(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function p(t){for(var e=1;e=r?o.notify(t):n.length>e.length&&o.notify(p(p({},t),{},{target:p(p({},t.target),{},{value:""})}))})}),g(f(o),"onKeyDown",function(e){"Enter"===e.key&&o.forceNotify(e);var t=o.props.onKeyDown;t&&(e.persist(),t(e))}),g(f(o),"onBlur",function(e){o.forceNotify(e);var t=o.props.onBlur;t&&(e.persist(),t(e))}),g(f(o),"createNotifier",function(e){var t;e<0?o.notify=function(){return null}:0===e?o.notify=o.doNotify:(t=(0,c.default)(function(e){o.isDebouncing=!1,o.doNotify(e)},e),o.notify=function(e){o.isDebouncing=!0,t(e)},o.flush=function(){return t.flush()},o.cancel=function(){o.isDebouncing=!1,t.cancel()})}),g(f(o),"doNotify",function(){o.props.onChange.apply(void 0,arguments)}),g(f(o),"forceNotify",function(e){var t,n=o.props.debounceTimeout;!o.isDebouncing&&0=t?o.doNotify(e):o.doNotify(p(p({},e),{},{target:p(p({},e.target),{},{value:n})})))}),o.isDebouncing=!1,o.state={value:void 0===e.value||null===e.value?"":e.value};e=o.props.debounceTimeout;return o.createNotifier(e),o}return t=i,(e=[{key:"componentDidUpdate",value:function(e){var t,n,r,o;this.isDebouncing||(t=(n=this.props).value,n=n.debounceTimeout,r=e.debounceTimeout,e=e.value,o=this.state.value,void 0!==t&&e!==t&&o!==t&&this.setState({value:t}),n!==r&&this.createNotifier(n))}},{key:"componentWillUnmount",value:function(){this.flush&&this.flush()}},{key:"render",value:function(){var e=this.props,t=e.element,n=(e.onChange,e.value,e.minLength,e.debounceTimeout,e.forceNotifyByEnter),r=e.forceNotifyOnBlur,o=e.onKeyDown,s=e.onBlur,i=e.inputRef,e=function(e,t){if(null==e)return{};var n,r=function(e,t){if(null==e)return{};for(var n,r={},o=Object.keys(e),s=0;s{"use strict";n=n(53441).DebounceInput;n.DebounceInput=n,e.exports=n},64448:(M,D,e)=>{"use strict";var F=e(67294),m=e(27418),o=e(63840);function L(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n