From 8a309d27ec0a6ff62dd396450572b067361fcdea Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Thu, 3 Jul 2025 16:57:54 +0100 Subject: [PATCH 01/20] Initial commit --- .github/azure-devops/release.yml | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index 631a16574..581f37def 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -12,6 +12,7 @@ pr: none variables: - name: tags value: production, multi-phased + - group: PR Metrics resources: repositories: @@ -90,6 +91,44 @@ extends: displayName: Release – Create workingDirectory: $(Build.SourcesDirectory)/release + - task: EsrpCodeSigning@5 + displayName: ESRP CodeSigning + inputs: + ConnectedServiceName: $env:CONNECTEDSERVICENAME + AppRegistrationClientId: $env:APPREGISTRATIONCLIENTID + AppRegistrationTenantId: $env:APPREGISTRATIONTENANTID + AuthAKVName: $env:AUTHAKVNAME + AuthCertName: $env:AUTHSIGNCERTNAME + AuthSignCertName: $env:AUTHSIGNCERTNAME + FolderPath: $(Build.SourcesDirectory)/release + Pattern: "*.vsix" + signConfigType: inlineSignParams + inlineOperation: |- + [ + { + "KeyCode": "CP-500813", + "OperationCode": "AdoExtensionSign", + "ToolName": "sign", + "ToolVersion": "1.0", + "Parameters": {} + }, + { + "KeyCode": "CP-500813", + "OperationCode": "AdoExtensionVerify", + "ToolName": "sign", + "ToolVersion": "1.0", + "Parameters": {} + } + ] + SessionTimeout: 30 + env: + CONNECTEDSERVICENAME: $(CODESIGNING-CONNECTEDSERVICENAME) + APPREGISTRATIONCLIENTID: $(CODESIGNING-APPREGISTRATIONCLIENTID) + APPREGISTRATIONTENANTID: $(CODESIGNING-APPREGISTRATIONTENANTID) + AUTHAKVNAME: $(CODESIGNING-AUTHAKVNAME) + AUTHCERTNAME: $(CODESIGNING-AUTHCERTNAME) + AUTHSIGNCERTNAME: $(CODESIGNING-AUTHSIGNCERTNAME) + - task: AzureCLI@2 displayName: Release – Publish inputs: From 6193ccf923c45b4739047382ae7ada80daa7250a Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Thu, 3 Jul 2025 17:00:52 +0100 Subject: [PATCH 02/20] Fixing syntax --- .github/azure-devops/release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index 581f37def..8e47207b6 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -94,12 +94,12 @@ extends: - task: EsrpCodeSigning@5 displayName: ESRP CodeSigning inputs: - ConnectedServiceName: $env:CONNECTEDSERVICENAME - AppRegistrationClientId: $env:APPREGISTRATIONCLIENTID - AppRegistrationTenantId: $env:APPREGISTRATIONTENANTID - AuthAKVName: $env:AUTHAKVNAME - AuthCertName: $env:AUTHSIGNCERTNAME - AuthSignCertName: $env:AUTHSIGNCERTNAME + ConnectedServiceName: $($env:CONNECTEDSERVICENAME) + AppRegistrationClientId: $($env:APPREGISTRATIONCLIENTID) + AppRegistrationTenantId: $($env:APPREGISTRATIONTENANTID) + AuthAKVName: $($env:AUTHAKVNAME) + AuthCertName: $($env:AUTHSIGNCERTNAME) + AuthSignCertName: $($env:AUTHSIGNCERTNAME) FolderPath: $(Build.SourcesDirectory)/release Pattern: "*.vsix" signConfigType: inlineSignParams From 34fbac4a39064e6d5dd69a3eabadd7c1dea84993 Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Thu, 3 Jul 2025 17:01:49 +0100 Subject: [PATCH 03/20] Fixing syntax --- .github/azure-devops/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index 8e47207b6..2d56e5eec 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -94,7 +94,7 @@ extends: - task: EsrpCodeSigning@5 displayName: ESRP CodeSigning inputs: - ConnectedServiceName: $($env:CONNECTEDSERVICENAME) + ConnectedServiceName: $($env:CODESIGNING-CONNECTEDSERVICENAME) AppRegistrationClientId: $($env:APPREGISTRATIONCLIENTID) AppRegistrationTenantId: $($env:APPREGISTRATIONTENANTID) AuthAKVName: $($env:AUTHAKVNAME) @@ -122,7 +122,7 @@ extends: ] SessionTimeout: 30 env: - CONNECTEDSERVICENAME: $(CODESIGNING-CONNECTEDSERVICENAME) + CODESIGNING-CONNECTEDSERVICENAME: $(CODESIGNING-CONNECTEDSERVICENAME) APPREGISTRATIONCLIENTID: $(CODESIGNING-APPREGISTRATIONCLIENTID) APPREGISTRATIONTENANTID: $(CODESIGNING-APPREGISTRATIONTENANTID) AUTHAKVNAME: $(CODESIGNING-AUTHAKVNAME) From c58e503607109daf5c3e5ddcb6c24fa86c21c08b Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Thu, 3 Jul 2025 17:03:36 +0100 Subject: [PATCH 04/20] Fixing syntax --- .github/azure-devops/release.yml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index 2d56e5eec..098fba9b2 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -94,12 +94,12 @@ extends: - task: EsrpCodeSigning@5 displayName: ESRP CodeSigning inputs: - ConnectedServiceName: $($env:CODESIGNING-CONNECTEDSERVICENAME) - AppRegistrationClientId: $($env:APPREGISTRATIONCLIENTID) - AppRegistrationTenantId: $($env:APPREGISTRATIONTENANTID) - AuthAKVName: $($env:AUTHAKVNAME) - AuthCertName: $($env:AUTHSIGNCERTNAME) - AuthSignCertName: $($env:AUTHSIGNCERTNAME) + ConnectedServiceName: $(CODESIGNING-CONNECTEDSERVICENAME) + AppRegistrationClientId: $(CODESIGNING-APPREGISTRATIONCLIENTID) + AppRegistrationTenantId: $(CODESIGNING-APPREGISTRATIONTENANTID) + AuthAKVName: $(CODESIGNING-AUTHAKVNAME) + AuthCertName: $(CODESIGNING-AUTHCERTNAME) + AuthSignCertName: $(CODESIGNING-AUTHSIGNCERTNAME) FolderPath: $(Build.SourcesDirectory)/release Pattern: "*.vsix" signConfigType: inlineSignParams @@ -121,13 +121,6 @@ extends: } ] SessionTimeout: 30 - env: - CODESIGNING-CONNECTEDSERVICENAME: $(CODESIGNING-CONNECTEDSERVICENAME) - APPREGISTRATIONCLIENTID: $(CODESIGNING-APPREGISTRATIONCLIENTID) - APPREGISTRATIONTENANTID: $(CODESIGNING-APPREGISTRATIONTENANTID) - AUTHAKVNAME: $(CODESIGNING-AUTHAKVNAME) - AUTHCERTNAME: $(CODESIGNING-AUTHCERTNAME) - AUTHSIGNCERTNAME: $(CODESIGNING-AUTHSIGNCERTNAME) - task: AzureCLI@2 displayName: Release – Publish From 144f0ab4737ad4620d625be8ea014e4014b50cc3 Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Thu, 3 Jul 2025 17:08:17 +0100 Subject: [PATCH 05/20] Moving to static --- .github/azure-devops/release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index 098fba9b2..3f6de0f02 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -12,7 +12,6 @@ pr: none variables: - name: tags value: production, multi-phased - - group: PR Metrics resources: repositories: @@ -59,9 +58,11 @@ extends: - job: Release pool: - name: Azure-Pipelines-1ESPT-ExDShared + name: Azure-Pipelines-1ESPT-ExDShared-StaticIP os: linux image: ubuntu-latest + variables: + - group: PR Metrics steps: - checkout: self displayName: Checkout @@ -94,6 +95,7 @@ extends: - task: EsrpCodeSigning@5 displayName: ESRP CodeSigning inputs: + # Signing details are stored within the PR Metrics variable group. ConnectedServiceName: $(CODESIGNING-CONNECTEDSERVICENAME) AppRegistrationClientId: $(CODESIGNING-APPREGISTRATIONCLIENTID) AppRegistrationTenantId: $(CODESIGNING-APPREGISTRATIONTENANTID) From ea88897ba2e9d15c1a7ef168dc5c69c81d791235 Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Thu, 3 Jul 2025 17:09:49 +0100 Subject: [PATCH 06/20] Moving to static --- .github/azure-devops/release.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index 3f6de0f02..4b1c73d13 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -12,6 +12,7 @@ pr: none variables: - name: tags value: production, multi-phased + - group: PR Metrics resources: repositories: @@ -25,7 +26,7 @@ extends: parameters: sdl: sourceAnalysisPool: - name: Azure-Pipelines-1ESPT-ExDShared + name: Azure-Pipelines-1ESPT-ExDShared-StaticIP os: windows image: windows-latest credscan: @@ -44,7 +45,7 @@ extends: jobs: - job: Checks pool: - name: Azure-Pipelines-1ESPT-ExDShared + name: Azure-Pipelines-1ESPT-ExDShared-StaticIP os: linux image: ubuntu-latest steps: @@ -61,8 +62,6 @@ extends: name: Azure-Pipelines-1ESPT-ExDShared-StaticIP os: linux image: ubuntu-latest - variables: - - group: PR Metrics steps: - checkout: self displayName: Checkout From cce3a5de493b08f085e29b5bd835460796add659 Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Thu, 3 Jul 2025 17:12:23 +0100 Subject: [PATCH 07/20] Commenting out code for test purposes --- .github/azure-devops/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index 4b1c73d13..279acceab 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -52,10 +52,10 @@ extends: - checkout: none displayName: Checkout - - bash: exit 1 - displayName: Terminate on Non-Release - # Releases are performed on tags, which begin with 'v'. - condition: not(startsWith(variables['Build.SourceBranchName'], 'v')) + #- bash: exit 1 + # displayName: Terminate on Non-Release + # # Releases are performed on tags, which begin with 'v'. + # condition: not(startsWith(variables['Build.SourceBranchName'], 'v')) - job: Release pool: From 09a0023046167fe504bc835f272cb0eab9af956b Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Thu, 3 Jul 2025 17:18:49 +0100 Subject: [PATCH 08/20] Reformatting settings --- .github/azure-devops/release.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index 279acceab..b14b673a5 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -95,12 +95,12 @@ extends: displayName: ESRP CodeSigning inputs: # Signing details are stored within the PR Metrics variable group. - ConnectedServiceName: $(CODESIGNING-CONNECTEDSERVICENAME) - AppRegistrationClientId: $(CODESIGNING-APPREGISTRATIONCLIENTID) - AppRegistrationTenantId: $(CODESIGNING-APPREGISTRATIONTENANTID) - AuthAKVName: $(CODESIGNING-AUTHAKVNAME) - AuthCertName: $(CODESIGNING-AUTHCERTNAME) - AuthSignCertName: $(CODESIGNING-AUTHSIGNCERTNAME) + ConnectedServiceName: $($env:CODESIGNING-CONNECTEDSERVICENAME) + AppRegistrationClientId: $($env:CODESIGNING-APPREGISTRATIONCLIENTID) + AppRegistrationTenantId: $($env:CODESIGNING-APPREGISTRATIONTENANTID) + AuthAKVName: $($env:CODESIGNING-AUTHAKVNAME) + AuthCertName: $($env:CODESIGNING-AUTHCERTNAME) + AuthSignCertName: $($env:CODESIGNING-AUTHSIGNCERTNAME) FolderPath: $(Build.SourcesDirectory)/release Pattern: "*.vsix" signConfigType: inlineSignParams @@ -122,6 +122,13 @@ extends: } ] SessionTimeout: 30 + env: + CODESIGNING-CONNECTEDSERVICENAME: $(CODESIGNING-CONNECTEDSERVICENAME) + CODESIGNING-APPREGISTRATIONCLIENTID: $(CODESIGNING-APPREGISTRATIONCLIENTID) + CODESIGNING-APPREGISTRATIONTENANTID: $(CODESIGNING-APPREGISTRATIONTENANTID) + CODESIGNING-AUTHAKVNAME: $(CODESIGNING-AUTHAKVNAME) + CODESIGNING-AUTHCERTNAME: $(CODESIGNING-AUTHCERTNAME) + CODESIGNING-AUTHSIGNCERTNAME: $(CODESIGNING-AUTHSIGNCERTNAME) - task: AzureCLI@2 displayName: Release – Publish From 89b110190da46aa15047930af4fb99a9cfeb478d Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Thu, 3 Jul 2025 17:19:38 +0100 Subject: [PATCH 09/20] Fixing --- .github/azure-devops/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index b14b673a5..8cf27106b 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -12,7 +12,6 @@ pr: none variables: - name: tags value: production, multi-phased - - group: PR Metrics resources: repositories: @@ -62,6 +61,8 @@ extends: name: Azure-Pipelines-1ESPT-ExDShared-StaticIP os: linux image: ubuntu-latest + variables: + - group: PR Metrics steps: - checkout: self displayName: Checkout From c51d81bb05b40baa18a092a2982cbefa6579190d Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Thu, 3 Jul 2025 17:25:45 +0100 Subject: [PATCH 10/20] Refining --- .github/azure-devops/release.yml | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index 8cf27106b..1fc9aca7c 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -96,12 +96,11 @@ extends: displayName: ESRP CodeSigning inputs: # Signing details are stored within the PR Metrics variable group. - ConnectedServiceName: $($env:CODESIGNING-CONNECTEDSERVICENAME) - AppRegistrationClientId: $($env:CODESIGNING-APPREGISTRATIONCLIENTID) - AppRegistrationTenantId: $($env:CODESIGNING-APPREGISTRATIONTENANTID) - AuthAKVName: $($env:CODESIGNING-AUTHAKVNAME) - AuthCertName: $($env:CODESIGNING-AUTHCERTNAME) - AuthSignCertName: $($env:CODESIGNING-AUTHSIGNCERTNAME) + ConnectedServiceName: $(CodeSigningConnectedServiceName) + AppRegistrationClientId: $(CodeSigningAppRegistrationClientId) + AppRegistrationTenantId: $(CodeSigningAppRegistrationTenantId) + AuthAKVName: $(CodeSigningAuthAKVName) + AuthSignCertName: $(CodeSigningAuthSignCertName) FolderPath: $(Build.SourcesDirectory)/release Pattern: "*.vsix" signConfigType: inlineSignParams @@ -123,13 +122,6 @@ extends: } ] SessionTimeout: 30 - env: - CODESIGNING-CONNECTEDSERVICENAME: $(CODESIGNING-CONNECTEDSERVICENAME) - CODESIGNING-APPREGISTRATIONCLIENTID: $(CODESIGNING-APPREGISTRATIONCLIENTID) - CODESIGNING-APPREGISTRATIONTENANTID: $(CODESIGNING-APPREGISTRATIONTENANTID) - CODESIGNING-AUTHAKVNAME: $(CODESIGNING-AUTHAKVNAME) - CODESIGNING-AUTHCERTNAME: $(CODESIGNING-AUTHCERTNAME) - CODESIGNING-AUTHSIGNCERTNAME: $(CODESIGNING-AUTHSIGNCERTNAME) - task: AzureCLI@2 displayName: Release – Publish @@ -140,3 +132,10 @@ extends: inlineScript: | $AccessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv tfx extension publish --service-url https://marketplace.visualstudio.com/ --token $AccessToken --vsix ms-omex.PRMetrics.vsix + inputs: + azureSubscription: PR Metrics + scriptType: pscore + scriptLocation: inlineScript + inlineScript: | + $AccessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv + tfx extension publish --service-url https://marketplace.visualstudio.com/ --token $AccessToken --vsix ms-omex.PRMetrics.vsix From 718bf0d1d141d96ae41e9dea3d47c1ad8553b176 Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Thu, 3 Jul 2025 17:26:25 +0100 Subject: [PATCH 11/20] Fixing --- .github/azure-devops/release.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index 1fc9aca7c..41657813a 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -132,10 +132,3 @@ extends: inlineScript: | $AccessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv tfx extension publish --service-url https://marketplace.visualstudio.com/ --token $AccessToken --vsix ms-omex.PRMetrics.vsix - inputs: - azureSubscription: PR Metrics - scriptType: pscore - scriptLocation: inlineScript - inlineScript: | - $AccessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv - tfx extension publish --service-url https://marketplace.visualstudio.com/ --token $AccessToken --vsix ms-omex.PRMetrics.vsix From f6065a00e90bbc7cbdab7d6ff2de7f10bb906314 Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Thu, 3 Jul 2025 17:28:17 +0100 Subject: [PATCH 12/20] Adding group --- .github/azure-devops/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index 41657813a..cf0d3afb2 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -12,6 +12,7 @@ pr: none variables: - name: tags value: production, multi-phased + - group: PR Metrics resources: repositories: From 5f1a52f27eebd85bfd170decbc1657c77a711163 Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Thu, 3 Jul 2025 17:32:09 +0100 Subject: [PATCH 13/20] Refining auth --- .github/azure-devops/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index cf0d3afb2..f38a4e51b 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -102,6 +102,7 @@ extends: AppRegistrationTenantId: $(CodeSigningAppRegistrationTenantId) AuthAKVName: $(CodeSigningAuthAKVName) AuthSignCertName: $(CodeSigningAuthSignCertName) + UseMSIAuthentication: true FolderPath: $(Build.SourcesDirectory)/release Pattern: "*.vsix" signConfigType: inlineSignParams From ca594fecce24595743d6ec0e5faffc3eef25c92f Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Thu, 3 Jul 2025 17:45:04 +0100 Subject: [PATCH 14/20] Refining design --- .github/azure-devops/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index f38a4e51b..9fa04b7c3 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -97,7 +97,7 @@ extends: displayName: ESRP CodeSigning inputs: # Signing details are stored within the PR Metrics variable group. - ConnectedServiceName: $(CodeSigningConnectedServiceName) + ConnectedServiceName: OmexCodeSigningESRP-Torus AppRegistrationClientId: $(CodeSigningAppRegistrationClientId) AppRegistrationTenantId: $(CodeSigningAppRegistrationTenantId) AuthAKVName: $(CodeSigningAuthAKVName) From 32e2a2eb2024bb23c7860ea98520bd331ccb0deb Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Thu, 3 Jul 2025 17:50:18 +0100 Subject: [PATCH 15/20] Simplifying design --- .github/azure-devops/release.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index 9fa04b7c3..175b8cd72 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -12,7 +12,6 @@ pr: none variables: - name: tags value: production, multi-phased - - group: PR Metrics resources: repositories: @@ -26,7 +25,7 @@ extends: parameters: sdl: sourceAnalysisPool: - name: Azure-Pipelines-1ESPT-ExDShared-StaticIP + name: Azure-Pipelines-1ESPT-ExDShared os: windows image: windows-latest credscan: @@ -45,7 +44,7 @@ extends: jobs: - job: Checks pool: - name: Azure-Pipelines-1ESPT-ExDShared-StaticIP + name: Azure-Pipelines-1ESPT-ExDShared os: linux image: ubuntu-latest steps: From b651c05800e4635c48ee089084614c55196d85ce Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Fri, 4 Jul 2025 11:26:29 +0100 Subject: [PATCH 16/20] Adding new param --- .github/azure-devops/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index 175b8cd72..38492c657 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -101,6 +101,7 @@ extends: AppRegistrationTenantId: $(CodeSigningAppRegistrationTenantId) AuthAKVName: $(CodeSigningAuthAKVName) AuthSignCertName: $(CodeSigningAuthSignCertName) + EsrpClientId: $(CodeSigningEsrpClientId) UseMSIAuthentication: true FolderPath: $(Build.SourcesDirectory)/release Pattern: "*.vsix" From 937e9ef62fdd06f31a2594eddee72fb4ecd3da2e Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Fri, 4 Jul 2025 11:45:12 +0100 Subject: [PATCH 17/20] Fixing path --- .github/azure-devops/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index 38492c657..2be38ae05 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -103,7 +103,7 @@ extends: AuthSignCertName: $(CodeSigningAuthSignCertName) EsrpClientId: $(CodeSigningEsrpClientId) UseMSIAuthentication: true - FolderPath: $(Build.SourcesDirectory)/release + FolderPath: $(Build.SourcesDirectory) Pattern: "*.vsix" signConfigType: inlineSignParams inlineOperation: |- From 367b3542d87d39e1ac25e6cf715a80f69b9e95d5 Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Wed, 9 Jul 2025 11:27:50 +0100 Subject: [PATCH 18/20] Updating release --- .github/azure-devops/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/azure-devops/release.yml b/.github/azure-devops/release.yml index 2be38ae05..0ecf3ff44 100644 --- a/.github/azure-devops/release.yml +++ b/.github/azure-devops/release.yml @@ -51,10 +51,10 @@ extends: - checkout: none displayName: Checkout - #- bash: exit 1 - # displayName: Terminate on Non-Release - # # Releases are performed on tags, which begin with 'v'. - # condition: not(startsWith(variables['Build.SourceBranchName'], 'v')) + - bash: exit 1 + displayName: Terminate on Non-Release + # Releases are performed on tags, which begin with 'v'. + condition: not(startsWith(variables['Build.SourceBranchName'], 'v')) - job: Release pool: From 2fc194997a6f9308d06b653e37c94fff58ebada9 Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Wed, 9 Jul 2025 11:55:08 +0100 Subject: [PATCH 19/20] Bump version to 1.7.4 and update related files - Updated friendly name and version in resources.resjson and task.json - Incremented version in package.json and package-lock.json - Changed user agent in gitHubReposInvoker.ts and corresponding test - Updated version in vss-extension.json and task localization files --- .github/workflows/release-phase-1.yml | 2 +- .github/workflows/support/release-trigger.txt | 2 +- README.md | 4 ++-- dist/index.mjs | 2 +- dist/resources.resjson | 2 +- package-lock.json | 4 ++-- package.json | 2 +- .../resources.resjson/en-US/resources.resjson | 2 +- src/task/src/repos/gitHubReposInvoker.ts | 2 +- src/task/task.json | 4 ++-- src/task/task.loc.json | 2 +- .../tests/repos/gitHubReposInvoker.spec.ts | 2 +- src/vss-extension.json | 18 +++++++++++++----- 13 files changed, 28 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release-phase-1.yml b/.github/workflows/release-phase-1.yml index 0bc997a2a..5718b1623 100644 --- a/.github/workflows/release-phase-1.yml +++ b/.github/workflows/release-phase-1.yml @@ -21,4 +21,4 @@ jobs: with: major: 1 minor: 7 - patch: 4 + patch: 5 diff --git a/.github/workflows/support/release-trigger.txt b/.github/workflows/support/release-trigger.txt index 661e7aead..10c088013 100644 --- a/.github/workflows/support/release-trigger.txt +++ b/.github/workflows/support/release-trigger.txt @@ -1 +1 @@ -1.7.3 +1.7.4 diff --git a/README.md b/README.md index ac6bc76bd..fc2abbb90 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ The default input values are expected to be appropriate for most builds. Therefore, the following YAML definition is recommended: ```YAML -uses: microsoft/PR-Metrics@v1.7.3 +uses: microsoft/PR-Metrics@v1.7.4 name: PR Metrics env: PR_METRICS_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -137,7 +137,7 @@ continue-on-error: true If you wish to modify the inputs, YAML akin the to the following can be used: ```YAML -uses: microsoft/PR-Metrics@v1.7.3 +uses: microsoft/PR-Metrics@v1.7.4 name: PR Metrics env: PR_METRICS_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/dist/index.mjs b/dist/index.mjs index 34c34e553..6bd45402f 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -89,4 +89,4 @@ var e;(function(e){(function(t){var i=typeof globalThis==="object"?globalThis:ty * @license MIT * @version 3.7.0 */ -class FifoMap{constructor(e=1e3,t=0){if(isNaN(e)||e<0){throw new Error("Invalid max value")}if(isNaN(t)||t<0){throw new Error("Invalid ttl value")}this.first=null;this.items=new Map;this.last=null;this.max=e;this.ttl=t}get size(){return this.items.size}clear(){this.items=new Map;this.first=null;this.last=null}delete(e){if(this.items.has(e)){const t=this.items.get(e);this.items.delete(e);if(t.prev!==null){t.prev.next=t.next}if(t.next!==null){t.next.prev=t.prev}if(this.first===t){this.first=t.next}if(this.last===t){this.last=t.prev}}}deleteMany(e){for(var t=0;t0){const e=this.first;this.items.delete(e.key);if(this.size===0){this.first=null;this.last=null}else{this.first=e.next;this.first.prev=null}}}expiresAt(e){if(this.items.has(e)){return this.items.get(e).expiry}}get(e){if(this.items.has(e)){const t=this.items.get(e);if(this.ttl>0&&t.expiry<=Date.now()){this.delete(e);return}return t.value}}getMany(e){const t=[];for(var i=0;i0?Date.now()+this.ttl:this.ttl;return}if(this.max>0&&this.size===this.max){this.evict()}const i={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t};this.items.set(e,i);if(this.size===1){this.first=i}else{this.last.next=i}this.last=i}}class LruMap{constructor(e=1e3,t=0){if(isNaN(e)||e<0){throw new Error("Invalid max value")}if(isNaN(t)||t<0){throw new Error("Invalid ttl value")}this.first=null;this.items=new Map;this.last=null;this.max=e;this.ttl=t}get size(){return this.items.size}bumpLru(e){if(this.last===e){return}const t=this.last;const i=e.next;const n=e.prev;if(this.first===e){this.first=i}e.next=null;e.prev=t;t.next=e;if(n!==null){n.next=i}if(i!==null){i.prev=n}this.last=e}clear(){this.items=new Map;this.first=null;this.last=null}delete(e){if(this.items.has(e)){const t=this.items.get(e);this.items.delete(e);if(t.prev!==null){t.prev.next=t.next}if(t.next!==null){t.next.prev=t.prev}if(this.first===t){this.first=t.next}if(this.last===t){this.last=t.prev}}}deleteMany(e){for(var t=0;t0){const e=this.first;this.items.delete(e.key);if(this.size===0){this.first=null;this.last=null}else{this.first=e.next;this.first.prev=null}}}expiresAt(e){if(this.items.has(e)){return this.items.get(e).expiry}}get(e){if(this.items.has(e)){const t=this.items.get(e);if(this.ttl>0&&t.expiry<=Date.now()){this.delete(e);return}this.bumpLru(t);return t.value}}getMany(e){const t=[];for(var i=0;i0?Date.now()+this.ttl:this.ttl;if(this.last!==i){this.bumpLru(i)}return}if(this.max>0&&this.size===this.max){this.evict()}const i={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t};this.items.set(e,i);if(this.size===1){this.first=i}else{this.last.next=i}this.last=i}}class LruObject{constructor(e=1e3,t=0){if(isNaN(e)||e<0){throw new Error("Invalid max value")}if(isNaN(t)||t<0){throw new Error("Invalid ttl value")}this.first=null;this.items=Object.create(null);this.last=null;this.size=0;this.max=e;this.ttl=t}bumpLru(e){if(this.last===e){return}const t=this.last;const i=e.next;const n=e.prev;if(this.first===e){this.first=i}e.next=null;e.prev=t;t.next=e;if(n!==null){n.next=i}if(i!==null){i.prev=n}this.last=e}clear(){this.items=Object.create(null);this.first=null;this.last=null;this.size=0}delete(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){const t=this.items[e];delete this.items[e];this.size--;if(t.prev!==null){t.prev.next=t.next}if(t.next!==null){t.next.prev=t.prev}if(this.first===t){this.first=t.next}if(this.last===t){this.last=t.prev}}}deleteMany(e){for(var t=0;t0){const e=this.first;delete this.items[e.key];if(--this.size===0){this.first=null;this.last=null}else{this.first=e.next;this.first.prev=null}}}expiresAt(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){return this.items[e].expiry}}get(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){const t=this.items[e];if(this.ttl>0&&t.expiry<=Date.now()){this.delete(e);return}this.bumpLru(t);return t.value}}getMany(e){const t=[];for(var i=0;i0?Date.now()+this.ttl:this.ttl;if(this.last!==i){this.bumpLru(i)}return}if(this.max>0&&this.size===this.max){this.evict()}const i={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t};this.items[e]=i;if(++this.size===1){this.first=i}else{this.last.next=i}this.last=i}}class HitStatisticsRecord{constructor(){this.records={}}initForCache(e,t){this.records[e]={[t]:{cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,invalidateOne:0,invalidateAll:0,sets:0}}}resetForCache(e){for(let t of Object.keys(this.records[e])){this.records[e][t]={cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,invalidateOne:0,invalidateAll:0,sets:0}}}getStatistics(){return this.records}}function getTimestamp(e){return`${e.getFullYear()}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")}`}class HitStatistics{constructor(e,t,i){this.cacheId=e;this.statisticTtlInHours=t;this.collectionStart=new Date;this.currentTimeStamp=getTimestamp(this.collectionStart);this.records=i||new HitStatisticsRecord;this.records.initForCache(this.cacheId,this.currentTimeStamp)}get currentRecord(){if(!this.records.records[this.cacheId][this.currentTimeStamp]){this.records.records[this.cacheId][this.currentTimeStamp]={cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,sets:0,invalidateOne:0,invalidateAll:0}}return this.records.records[this.cacheId][this.currentTimeStamp]}hoursPassed(){return(Date.now()-this.collectionStart)/1e3/60/60}addHit(){this.archiveIfNeeded();this.currentRecord.hits++}addFalsyHit(){this.archiveIfNeeded();this.currentRecord.falsyHits++}addEmptyHit(){this.archiveIfNeeded();this.currentRecord.emptyHits++}addMiss(){this.archiveIfNeeded();this.currentRecord.misses++}addEviction(){this.archiveIfNeeded();this.currentRecord.evictions++}setCacheSize(e){this.archiveIfNeeded();this.currentRecord.cacheSize=e}addExpiration(){this.archiveIfNeeded();this.currentRecord.expirations++}addSet(){this.archiveIfNeeded();this.currentRecord.sets++}addInvalidateOne(){this.archiveIfNeeded();this.currentRecord.invalidateOne++}addInvalidateAll(){this.archiveIfNeeded();this.currentRecord.invalidateAll++}getStatistics(){return this.records.getStatistics()}archiveIfNeeded(){if(this.hoursPassed()>=this.statisticTtlInHours){this.collectionStart=new Date;this.currentTimeStamp=getTimestamp(this.collectionStart);this.records.initForCache(this.cacheId,this.currentTimeStamp)}}}class LruObjectHitStatistics extends LruObject{constructor(e,t,i,n,r){super(e||1e3,t||0);if(!i){throw new Error("Cache id is mandatory")}this.hitStatistics=new HitStatistics(i,r!==undefined?r:24,n)}getStatistics(){return this.hitStatistics.getStatistics()}set(e,t){super.set(e,t);this.hitStatistics.addSet();this.hitStatistics.setCacheSize(this.size)}evict(){super.evict();this.hitStatistics.addEviction();this.hitStatistics.setCacheSize(this.size)}delete(e,t=false){super.delete(e);if(!t){this.hitStatistics.addInvalidateOne()}this.hitStatistics.setCacheSize(this.size)}clear(){super.clear();this.hitStatistics.addInvalidateAll();this.hitStatistics.setCacheSize(this.size)}get(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){const t=this.items[e];if(this.ttl>0&&t.expiry<=Date.now()){this.delete(e,true);this.hitStatistics.addExpiration();return}this.bumpLru(t);if(!t.value){this.hitStatistics.addFalsyHit()}if(t.value===undefined||t.value===null||t.value===""){this.hitStatistics.addEmptyHit()}this.hitStatistics.addHit();return t.value}this.hitStatistics.addMiss()}}class FifoObject{constructor(e=1e3,t=0){if(isNaN(e)||e<0){throw new Error("Invalid max value")}if(isNaN(t)||t<0){throw new Error("Invalid ttl value")}this.first=null;this.items=Object.create(null);this.last=null;this.size=0;this.max=e;this.ttl=t}clear(){this.items=Object.create(null);this.first=null;this.last=null;this.size=0}delete(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){const t=this.items[e];delete this.items[e];this.size--;if(t.prev!==null){t.prev.next=t.next}if(t.next!==null){t.next.prev=t.prev}if(this.first===t){this.first=t.next}if(this.last===t){this.last=t.prev}}}deleteMany(e){for(var t=0;t0){const e=this.first;delete this.items[e.key];if(--this.size===0){this.first=null;this.last=null}else{this.first=e.next;this.first.prev=null}}}expiresAt(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){return this.items[e].expiry}}get(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){const t=this.items[e];if(this.ttl>0&&t.expiry<=Date.now()){this.delete(e);return}return t.value}}getMany(e){const t=[];for(var i=0;i0?Date.now()+this.ttl:this.ttl;return}if(this.max>0&&this.size===this.max){this.evict()}const i={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t};this.items[e]=i;if(++this.size===1){this.first=i}else{this.last.next=i}this.last=i}}async function getAppAuthentication({appId:e,privateKey:t,timeDifference:i}){try{const n={id:e,privateKey:t};if(i){Object.assign(n,{now:Math.floor(Date.now()/1e3)+i})}const r=await githubAppJwt(n);return{type:"app",token:r.token,appId:r.appId,expiresAt:new Date(r.expiration*1e3).toISOString()}}catch(e){if(t==="-----BEGIN RSA PRIVATE KEY-----"){throw new Error("The 'privateKey` option contains only the first line '-----BEGIN RSA PRIVATE KEY-----'. If you are setting it using a `.env` file, make sure it is set on a single line with newlines replaced by '\n'")}else{throw e}}}function getCache(){return new LruObject(15e3,1e3*60*59)}async function dist_node_get(e,t){const i=optionsToCacheKey(t);const n=await e.get(i);if(!n){return}const[r,s,o,a,l,p]=n.split("|");const c=t.permissions||l.split(/,/).reduce(((e,t)=>{if(/!$/.test(t)){e[t.slice(0,-1)]="write"}else{e[t]="read"}return e}),{});return{token:r,createdAt:s,expiresAt:o,permissions:c,repositoryIds:t.repositoryIds,repositoryNames:t.repositoryNames,singleFileName:p,repositorySelection:a}}async function dist_node_set(e,t,i){const n=optionsToCacheKey(t);const r=t.permissions?"":Object.keys(i.permissions).map((e=>`${e}${i.permissions[e]==="write"?"!":""}`)).join(",");const s=[i.token,i.createdAt,i.expiresAt,i.repositorySelection,r,i.singleFileName].join("|");await e.set(n,s)}function optionsToCacheKey({installationId:e,permissions:t={},repositoryIds:i=[],repositoryNames:n=[]}){const r=Object.keys(t).sort().map((e=>t[e]==="read"?e:`${e}!`)).join(",");const s=i.sort().join(",");const o=n.join(",");return[e,s,o,r].filter(Boolean).join("|")}function toTokenAuthentication({installationId:e,token:t,createdAt:i,expiresAt:n,repositorySelection:r,permissions:s,repositoryIds:o,repositoryNames:a,singleFileName:l}){return Object.assign({type:"token",tokenType:"installation",token:t,installationId:e,permissions:s,createdAt:i,expiresAt:n,repositorySelection:r},o?{repositoryIds:o}:null,a?{repositoryNames:a}:null,l?{singleFileName:l}:null)}async function getInstallationAuthentication(e,t,i){const n=Number(t.installationId||e.installationId);if(!n){throw new Error("[@octokit/auth-app] installationId option is required for installation authentication.")}if(t.factory){const{type:i,factory:n,oauthApp:r,...s}={...e,...t};return n(s)}const r=i||e.request;return getInstallationAuthenticationConcurrently(e,{...t,installationId:n},r)}var ni=new Map;function getInstallationAuthenticationConcurrently(e,t,i){const n=optionsToCacheKey(t);if(ni.has(n)){return ni.get(n)}const r=getInstallationAuthenticationImpl(e,t,i).finally((()=>ni.delete(n)));ni.set(n,r);return r}async function getInstallationAuthenticationImpl(e,t,i){if(!t.refresh){const i=await dist_node_get(e.cache,t);if(i){const{token:e,createdAt:n,expiresAt:r,permissions:s,repositoryIds:o,repositoryNames:a,singleFileName:l,repositorySelection:p}=i;return toTokenAuthentication({installationId:t.installationId,token:e,createdAt:n,expiresAt:r,permissions:s,repositorySelection:p,repositoryIds:o,repositoryNames:a,singleFileName:l})}}const n=await getAppAuthentication(e);const r={installation_id:t.installationId,mediaType:{previews:["machine-man"]},headers:{authorization:`bearer ${n.token}`}};if(t.repositoryIds){Object.assign(r,{repository_ids:t.repositoryIds})}if(t.repositoryNames){Object.assign(r,{repositories:t.repositoryNames})}if(t.permissions){Object.assign(r,{permissions:t.permissions})}const{data:{token:s,expires_at:o,repositories:a,permissions:l,repository_selection:p,single_file:c}}=await i("POST /app/installations/{installation_id}/access_tokens",r);const d=l||{};const u=p||"all";const A=a?a.map((e=>e.id)):void 0;const f=a?a.map((e=>e.name)):void 0;const h=(new Date).toISOString();const g={token:s,createdAt:h,expiresAt:o,repositorySelection:u,permissions:d,repositoryIds:A,repositoryNames:f};if(c){Object.assign(r,{singleFileName:c})}await dist_node_set(e.cache,t,g);const y={installationId:t.installationId,token:s,createdAt:h,expiresAt:o,repositorySelection:u,permissions:d,repositoryIds:A,repositoryNames:f};if(c){Object.assign(y,{singleFileName:c})}return toTokenAuthentication(y)}async function dist_node_auth(e,t){switch(t.type){case"app":return getAppAuthentication(e);case"oauth-app":return e.oauthApp({type:"oauth-app"});case"installation":t;return getInstallationAuthentication(e,{...t,type:"installation"});case"oauth-user":return e.oauthApp(t);default:throw new Error(`Invalid auth type: ${t.type}`)}}var ri=["/app","/app/hook/config","/app/hook/deliveries","/app/hook/deliveries/{delivery_id}","/app/hook/deliveries/{delivery_id}/attempts","/app/installations","/app/installations/{installation_id}","/app/installations/{installation_id}/access_tokens","/app/installations/{installation_id}/suspended","/app/installation-requests","/marketplace_listing/accounts/{account_id}","/marketplace_listing/plan","/marketplace_listing/plans","/marketplace_listing/plans/{plan_id}/accounts","/marketplace_listing/stubbed/accounts/{account_id}","/marketplace_listing/stubbed/plan","/marketplace_listing/stubbed/plans","/marketplace_listing/stubbed/plans/{plan_id}/accounts","/orgs/{org}/installation","/repos/{owner}/{repo}/installation","/users/{username}/installation"];function dist_node_routeMatcher(e){const t=e.map((e=>e.split("/").map((e=>e.startsWith("{")?"(?:.+?)":e)).join("/")));const i=`^(?:${t.map((e=>`(?:${e})`)).join("|")})$`;return new RegExp(i,"i")}var si=dist_node_routeMatcher(ri);function requiresAppAuth(e){return!!e&&si.test(e.split("?")[0])}var oi=5*1e3;function isNotTimeSkewError(e){return!(e.message.match(/'Expiration time' claim \('exp'\) must be a numeric value representing the future time at which the assertion expires/)||e.message.match(/'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/))}async function dist_node_hook(e,t,i,n){const r=t.endpoint.merge(i,n);const s=r.url;if(/\/login\/oauth\/access_token$/.test(s)){return t(r)}if(requiresAppAuth(s.replace(t.endpoint.DEFAULTS.baseUrl,""))){const{token:i}=await getAppAuthentication(e);r.headers.authorization=`bearer ${i}`;let n;try{n=await t(r)}catch(i){if(isNotTimeSkewError(i)){throw i}if(typeof i.response.headers.date==="undefined"){throw i}const n=Math.floor((Date.parse(i.response.headers.date)-Date.parse((new Date).toString()))/1e3);e.log.warn(i.message);e.log.warn(`[@octokit/auth-app] GitHub API time and system time are different by ${n} seconds. Retrying request with the difference accounted for.`);const{token:s}=await getAppAuthentication({...e,timeDifference:n});r.headers.authorization=`bearer ${s}`;return t(r)}return n}if(requiresBasicAuth(s)){const i=await e.oauthApp({type:"oauth-app"});r.headers.authorization=i.headers.authorization;return t(r)}const{token:o,createdAt:a}=await getInstallationAuthentication(e,{},t.defaults({baseUrl:r.baseUrl}));r.headers.authorization=`token ${o}`;return sendRequestWithRetries(e,t,r,a)}async function sendRequestWithRetries(e,t,i,n,r=0){const s=+new Date-+new Date(n);try{return await t(i)}catch(o){if(o.status!==401){throw o}if(s>=oi){if(r>0){o.message=`After ${r} retries within ${s/1e3}s of creating the installation access token, the response remains 401. At this point, the cause may be an authentication problem or a system outage. Please check https://www.githubstatus.com for status information`}throw o}++r;const a=r*1e3;e.log.warn(`[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${r}, wait: ${a/1e3}s)`);await new Promise((e=>setTimeout(e,a)));return sendRequestWithRetries(e,t,i,n,r)}}var ai="8.0.1";function createAppAuth(e){if(!e.appId){throw new Error("[@octokit/auth-app] appId option is required")}if(!e.privateKey){throw new Error("[@octokit/auth-app] privateKey option is required")}if("installationId"in e&&!e.installationId){throw new Error("[@octokit/auth-app] installationId is set to a falsy value")}const t=Object.assign({warn:console.warn.bind(console)},e.log);const i=e.request||mt.defaults({headers:{"user-agent":`octokit-auth-app.js/${ai} ${getUserAgent()}`}});const n=Object.assign({request:i,cache:getCache()},e,e.installationId?{installationId:Number(e.installationId)}:{},{log:t,oauthApp:createOAuthAppAuth({clientType:"github-app",clientId:e.clientId||"",clientSecret:e.clientSecret||"",request:i})});return Object.assign(dist_node_auth.bind(null,n),{hook:dist_node_hook.bind(null,n)})}async function auth_unauthenticated_dist_node_auth(e){return{type:"unauthenticated",reason:e}}function isRateLimitError(e){if(e.status!==403){return false}if(!e.response){return false}return e.response.headers["x-ratelimit-remaining"]==="0"}var li=/\babuse\b/i;function isAbuseLimitError(e){if(e.status!==403){return false}return li.test(e.message)}async function auth_unauthenticated_dist_node_hook(e,t,i,n){const r=t.endpoint.merge(i,n);return t(r).catch((t=>{if(t.status===404){t.message=`Not found. May be due to lack of authentication. Reason: ${e}`;throw t}if(isRateLimitError(t)){t.message=`API rate limit exceeded. This maybe caused by the lack of authentication. Reason: ${e}`;throw t}if(isAbuseLimitError(t)){t.message=`You have triggered an abuse detection mechanism. This maybe caused by the lack of authentication. Reason: ${e}`;throw t}if(t.status===401){t.message=`Unauthorized. "${r.method} ${r.url}" failed most likely due to lack of authentication. Reason: ${e}`;throw t}if(t.status>=400&&t.status<500){t.message=t.message.replace(/\.?$/,`. May be caused by lack of authentication (${e}).`)}throw t}))}var pi=function createUnauthenticatedAuth2(e){if(!e||!e.reason){throw new Error("[@octokit/auth-unauthenticated] No reason passed to createUnauthenticatedAuth")}return Object.assign(auth_unauthenticated_dist_node_auth.bind(null,e.reason),{hook:auth_unauthenticated_dist_node_hook.bind(null,e.reason)})};var ci="8.0.1";function addEventHandler(e,t,i){if(Array.isArray(t)){for(const n of t){addEventHandler(e,n,i)}return}if(!e.eventHandlers[t]){e.eventHandlers[t]=[]}e.eventHandlers[t].push(i)}var di=dist_src_Octokit.defaults({userAgent:`octokit-oauth-app.js/${ci} ${getUserAgent()}`});async function emitEvent(e,t){const{name:i,action:n}=t;if(e.eventHandlers[`${i}.${n}`]){for(const r of e.eventHandlers[`${i}.${n}`]){await r(t)}}if(e.eventHandlers[i]){for(const n of e.eventHandlers[i]){await n(t)}}}async function getUserOctokitWithState(e,t){return e.octokit.auth({type:"oauth-user",...t,async factory(t){const i=new e.Octokit({authStrategy:createOAuthUserAuth,auth:t});const n=await i.auth({type:"get"});await emitEvent(e,{name:"token",action:"created",token:n.token,scopes:n.scopes,authentication:n,octokit:i});return i}})}function getWebFlowAuthorizationUrlWithState(e,t){const i={clientId:e.clientId,request:e.octokit.request,...t,allowSignup:e.allowSignup??t.allowSignup,redirectUrl:t.redirectUrl??e.redirectUrl,scopes:t.scopes??e.defaultScopes};return getWebFlowAuthorizationUrl({clientType:e.clientType,...i})}async function createTokenWithState(e,t){const i=await e.octokit.auth({type:"oauth-user",...t});await emitEvent(e,{name:"token",action:"created",token:i.token,scopes:i.scopes,authentication:i,octokit:new e.Octokit({authStrategy:createOAuthUserAuth,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:i.token,scopes:i.scopes,refreshToken:i.refreshToken,expiresAt:i.expiresAt,refreshTokenExpiresAt:i.refreshTokenExpiresAt}})});return{authentication:i}}async function checkTokenWithState(e,t){const i=await checkToken({clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t});Object.assign(i.authentication,{type:"token",tokenType:"oauth"});return i}async function resetTokenWithState(e,t){const i={clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t};if(e.clientType==="oauth-app"){const t=await resetToken({clientType:"oauth-app",...i});const n=Object.assign(t.authentication,{type:"token",tokenType:"oauth"});await emitEvent(e,{name:"token",action:"reset",token:t.authentication.token,scopes:t.authentication.scopes||void 0,authentication:n,octokit:new e.Octokit({authStrategy:createOAuthUserAuth,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:t.authentication.token,scopes:t.authentication.scopes}})});return{...t,authentication:n}}const n=await resetToken({clientType:"github-app",...i});const r=Object.assign(n.authentication,{type:"token",tokenType:"oauth"});await emitEvent(e,{name:"token",action:"reset",token:n.authentication.token,authentication:r,octokit:new e.Octokit({authStrategy:createOAuthUserAuth,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:n.authentication.token}})});return{...n,authentication:r}}async function refreshTokenWithState(e,t){if(e.clientType==="oauth-app"){throw new Error("[@octokit/oauth-app] app.refreshToken() is not supported for OAuth Apps")}const i=await refreshToken({clientType:"github-app",clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,refreshToken:t.refreshToken});const n=Object.assign(i.authentication,{type:"token",tokenType:"oauth"});await emitEvent(e,{name:"token",action:"refreshed",token:i.authentication.token,authentication:n,octokit:new e.Octokit({authStrategy:createOAuthUserAuth,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:i.authentication.token}})});return{...i,authentication:n}}async function scopeTokenWithState(e,t){if(e.clientType==="oauth-app"){throw new Error("[@octokit/oauth-app] app.scopeToken() is not supported for OAuth Apps")}const i=await scopeToken({clientType:"github-app",clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t});const n=Object.assign(i.authentication,{type:"token",tokenType:"oauth"});await emitEvent(e,{name:"token",action:"scoped",token:i.authentication.token,authentication:n,octokit:new e.Octokit({authStrategy:createOAuthUserAuth,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:i.authentication.token}})});return{...i,authentication:n}}async function deleteTokenWithState(e,t){const i={clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t};const n=e.clientType==="oauth-app"?await deleteToken({clientType:"oauth-app",...i}):await deleteToken({clientType:"github-app",...i});await emitEvent(e,{name:"token",action:"deleted",token:t.token,octokit:new e.Octokit({authStrategy:pi,auth:{reason:`Handling "token.deleted" event. The access for the token has been revoked.`}})});return n}async function deleteAuthorizationWithState(e,t){const i={clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t};const n=e.clientType==="oauth-app"?await deleteAuthorization({clientType:"oauth-app",...i}):await deleteAuthorization({clientType:"github-app",...i});await emitEvent(e,{name:"token",action:"deleted",token:t.token,octokit:new e.Octokit({authStrategy:pi,auth:{reason:`Handling "token.deleted" event. The access for the token has been revoked.`}})});await emitEvent(e,{name:"authorization",action:"deleted",token:t.token,octokit:new e.Octokit({authStrategy:pi,auth:{reason:`Handling "authorization.deleted" event. The access for the app has been revoked.`}})});return n}function dist_node_unknownRouteResponse(e){return{status:404,headers:{"content-type":"application/json"},text:JSON.stringify({error:`Unknown route: ${e.method} ${e.url}`})}}async function handleRequest(e,{pathPrefix:t="/api/github/oauth"},i){let{pathname:n}=new URL(i.url,"http://localhost");if(!n.startsWith(`${t}/`)){return void 0}if(i.method==="OPTIONS"){return{status:200,headers:{"access-control-allow-origin":"*","access-control-allow-methods":"*","access-control-allow-headers":"Content-Type, User-Agent, Authorization"}}}n=n.slice(t.length+1);const r=[i.method,n].join(" ");const s={getLogin:`GET login`,getCallback:`GET callback`,createToken:`POST token`,getToken:`GET token`,patchToken:`PATCH token`,patchRefreshToken:`PATCH refresh-token`,scopeToken:`POST token/scoped`,deleteToken:`DELETE token`,deleteGrant:`DELETE grant`};if(!Object.values(s).includes(r)){return dist_node_unknownRouteResponse(i)}let o;try{const e=await i.text();o=e?JSON.parse(e):{}}catch(e){return{status:400,headers:{"content-type":"application/json","access-control-allow-origin":"*"},text:JSON.stringify({error:"[@octokit/oauth-app] request error"})}}const{searchParams:a}=new URL(i.url,"http://localhost");const l=Object.fromEntries(a);const p=i.headers;try{if(r===s.getLogin){const t={};if(l.state){Object.assign(t,{state:l.state})}if(l.scopes){Object.assign(t,{scopes:l.scopes.split(",")})}if(l.allowSignup){Object.assign(t,{allowSignup:l.allowSignup==="true"})}if(l.redirectUrl){Object.assign(t,{redirectUrl:l.redirectUrl})}const{url:i}=e.getWebFlowAuthorizationUrl(t);return{status:302,headers:{location:i}}}if(r===s.getCallback){if(l.error){throw new Error(`[@octokit/oauth-app] ${l.error} ${l.error_description}`)}if(!l.code){throw new Error('[@octokit/oauth-app] "code" parameter is required')}const{authentication:{token:t}}=await e.createToken({code:l.code});return{status:200,headers:{"content-type":"text/html"},text:`

Token created successfully

\n\n

Your token is: ${t}. Copy it now as it cannot be shown again.

`}}if(r===s.createToken){const{code:t,redirectUrl:i}=o;if(!t){throw new Error('[@octokit/oauth-app] "code" parameter is required')}const n=await e.createToken({code:t,redirectUrl:i});delete n.authentication.clientSecret;return{status:201,headers:{"content-type":"application/json","access-control-allow-origin":"*"},text:JSON.stringify(n)}}if(r===s.getToken){const t=p.authorization?.substr("token ".length);if(!t){throw new Error('[@octokit/oauth-app] "Authorization" header is required')}const i=await e.checkToken({token:t});delete i.authentication.clientSecret;return{status:200,headers:{"content-type":"application/json","access-control-allow-origin":"*"},text:JSON.stringify(i)}}if(r===s.patchToken){const t=p.authorization?.substr("token ".length);if(!t){throw new Error('[@octokit/oauth-app] "Authorization" header is required')}const i=await e.resetToken({token:t});delete i.authentication.clientSecret;return{status:200,headers:{"content-type":"application/json","access-control-allow-origin":"*"},text:JSON.stringify(i)}}if(r===s.patchRefreshToken){const t=p.authorization?.substr("token ".length);if(!t){throw new Error('[@octokit/oauth-app] "Authorization" header is required')}const{refreshToken:i}=o;if(!i){throw new Error("[@octokit/oauth-app] refreshToken must be sent in request body")}const n=await e.refreshToken({refreshToken:i});delete n.authentication.clientSecret;return{status:200,headers:{"content-type":"application/json","access-control-allow-origin":"*"},text:JSON.stringify(n)}}if(r===s.scopeToken){const t=p.authorization?.substr("token ".length);if(!t){throw new Error('[@octokit/oauth-app] "Authorization" header is required')}const i=await e.scopeToken({token:t,...o});delete i.authentication.clientSecret;return{status:200,headers:{"content-type":"application/json","access-control-allow-origin":"*"},text:JSON.stringify(i)}}if(r===s.deleteToken){const t=p.authorization?.substr("token ".length);if(!t){throw new Error('[@octokit/oauth-app] "Authorization" header is required')}await e.deleteToken({token:t});return{status:204,headers:{"access-control-allow-origin":"*"}}}const t=p.authorization?.substr("token ".length);if(!t){throw new Error('[@octokit/oauth-app] "Authorization" header is required')}await e.deleteAuthorization({token:t});return{status:204,headers:{"access-control-allow-origin":"*"}}}catch(e){return{status:400,headers:{"content-type":"application/json","access-control-allow-origin":"*"},text:JSON.stringify({error:e.message})}}}function parseRequest(e){const{method:t,url:i,headers:n}=e;async function text(){const t=await new Promise(((t,i)=>{let n=[];e.on("error",i).on("data",(e=>n.push(e))).on("end",(()=>t(Buffer.concat(n).toString())))}));return t}return{method:t,url:i,headers:n,text:text}}function sendResponse(e,t){t.writeHead(e.status,e.headers);t.end(e.text)}function createNodeMiddleware(e,t={}){return async function(i,n,r){const s=await parseRequest(i);const o=await handleRequest(e,t,s);if(o){sendResponse(o,n);return true}else{r?.();return false}}}function parseRequest2(e){const t=Object.fromEntries(e.headers.entries());return{method:e.method,url:e.url,headers:t,text:()=>e.text()}}function sendResponse2(e){const t={status:e.status};if(e.headers){Object.assign(t,{headers:e.headers})}return new Response(e.text,t)}function createWebWorkerHandler(e,t={}){return async function(i){const n=await parseRequest2(i);const r=await handleRequest(e,t,n);return r?sendResponse2(r):void 0}}function parseRequest3(e){const{method:t}=e.requestContext.http;let i=e.rawPath;const{stage:n}=e.requestContext;if(i.startsWith("/"+n))i=i.substring(n.length+1);if(e.rawQueryString)i+="?"+e.rawQueryString;const r=e.headers;const text=async()=>e.body||"";return{method:t,url:i,headers:r,text:text}}function sendResponse3(e){return{statusCode:e.status,headers:e.headers,body:e.text}}function createAWSLambdaAPIGatewayV2Handler(e,t={}){return async function(i){const n=parseRequest3(i);const r=await handleRequest(e,t,n);return r?sendResponse3(r):void 0}}var ui=class{static VERSION=ci;static defaults(e){const t=class extends(this){constructor(...t){super({...e,...t[0]})}};return t}constructor(e){const t=e.Octokit||di;this.type=e.clientType||"oauth-app";const i=new t({authStrategy:createOAuthAppAuth,auth:{clientType:this.type,clientId:e.clientId,clientSecret:e.clientSecret}});const n={clientType:this.type,clientId:e.clientId,clientSecret:e.clientSecret,defaultScopes:e.defaultScopes||[],allowSignup:e.allowSignup,baseUrl:e.baseUrl,redirectUrl:e.redirectUrl,log:e.log,Octokit:t,octokit:i,eventHandlers:{}};this.on=addEventHandler.bind(null,n);this.octokit=i;this.getUserOctokit=getUserOctokitWithState.bind(null,n);this.getWebFlowAuthorizationUrl=getWebFlowAuthorizationUrlWithState.bind(null,n);this.createToken=createTokenWithState.bind(null,n);this.checkToken=checkTokenWithState.bind(null,n);this.resetToken=resetTokenWithState.bind(null,n);this.refreshToken=refreshTokenWithState.bind(null,n);this.scopeToken=scopeTokenWithState.bind(null,n);this.deleteToken=deleteTokenWithState.bind(null,n);this.deleteAuthorization=deleteAuthorizationWithState.bind(null,n)}type;on;octokit;getUserOctokit;getWebFlowAuthorizationUrl;createToken;checkToken;resetToken;refreshToken;scopeToken;deleteToken;deleteAuthorization};const Ai=e(import.meta.url)("node:buffer");var fi="6.0.0";async function sign(e,t){if(!e||!t){throw new TypeError("[@octokit/webhooks-methods] secret & payload required for sign()")}if(typeof t!=="string"){throw new TypeError("[@octokit/webhooks-methods] payload must be a string")}const i="sha256";return`${i}=${(0,ii.createHmac)(i,e).update(t).digest("hex")}`}sign.VERSION=fi;async function verify(e,t,i){if(!e||!t||!i){throw new TypeError("[@octokit/webhooks-methods] secret, eventPayload & signature required")}if(typeof t!=="string"){throw new TypeError("[@octokit/webhooks-methods] eventPayload must be a string")}const n=Ai.Buffer.from(i);const r=Ai.Buffer.from(await sign(e,t));if(n.length!==r.length){return false}return(0,ii.timingSafeEqual)(n,r)}verify.VERSION=fi;async function verifyWithFallback(e,t,i,n){const r=await verify(e,t,i);if(r){return true}if(n!==void 0){for(const e of n){const n=await verify(e,t,i);if(n){return n}}}return false}var createLogger=e=>({debug:()=>{},info:()=>{},warn:console.warn.bind(console),error:console.error.bind(console),...e});var hi=["branch_protection_configuration","branch_protection_configuration.disabled","branch_protection_configuration.enabled","branch_protection_rule","branch_protection_rule.created","branch_protection_rule.deleted","branch_protection_rule.edited","check_run","check_run.completed","check_run.created","check_run.requested_action","check_run.rerequested","check_suite","check_suite.completed","check_suite.requested","check_suite.rerequested","code_scanning_alert","code_scanning_alert.appeared_in_branch","code_scanning_alert.closed_by_user","code_scanning_alert.created","code_scanning_alert.fixed","code_scanning_alert.reopened","code_scanning_alert.reopened_by_user","commit_comment","commit_comment.created","create","custom_property","custom_property.created","custom_property.deleted","custom_property.promote_to_enterprise","custom_property.updated","custom_property_values","custom_property_values.updated","delete","dependabot_alert","dependabot_alert.auto_dismissed","dependabot_alert.auto_reopened","dependabot_alert.created","dependabot_alert.dismissed","dependabot_alert.fixed","dependabot_alert.reintroduced","dependabot_alert.reopened","deploy_key","deploy_key.created","deploy_key.deleted","deployment","deployment.created","deployment_protection_rule","deployment_protection_rule.requested","deployment_review","deployment_review.approved","deployment_review.rejected","deployment_review.requested","deployment_status","deployment_status.created","discussion","discussion.answered","discussion.category_changed","discussion.closed","discussion.created","discussion.deleted","discussion.edited","discussion.labeled","discussion.locked","discussion.pinned","discussion.reopened","discussion.transferred","discussion.unanswered","discussion.unlabeled","discussion.unlocked","discussion.unpinned","discussion_comment","discussion_comment.created","discussion_comment.deleted","discussion_comment.edited","fork","github_app_authorization","github_app_authorization.revoked","gollum","installation","installation.created","installation.deleted","installation.new_permissions_accepted","installation.suspend","installation.unsuspend","installation_repositories","installation_repositories.added","installation_repositories.removed","installation_target","installation_target.renamed","issue_comment","issue_comment.created","issue_comment.deleted","issue_comment.edited","issues","issues.assigned","issues.closed","issues.deleted","issues.demilestoned","issues.edited","issues.labeled","issues.locked","issues.milestoned","issues.opened","issues.pinned","issues.reopened","issues.transferred","issues.typed","issues.unassigned","issues.unlabeled","issues.unlocked","issues.unpinned","issues.untyped","label","label.created","label.deleted","label.edited","marketplace_purchase","marketplace_purchase.cancelled","marketplace_purchase.changed","marketplace_purchase.pending_change","marketplace_purchase.pending_change_cancelled","marketplace_purchase.purchased","member","member.added","member.edited","member.removed","membership","membership.added","membership.removed","merge_group","merge_group.checks_requested","merge_group.destroyed","meta","meta.deleted","milestone","milestone.closed","milestone.created","milestone.deleted","milestone.edited","milestone.opened","org_block","org_block.blocked","org_block.unblocked","organization","organization.deleted","organization.member_added","organization.member_invited","organization.member_removed","organization.renamed","package","package.published","package.updated","page_build","personal_access_token_request","personal_access_token_request.approved","personal_access_token_request.cancelled","personal_access_token_request.created","personal_access_token_request.denied","ping","project","project.closed","project.created","project.deleted","project.edited","project.reopened","project_card","project_card.converted","project_card.created","project_card.deleted","project_card.edited","project_card.moved","project_column","project_column.created","project_column.deleted","project_column.edited","project_column.moved","projects_v2","projects_v2.closed","projects_v2.created","projects_v2.deleted","projects_v2.edited","projects_v2.reopened","projects_v2_item","projects_v2_item.archived","projects_v2_item.converted","projects_v2_item.created","projects_v2_item.deleted","projects_v2_item.edited","projects_v2_item.reordered","projects_v2_item.restored","projects_v2_status_update","projects_v2_status_update.created","projects_v2_status_update.deleted","projects_v2_status_update.edited","public","pull_request","pull_request.assigned","pull_request.auto_merge_disabled","pull_request.auto_merge_enabled","pull_request.closed","pull_request.converted_to_draft","pull_request.demilestoned","pull_request.dequeued","pull_request.edited","pull_request.enqueued","pull_request.labeled","pull_request.locked","pull_request.milestoned","pull_request.opened","pull_request.ready_for_review","pull_request.reopened","pull_request.review_request_removed","pull_request.review_requested","pull_request.synchronize","pull_request.unassigned","pull_request.unlabeled","pull_request.unlocked","pull_request_review","pull_request_review.dismissed","pull_request_review.edited","pull_request_review.submitted","pull_request_review_comment","pull_request_review_comment.created","pull_request_review_comment.deleted","pull_request_review_comment.edited","pull_request_review_thread","pull_request_review_thread.resolved","pull_request_review_thread.unresolved","push","registry_package","registry_package.published","registry_package.updated","release","release.created","release.deleted","release.edited","release.prereleased","release.published","release.released","release.unpublished","repository","repository.archived","repository.created","repository.deleted","repository.edited","repository.privatized","repository.publicized","repository.renamed","repository.transferred","repository.unarchived","repository_advisory","repository_advisory.published","repository_advisory.reported","repository_dispatch","repository_dispatch.sample.collected","repository_import","repository_ruleset","repository_ruleset.created","repository_ruleset.deleted","repository_ruleset.edited","repository_vulnerability_alert","repository_vulnerability_alert.create","repository_vulnerability_alert.dismiss","repository_vulnerability_alert.reopen","repository_vulnerability_alert.resolve","secret_scanning_alert","secret_scanning_alert.created","secret_scanning_alert.publicly_leaked","secret_scanning_alert.reopened","secret_scanning_alert.resolved","secret_scanning_alert.validated","secret_scanning_alert_location","secret_scanning_alert_location.created","secret_scanning_scan","secret_scanning_scan.completed","security_advisory","security_advisory.published","security_advisory.updated","security_advisory.withdrawn","security_and_analysis","sponsorship","sponsorship.cancelled","sponsorship.created","sponsorship.edited","sponsorship.pending_cancellation","sponsorship.pending_tier_change","sponsorship.tier_changed","star","star.created","star.deleted","status","sub_issues","sub_issues.parent_issue_added","sub_issues.parent_issue_removed","sub_issues.sub_issue_added","sub_issues.sub_issue_removed","team","team.added_to_repository","team.created","team.deleted","team.edited","team.removed_from_repository","team_add","watch","watch.started","workflow_dispatch","workflow_job","workflow_job.completed","workflow_job.in_progress","workflow_job.queued","workflow_job.waiting","workflow_run","workflow_run.completed","workflow_run.in_progress","workflow_run.requested"];function validateEventName(e,t={}){if(typeof e!=="string"){throw new TypeError("eventName must be of type string")}if(e==="*"){throw new TypeError(`Using the "*" event with the regular Webhooks.on() function is not supported. Please use the Webhooks.onAny() method instead`)}if(e==="error"){throw new TypeError(`Using the "error" event with the regular Webhooks.on() function is not supported. Please use the Webhooks.onError() method instead`)}if(t.onUnknownEventName==="ignore"){return}if(!hi.includes(e)){if(t.onUnknownEventName!=="warn"){throw new TypeError(`"${e}" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`)}else{(t.log||console).warn(`"${e}" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`)}}}function handleEventHandlers(e,t,i){if(!e.hooks[t]){e.hooks[t]=[]}e.hooks[t].push(i)}function receiverOn(e,t,i){if(Array.isArray(t)){t.forEach((t=>receiverOn(e,t,i)));return}validateEventName(t,{onUnknownEventName:"warn",log:e.log});handleEventHandlers(e,t,i)}function receiverOnAny(e,t){handleEventHandlers(e,"*",t)}function receiverOnError(e,t){handleEventHandlers(e,"error",t)}function wrapErrorHandler(e,t){let i;try{i=e(t)}catch(e){console.log('FATAL: Error occurred in "error" event handler');console.log(e)}if(i&&i.catch){i.catch((e=>{console.log('FATAL: Error occurred in "error" event handler');console.log(e)}))}}function getHooks(e,t,i){const n=[e.hooks[i],e.hooks["*"]];if(t){n.unshift(e.hooks[`${i}.${t}`])}return[].concat(...n.filter(Boolean))}function receiverHandle(e,t){const i=e.hooks.error||[];if(t instanceof Error){const e=Object.assign(new AggregateError([t],t.message),{event:t});i.forEach((t=>wrapErrorHandler(t,e)));return Promise.reject(e)}if(!t||!t.name){const e=new Error("Event name not passed");throw new AggregateError([e],e.message)}if(!t.payload){const e=new Error("Event name not passed");throw new AggregateError([e],e.message)}const n=getHooks(e,"action"in t.payload?t.payload.action:null,t.name);if(n.length===0){return Promise.resolve()}const r=[];const s=n.map((i=>{let n=Promise.resolve(t);if(e.transform){n=n.then(e.transform)}return n.then((e=>i(e))).catch((e=>r.push(Object.assign(e,{event:t}))))}));return Promise.all(s).then((()=>{if(r.length===0){return}const e=new AggregateError(r,r.map((e=>e.message)).join("\n"));Object.assign(e,{event:t});i.forEach((t=>wrapErrorHandler(t,e)));throw e}))}function removeListener(e,t,i){if(Array.isArray(t)){t.forEach((t=>removeListener(e,t,i)));return}if(!e.hooks[t]){return}for(let n=e.hooks[t].length-1;n>=0;n--){if(e.hooks[t][n]===i){e.hooks[t].splice(n,1);return}}}function createEventHandler(e){const t={hooks:{},log:createLogger(e&&e.log)};if(e&&e.transform){t.transform=e.transform}return{on:receiverOn.bind(null,t),onAny:receiverOnAny.bind(null,t),onError:receiverOnError.bind(null,t),removeListener:removeListener.bind(null,t),receive:receiverHandle.bind(null,t)}}async function verifyAndReceive(e,t){const i=await verifyWithFallback(e.secret,t.payload,t.signature,e.additionalSecrets).catch((()=>false));if(!i){const i=new Error("[@octokit/webhooks] signature does not match event payload and secret");return e.eventHandler.receive(Object.assign(i,{event:t,status:400}))}let n;try{n=JSON.parse(t.payload)}catch(e){e.message="Invalid JSON";e.status=400;throw new AggregateError([e],e.message)}return e.eventHandler.receive({id:t.id,name:t.name,payload:n})}var mi=/^\s*(application\/json)\s*(?:;|$)/u;var gi=null&&["x-github-event","x-hub-signature-256","x-github-delivery"];function createMiddleware(e){const{handleResponse:t,getRequestHeader:i,getPayload:n}=e;return function middleware(e,r){return async function octokitWebhooksMiddleware(s,o,a){let l;try{l=new URL(s.url,"http://localhost").pathname}catch(e){return t(JSON.stringify({error:`Request URL could not be parsed: ${s.url}`}),422,{"content-type":"application/json"},o)}if(l!==r.path){a?.();return t(null)}else if(s.method!=="POST"){return t(JSON.stringify({error:`Unknown route: ${s.method} ${l}`}),404,{"content-type":"application/json"},o)}const p=i(s,"content-type");if(typeof p!=="string"||!mi.test(p)){return t(JSON.stringify({error:`Unsupported "Content-Type" header value. Must be "application/json"`}),415,{"content-type":"application/json",accept:"application/json"},o)}const c=gi.filter((e=>i(s,e)==void 0)).join(", ");if(c){return t(JSON.stringify({error:`Required headers missing: ${c}`}),400,{"content-type":"application/json",accept:"application/json"},o)}const d=i(s,"x-github-event");const u=i(s,"x-hub-signature-256");const A=i(s,"x-github-delivery");r.log.debug(`${d} event received (id: ${A})`);let f=false;let h;const g=new Promise((e=>{h=setTimeout((()=>{f=true;e(t("still processing\n",202,{"Content-Type":"text/plain",accept:"application/json"},o))}),r.timeout)}));const processWebhook=async()=>{try{const i=await n(s);await e.verifyAndReceive({id:A,name:d,payload:i,signature:u});clearTimeout(h);if(f)return t(null);return t("ok\n",200,{"content-type":"text/plain",accept:"application/json"},o)}catch(e){clearTimeout(h);if(f)return t(null);const i=Array.from(e.errors)[0];const n=i.message?`${i.name}: ${i.message}`:"Error: An Unspecified error occurred";const s=typeof i.status!=="undefined"?i.status:500;r.log.error(e);return t(JSON.stringify({error:n}),s,{"content-type":"application/json",accept:"application/json"},o)}};return await Promise.race([g,processWebhook()])}}}function handleResponse(e,t=200,i={},n){if(e===null){return false}i["content-length"]=e.length.toString();n.writeHead(t,i).end(e);return true}function getRequestHeader(e,t){return e.headers[t]}function concatUint8Array(e){if(e.length===0){return new Uint8Array(0)}let t=0;for(let i=0;i{let n=[];e.on("error",(e=>i(new AggregateError([e],e.message))));e.on("data",n.push.bind(n));e.on("end",(()=>{const e=concatUint8Array(n);queueMicrotask((()=>t(e)))}))}))}function dist_bundle_createNodeMiddleware(e,{path:t="/api/github/webhooks",log:i=createLogger(),timeout:n=9e3}={}){return createMiddleware({handleResponse:handleResponse,getRequestHeader:getRequestHeader,getPayload:getPayload})(e,{path:t,log:i,timeout:n})}function getPayload2(e){return e.text()}function getRequestHeader2(e,t){return e.headers.get(t)}function handleResponse2(e,t=200,i={}){if(e!==null){i["content-length"]=e.length.toString()}return new Response(e,{status:t,headers:i})}function createWebMiddleware(e,{path:t="/api/github/webhooks",log:i=createLogger(),timeout:n=9e3}={}){return createMiddleware({handleResponse:handleResponse2,getRequestHeader:getRequestHeader2,getPayload:getPayload2})(e,{path:t,log:i,timeout:n})}var Ii=class{sign;verify;on;onAny;onError;removeListener;receive;verifyAndReceive;constructor(e){if(!e||!e.secret){throw new Error("[@octokit/webhooks] options.secret required")}const t={eventHandler:createEventHandler(e),secret:e.secret,additionalSecrets:e.additionalSecrets,hooks:{},log:createLogger(e.log)};this.sign=sign.bind(null,e.secret);this.verify=verify.bind(null,e.secret);this.on=t.eventHandler.on;this.onAny=t.eventHandler.onAny;this.onError=t.eventHandler.onError;this.removeListener=t.eventHandler.removeListener;this.receive=t.eventHandler.receive;this.verifyAndReceive=verifyAndReceive.bind(null,t)}};var Ei="16.0.1";function webhooks(e,t){return new Ii({secret:t.secret,transform:async t=>{if(!("installation"in t.payload)||typeof t.payload.installation!=="object"){const i=new e.constructor({authStrategy:pi,auth:{reason:`"installation" key missing in webhook event payload`}});return{...t,octokit:i}}const i=t.payload.installation.id;const n=await e.auth({type:"installation",installationId:i,factory(e){return new e.octokit.constructor({...e.octokitOptions,authStrategy:createAppAuth,...{auth:{...e,installationId:i}}})}});n.hook.before("request",(e=>{e.headers["x-github-delivery"]=t.id}));return{...t,octokit:n}}})}async function getInstallationOctokit(e,t){return e.octokit.auth({type:"installation",installationId:t,factory(e){const i={...e.octokitOptions,authStrategy:createAppAuth,...{auth:{...e,installationId:t}}};return new e.octokit.constructor(i)}})}function eachInstallationFactory(e){return Object.assign(eachInstallation.bind(null,e),{iterator:eachInstallationIterator.bind(null,e)})}async function eachInstallation(e,t){const i=eachInstallationIterator(e)[Symbol.asyncIterator]();let n=await i.next();while(!n.done){await t(n.value);n=await i.next()}}function eachInstallationIterator(e){return{async*[Symbol.asyncIterator](){const t=xt.iterator(e.octokit,"GET /app/installations");for await(const{data:i}of t){for(const t of i){const i=await getInstallationOctokit(e,t.id);yield{octokit:i,installation:t}}}}}}function eachRepositoryFactory(e){return Object.assign(eachRepository.bind(null,e),{iterator:eachRepositoryIterator.bind(null,e)})}async function eachRepository(e,t,i){const n=eachRepositoryIterator(e,i?t:void 0)[Symbol.asyncIterator]();let r=await n.next();while(!r.done){if(i){await i(r.value)}else{await t(r.value)}r=await n.next()}}function singleInstallationIterator(e,t){return{async*[Symbol.asyncIterator](){yield{octokit:await e.getInstallationOctokit(t)}}}}function eachRepositoryIterator(e,t){return{async*[Symbol.asyncIterator](){const i=t?singleInstallationIterator(e,t.installationId):e.eachInstallation.iterator();for await(const{octokit:e}of i){const t=xt.iterator(e,"GET /installation/repositories");for await(const{data:i}of t){for(const t of i){yield{octokit:e,repository:t}}}}}}}function getInstallationUrlFactory(e){let t;return async function getInstallationUrl(i={}){if(!t){t=getInstallationUrlBase(e)}const n=await t;const r=new URL(n);if(i.target_id!==void 0){r.pathname+="/permissions";r.searchParams.append("target_id",i.target_id.toFixed())}if(i.state!==void 0){r.searchParams.append("state",i.state)}return r.href}}async function getInstallationUrlBase(e){const{data:t}=await e.octokit.request("GET /app");if(!t){throw new Error("[@octokit/app] unable to fetch metadata for app")}return`${t.html_url}/installations/new`}function dist_node_noop(){}function dist_node_createNodeMiddleware(e,t={}){const i=Object.assign({debug:dist_node_noop,info:dist_node_noop,warn:console.warn.bind(console),error:console.error.bind(console)},t.log);const n={pathPrefix:"/api/github",...t,log:i};const r=webhooksNodeMiddleware(e.webhooks,{path:n.pathPrefix+"/webhooks",log:i});const s=oauthNodeMiddleware(e.oauth,{pathPrefix:n.pathPrefix+"/oauth"});return middleware.bind(null,n.pathPrefix,r,s)}async function middleware(e,t,i,n,r,s){const{pathname:o}=new URL(n.url,"http://localhost");if(o.startsWith(`${e}/`)){if(o===`${e}/webhooks`){t(n,r)}else if(o.startsWith(`${e}/oauth/`)){i(n,r)}else{sendNodeResponse(unknownRouteResponse(n),r)}return true}else{s?.();return false}}var Ci=class{static VERSION=Ei;static defaults(e){const t=class extends(this){constructor(...t){super({...e,...t[0]})}};return t}octokit;webhooks;oauth;getInstallationOctokit;eachInstallation;eachRepository;getInstallationUrl;log;constructor(e){const t=e.Octokit||dist_src_Octokit;const i=Object.assign({appId:e.appId,privateKey:e.privateKey},e.oauth?{clientId:e.oauth.clientId,clientSecret:e.oauth.clientSecret}:{});const n={authStrategy:createAppAuth,auth:i};if("log"in e&&typeof e.log!=="undefined"){n.log=e.log}this.octokit=new t(n);this.log=Object.assign({debug:()=>{},info:()=>{},warn:console.warn.bind(console),error:console.error.bind(console)},e.log);if(e.webhooks){this.webhooks=webhooks(this.octokit,e.webhooks)}else{Object.defineProperty(this,"webhooks",{get(){throw new Error("[@octokit/app] webhooks option not set")}})}if(e.oauth){this.oauth=new ui({...e.oauth,clientType:"github-app",Octokit:t})}else{Object.defineProperty(this,"oauth",{get(){throw new Error("[@octokit/app] oauth.clientId / oauth.clientSecret options are not set")}})}this.getInstallationOctokit=getInstallationOctokit.bind(null,this);this.eachInstallation=eachInstallationFactory(this);this.eachRepository=eachRepositoryFactory(this);this.getInstallationUrl=getInstallationUrlFactory(this)}};var bi="0.0.0-development";var Ti=dist_src_Octokit.plugin(restEndpointMethods,paginateRest,paginateGraphQL,retry,throttling).defaults({userAgent:`octokit.js/${bi}`,throttle:{onRateLimit:onRateLimit,onSecondaryRateLimit:onSecondaryRateLimit}});function onRateLimit(e,t,i){i.log.warn(`Request quota exhausted for request ${t.method} ${t.url}`);if(t.request.retryCount===0){i.log.info(`Retrying after ${e} seconds!`);return true}}function onSecondaryRateLimit(e,t,i){i.log.warn(`SecondaryRateLimit detected for request ${t.method} ${t.url}`);if(t.request.retryCount===0){i.log.info(`Retrying after ${e} seconds!`);return true}}var wi=Ci.defaults({Octokit:Ti});var Ri=ui.defaults({Octokit:Ti});class Context{line=1;lines=[];options={noPrefix:false};constructor(e,t){this.lines=e.split("\n");this.options.noPrefix=!!t?.noPrefix}getCurLine(){return this.lines[this.line-1]}nextLine(){this.line++;return this.getCurLine()}isEof(){return this.line>this.lines.length}}const Bi={Added:"AddedLine",Deleted:"DeletedLine",Unchanged:"UnchangedLine",Message:"MessageLine"};const Qi={Changed:"ChangedFile",Added:"AddedFile",Deleted:"DeletedFile",Renamed:"RenamedFile"};const Di={Index:"index",Old:"old",Copy:"copy",Similarity:"similarity",Dissimilarity:"dissimilarity",Deleted:"deleted",NewFile:"new file",RenameFrom:"rename from",RenameTo:"rename to"};const Si=Object.values(Di);function parseGitDiff(e,t){const i=new Context(e,t);const n=parseFileChanges(i);return{type:"GitDiff",files:n}}function parseFileChanges(e){const t=[];while(!e.isEof()){const i=parseFileChange(e);if(!i){break}t.push(i)}return t}function parseFileChange(e){if(!isComparisonInputLine(e.getCurLine())){return}const t=parseComparisonInputLine(e);let i=false;let n=false;let r=false;let s="";let o="";while(!e.isEof()){const a=parseExtendedHeader(e);if(!a){break}if(a.type===Di.Deleted){i=true;s=t?.from||""}if(a.type===Di.NewFile){n=true;o=t?.to||""}if(a.type===Di.RenameFrom){r=true;s=a.path}if(a.type===Di.RenameTo){r=true;o=a.path}}const a=parseChangeMarkers(e);const l=parseChunks(e);if(i&&l.length&&l[0].type==="BinaryFilesChunk"){return{type:Qi.Deleted,chunks:l,path:l[0].pathBefore}}if(i){return{type:Qi.Deleted,chunks:l,path:a?.deleted||s}}else if(n&&l.length&&l[0].type==="BinaryFilesChunk"){return{type:Qi.Added,chunks:l,path:l[0].pathAfter}}else if(n){return{type:Qi.Added,chunks:l,path:a?.added||o}}else if(r){return{type:Qi.Renamed,pathAfter:o,pathBefore:s,chunks:l}}else if(a){return{type:Qi.Changed,chunks:l,path:a.added}}else if(l.length&&l[0].type==="BinaryFilesChunk"&&l[0].pathAfter){return{type:Qi.Changed,chunks:l,path:l[0].pathAfter}}return}function isComparisonInputLine(e){return e.indexOf("diff")===0}function parseComparisonInputLine(e){const t=e.getCurLine();const[i,n]=t.split(" ").reverse();e.nextLine();if(i&&n){return{from:getFilePath(e,n,"src"),to:getFilePath(e,i,"dst")}}return null}function parseChunks(e){const t=[];while(!e.isEof()){const i=parseChunk(e);if(!i){break}t.push(i)}return t}function parseChunk(e){const t=parseChunkHeader(e);if(!t){return}if(t.type==="Normal"){const i=parseChanges(e,t.fromFileRange,t.toFileRange);return{...t,type:"Chunk",changes:i}}else if(t.type==="Combined"&&t.fromFileRangeA&&t.fromFileRangeB){const i=parseChanges(e,t.fromFileRangeA.startt.startsWith(e)));if(i){e.nextLine()}if(i===Di.RenameFrom||i===Di.RenameTo){return{type:i,path:t.slice(`${i} `.length)}}else if(i){return{type:i}}return null}function parseChunkHeader(e){const t=e.getCurLine();const i=/^@@\s\-(\d+),?(\d+)?\s\+(\d+),?(\d+)?\s@@\s?(.+)?/.exec(t);if(!i){const i=/^@@@\s\-(\d+),?(\d+)?\s\-(\d+),?(\d+)?\s\+(\d+),?(\d+)?\s@@@\s?(.+)?/.exec(t);if(!i){const i=/^Binary\sfiles\s(.*)\sand\s(.*)\sdiffer$/.exec(t);if(i){const[t,n,r]=i;e.nextLine();return{type:"BinaryFiles",fileA:getFilePath(e,n,"src"),fileB:getFilePath(e,r,"dst")}}return null}const[n,r,s,o,a,l,p,c]=i;e.nextLine();return{context:c,type:"Combined",fromFileRangeA:getRange(r,s),fromFileRangeB:getRange(o,a),toFileRange:getRange(l,p)}}const[n,r,s,o,a,l]=i;e.nextLine();return{context:l,type:"Normal",toFileRange:getRange(o,a),fromFileRange:getRange(r,s)}}function getRange(e,t){const i=parseInt(e,10);return{start:i,lines:t===undefined?1:parseInt(t,10)}}function parseChangeMarkers(e){const t=parseMarker(e,"--- ");const i=t?getFilePath(e,t,"src"):t;const n=parseMarker(e,"+++ ");const r=n?getFilePath(e,n,"dst"):n;return r&&i?{added:r,deleted:i}:null}function parseMarker(e,t){const i=e.getCurLine();if(i?.startsWith(t)){e.nextLine();return i.replace(t,"")}return null}const ki={"+":Bi.Added,"-":Bi.Deleted," ":Bi.Unchanged,"\\":Bi.Message};function parseChanges(e,t,i){const n=[];let r=t.start;let s=i.start;while(!e.isEof()){const t=e.getCurLine();const i=getLineType(t);if(!i){break}e.nextLine();let o;const a=t.slice(1);switch(i){case Bi.Added:{o={type:i,lineAfter:s++,content:a};break}case Bi.Deleted:{o={type:i,lineBefore:r++,content:a};break}case Bi.Unchanged:{o={type:i,lineBefore:r++,lineAfter:s++,content:a};break}case Bi.Message:{o={type:i,content:a.trim()};break}}n.push(o)}return n}function getLineType(e){return ki[e[0]]||null}function getFilePath(e,t,i){if(e.options.noPrefix){return t}if(i==="src")return t.replace(/^a\//,"");if(i==="dst")return t.replace(/^b\//,"");throw new Error("Unexpected unreachable code")}const _i=parseGitDiff;function bind_bind(e,t){return function wrap(){return e.apply(t,arguments)}}const{toString:Pi}=Object.prototype;const{getPrototypeOf:xi}=Object;const{iterator:Oi,toStringTag:Vi}=Symbol;const Ui=(e=>t=>{const i=Pi.call(t);return e[i]||(e[i]=i.slice(8,-1).toLowerCase())})(Object.create(null));const kindOfTest=e=>{e=e.toLowerCase();return t=>Ui(t)===e};const typeOfTest=e=>t=>typeof t===e;const{isArray:Ni}=Array;const Fi=typeOfTest("undefined");function isBuffer(e){return e!==null&&!Fi(e)&&e.constructor!==null&&!Fi(e.constructor)&&Mi(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const qi=kindOfTest("ArrayBuffer");function isArrayBufferView(e){let t;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){t=ArrayBuffer.isView(e)}else{t=e&&e.buffer&&qi(e.buffer)}return t}const ji=typeOfTest("string");const Mi=typeOfTest("function");const Li=typeOfTest("number");const utils_isObject=e=>e!==null&&typeof e==="object";const isBoolean=e=>e===true||e===false;const utils_isPlainObject=e=>{if(Ui(e)!=="object"){return false}const t=xi(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Vi in e)&&!(Oi in e)};const Gi=kindOfTest("Date");const Hi=kindOfTest("File");const Wi=kindOfTest("Blob");const Ji=kindOfTest("FileList");const isStream=e=>utils_isObject(e)&&Mi(e.pipe);const isFormData=e=>{let t;return e&&(typeof FormData==="function"&&e instanceof FormData||Mi(e.append)&&((t=Ui(e))==="formdata"||t==="object"&&Mi(e.toString)&&e.toString()==="[object FormData]"))};const Yi=kindOfTest("URLSearchParams");const[zi,Ki,$i,Xi]=["ReadableStream","Request","Response","Headers"].map(kindOfTest);const trim=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach(e,t,{allOwnKeys:i=false}={}){if(e===null||typeof e==="undefined"){return}let n;let r;if(typeof e!=="object"){e=[e]}if(Ni(e)){for(n=0,r=e.length;n0){r=i[n];if(t===r.toLowerCase()){return r}}return null}const Zi=(()=>{if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global})();const isContextDefined=e=>!Fi(e)&&e!==Zi;function utils_merge(){const{caseless:e}=isContextDefined(this)&&this||{};const t={};const assignValue=(i,n)=>{const r=e&&findKey(t,n)||n;if(utils_isPlainObject(t[r])&&utils_isPlainObject(i)){t[r]=utils_merge(t[r],i)}else if(utils_isPlainObject(i)){t[r]=utils_merge({},i)}else if(Ni(i)){t[r]=i.slice()}else{t[r]=i}};for(let e=0,t=arguments.length;e{forEach(t,((t,n)=>{if(i&&Mi(t)){e[n]=bind_bind(t,i)}else{e[n]=t}}),{allOwnKeys:n});return e};const stripBOM=e=>{if(e.charCodeAt(0)===65279){e=e.slice(1)}return e};const inherits=(e,t,i,n)=>{e.prototype=Object.create(t.prototype,n);e.prototype.constructor=e;Object.defineProperty(e,"super",{value:t.prototype});i&&Object.assign(e.prototype,i)};const toFlatObject=(e,t,i,n)=>{let r;let s;let o;const a={};t=t||{};if(e==null)return t;do{r=Object.getOwnPropertyNames(e);s=r.length;while(s-- >0){o=r[s];if((!n||n(o,e,t))&&!a[o]){t[o]=e[o];a[o]=true}}e=i!==false&&xi(e)}while(e&&(!i||i(e,t))&&e!==Object.prototype);return t};const endsWith=(e,t,i)=>{e=String(e);if(i===undefined||i>e.length){i=e.length}i-=t.length;const n=e.indexOf(t,i);return n!==-1&&n===i};const toArray=e=>{if(!e)return null;if(Ni(e))return e;let t=e.length;if(!Li(t))return null;const i=new Array(t);while(t-- >0){i[t]=e[t]}return i};const en=(e=>t=>e&&t instanceof e)(typeof Uint8Array!=="undefined"&&xi(Uint8Array));const forEachEntry=(e,t)=>{const i=e&&e[Oi];const n=i.call(e);let r;while((r=n.next())&&!r.done){const i=r.value;t.call(e,i[0],i[1])}};const matchAll=(e,t)=>{let i;const n=[];while((i=e.exec(t))!==null){n.push(i)}return n};const tn=kindOfTest("HTMLFormElement");const toCamelCase=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function replacer(e,t,i){return t.toUpperCase()+i}));const nn=(({hasOwnProperty:e})=>(t,i)=>e.call(t,i))(Object.prototype);const rn=kindOfTest("RegExp");const reduceDescriptors=(e,t)=>{const i=Object.getOwnPropertyDescriptors(e);const n={};forEach(i,((i,r)=>{let s;if((s=t(i,r,e))!==false){n[r]=s||i}}));Object.defineProperties(e,n)};const freezeMethods=e=>{reduceDescriptors(e,((t,i)=>{if(Mi(e)&&["arguments","caller","callee"].indexOf(i)!==-1){return false}const n=e[i];if(!Mi(n))return;t.enumerable=false;if("writable"in t){t.writable=false;return}if(!t.set){t.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")}}}))};const toObjectSet=(e,t)=>{const i={};const define=e=>{e.forEach((e=>{i[e]=true}))};Ni(e)?define(e):define(String(e).split(t));return i};const utils_noop=()=>{};const toFiniteNumber=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function isSpecCompliantForm(e){return!!(e&&Mi(e.append)&&e[Vi]==="FormData"&&e[Oi])}const toJSONObject=e=>{const t=new Array(10);const visit=(e,i)=>{if(utils_isObject(e)){if(t.indexOf(e)>=0){return}if(!("toJSON"in e)){t[i]=e;const n=Ni(e)?[]:{};forEach(e,((e,t)=>{const r=visit(e,i+1);!Fi(r)&&(n[t]=r)}));t[i]=undefined;return n}}return e};return visit(e,0)};const sn=kindOfTest("AsyncFunction");const isThenable=e=>e&&(utils_isObject(e)||Mi(e))&&Mi(e.then)&&Mi(e.catch);const on=((e,t)=>{if(e){return setImmediate}return t?((e,t)=>{Zi.addEventListener("message",(({source:i,data:n})=>{if(i===Zi&&n===e){t.length&&t.shift()()}}),false);return i=>{t.push(i);Zi.postMessage(e,"*")}})(`axios@${Math.random()}`,[]):e=>setTimeout(e)})(typeof setImmediate==="function",Mi(Zi.postMessage));const an=typeof queueMicrotask!=="undefined"?queueMicrotask.bind(Zi):typeof process!=="undefined"&&process.nextTick||on;const isIterable=e=>e!=null&&Mi(e[Oi]);const ln={isArray:Ni,isArrayBuffer:qi,isBuffer:isBuffer,isFormData:isFormData,isArrayBufferView:isArrayBufferView,isString:ji,isNumber:Li,isBoolean:isBoolean,isObject:utils_isObject,isPlainObject:utils_isPlainObject,isReadableStream:zi,isRequest:Ki,isResponse:$i,isHeaders:Xi,isUndefined:Fi,isDate:Gi,isFile:Hi,isBlob:Wi,isRegExp:rn,isFunction:Mi,isStream:isStream,isURLSearchParams:Yi,isTypedArray:en,isFileList:Ji,forEach:forEach,merge:utils_merge,extend:extend,trim:trim,stripBOM:stripBOM,inherits:inherits,toFlatObject:toFlatObject,kindOf:Ui,kindOfTest:kindOfTest,endsWith:endsWith,toArray:toArray,forEachEntry:forEachEntry,matchAll:matchAll,isHTMLForm:tn,hasOwnProperty:nn,hasOwnProp:nn,reduceDescriptors:reduceDescriptors,freezeMethods:freezeMethods,toObjectSet:toObjectSet,toCamelCase:toCamelCase,noop:utils_noop,toFiniteNumber:toFiniteNumber,findKey:findKey,global:Zi,isContextDefined:isContextDefined,isSpecCompliantForm:isSpecCompliantForm,toJSONObject:toJSONObject,isAsyncFn:sn,isThenable:isThenable,setImmediate:on,asap:an,isIterable:isIterable};function AxiosError(e,t,i,n,r){Error.call(this);if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}else{this.stack=(new Error).stack}this.message=e;this.name="AxiosError";t&&(this.code=t);i&&(this.config=i);n&&(this.request=n);if(r){this.response=r;this.status=r.status?r.status:null}}ln.inherits(AxiosError,Error,{toJSON:function toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ln.toJSONObject(this.config),code:this.code,status:this.status}}});const pn=AxiosError.prototype;const cn={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{cn[e]={value:e}}));Object.defineProperties(AxiosError,cn);Object.defineProperty(pn,"isAxiosError",{value:true});AxiosError.from=(e,t,i,n,r,s)=>{const o=Object.create(pn);ln.toFlatObject(e,o,(function filter(e){return e!==Error.prototype}),(e=>e!=="isAxiosError"));AxiosError.call(o,e.message,t,i,n,r);o.cause=e;o.name=e.name;s&&Object.assign(o,s);return o};const dn=AxiosError;var un=__nccwpck_require__(6454);const An=un;function isVisitable(e){return ln.isPlainObject(e)||ln.isArray(e)}function removeBrackets(e){return ln.endsWith(e,"[]")?e.slice(0,-2):e}function renderKey(e,t,i){if(!e)return t;return e.concat(t).map((function each(e,t){e=removeBrackets(e);return!i&&t?"["+e+"]":e})).join(i?".":"")}function isFlatArray(e){return ln.isArray(e)&&!e.some(isVisitable)}const fn=ln.toFlatObject(ln,{},null,(function filter(e){return/^is[A-Z]/.test(e)}));function toFormData(e,t,i){if(!ln.isObject(e)){throw new TypeError("target must be an object")}t=t||new(An||FormData);i=ln.toFlatObject(i,{metaTokens:true,dots:false,indexes:false},false,(function defined(e,t){return!ln.isUndefined(t[e])}));const n=i.metaTokens;const r=i.visitor||defaultVisitor;const s=i.dots;const o=i.indexes;const a=i.Blob||typeof Blob!=="undefined"&&Blob;const l=a&&ln.isSpecCompliantForm(t);if(!ln.isFunction(r)){throw new TypeError("visitor must be a function")}function convertValue(e){if(e===null)return"";if(ln.isDate(e)){return e.toISOString()}if(ln.isBoolean(e)){return e.toString()}if(!l&&ln.isBlob(e)){throw new dn("Blob is not supported. Use a Buffer instead.")}if(ln.isArrayBuffer(e)||ln.isTypedArray(e)){return l&&typeof Blob==="function"?new Blob([e]):Buffer.from(e)}return e}function defaultVisitor(e,i,r){let a=e;if(e&&!r&&typeof e==="object"){if(ln.endsWith(i,"{}")){i=n?i:i.slice(0,-2);e=JSON.stringify(e)}else if(ln.isArray(e)&&isFlatArray(e)||(ln.isFileList(e)||ln.endsWith(i,"[]"))&&(a=ln.toArray(e))){i=removeBrackets(i);a.forEach((function each(e,n){!(ln.isUndefined(e)||e===null)&&t.append(o===true?renderKey([i],n,s):o===null?i:i+"[]",convertValue(e))}));return false}}if(isVisitable(e)){return true}t.append(renderKey(r,i,s),convertValue(e));return false}const p=[];const c=Object.assign(fn,{defaultVisitor:defaultVisitor,convertValue:convertValue,isVisitable:isVisitable});function build(e,i){if(ln.isUndefined(e))return;if(p.indexOf(e)!==-1){throw Error("Circular reference detected in "+i.join("."))}p.push(e);ln.forEach(e,(function each(e,n){const s=!(ln.isUndefined(e)||e===null)&&r.call(t,e,ln.isString(n)?n.trim():n,i,c);if(s===true){build(e,i?i.concat(n):[n])}}));p.pop()}if(!ln.isObject(e)){throw new TypeError("data must be an object")}build(e);return t}const hn=toFormData;function encode(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function replacer(e){return t[e]}))}function AxiosURLSearchParams(e,t){this._pairs=[];e&&hn(e,this,t)}const mn=AxiosURLSearchParams.prototype;mn.append=function append(e,t){this._pairs.push([e,t])};mn.toString=function toString(e){const t=e?function(t){return e.call(this,t,encode)}:encode;return this._pairs.map((function each(e){return t(e[0])+"="+t(e[1])}),"").join("&")};const gn=AxiosURLSearchParams;function buildURL_encode(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(e,t,i){if(!t){return e}const n=i&&i.encode||buildURL_encode;if(ln.isFunction(i)){i={serialize:i}}const r=i&&i.serialize;let s;if(r){s=r(t,i)}else{s=ln.isURLSearchParams(t)?t.toString():new gn(t,i).toString(n)}if(s){const t=e.indexOf("#");if(t!==-1){e=e.slice(0,t)}e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class InterceptorManager{constructor(){this.handlers=[]}use(e,t,i){this.handlers.push({fulfilled:e,rejected:t,synchronous:i?i.synchronous:false,runWhen:i?i.runWhen:null});return this.handlers.length-1}eject(e){if(this.handlers[e]){this.handlers[e]=null}}clear(){if(this.handlers){this.handlers=[]}}forEach(e){ln.forEach(this.handlers,(function forEachHandler(t){if(t!==null){e(t)}}))}}const yn=InterceptorManager;const vn={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};var In=__nccwpck_require__(6982);var En=__nccwpck_require__(7016);const Cn=En.URLSearchParams;const bn="abcdefghijklmnopqrstuvwxyz";const Tn="0123456789";const wn={DIGIT:Tn,ALPHA:bn,ALPHA_DIGIT:bn+bn.toUpperCase()+Tn};const generateString=(e=16,t=wn.ALPHA_DIGIT)=>{let i="";const{length:n}=t;const r=new Uint32Array(e);In.randomFillSync(r);for(let s=0;stypeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function")();const kn=Bn&&window.location.href||"http://localhost";const _n={...r,...Rn};function toURLEncodedForm(e,t){return hn(e,new _n.classes.URLSearchParams,Object.assign({visitor:function(e,t,i,n){if(_n.isNode&&ln.isBuffer(e)){this.append(t,e.toString("base64"));return false}return n.defaultVisitor.apply(this,arguments)}},t))}function parsePropPath(e){return ln.matchAll(/\w+|\[(\w*)]/g,e).map((e=>e[0]==="[]"?"":e[1]||e[0]))}function arrayToObject(e){const t={};const i=Object.keys(e);let n;const r=i.length;let s;for(n=0;n=e.length;r=!r&&ln.isArray(i)?i.length:r;if(o){if(ln.hasOwnProp(i,r)){i[r]=[i[r],t]}else{i[r]=t}return!s}if(!i[r]||!ln.isObject(i[r])){i[r]=[]}const a=buildPath(e,t,i[r],n);if(a&&ln.isArray(i[r])){i[r]=arrayToObject(i[r])}return!s}if(ln.isFormData(e)&&ln.isFunction(e.entries)){const t={};ln.forEachEntry(e,((e,i)=>{buildPath(parsePropPath(e),i,t,0)}));return t}return null}const Pn=formDataToJSON;function stringifySafely(e,t,i){if(ln.isString(e)){try{(t||JSON.parse)(e);return ln.trim(e)}catch(e){if(e.name!=="SyntaxError"){throw e}}}return(i||JSON.stringify)(e)}const xn={transitional:vn,adapter:["xhr","http","fetch"],transformRequest:[function transformRequest(e,t){const i=t.getContentType()||"";const n=i.indexOf("application/json")>-1;const r=ln.isObject(e);if(r&&ln.isHTMLForm(e)){e=new FormData(e)}const s=ln.isFormData(e);if(s){return n?JSON.stringify(Pn(e)):e}if(ln.isArrayBuffer(e)||ln.isBuffer(e)||ln.isStream(e)||ln.isFile(e)||ln.isBlob(e)||ln.isReadableStream(e)){return e}if(ln.isArrayBufferView(e)){return e.buffer}if(ln.isURLSearchParams(e)){t.setContentType("application/x-www-form-urlencoded;charset=utf-8",false);return e.toString()}let o;if(r){if(i.indexOf("application/x-www-form-urlencoded")>-1){return toURLEncodedForm(e,this.formSerializer).toString()}if((o=ln.isFileList(e))||i.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return hn(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}if(r||n){t.setContentType("application/json",false);return stringifySafely(e)}return e}],transformResponse:[function transformResponse(e){const t=this.transitional||xn.transitional;const i=t&&t.forcedJSONParsing;const n=this.responseType==="json";if(ln.isResponse(e)||ln.isReadableStream(e)){return e}if(e&&ln.isString(e)&&(i&&!this.responseType||n)){const i=t&&t.silentJSONParsing;const r=!i&&n;try{return JSON.parse(e)}catch(e){if(r){if(e.name==="SyntaxError"){throw dn.from(e,dn.ERR_BAD_RESPONSE,this,null,this.response)}throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_n.classes.FormData,Blob:_n.classes.Blob},validateStatus:function validateStatus(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":undefined}}};ln.forEach(["delete","get","head","post","put","patch"],(e=>{xn.headers[e]={}}));const On=xn;const Vn=ln.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const parseHeaders=e=>{const t={};let i;let n;let r;e&&e.split("\n").forEach((function parser(e){r=e.indexOf(":");i=e.substring(0,r).trim().toLowerCase();n=e.substring(r+1).trim();if(!i||t[i]&&Vn[i]){return}if(i==="set-cookie"){if(t[i]){t[i].push(n)}else{t[i]=[n]}}else{t[i]=t[i]?t[i]+", "+n:n}}));return t};const Un=Symbol("internals");function normalizeHeader(e){return e&&String(e).trim().toLowerCase()}function normalizeValue(e){if(e===false||e==null){return e}return ln.isArray(e)?e.map(normalizeValue):String(e)}function parseTokens(e){const t=Object.create(null);const i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;while(n=i.exec(e)){t[n[1]]=n[2]}return t}const isValidHeaderName=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function matchHeaderValue(e,t,i,n,r){if(ln.isFunction(n)){return n.call(this,t,i)}if(r){t=i}if(!ln.isString(t))return;if(ln.isString(n)){return t.indexOf(n)!==-1}if(ln.isRegExp(n)){return n.test(t)}}function formatHeader(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,i)=>t.toUpperCase()+i))}function buildAccessors(e,t){const i=ln.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+i,{value:function(e,i,r){return this[n].call(this,t,e,i,r)},configurable:true})}))}class AxiosHeaders{constructor(e){e&&this.set(e)}set(e,t,i){const n=this;function setHeader(e,t,i){const r=normalizeHeader(t);if(!r){throw new Error("header name must be a non-empty string")}const s=ln.findKey(n,r);if(!s||n[s]===undefined||i===true||i===undefined&&n[s]!==false){n[s||t]=normalizeValue(e)}}const setHeaders=(e,t)=>ln.forEach(e,((e,i)=>setHeader(e,i,t)));if(ln.isPlainObject(e)||e instanceof this.constructor){setHeaders(e,t)}else if(ln.isString(e)&&(e=e.trim())&&!isValidHeaderName(e)){setHeaders(parseHeaders(e),t)}else if(ln.isObject(e)&&ln.isIterable(e)){let i={},n,r;for(const t of e){if(!ln.isArray(t)){throw TypeError("Object iterator must return a key-value pair")}i[r=t[0]]=(n=i[r])?ln.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}setHeaders(i,t)}else{e!=null&&setHeader(t,e,i)}return this}get(e,t){e=normalizeHeader(e);if(e){const i=ln.findKey(this,e);if(i){const e=this[i];if(!t){return e}if(t===true){return parseTokens(e)}if(ln.isFunction(t)){return t.call(this,e,i)}if(ln.isRegExp(t)){return t.exec(e)}throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){e=normalizeHeader(e);if(e){const i=ln.findKey(this,e);return!!(i&&this[i]!==undefined&&(!t||matchHeaderValue(this,this[i],i,t)))}return false}delete(e,t){const i=this;let n=false;function deleteHeader(e){e=normalizeHeader(e);if(e){const r=ln.findKey(i,e);if(r&&(!t||matchHeaderValue(i,i[r],r,t))){delete i[r];n=true}}}if(ln.isArray(e)){e.forEach(deleteHeader)}else{deleteHeader(e)}return n}clear(e){const t=Object.keys(this);let i=t.length;let n=false;while(i--){const r=t[i];if(!e||matchHeaderValue(this,this[r],r,e,true)){delete this[r];n=true}}return n}normalize(e){const t=this;const i={};ln.forEach(this,((n,r)=>{const s=ln.findKey(i,r);if(s){t[s]=normalizeValue(n);delete t[r];return}const o=e?formatHeader(r):String(r).trim();if(o!==r){delete t[r]}t[o]=normalizeValue(n);i[o]=true}));return this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);ln.forEach(this,((i,n)=>{i!=null&&i!==false&&(t[n]=e&&ln.isArray(i)?i.join(", "):i)}));return t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);t.forEach((e=>i.set(e)));return i}static accessor(e){const t=this[Un]=this[Un]={accessors:{}};const i=t.accessors;const n=this.prototype;function defineAccessor(e){const t=normalizeHeader(e);if(!i[t]){buildAccessors(n,e);i[t]=true}}ln.isArray(e)?e.forEach(defineAccessor):defineAccessor(e);return this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ln.reduceDescriptors(AxiosHeaders.prototype,(({value:e},t)=>{let i=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[i]=e}}}));ln.freezeMethods(AxiosHeaders);const Nn=AxiosHeaders;function transformData(e,t){const i=this||On;const n=t||i;const r=Nn.from(n.headers);let s=n.data;ln.forEach(e,(function transform(e){s=e.call(i,s,r.normalize(),t?t.status:undefined)}));r.normalize();return s}function isCancel(e){return!!(e&&e.__CANCEL__)}function CanceledError(e,t,i){dn.call(this,e==null?"canceled":e,dn.ERR_CANCELED,t,i);this.name="CanceledError"}ln.inherits(CanceledError,dn,{__CANCEL__:true});const Fn=CanceledError;function settle(e,t,i){const n=i.config.validateStatus;if(!i.status||!n||n(i.status)){e(i)}else{t(new dn("Request failed with status code "+i.status,[dn.ERR_BAD_REQUEST,dn.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}}function isAbsoluteURL(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function combineURLs(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function buildFullPath(e,t,i){let n=!isAbsoluteURL(t);if(e&&(n||i==false)){return combineURLs(e,t)}return t}var qn=__nccwpck_require__(7777);var jn=__nccwpck_require__(8611);var Mn=__nccwpck_require__(5692);var Ln=__nccwpck_require__(1573);var Gn=__nccwpck_require__(3106);const Hn="1.10.0";function parseProtocol(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}const Wn=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function fromDataURI(e,t,i){const n=i&&i.Blob||_n.classes.Blob;const r=parseProtocol(e);if(t===undefined&&n){t=true}if(r==="data"){e=r.length?e.slice(r.length+1):e;const i=Wn.exec(e);if(!i){throw new dn("Invalid URL",dn.ERR_INVALID_URL)}const s=i[1];const o=i[2];const a=i[3];const l=Buffer.from(decodeURIComponent(a),o?"base64":"utf8");if(t){if(!n){throw new dn("Blob is not supported",dn.ERR_NOT_SUPPORT)}return new n([l],{type:s})}return l}throw new dn("Unsupported protocol "+r,dn.ERR_NOT_SUPPORT)}var Jn=__nccwpck_require__(2203);const Yn=Symbol("internals");class AxiosTransformStream extends Jn.Transform{constructor(e){e=ln.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,((e,t)=>!ln.isUndefined(t[e])));super({readableHighWaterMark:e.chunkSize});const t=this[Yn]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:false,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",(e=>{if(e==="progress"){if(!t.isCaptured){t.isCaptured=true}}}))}_read(e){const t=this[Yn];if(t.onReadCallback){t.onReadCallback()}return super._read(e)}_transform(e,t,i){const n=this[Yn];const r=n.maxRate;const s=this.readableHighWaterMark;const o=n.timeWindow;const a=1e3/o;const l=r/a;const p=n.minChunkSize!==false?Math.max(n.minChunkSize,l*.01):0;const pushChunk=(e,t)=>{const i=Buffer.byteLength(e);n.bytesSeen+=i;n.bytes+=i;n.isCaptured&&this.emit("progress",n.bytesSeen);if(this.push(e)){process.nextTick(t)}else{n.onReadCallback=()=>{n.onReadCallback=null;process.nextTick(t)}}};const transformChunk=(e,t)=>{const i=Buffer.byteLength(e);let a=null;let c=s;let d;let u=0;if(r){const e=Date.now();if(!n.ts||(u=e-n.ts)>=o){n.ts=e;d=l-n.bytes;n.bytes=d<0?-d:0;u=0}d=l-n.bytes}if(r){if(d<=0){return setTimeout((()=>{t(null,e)}),o-u)}if(dc&&i-c>p){a=e.subarray(c);e=e.subarray(0,c)}pushChunk(e,a?()=>{process.nextTick(t,null,a)}:t)};transformChunk(e,(function transformNextChunk(e,t){if(e){return i(e)}if(t){transformChunk(t,transformNextChunk)}else{i(null)}}))}}const zn=AxiosTransformStream;var Kn=__nccwpck_require__(4434);const{asyncIterator:$n}=Symbol;const readBlob=async function*(e){if(e.stream){yield*e.stream()}else if(e.arrayBuffer){yield await e.arrayBuffer()}else if(e[$n]){yield*e[$n]()}else{yield e}};const Xn=readBlob;const Zn=_n.ALPHABET.ALPHA_DIGIT+"-_";const er=typeof TextEncoder==="function"?new TextEncoder:new b.TextEncoder;const tr="\r\n";const ir=er.encode(tr);const nr=2;class FormDataPart{constructor(e,t){const{escapeName:i}=this.constructor;const n=ln.isString(t);let r=`Content-Disposition: form-data; name="${i(e)}"${!n&&t.name?`; filename="${i(t.name)}"`:""}${tr}`;if(n){t=er.encode(String(t).replace(/\r?\n|\r\n?/g,tr))}else{r+=`Content-Type: ${t.type||"application/octet-stream"}${tr}`}this.headers=er.encode(r+tr);this.contentLength=n?t.byteLength:t.size;this.size=this.headers.byteLength+this.contentLength+nr;this.name=e;this.value=t}async*encode(){yield this.headers;const{value:e}=this;if(ln.isTypedArray(e)){yield e}else{yield*Xn(e)}yield ir}static escapeName(e){return String(e).replace(/[\r\n"]/g,(e=>({"\r":"%0D","\n":"%0A",'"':"%22"}[e])))}}const formDataToStream=(e,t,i)=>{const{tag:n="form-data-boundary",size:r=25,boundary:s=n+"-"+_n.generateString(r,Zn)}=i||{};if(!ln.isFormData(e)){throw TypeError("FormData instance required")}if(s.length<1||s.length>70){throw Error("boundary must be 10-70 characters long")}const o=er.encode("--"+s+tr);const a=er.encode("--"+s+"--"+tr);let l=a.byteLength;const p=Array.from(e.entries()).map((([e,t])=>{const i=new FormDataPart(e,t);l+=i.size;return i}));l+=o.byteLength*p.length;l=ln.toFiniteNumber(l);const c={"Content-Type":`multipart/form-data; boundary=${s}`};if(Number.isFinite(l)){c["Content-Length"]=l}t&&t(c);return Jn.Readable.from(async function*(){for(const e of p){yield o;yield*e.encode()}yield a}())};const rr=formDataToStream;class ZlibHeaderTransformStream extends Jn.Transform{__transform(e,t,i){this.push(e);i()}_transform(e,t,i){if(e.length!==0){this._transform=this.__transform;if(e[0]!==120){const e=Buffer.alloc(2);e[0]=120;e[1]=156;this.push(e,t)}}this.__transform(e,t,i)}}const sr=ZlibHeaderTransformStream;const callbackify=(e,t)=>ln.isAsyncFn(e)?function(...i){const n=i.pop();e.apply(this,i).then((e=>{try{t?n(null,...t(e)):n(null,e)}catch(e){n(e)}}),n)}:e;const or=callbackify;function speedometer(e,t){e=e||10;const i=new Array(e);const n=new Array(e);let r=0;let s=0;let o;t=t!==undefined?t:1e3;return function push(a){const l=Date.now();const p=n[s];if(!o){o=l}i[r]=a;n[r]=l;let c=s;let d=0;while(c!==r){d+=i[c++];c=c%e}r=(r+1)%e;if(r===s){s=(s+1)%e}if(l-o{i=n;r=null;if(s){clearTimeout(s);s=null}e.apply(null,t)};const throttled=(...e)=>{const t=Date.now();const o=t-i;if(o>=n){invoke(e,t)}else{r=e;if(!s){s=setTimeout((()=>{s=null;invoke(r)}),n-o)}}};const flush=()=>r&&invoke(r);return[throttled,flush]}const lr=throttle;const progressEventReducer=(e,t,i=3)=>{let n=0;const r=ar(50,250);return lr((i=>{const s=i.loaded;const o=i.lengthComputable?i.total:undefined;const a=s-n;const l=r(a);const p=s<=o;n=s;const c={loaded:s,total:o,progress:o?s/o:undefined,bytes:a,rate:l?l:undefined,estimated:l&&o&&p?(o-s)/l:undefined,event:i,lengthComputable:o!=null,[t?"download":"upload"]:true};e(c)}),i)};const progressEventDecorator=(e,t)=>{const i=e!=null;return[n=>t[0]({lengthComputable:i,total:e,loaded:n}),t[1]]};const asyncDecorator=e=>(...t)=>ln.asap((()=>e(...t)));const pr={flush:Gn.constants.Z_SYNC_FLUSH,finishFlush:Gn.constants.Z_SYNC_FLUSH};const cr={flush:Gn.constants.BROTLI_OPERATION_FLUSH,finishFlush:Gn.constants.BROTLI_OPERATION_FLUSH};const dr=ln.isFunction(Gn.createBrotliDecompress);const{http:ur,https:Ar}=Ln;const fr=/https:?/;const hr=_n.protocols.map((e=>e+":"));const flushOnFinish=(e,[t,i])=>{e.on("end",i).on("error",i);return t};function dispatchBeforeRedirect(e,t){if(e.beforeRedirects.proxy){e.beforeRedirects.proxy(e)}if(e.beforeRedirects.config){e.beforeRedirects.config(e,t)}}function setProxy(e,t,i){let n=t;if(!n&&n!==false){const e=qn.getProxyForUrl(i);if(e){n=new URL(e)}}if(n){if(n.username){n.auth=(n.username||"")+":"+(n.password||"")}if(n.auth){if(n.auth.username||n.auth.password){n.auth=(n.auth.username||"")+":"+(n.auth.password||"")}const t=Buffer.from(n.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}e.headers.host=e.hostname+(e.port?":"+e.port:"");const t=n.hostname||n.host;e.hostname=t;e.host=t;e.port=n.port;e.path=i;if(n.protocol){e.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`}}e.beforeRedirects.proxy=function beforeRedirect(e){setProxy(e,t,e.href)}}const mr=typeof process!=="undefined"&&ln.kindOf(process)==="process";const wrapAsync=e=>new Promise(((t,i)=>{let n;let r;const done=(e,t)=>{if(r)return;r=true;n&&n(e,t)};const _resolve=e=>{done(e);t(e)};const _reject=e=>{done(e,true);i(e)};e(_resolve,_reject,(e=>n=e)).catch(_reject)}));const resolveFamily=({address:e,family:t})=>{if(!ln.isString(e)){throw TypeError("address must be a string")}return{address:e,family:t||(e.indexOf(".")<0?6:4)}};const buildAddressEntry=(e,t)=>resolveFamily(ln.isObject(e)?e:{address:e,family:t});const gr=mr&&function httpAdapter(e){return wrapAsync((async function dispatchHttpRequest(t,i,n){let{data:r,lookup:s,family:o}=e;const{responseType:a,responseEncoding:l}=e;const p=e.method.toUpperCase();let c;let d=false;let u;if(s){const e=or(s,(e=>ln.isArray(e)?e:[e]));s=(t,i,n)=>{e(t,i,((e,t,r)=>{if(e){return n(e)}const s=ln.isArray(t)?t.map((e=>buildAddressEntry(e))):[buildAddressEntry(t,r)];i.all?n(e,s):n(e,s[0].address,s[0].family)}))}}const A=new Kn.EventEmitter;const onFinished=()=>{if(e.cancelToken){e.cancelToken.unsubscribe(abort)}if(e.signal){e.signal.removeEventListener("abort",abort)}A.removeAllListeners()};n(((e,t)=>{c=true;if(t){d=true;onFinished()}}));function abort(t){A.emit("abort",!t||t.type?new Fn(null,e,u):t)}A.once("abort",i);if(e.cancelToken||e.signal){e.cancelToken&&e.cancelToken.subscribe(abort);if(e.signal){e.signal.aborted?abort():e.signal.addEventListener("abort",abort)}}const f=buildFullPath(e.baseURL,e.url,e.allowAbsoluteUrls);const h=new URL(f,_n.hasBrowserEnv?_n.origin:undefined);const g=h.protocol||hr[0];if(g==="data:"){let n;if(p!=="GET"){return settle(t,i,{status:405,statusText:"method not allowed",headers:{},config:e})}try{n=fromDataURI(e.url,a==="blob",{Blob:e.env&&e.env.Blob})}catch(t){throw dn.from(t,dn.ERR_BAD_REQUEST,e)}if(a==="text"){n=n.toString(l);if(!l||l==="utf8"){n=ln.stripBOM(n)}}else if(a==="stream"){n=Jn.Readable.from(n)}return settle(t,i,{data:n,status:200,statusText:"OK",headers:new Nn,config:e})}if(hr.indexOf(g)===-1){return i(new dn("Unsupported protocol "+g,dn.ERR_BAD_REQUEST,e))}const y=Nn.from(e.headers).normalize();y.set("User-Agent","axios/"+Hn,false);const{onUploadProgress:v,onDownloadProgress:I}=e;const E=e.maxRate;let C=undefined;let T=undefined;if(ln.isSpecCompliantForm(r)){const e=y.getContentType(/boundary=([-_\w\d]{10,70})/i);r=rr(r,(e=>{y.set(e)}),{tag:`axios-${Hn}-boundary`,boundary:e&&e[1]||undefined})}else if(ln.isFormData(r)&&ln.isFunction(r.getHeaders)){y.set(r.getHeaders());if(!y.hasContentLength()){try{const e=await b.promisify(r.getLength).call(r);Number.isFinite(e)&&e>=0&&y.setContentLength(e)}catch(e){}}}else if(ln.isBlob(r)||ln.isFile(r)){r.size&&y.setContentType(r.type||"application/octet-stream");y.setContentLength(r.size||0);r=Jn.Readable.from(Xn(r))}else if(r&&!ln.isStream(r)){if(Buffer.isBuffer(r)){}else if(ln.isArrayBuffer(r)){r=Buffer.from(new Uint8Array(r))}else if(ln.isString(r)){r=Buffer.from(r,"utf-8")}else{return i(new dn("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",dn.ERR_BAD_REQUEST,e))}y.setContentLength(r.length,false);if(e.maxBodyLength>-1&&r.length>e.maxBodyLength){return i(new dn("Request body larger than maxBodyLength limit",dn.ERR_BAD_REQUEST,e))}}const w=ln.toFiniteNumber(y.getContentLength());if(ln.isArray(E)){C=E[0];T=E[1]}else{C=T=E}if(r&&(v||C)){if(!ln.isStream(r)){r=Jn.Readable.from(r,{objectMode:false})}r=Jn.pipeline([r,new zn({maxRate:ln.toFiniteNumber(C)})],ln.noop);v&&r.on("progress",flushOnFinish(r,progressEventDecorator(w,progressEventReducer(asyncDecorator(v),false,3))))}let R=undefined;if(e.auth){const t=e.auth.username||"";const i=e.auth.password||"";R=t+":"+i}if(!R&&h.username){const e=h.username;const t=h.password;R=e+":"+t}R&&y.delete("authorization");let B;try{B=buildURL(h.pathname+h.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){const n=new Error(t.message);n.config=e;n.url=e.url;n.exists=true;return i(n)}y.set("Accept-Encoding","gzip, compress, deflate"+(dr?", br":""),false);const D={path:B,method:p,headers:y.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:R,protocol:g,family:o,beforeRedirect:dispatchBeforeRedirect,beforeRedirects:{}};!ln.isUndefined(s)&&(D.lookup=s);if(e.socketPath){D.socketPath=e.socketPath}else{D.hostname=h.hostname.startsWith("[")?h.hostname.slice(1,-1):h.hostname;D.port=h.port;setProxy(D,e.proxy,g+"//"+h.hostname+(h.port?":"+h.port:"")+D.path)}let S;const k=fr.test(D.protocol);D.agent=k?e.httpsAgent:e.httpAgent;if(e.transport){S=e.transport}else if(e.maxRedirects===0){S=k?Mn:jn}else{if(e.maxRedirects){D.maxRedirects=e.maxRedirects}if(e.beforeRedirect){D.beforeRedirects.config=e.beforeRedirect}S=k?Ar:ur}if(e.maxBodyLength>-1){D.maxBodyLength=e.maxBodyLength}else{D.maxBodyLength=Infinity}if(e.insecureHTTPParser){D.insecureHTTPParser=e.insecureHTTPParser}u=S.request(D,(function handleResponse(n){if(u.destroyed)return;const r=[n];const s=+n.headers["content-length"];if(I||T){const e=new zn({maxRate:ln.toFiniteNumber(T)});I&&e.on("progress",flushOnFinish(e,progressEventDecorator(s,progressEventReducer(asyncDecorator(I),true,3))));r.push(e)}let o=n;const c=n.req||u;if(e.decompress!==false&&n.headers["content-encoding"]){if(p==="HEAD"||n.statusCode===204){delete n.headers["content-encoding"]}switch((n.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":r.push(Gn.createUnzip(pr));delete n.headers["content-encoding"];break;case"deflate":r.push(new sr);r.push(Gn.createUnzip(pr));delete n.headers["content-encoding"];break;case"br":if(dr){r.push(Gn.createBrotliDecompress(cr));delete n.headers["content-encoding"]}}}o=r.length>1?Jn.pipeline(r,ln.noop):r[0];const f=Jn.finished(o,(()=>{f();onFinished()}));const h={status:n.statusCode,statusText:n.statusMessage,headers:new Nn(n.headers),config:e,request:c};if(a==="stream"){h.data=o;settle(t,i,h)}else{const n=[];let r=0;o.on("data",(function handleStreamData(t){n.push(t);r+=t.length;if(e.maxContentLength>-1&&r>e.maxContentLength){d=true;o.destroy();i(new dn("maxContentLength size of "+e.maxContentLength+" exceeded",dn.ERR_BAD_RESPONSE,e,c))}}));o.on("aborted",(function handlerStreamAborted(){if(d){return}const t=new dn("stream has been aborted",dn.ERR_BAD_RESPONSE,e,c);o.destroy(t);i(t)}));o.on("error",(function handleStreamError(t){if(u.destroyed)return;i(dn.from(t,null,e,c))}));o.on("end",(function handleStreamEnd(){try{let e=n.length===1?n[0]:Buffer.concat(n);if(a!=="arraybuffer"){e=e.toString(l);if(!l||l==="utf8"){e=ln.stripBOM(e)}}h.data=e}catch(t){return i(dn.from(t,null,e,h.request,h))}settle(t,i,h)}))}A.once("abort",(e=>{if(!o.destroyed){o.emit("error",e);o.destroy()}}))}));A.once("abort",(e=>{i(e);u.destroy(e)}));u.on("error",(function handleRequestError(t){i(dn.from(t,null,e,u))}));u.on("socket",(function handleRequestSocket(e){e.setKeepAlive(true,1e3*60)}));if(e.timeout){const t=parseInt(e.timeout,10);if(Number.isNaN(t)){i(new dn("error trying to parse `config.timeout` to int",dn.ERR_BAD_OPTION_VALUE,e,u));return}u.setTimeout(t,(function handleRequestTimeout(){if(c)return;let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||vn;if(e.timeoutErrorMessage){t=e.timeoutErrorMessage}i(new dn(t,n.clarifyTimeoutError?dn.ETIMEDOUT:dn.ECONNABORTED,e,u));abort()}))}if(ln.isStream(r)){let t=false;let i=false;r.on("end",(()=>{t=true}));r.once("error",(e=>{i=true;u.destroy(e)}));r.on("close",(()=>{if(!t&&!i){abort(new Fn("Request stream has been aborted",e,u))}}));r.pipe(u)}else{u.end(r)}}))};const yr=null&&setProxy;const vr=_n.hasStandardBrowserEnv?((e,t)=>i=>{i=new URL(i,_n.origin);return e.protocol===i.protocol&&e.host===i.host&&(t||e.port===i.port)})(new URL(_n.origin),_n.navigator&&/(msie|trident)/i.test(_n.navigator.userAgent)):()=>true;const Ir=_n.hasStandardBrowserEnv?{write(e,t,i,n,r,s){const o=[e+"="+encodeURIComponent(t)];ln.isNumber(i)&&o.push("expires="+new Date(i).toGMTString());ln.isString(n)&&o.push("path="+n);ln.isString(r)&&o.push("domain="+r);s===true&&o.push("secure");document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};const headersToObject=e=>e instanceof Nn?{...e}:e;function mergeConfig(e,t){t=t||{};const i={};function getMergedValue(e,t,i,n){if(ln.isPlainObject(e)&&ln.isPlainObject(t)){return ln.merge.call({caseless:n},e,t)}else if(ln.isPlainObject(t)){return ln.merge({},t)}else if(ln.isArray(t)){return t.slice()}return t}function mergeDeepProperties(e,t,i,n){if(!ln.isUndefined(t)){return getMergedValue(e,t,i,n)}else if(!ln.isUndefined(e)){return getMergedValue(undefined,e,i,n)}}function valueFromConfig2(e,t){if(!ln.isUndefined(t)){return getMergedValue(undefined,t)}}function defaultToConfig2(e,t){if(!ln.isUndefined(t)){return getMergedValue(undefined,t)}else if(!ln.isUndefined(e)){return getMergedValue(undefined,e)}}function mergeDirectKeys(i,n,r){if(r in t){return getMergedValue(i,n)}else if(r in e){return getMergedValue(undefined,i)}}const n={url:valueFromConfig2,method:valueFromConfig2,data:valueFromConfig2,baseURL:defaultToConfig2,transformRequest:defaultToConfig2,transformResponse:defaultToConfig2,paramsSerializer:defaultToConfig2,timeout:defaultToConfig2,timeoutMessage:defaultToConfig2,withCredentials:defaultToConfig2,withXSRFToken:defaultToConfig2,adapter:defaultToConfig2,responseType:defaultToConfig2,xsrfCookieName:defaultToConfig2,xsrfHeaderName:defaultToConfig2,onUploadProgress:defaultToConfig2,onDownloadProgress:defaultToConfig2,decompress:defaultToConfig2,maxContentLength:defaultToConfig2,maxBodyLength:defaultToConfig2,beforeRedirect:defaultToConfig2,transport:defaultToConfig2,httpAgent:defaultToConfig2,httpsAgent:defaultToConfig2,cancelToken:defaultToConfig2,socketPath:defaultToConfig2,responseEncoding:defaultToConfig2,validateStatus:mergeDirectKeys,headers:(e,t,i)=>mergeDeepProperties(headersToObject(e),headersToObject(t),i,true)};ln.forEach(Object.keys(Object.assign({},e,t)),(function computeConfigValue(r){const s=n[r]||mergeDeepProperties;const o=s(e[r],t[r],r);ln.isUndefined(o)&&s!==mergeDirectKeys||(i[r]=o)}));return i}const resolveConfig=e=>{const t=mergeConfig({},e);let{data:i,withXSRFToken:n,xsrfHeaderName:r,xsrfCookieName:s,headers:o,auth:a}=t;t.headers=o=Nn.from(o);t.url=buildURL(buildFullPath(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer);if(a){o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")))}let l;if(ln.isFormData(i)){if(_n.hasStandardBrowserEnv||_n.hasStandardBrowserWebWorkerEnv){o.setContentType(undefined)}else if((l=o.getContentType())!==false){const[e,...t]=l?l.split(";").map((e=>e.trim())).filter(Boolean):[];o.setContentType([e||"multipart/form-data",...t].join("; "))}}if(_n.hasStandardBrowserEnv){n&&ln.isFunction(n)&&(n=n(t));if(n||n!==false&&vr(t.url)){const e=r&&s&&Ir.read(s);if(e){o.set(r,e)}}}return t};const Er=typeof XMLHttpRequest!=="undefined";const Cr=Er&&function(e){return new Promise((function dispatchXhrRequest(t,i){const n=resolveConfig(e);let r=n.data;const s=Nn.from(n.headers).normalize();let{responseType:o,onUploadProgress:a,onDownloadProgress:l}=n;let p;let c,d;let u,A;function done(){u&&u();A&&A();n.cancelToken&&n.cancelToken.unsubscribe(p);n.signal&&n.signal.removeEventListener("abort",p)}let f=new XMLHttpRequest;f.open(n.method.toUpperCase(),n.url,true);f.timeout=n.timeout;function onloadend(){if(!f){return}const n=Nn.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders());const r=!o||o==="text"||o==="json"?f.responseText:f.response;const s={data:r,status:f.status,statusText:f.statusText,headers:n,config:e,request:f};settle((function _resolve(e){t(e);done()}),(function _reject(e){i(e);done()}),s);f=null}if("onloadend"in f){f.onloadend=onloadend}else{f.onreadystatechange=function handleLoad(){if(!f||f.readyState!==4){return}if(f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)){return}setTimeout(onloadend)}}f.onabort=function handleAbort(){if(!f){return}i(new dn("Request aborted",dn.ECONNABORTED,e,f));f=null};f.onerror=function handleError(){i(new dn("Network Error",dn.ERR_NETWORK,e,f));f=null};f.ontimeout=function handleTimeout(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const r=n.transitional||vn;if(n.timeoutErrorMessage){t=n.timeoutErrorMessage}i(new dn(t,r.clarifyTimeoutError?dn.ETIMEDOUT:dn.ECONNABORTED,e,f));f=null};r===undefined&&s.setContentType(null);if("setRequestHeader"in f){ln.forEach(s.toJSON(),(function setRequestHeader(e,t){f.setRequestHeader(t,e)}))}if(!ln.isUndefined(n.withCredentials)){f.withCredentials=!!n.withCredentials}if(o&&o!=="json"){f.responseType=n.responseType}if(l){[d,A]=progressEventReducer(l,true);f.addEventListener("progress",d)}if(a&&f.upload){[c,u]=progressEventReducer(a);f.upload.addEventListener("progress",c);f.upload.addEventListener("loadend",u)}if(n.cancelToken||n.signal){p=t=>{if(!f){return}i(!t||t.type?new Fn(null,e,f):t);f.abort();f=null};n.cancelToken&&n.cancelToken.subscribe(p);if(n.signal){n.signal.aborted?p():n.signal.addEventListener("abort",p)}}const h=parseProtocol(n.url);if(h&&_n.protocols.indexOf(h)===-1){i(new dn("Unsupported protocol "+h+":",dn.ERR_BAD_REQUEST,e));return}f.send(r||null)}))};const composeSignals=(e,t)=>{const{length:i}=e=e?e.filter(Boolean):[];if(t||i){let i=new AbortController;let n;const onabort=function(e){if(!n){n=true;unsubscribe();const t=e instanceof Error?e:this.reason;i.abort(t instanceof dn?t:new Fn(t instanceof Error?t.message:t))}};let r=t&&setTimeout((()=>{r=null;onabort(new dn(`timeout ${t} of ms exceeded`,dn.ETIMEDOUT))}),t);const unsubscribe=()=>{if(e){r&&clearTimeout(r);r=null;e.forEach((e=>{e.unsubscribe?e.unsubscribe(onabort):e.removeEventListener("abort",onabort)}));e=null}};e.forEach((e=>e.addEventListener("abort",onabort)));const{signal:s}=i;s.unsubscribe=()=>ln.asap(unsubscribe);return s}};const br=composeSignals;const streamChunk=function*(e,t){let i=e.byteLength;if(!t||i{const r=readBytes(e,t);let s=0;let o;let _onFinish=e=>{if(!o){o=true;n&&n(e)}};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await r.next();if(t){_onFinish();e.close();return}let o=n.byteLength;if(i){let e=s+=o;i(e)}e.enqueue(new Uint8Array(n))}catch(e){_onFinish(e);throw e}},cancel(e){_onFinish(e);return r.return()}},{highWaterMark:2})};const Tr=typeof fetch==="function"&&typeof Request==="function"&&typeof Response==="function";const wr=Tr&&typeof ReadableStream==="function";const Rr=Tr&&(typeof TextEncoder==="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer()));const test=(e,...t)=>{try{return!!e(...t)}catch(e){return false}};const Br=wr&&test((()=>{let e=false;const t=new Request(_n.origin,{body:new ReadableStream,method:"POST",get duplex(){e=true;return"half"}}).headers.has("Content-Type");return e&&!t}));const Qr=64*1024;const Dr=wr&&test((()=>ln.isReadableStream(new Response("").body)));const Sr={stream:Dr&&(e=>e.body)};Tr&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach((t=>{!Sr[t]&&(Sr[t]=ln.isFunction(e[t])?e=>e[t]():(e,i)=>{throw new dn(`Response type '${t}' is not supported`,dn.ERR_NOT_SUPPORT,i)})}))})(new Response);const getBodyLength=async e=>{if(e==null){return 0}if(ln.isBlob(e)){return e.size}if(ln.isSpecCompliantForm(e)){const t=new Request(_n.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}if(ln.isArrayBufferView(e)||ln.isArrayBuffer(e)){return e.byteLength}if(ln.isURLSearchParams(e)){e=e+""}if(ln.isString(e)){return(await Rr(e)).byteLength}};const resolveBodyLength=async(e,t)=>{const i=ln.toFiniteNumber(e.getContentLength());return i==null?getBodyLength(t):i};const kr=Tr&&(async e=>{let{url:t,method:i,data:n,signal:r,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:l,responseType:p,headers:c,withCredentials:d="same-origin",fetchOptions:u}=resolveConfig(e);p=p?(p+"").toLowerCase():"text";let A=br([r,s&&s.toAbortSignal()],o);let f;const h=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let g;try{if(l&&Br&&i!=="get"&&i!=="head"&&(g=await resolveBodyLength(c,n))!==0){let e=new Request(t,{method:"POST",body:n,duplex:"half"});let i;if(ln.isFormData(n)&&(i=e.headers.get("content-type"))){c.setContentType(i)}if(e.body){const[t,i]=progressEventDecorator(g,progressEventReducer(asyncDecorator(l)));n=trackStream(e.body,Qr,t,i)}}if(!ln.isString(d)){d=d?"include":"omit"}const r="credentials"in Request.prototype;f=new Request(t,{...u,signal:A,method:i.toUpperCase(),headers:c.normalize().toJSON(),body:n,duplex:"half",credentials:r?d:undefined});let s=await fetch(f,u);const o=Dr&&(p==="stream"||p==="response");if(Dr&&(a||o&&h)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=s[t]}));const t=ln.toFiniteNumber(s.headers.get("content-length"));const[i,n]=a&&progressEventDecorator(t,progressEventReducer(asyncDecorator(a),true))||[];s=new Response(trackStream(s.body,Qr,i,(()=>{n&&n();h&&h()})),e)}p=p||"text";let y=await Sr[ln.findKey(Sr,p)||"text"](s,e);!o&&h&&h();return await new Promise(((t,i)=>{settle(t,i,{data:y,headers:Nn.from(s.headers),status:s.status,statusText:s.statusText,config:e,request:f})}))}catch(t){h&&h();if(t&&t.name==="TypeError"&&/Load failed|fetch/i.test(t.message)){throw Object.assign(new dn("Network Error",dn.ERR_NETWORK,e,f),{cause:t.cause||t})}throw dn.from(t,t&&t.code,e,f)}});const _r={http:gr,xhr:Cr,fetch:kr};ln.forEach(_r,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const renderReason=e=>`- ${e}`;const isResolvedHandle=e=>ln.isFunction(e)||e===null||e===false;const Pr={getAdapter:e=>{e=ln.isArray(e)?e:[e];const{length:t}=e;let i;let n;const r={};for(let s=0;s`adapter ${e} `+(t===false?"is not supported by the environment":"is not available in the build")));let i=t?e.length>1?"since :\n"+e.map(renderReason).join("\n"):" "+renderReason(e[0]):"as no adapter specified";throw new dn(`There is no suitable adapter to dispatch the request `+i,"ERR_NOT_SUPPORT")}return n},adapters:_r};function throwIfCancellationRequested(e){if(e.cancelToken){e.cancelToken.throwIfRequested()}if(e.signal&&e.signal.aborted){throw new Fn(null,e)}}function dispatchRequest(e){throwIfCancellationRequested(e);e.headers=Nn.from(e.headers);e.data=transformData.call(e,e.transformRequest);if(["post","put","patch"].indexOf(e.method)!==-1){e.headers.setContentType("application/x-www-form-urlencoded",false)}const t=Pr.getAdapter(e.adapter||On.adapter);return t(e).then((function onAdapterResolution(t){throwIfCancellationRequested(e);t.data=transformData.call(e,e.transformResponse,t);t.headers=Nn.from(t.headers);return t}),(function onAdapterRejection(t){if(!isCancel(t)){throwIfCancellationRequested(e);if(t&&t.response){t.response.data=transformData.call(e,e.transformResponse,t.response);t.response.headers=Nn.from(t.response.headers)}}return Promise.reject(t)}))}const xr={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{xr[e]=function validator(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}}));const Or={};xr.transitional=function transitional(e,t,i){function formatMessage(e,t){return"[Axios v"+Hn+"] Transitional option '"+e+"'"+t+(i?". "+i:"")}return(i,n,r)=>{if(e===false){throw new dn(formatMessage(n," has been removed"+(t?" in "+t:"")),dn.ERR_DEPRECATED)}if(t&&!Or[n]){Or[n]=true;console.warn(formatMessage(n," has been deprecated since v"+t+" and will be removed in the near future"))}return e?e(i,n,r):true}};xr.spelling=function spelling(e){return(t,i)=>{console.warn(`${i} is likely a misspelling of ${e}`);return true}};function assertOptions(e,t,i){if(typeof e!=="object"){throw new dn("options must be an object",dn.ERR_BAD_OPTION_VALUE)}const n=Object.keys(e);let r=n.length;while(r-- >0){const s=n[r];const o=t[s];if(o){const t=e[s];const i=t===undefined||o(t,s,e);if(i!==true){throw new dn("option "+s+" must be "+i,dn.ERR_BAD_OPTION_VALUE)}continue}if(i!==true){throw new dn("Unknown option "+s,dn.ERR_BAD_OPTION)}}}const Vr={assertOptions:assertOptions,validators:xr};const Ur=Vr.validators;class Axios{constructor(e){this.defaults=e||{};this.interceptors={request:new yn,response:new yn}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const i=t.stack?t.stack.replace(/^.+\n/,""):"";try{if(!e.stack){e.stack=i}else if(i&&!String(e.stack).endsWith(i.replace(/^.+\n.+\n/,""))){e.stack+="\n"+i}}catch(e){}}throw e}}_request(e,t){if(typeof e==="string"){t=t||{};t.url=e}else{t=e||{}}t=mergeConfig(this.defaults,t);const{transitional:i,paramsSerializer:n,headers:r}=t;if(i!==undefined){Vr.assertOptions(i,{silentJSONParsing:Ur.transitional(Ur.boolean),forcedJSONParsing:Ur.transitional(Ur.boolean),clarifyTimeoutError:Ur.transitional(Ur.boolean)},false)}if(n!=null){if(ln.isFunction(n)){t.paramsSerializer={serialize:n}}else{Vr.assertOptions(n,{encode:Ur.function,serialize:Ur.function},true)}}if(t.allowAbsoluteUrls!==undefined){}else if(this.defaults.allowAbsoluteUrls!==undefined){t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls}else{t.allowAbsoluteUrls=true}Vr.assertOptions(t,{baseUrl:Ur.spelling("baseURL"),withXsrfToken:Ur.spelling("withXSRFToken")},true);t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=r&&ln.merge(r.common,r[t.method]);r&&ln.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete r[e]}));t.headers=Nn.concat(s,r);const o=[];let a=true;this.interceptors.request.forEach((function unshiftRequestInterceptors(e){if(typeof e.runWhen==="function"&&e.runWhen(t)===false){return}a=a&&e.synchronous;o.unshift(e.fulfilled,e.rejected)}));const l=[];this.interceptors.response.forEach((function pushResponseInterceptors(e){l.push(e.fulfilled,e.rejected)}));let p;let c=0;let d;if(!a){const e=[dispatchRequest.bind(this),undefined];e.unshift.apply(e,o);e.push.apply(e,l);d=e.length;p=Promise.resolve(t);while(c{if(!i._listeners)return;let t=i._listeners.length;while(t-- >0){i._listeners[t](e)}i._listeners=null}));this.promise.then=e=>{let t;const n=new Promise((e=>{i.subscribe(e);t=e})).then(e);n.cancel=function reject(){i.unsubscribe(t)};return n};e((function cancel(e,n,r){if(i.reason){return}i.reason=new Fn(e,n,r);t(i.reason)}))}throwIfRequested(){if(this.reason){throw this.reason}}subscribe(e){if(this.reason){e(this.reason);return}if(this._listeners){this._listeners.push(e)}else{this._listeners=[e]}}unsubscribe(e){if(!this._listeners){return}const t=this._listeners.indexOf(e);if(t!==-1){this._listeners.splice(t,1)}}toAbortSignal(){const e=new AbortController;const abort=t=>{e.abort(t)};this.subscribe(abort);e.signal.unsubscribe=()=>this.unsubscribe(abort);return e.signal}static source(){let e;const t=new CancelToken((function executor(t){e=t}));return{token:t,cancel:e}}}const Fr=CancelToken;function spread(e){return function wrap(t){return e.apply(null,t)}}function isAxiosError(e){return ln.isObject(e)&&e.isAxiosError===true}const qr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(qr).forEach((([e,t])=>{qr[t]=e}));const jr=qr;function createInstance(e){const t=new Nr(e);const i=bind_bind(Nr.prototype.request,t);ln.extend(i,Nr.prototype,t,{allOwnKeys:true});ln.extend(i,t,null,{allOwnKeys:true});i.create=function create(t){return createInstance(mergeConfig(e,t))};return i}const Mr=createInstance(On);Mr.Axios=Nr;Mr.CanceledError=Fn;Mr.CancelToken=Fr;Mr.isCancel=isCancel;Mr.VERSION=Hn;Mr.toFormData=hn;Mr.AxiosError=dn;Mr.Cancel=Mr.CanceledError;Mr.all=function all(e){return Promise.all(e)};Mr.spread=spread;Mr.isAxiosError=isAxiosError;Mr.mergeConfig=mergeConfig;Mr.AxiosHeaders=Nn;Mr.formToJSON=e=>Pn(ln.isHTMLForm(e)?new FormData(e):e);Mr.getAdapter=Pr.getAdapter;Mr.HttpStatusCode=jr;Mr.default=Mr;const Lr=Mr;var Gr=undefined&&undefined.__decorate||function(e,t,i,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)if(o=e[a])s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s;return r>3&&s&&Object.defineProperty(t,i,s),s};let Hr=class AxiosWrapper{async getUrl(e){const t=await Lr.get(e);return t.data}};Hr=Gr([(0,a.singleton)()],Hr);const Wr=Hr;var Jr=undefined&&undefined.__decorate||function(e,t,i,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)if(o=e[a])s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s;return r>3&&s&&Object.defineProperty(t,i,s),s};var Yr=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};let zr=class OctokitGitDiffParser{_axiosWrapper;_logger;_firstLineOfFiles=null;constructor(e,t){this._axiosWrapper=e;this._logger=t}async getFirstChangedLine(e,t,i,n,r){this._logger.logDebug("* OctokitGitDiffParser.getFirstChangedLine()");const s=await this.getFirstChangedLines(e,t,i,n);return s.get(r)??null}async getFirstChangedLines(e,t,i,n){this._logger.logDebug("* OctokitGitDiffParser.getFirstChangedLines()");if(this._firstLineOfFiles!==null){return this._firstLineOfFiles}const r=await this.getDiffs(e,t,i,n);this._firstLineOfFiles=this.processDiffs(r);return this._firstLineOfFiles}async getDiffs(e,t,i,n){this._logger.logDebug("* OctokitGitDiffParser.getDiffs()");const r=await e.getPull(t,i,n);const s=await this._axiosWrapper.getUrl(r.data.diff_url);const o=s.split(/^diff --git/gmu);const a=[];for(const e of o.slice(1)){a.push(`diff --git ${e}`)}return a}processDiffs(e){this._logger.logDebug("* OctokitGitDiffParser.processDiffs()");const t=new Map;for(const i of e){const e=_i(i);for(const i of e.files){switch(i.type){case"AddedFile":case"ChangedFile":{const e=i;const[n]=e.chunks;if(n?.type==="BinaryFilesChunk"){this._logger.logDebug(`Skipping '${i.type}' '${e.path}' while performing diff parsing.`);break}if(n){t.set(e.path,n.toFileRange.start)}break}case"RenamedFile":{const e=i;if(e.chunks[0]){t.set(e.pathAfter,e.chunks[0].toFileRange.start)}break}case"DeletedFile":default:this._logger.logDebug(`Skipping file type '${i.type}' while performing diff parsing.`);break}}}return t}};zr=Jr([(0,a.singleton)(),Yr("design:paramtypes",[Wr,L])],zr);const Kr=zr;var $r=undefined&&undefined.__decorate||function(e,t,i,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)if(o=e[a])s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s;return r>3&&s&&Object.defineProperty(t,i,s),s};var Xr=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};let Zr=class OctokitWrapper{_octokitGitDiffParser;_octokit=null;constructor(e){this._octokitGitDiffParser=e}initialize(e){if(this._octokit!==null){throw new Error("OctokitWrapper was already initialized prior to calling OctokitWrapper.initialize().")}this._octokit=new Ti(e)}async getPull(e,t,i){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.getPull().")}return this._octokit.rest.pulls.get({owner:e,pull_number:i,repo:t})}async updatePull(e,t,i,n,r){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.updatePull().")}const s={owner:e,pull_number:i,repo:t};if(n!==null){s.title=n}if(r!==null){s.body=r}return this._octokit.rest.pulls.update(s)}async getIssueComments(e,t,i){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.getIssueComments().")}return this._octokit.rest.issues.listComments({issue_number:i,owner:e,repo:t})}async getReviewComments(e,t,i){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.getReviewComments().")}return this._octokit.rest.pulls.listReviewComments({owner:e,pull_number:i,repo:t})}async createIssueComment(e,t,i,n){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.createIssueComment().")}return this._octokit.rest.issues.createComment({body:n,issue_number:i,owner:e,repo:t})}async listCommits(e,t,i,n){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.listCommits().")}return this._octokit.rest.pulls.listCommits({owner:e,page:n,pull_number:i,repo:t})}async createReviewComment(e,t,i,n,r,s){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.createReviewComment().")}const o=await this._octokitGitDiffParser.getFirstChangedLine(this,e,t,i,r);if(o===null){return null}return this._octokit.rest.pulls.createReviewComment({body:n,commit_id:s,line:o,owner:e,path:r,pull_number:i,repo:t})}async updateIssueComment(e,t,i,n,r){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.updateIssueComment().")}return this._octokit.rest.issues.updateComment({body:r,comment_id:n,issue_number:i,owner:e,repo:t})}async deleteReviewComment(e,t,i){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.deleteReviewComment().")}return this._octokit.rest.pulls.deleteReviewComment({comment_id:i,owner:e,repo:t})}};Zr=$r([(0,a.singleton)(),Xr("design:paramtypes",[Kr])],Zr);const es=Zr;var ts=undefined&&undefined.__decorate||function(e,t,i,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)if(o=e[a])s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s;return r>3&&s&&Object.defineProperty(t,i,s),s};var is=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};let ns=class GitHubReposInvoker extends BaseReposInvoker{_gitInvoker;_logger;_octokitWrapper;_runnerInvoker;_isInitialized=false;_owner="";_repo="";_pullRequestId=0;_commitId="";constructor(e,t,i,n){super();this._gitInvoker=e;this._logger=t;this._octokitWrapper=i;this._runnerInvoker=n}async isAccessTokenAvailable(){this._logger.logDebug("* GitHubReposInvoker.isAccessTokenAvailable()");if(typeof process.env.PR_METRICS_ACCESS_TOKEN==="undefined"){return Promise.resolve(this._runnerInvoker.loc("repos.gitHubReposInvoker.noGitHubAccessToken"))}return Promise.resolve(null)}async getTitleAndDescription(){this._logger.logDebug("* GitHubReposInvoker.getTitleAndDescription()");this.initialize();const e=await this.invokeApiCall((async()=>{const e=await this._octokitWrapper.getPull(this._owner,this._repo,this._pullRequestId);this._logger.logDebug(JSON.stringify(e));return e}));return{description:e.data.body??null,title:e.data.title}}async getComments(){this._logger.logDebug("* GitHubReposInvoker.getComments()");this.initialize();let e=null;let t=null;await Promise.all([this.invokeApiCall((async()=>{e=await this._octokitWrapper.getIssueComments(this._owner,this._repo,this._pullRequestId);this._logger.logDebug(JSON.stringify(e))})),this.invokeApiCall((async()=>{t=await this._octokitWrapper.getReviewComments(this._owner,this._repo,this._pullRequestId);this._logger.logDebug(JSON.stringify(t))}))]);return this.convertPullRequestComments(e,t)}async setTitleAndDescription(e,t){this._logger.logDebug("* GitHubReposInvoker.setTitleAndDescription()");if(e===null&&t===null){return}this.initialize();await this.invokeApiCall((async()=>{const i=await this._octokitWrapper.updatePull(this._owner,this._repo,this._pullRequestId,e,t);this._logger.logDebug(JSON.stringify(i))}))}async createComment(e,t){this._logger.logDebug("* GitHubReposInvoker.createComment()");this.initialize();if(t===null){await this.invokeApiCall((async()=>{const t=await this._octokitWrapper.createIssueComment(this._owner,this._repo,this._pullRequestId,e);this._logger.logDebug(JSON.stringify(t))}))}else{if(this._commitId===""){await this.getCommitId()}await this.invokeApiCall((async()=>{try{const i=await this._octokitWrapper.createReviewComment(this._owner,this._repo,this._pullRequestId,e,t,this._commitId);this._logger.logDebug(JSON.stringify(i))}catch(e){if(e instanceof RequestError&&e.status===We.StatusCodes.UNPROCESSABLE_ENTITY&&e.message.includes("pull_request_review_thread.path diff too large")){this._logger.logInfo("GitHub createReviewComment() threw a 422 error related to a large diff. Ignoring as this is expected.");this._logger.logErrorObject(e)}else{throw e}}}))}}async updateComment(e,t){this._logger.logDebug("* GitHubReposInvoker.updateComment()");if(t===null){return}this.initialize();await this.invokeApiCall((async()=>{const i=await this._octokitWrapper.updateIssueComment(this._owner,this._repo,this._pullRequestId,e,t);this._logger.logDebug(JSON.stringify(i))}))}async deleteCommentThread(e){this._logger.logDebug("* GitHubReposInvoker.deleteCommentThread()");this.initialize();await this.invokeApiCall((async()=>{const t=await this._octokitWrapper.deleteReviewComment(this._owner,this._repo,e);this._logger.logDebug(JSON.stringify(t))}))}async invokeApiCall(e){return BaseReposInvoker.invokeApiCall(e,this._runnerInvoker.loc("repos.gitHubReposInvoker.insufficientGitHubAccessTokenPermissions"))}initialize(){this._logger.logDebug("* GitHubReposInvoker.initialize()");if(this._isInitialized){return}const e={auth:process.env.PR_METRICS_ACCESS_TOKEN,log:{debug:e=>{this._logger.logDebug(`Octokit – ${e}`)},error:e=>{this._logger.logError(`Octokit – ${e}`)},info:e=>{this._logger.logInfo(`Octokit – ${e}`)},warn:e=>{this._logger.logWarning(`Octokit – ${e}`)}},userAgent:"PRMetrics/v1.7.3"};if(N.isGitHub){e.baseUrl=this.initializeForGitHub()}else{e.baseUrl=this.initializeForAzureDevOps()}this._logger.logDebug(`Using Base URL '${converter_toString(e.baseUrl)}'.`);this._octokitWrapper.initialize(e);this._pullRequestId=this._gitInvoker.pullRequestId;this._isInitialized=true}initializeForGitHub(){this._logger.logDebug("* GitHubReposInvoker.initializeForGitHub()");const e=validateVariable("GITHUB_API_URL","GitHubReposInvoker.initializeForGitHub()");this._owner=validateVariable("GITHUB_REPOSITORY_OWNER","GitHubReposInvoker.initializeForGitHub()");const t=validateVariable("GITHUB_REPOSITORY","GitHubReposInvoker.initializeForGitHub()");const i=t.split("/");if(typeof i[1]==="undefined"){throw new Error(`GITHUB_REPOSITORY '${t}' is in an unexpected format.`)}[,this._repo]=i;return e}initializeForAzureDevOps(){this._logger.logDebug("* GitHubReposInvoker.initializeForAzureDevOps()");const e=validateVariable("SYSTEM_PULLREQUEST_SOURCEREPOSITORYURI","GitHubReposInvoker.initializeForAzureDevOps()");const t=e.split("/");if(typeof t[2]==="undefined"||typeof t[3]==="undefined"||typeof t[4]==="undefined"){throw new Error(`SYSTEM_PULLREQUEST_SOURCEREPOSITORYURI '${e}' is in an unexpected format.`)}let i="";let n;[,,n,this._owner,this._repo]=t;if(n!=="github.com"){i=`https://${n}/api/v3`}const r=".git";if(this._repo.endsWith(r)){this._repo=this._repo.substring(0,this._repo.length-r.length)}return i}convertPullRequestComments(e,t){this._logger.logDebug("* GitHubReposInvoker.convertPullRequestComments()");const i=new CommentData;if(e!==null){for(const t of e.data){const e=t.body;if(typeof e!=="undefined"){i.pullRequestComments.push(new PullRequestCommentData(t.id,e))}}}if(t!==null){for(const e of t.data){const t=e.body;const n=e.path;i.fileComments.push(new FileCommentData(e.id,t,n))}}return i}async getCommitId(){this._logger.logDebug("* GitHubReposInvoker.getCommitId()");let e=await this.invokeApiCall((async()=>{const e=await this._octokitWrapper.listCommits(this._owner,this._repo,this._pullRequestId,1);this._logger.logDebug(JSON.stringify(e));return e}));if(typeof e.headers.link!=="undefined"){const t=e.headers.link;const i=/<.+>; rel="next", <.+?page=(?\d+)>; rel="last"/u.exec(t);if(typeof i?.groups?.pageNumber==="undefined"){throw new Error(`The regular expression did not match '${t}'.`)}const n=parseInt(i.groups.pageNumber,G);e=await this.invokeApiCall((async()=>{const e=await this._octokitWrapper.listCommits(this._owner,this._repo,this._pullRequestId,n);this._logger.logDebug(JSON.stringify(e));return e}))}this._commitId=validateString(e.data[e.data.length-1]?.sha,`result.data[${String(e.data.length-1)}].sha`,"GitHubReposInvoker.getCommitId()")}};ns=ts([(0,a.singleton)(),is("design:paramtypes",[z,L,es,N])],ns);const rs=ns;var ss=undefined&&undefined.__decorate||function(e,t,i,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)if(o=e[a])s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s;return r>3&&s&&Object.defineProperty(t,i,s),s};var os=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};let as=class ReposInvoker{_azureReposInvoker;_gitHubReposInvoker;_logger;_reposInvoker=null;constructor(e,t,i){this._azureReposInvoker=e;this._gitHubReposInvoker=t;this._logger=i}async isAccessTokenAvailable(){this._logger.logDebug("* ReposInvoker.isAccessTokenAvailable()");const e=this.getReposInvoker();return e.isAccessTokenAvailable()}async getTitleAndDescription(){this._logger.logDebug("* ReposInvoker.getTitleAndDescription()");const e=this.getReposInvoker();return e.getTitleAndDescription()}async getComments(){this._logger.logDebug("* ReposInvoker.getComments()");const e=this.getReposInvoker();return e.getComments()}async setTitleAndDescription(e,t){this._logger.logDebug("* ReposInvoker.setTitleAndDescription()");const i=this.getReposInvoker();return i.setTitleAndDescription(e,t)}async createComment(e,t,i,n){this._logger.logDebug("* ReposInvoker.createComment()");const r=this.getReposInvoker();return r.createComment(e,t,i,n)}async updateComment(e,t,i){this._logger.logDebug("* ReposInvoker.updateComment()");const n=this.getReposInvoker();return n.updateComment(e,t,i)}async deleteCommentThread(e){this._logger.logDebug("* ReposInvoker.deleteCommentThread()");const t=this.getReposInvoker();return t.deleteCommentThread(e)}getReposInvoker(){this._logger.logDebug("* ReposInvoker.getReposInvoker()");if(this._reposInvoker!==null){return this._reposInvoker}if(N.isGitHub){this._reposInvoker=this._gitHubReposInvoker;return this._reposInvoker}const e=validateVariable("BUILD_REPOSITORY_PROVIDER","ReposInvoker.getReposInvoker()");switch(e){case"TfsGit":this._reposInvoker=this._azureReposInvoker;break;case"GitHub":case"GitHubEnterprise":this._reposInvoker=this._gitHubReposInvoker;break;default:throw new RangeError(`BUILD_REPOSITORY_PROVIDER '${e}' is unsupported.`)}return this._reposInvoker}};as=ss([(0,a.singleton)(),os("design:paramtypes",[tt,rs,L])],as);const ps=as;var cs=undefined&&undefined.__decorate||function(e,t,i,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)if(o=e[a])s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s;return r>3&&s&&Object.defineProperty(t,i,s),s};var ds=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};let us=class PullRequestComments{_codeMetrics;_inputs;_logger;_reposInvoker;_runnerInvoker;constructor(e,t,i,n,r){this._codeMetrics=e;this._inputs=t;this._logger=i;this._reposInvoker=n;this._runnerInvoker=r}get noReviewRequiredComment(){this._logger.logDebug("* PullRequestComments.noReviewRequiredComment");return this._runnerInvoker.loc("pullRequests.pullRequestComments.noReviewRequiredComment")}async getCommentData(){this._logger.logDebug("* PullRequestComments.getCommentData()");const e=await this._codeMetrics.getFilesNotRequiringReview();const t=await this._codeMetrics.getDeletedFilesNotRequiringReview();let i=new PullRequestCommentsData(e,t);const n=await this._reposInvoker.getComments();for(const e of n.pullRequestComments){i=this.getMetricsCommentData(i,e)}for(const e of n.fileComments){i=this.getFilesRequiringCommentUpdates(i,e)}return i}async getMetricsComment(){this._logger.logDebug("* PullRequestComments.getMetricsComment()");const e=await this._codeMetrics.getMetrics();let t=`${this._runnerInvoker.loc("pullRequests.pullRequestComments.commentTitle")}\n`;t+=await this.addCommentSizeStatus();t+=await this.addCommentTestStatus();t+=`||${this._runnerInvoker.loc("pullRequests.pullRequestComments.tableLines")}\n`;t+="-|-:\n";t+=this.addCommentMetrics(this._runnerInvoker.loc("pullRequests.pullRequestComments.tableProductCode"),e.productCode,false);t+=this.addCommentMetrics(this._runnerInvoker.loc("pullRequests.pullRequestComments.tableTestCode"),e.testCode,false);t+=this.addCommentMetrics(this._runnerInvoker.loc("pullRequests.pullRequestComments.tableSubtotal"),e.subtotal,true);t+=this.addCommentMetrics(this._runnerInvoker.loc("pullRequests.pullRequestComments.tableIgnoredCode"),e.ignoredCode,false);t+=this.addCommentMetrics(this._runnerInvoker.loc("pullRequests.pullRequestComments.tableTotal"),e.total,true);t+="\n";t+=this._runnerInvoker.loc("pullRequests.pullRequestComments.commentFooter");return t}async getMetricsCommentStatus(){this._logger.logDebug("* PullRequestComments.getMetricsCommentStatus()");if(this._inputs.alwaysCloseComment){return o.CommentThreadStatus.Closed}if(await this._codeMetrics.isSmall()){const e=await this._codeMetrics.isSufficientlyTested();if(e??true){return o.CommentThreadStatus.Closed}}return o.CommentThreadStatus.Active}getMetricsCommentData(e,t){this._logger.logDebug("* PullRequestComments.getMetricsCommentData()");if(!t.content.startsWith(`${this._runnerInvoker.loc("pullRequests.pullRequestComments.commentTitle")}\n`)){return e}e.metricsCommentThreadId=t.id;e.metricsCommentContent=t.content;e.metricsCommentThreadStatus=t.status;return e}getFilesRequiringCommentUpdates(e,t){this._logger.logDebug("* PullRequestComments.getFilesRequiringCommentUpdates()");if(t.content!==this.noReviewRequiredComment){return e}const i=-1;const n=e.filesNotRequiringReview.indexOf(t.fileName);if(n!==i){e.filesNotRequiringReview.splice(n,1);return e}const r=e.deletedFilesNotRequiringReview.indexOf(t.fileName);if(r!==i){e.deletedFilesNotRequiringReview.splice(r,1);return e}e.commentThreadsRequiringDeletion.push(t.id);return e}async addCommentSizeStatus(){this._logger.logDebug("* PullRequestComments.addCommentSizeStatus()");let e="";if(await this._codeMetrics.isSmall()){e+=this._runnerInvoker.loc("pullRequests.pullRequestComments.smallPullRequestComment")}else{const t=(this._inputs.baseSize*this._inputs.growthRate).toLocaleString();e+=this._runnerInvoker.loc("pullRequests.pullRequestComments.largePullRequestComment",t)}e+="\n";return e}async addCommentTestStatus(){this._logger.logDebug("* PullRequestComments.addCommentTestStatus()");let e="";const t=await this._codeMetrics.isSufficientlyTested();if(t!==null){if(t){e+=this._runnerInvoker.loc("pullRequests.pullRequestComments.testsSufficientComment")}else{e+=this._runnerInvoker.loc("pullRequests.pullRequestComments.testsInsufficientComment")}e+="\n"}return e}addCommentMetrics(e,t,i){this._logger.logDebug("* PullRequestComments.addCommentMetrics()");let n="";if(i){n="**"}let r=t.toLocaleString();if(r==="0"){r="-"}return`${n}${e}${n}|${n}${r}${n}\n`}};us=cs([(0,a.injectable)(),ds("design:paramtypes",[Ue,_e,L,ps,N])],us);const As=us;var fs=undefined&&undefined.__decorate||function(e,t,i,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)if(o=e[a])s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s;return r>3&&s&&Object.defineProperty(t,i,s),s};var hs=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};let ms=class CodeMetricsCalculator{_gitInvoker;_logger;_pullRequest;_pullRequestComments;_reposInvoker;_runnerInvoker;constructor(e,t,i,n,r,s){this._gitInvoker=e;this._logger=t;this._pullRequest=i;this._pullRequestComments=n;this._reposInvoker=r;this._runnerInvoker=s}get shouldSkip(){this._logger.logDebug("* CodeMetricsCalculator.shouldSkip");if(!this._pullRequest.isPullRequest){return this._runnerInvoker.loc("metrics.codeMetricsCalculator.noPullRequest")}const e=this._pullRequest.isSupportedProvider;if(e!==true){return this._runnerInvoker.loc("metrics.codeMetricsCalculator.unsupportedProvider",String(e))}return null}async shouldStop(){this._logger.logDebug("* CodeMetricsCalculator.shouldStop()");const e=await this._reposInvoker.isAccessTokenAvailable();if(e!==null){return e}if(!await this._gitInvoker.isGitRepo()){return N.isGitHub?this._runnerInvoker.loc("metrics.codeMetricsCalculator.noGitRepoGitHub"):this._runnerInvoker.loc("metrics.codeMetricsCalculator.noGitRepoAzureDevOps")}if(!this._gitInvoker.isPullRequestIdAvailable()){return N.isGitHub?this._runnerInvoker.loc("metrics.codeMetricsCalculator.noPullRequestIdGitHub"):this._runnerInvoker.loc("metrics.codeMetricsCalculator.noPullRequestIdAzureDevOps")}if(!await this._gitInvoker.isGitHistoryAvailable()){return N.isGitHub?this._runnerInvoker.loc("metrics.codeMetricsCalculator.noGitHistoryGitHub"):this._runnerInvoker.loc("metrics.codeMetricsCalculator.noGitHistoryAzureDevOps")}return null}async updateDetails(){this._logger.logDebug("* CodeMetricsCalculator.updateDetails()");const e=await this._reposInvoker.getTitleAndDescription();const t=await this._pullRequest.getUpdatedTitle(e.title);const i=this._pullRequest.getUpdatedDescription(e.description);await this._reposInvoker.setTitleAndDescription(t,i)}async updateComments(){this._logger.logDebug("* CodeMetricsCalculator.updateComments()");const e=[];const t=await this._pullRequestComments.getCommentData();e.push(this.updateMetricsComment(t));for(const i of t.commentThreadsRequiringDeletion){e.push(this._reposInvoker.deleteCommentThread(i))}await Promise.all(e);for(const e of t.filesNotRequiringReview){await this.updateNoReviewRequiredComment(e,false)}for(const e of t.deletedFilesNotRequiringReview){await this.updateNoReviewRequiredComment(e,true)}}async updateMetricsComment(e){this._logger.logDebug("* CodeMetricsCalculator.updateMetricsComment()");const t=await this._pullRequestComments.getMetricsComment();const i=await this._pullRequestComments.getMetricsCommentStatus();if(e.metricsCommentThreadId===null){await this._reposInvoker.createComment(t,null,i)}else{await this._reposInvoker.updateComment(e.metricsCommentThreadId,e.metricsCommentContent===t?null:t,e.metricsCommentThreadStatus===i?null:i)}}async updateNoReviewRequiredComment(e,t){this._logger.logDebug("* CodeMetricsCalculator.updateNoReviewRequiredComment()");await this._reposInvoker.createComment(this._pullRequestComments.noReviewRequiredComment,e,o.CommentThreadStatus.Closed,t)}};ms=fs([(0,a.injectable)(),hs("design:paramtypes",[z,L,je,As,ps,N])],ms);const gs=ms;var ys=undefined&&undefined.__decorate||function(e,t,i,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)if(o=e[a])s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s;return r>3&&s&&Object.defineProperty(t,i,s),s};var vs=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};let Is=class PullRequestMetrics{_codeMetricsCalculator;_logger;_runnerInvoker;constructor(e,t,i){this._codeMetricsCalculator=e;this._logger=t;this._runnerInvoker=i}async run(e){try{this._runnerInvoker.locInitialize(e);const t=this._codeMetricsCalculator.shouldSkip;if(t!==null){this._runnerInvoker.setStatusSkipped(t);return}const i=await this._codeMetricsCalculator.shouldStop();if(i!==null){this._runnerInvoker.setStatusFailed(i);return}await Promise.all([this._codeMetricsCalculator.updateDetails(),this._codeMetricsCalculator.updateComments()]);this._runnerInvoker.setStatusSucceeded(this._runnerInvoker.loc("pullRequestMetrics.succeeded"))}catch(e){const t=e;this._logger.logErrorObject(t);this._logger.replay();this._runnerInvoker.setStatusFailed(t.message)}}};Is=ys([(0,a.singleton)(),vs("design:paramtypes",[gs,L,N])],Is);const Es=Is;const run=async()=>{const e=a.container.resolve(Es);await e.run(u().dirname((0,En.fileURLToPath)(import.meta.url)))};run().catch((()=>{process.exit(H)})); \ No newline at end of file +class FifoMap{constructor(e=1e3,t=0){if(isNaN(e)||e<0){throw new Error("Invalid max value")}if(isNaN(t)||t<0){throw new Error("Invalid ttl value")}this.first=null;this.items=new Map;this.last=null;this.max=e;this.ttl=t}get size(){return this.items.size}clear(){this.items=new Map;this.first=null;this.last=null}delete(e){if(this.items.has(e)){const t=this.items.get(e);this.items.delete(e);if(t.prev!==null){t.prev.next=t.next}if(t.next!==null){t.next.prev=t.prev}if(this.first===t){this.first=t.next}if(this.last===t){this.last=t.prev}}}deleteMany(e){for(var t=0;t0){const e=this.first;this.items.delete(e.key);if(this.size===0){this.first=null;this.last=null}else{this.first=e.next;this.first.prev=null}}}expiresAt(e){if(this.items.has(e)){return this.items.get(e).expiry}}get(e){if(this.items.has(e)){const t=this.items.get(e);if(this.ttl>0&&t.expiry<=Date.now()){this.delete(e);return}return t.value}}getMany(e){const t=[];for(var i=0;i0?Date.now()+this.ttl:this.ttl;return}if(this.max>0&&this.size===this.max){this.evict()}const i={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t};this.items.set(e,i);if(this.size===1){this.first=i}else{this.last.next=i}this.last=i}}class LruMap{constructor(e=1e3,t=0){if(isNaN(e)||e<0){throw new Error("Invalid max value")}if(isNaN(t)||t<0){throw new Error("Invalid ttl value")}this.first=null;this.items=new Map;this.last=null;this.max=e;this.ttl=t}get size(){return this.items.size}bumpLru(e){if(this.last===e){return}const t=this.last;const i=e.next;const n=e.prev;if(this.first===e){this.first=i}e.next=null;e.prev=t;t.next=e;if(n!==null){n.next=i}if(i!==null){i.prev=n}this.last=e}clear(){this.items=new Map;this.first=null;this.last=null}delete(e){if(this.items.has(e)){const t=this.items.get(e);this.items.delete(e);if(t.prev!==null){t.prev.next=t.next}if(t.next!==null){t.next.prev=t.prev}if(this.first===t){this.first=t.next}if(this.last===t){this.last=t.prev}}}deleteMany(e){for(var t=0;t0){const e=this.first;this.items.delete(e.key);if(this.size===0){this.first=null;this.last=null}else{this.first=e.next;this.first.prev=null}}}expiresAt(e){if(this.items.has(e)){return this.items.get(e).expiry}}get(e){if(this.items.has(e)){const t=this.items.get(e);if(this.ttl>0&&t.expiry<=Date.now()){this.delete(e);return}this.bumpLru(t);return t.value}}getMany(e){const t=[];for(var i=0;i0?Date.now()+this.ttl:this.ttl;if(this.last!==i){this.bumpLru(i)}return}if(this.max>0&&this.size===this.max){this.evict()}const i={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t};this.items.set(e,i);if(this.size===1){this.first=i}else{this.last.next=i}this.last=i}}class LruObject{constructor(e=1e3,t=0){if(isNaN(e)||e<0){throw new Error("Invalid max value")}if(isNaN(t)||t<0){throw new Error("Invalid ttl value")}this.first=null;this.items=Object.create(null);this.last=null;this.size=0;this.max=e;this.ttl=t}bumpLru(e){if(this.last===e){return}const t=this.last;const i=e.next;const n=e.prev;if(this.first===e){this.first=i}e.next=null;e.prev=t;t.next=e;if(n!==null){n.next=i}if(i!==null){i.prev=n}this.last=e}clear(){this.items=Object.create(null);this.first=null;this.last=null;this.size=0}delete(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){const t=this.items[e];delete this.items[e];this.size--;if(t.prev!==null){t.prev.next=t.next}if(t.next!==null){t.next.prev=t.prev}if(this.first===t){this.first=t.next}if(this.last===t){this.last=t.prev}}}deleteMany(e){for(var t=0;t0){const e=this.first;delete this.items[e.key];if(--this.size===0){this.first=null;this.last=null}else{this.first=e.next;this.first.prev=null}}}expiresAt(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){return this.items[e].expiry}}get(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){const t=this.items[e];if(this.ttl>0&&t.expiry<=Date.now()){this.delete(e);return}this.bumpLru(t);return t.value}}getMany(e){const t=[];for(var i=0;i0?Date.now()+this.ttl:this.ttl;if(this.last!==i){this.bumpLru(i)}return}if(this.max>0&&this.size===this.max){this.evict()}const i={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t};this.items[e]=i;if(++this.size===1){this.first=i}else{this.last.next=i}this.last=i}}class HitStatisticsRecord{constructor(){this.records={}}initForCache(e,t){this.records[e]={[t]:{cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,invalidateOne:0,invalidateAll:0,sets:0}}}resetForCache(e){for(let t of Object.keys(this.records[e])){this.records[e][t]={cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,invalidateOne:0,invalidateAll:0,sets:0}}}getStatistics(){return this.records}}function getTimestamp(e){return`${e.getFullYear()}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")}`}class HitStatistics{constructor(e,t,i){this.cacheId=e;this.statisticTtlInHours=t;this.collectionStart=new Date;this.currentTimeStamp=getTimestamp(this.collectionStart);this.records=i||new HitStatisticsRecord;this.records.initForCache(this.cacheId,this.currentTimeStamp)}get currentRecord(){if(!this.records.records[this.cacheId][this.currentTimeStamp]){this.records.records[this.cacheId][this.currentTimeStamp]={cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,sets:0,invalidateOne:0,invalidateAll:0}}return this.records.records[this.cacheId][this.currentTimeStamp]}hoursPassed(){return(Date.now()-this.collectionStart)/1e3/60/60}addHit(){this.archiveIfNeeded();this.currentRecord.hits++}addFalsyHit(){this.archiveIfNeeded();this.currentRecord.falsyHits++}addEmptyHit(){this.archiveIfNeeded();this.currentRecord.emptyHits++}addMiss(){this.archiveIfNeeded();this.currentRecord.misses++}addEviction(){this.archiveIfNeeded();this.currentRecord.evictions++}setCacheSize(e){this.archiveIfNeeded();this.currentRecord.cacheSize=e}addExpiration(){this.archiveIfNeeded();this.currentRecord.expirations++}addSet(){this.archiveIfNeeded();this.currentRecord.sets++}addInvalidateOne(){this.archiveIfNeeded();this.currentRecord.invalidateOne++}addInvalidateAll(){this.archiveIfNeeded();this.currentRecord.invalidateAll++}getStatistics(){return this.records.getStatistics()}archiveIfNeeded(){if(this.hoursPassed()>=this.statisticTtlInHours){this.collectionStart=new Date;this.currentTimeStamp=getTimestamp(this.collectionStart);this.records.initForCache(this.cacheId,this.currentTimeStamp)}}}class LruObjectHitStatistics extends LruObject{constructor(e,t,i,n,r){super(e||1e3,t||0);if(!i){throw new Error("Cache id is mandatory")}this.hitStatistics=new HitStatistics(i,r!==undefined?r:24,n)}getStatistics(){return this.hitStatistics.getStatistics()}set(e,t){super.set(e,t);this.hitStatistics.addSet();this.hitStatistics.setCacheSize(this.size)}evict(){super.evict();this.hitStatistics.addEviction();this.hitStatistics.setCacheSize(this.size)}delete(e,t=false){super.delete(e);if(!t){this.hitStatistics.addInvalidateOne()}this.hitStatistics.setCacheSize(this.size)}clear(){super.clear();this.hitStatistics.addInvalidateAll();this.hitStatistics.setCacheSize(this.size)}get(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){const t=this.items[e];if(this.ttl>0&&t.expiry<=Date.now()){this.delete(e,true);this.hitStatistics.addExpiration();return}this.bumpLru(t);if(!t.value){this.hitStatistics.addFalsyHit()}if(t.value===undefined||t.value===null||t.value===""){this.hitStatistics.addEmptyHit()}this.hitStatistics.addHit();return t.value}this.hitStatistics.addMiss()}}class FifoObject{constructor(e=1e3,t=0){if(isNaN(e)||e<0){throw new Error("Invalid max value")}if(isNaN(t)||t<0){throw new Error("Invalid ttl value")}this.first=null;this.items=Object.create(null);this.last=null;this.size=0;this.max=e;this.ttl=t}clear(){this.items=Object.create(null);this.first=null;this.last=null;this.size=0}delete(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){const t=this.items[e];delete this.items[e];this.size--;if(t.prev!==null){t.prev.next=t.next}if(t.next!==null){t.next.prev=t.prev}if(this.first===t){this.first=t.next}if(this.last===t){this.last=t.prev}}}deleteMany(e){for(var t=0;t0){const e=this.first;delete this.items[e.key];if(--this.size===0){this.first=null;this.last=null}else{this.first=e.next;this.first.prev=null}}}expiresAt(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){return this.items[e].expiry}}get(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){const t=this.items[e];if(this.ttl>0&&t.expiry<=Date.now()){this.delete(e);return}return t.value}}getMany(e){const t=[];for(var i=0;i0?Date.now()+this.ttl:this.ttl;return}if(this.max>0&&this.size===this.max){this.evict()}const i={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t};this.items[e]=i;if(++this.size===1){this.first=i}else{this.last.next=i}this.last=i}}async function getAppAuthentication({appId:e,privateKey:t,timeDifference:i}){try{const n={id:e,privateKey:t};if(i){Object.assign(n,{now:Math.floor(Date.now()/1e3)+i})}const r=await githubAppJwt(n);return{type:"app",token:r.token,appId:r.appId,expiresAt:new Date(r.expiration*1e3).toISOString()}}catch(e){if(t==="-----BEGIN RSA PRIVATE KEY-----"){throw new Error("The 'privateKey` option contains only the first line '-----BEGIN RSA PRIVATE KEY-----'. If you are setting it using a `.env` file, make sure it is set on a single line with newlines replaced by '\n'")}else{throw e}}}function getCache(){return new LruObject(15e3,1e3*60*59)}async function dist_node_get(e,t){const i=optionsToCacheKey(t);const n=await e.get(i);if(!n){return}const[r,s,o,a,l,p]=n.split("|");const c=t.permissions||l.split(/,/).reduce(((e,t)=>{if(/!$/.test(t)){e[t.slice(0,-1)]="write"}else{e[t]="read"}return e}),{});return{token:r,createdAt:s,expiresAt:o,permissions:c,repositoryIds:t.repositoryIds,repositoryNames:t.repositoryNames,singleFileName:p,repositorySelection:a}}async function dist_node_set(e,t,i){const n=optionsToCacheKey(t);const r=t.permissions?"":Object.keys(i.permissions).map((e=>`${e}${i.permissions[e]==="write"?"!":""}`)).join(",");const s=[i.token,i.createdAt,i.expiresAt,i.repositorySelection,r,i.singleFileName].join("|");await e.set(n,s)}function optionsToCacheKey({installationId:e,permissions:t={},repositoryIds:i=[],repositoryNames:n=[]}){const r=Object.keys(t).sort().map((e=>t[e]==="read"?e:`${e}!`)).join(",");const s=i.sort().join(",");const o=n.join(",");return[e,s,o,r].filter(Boolean).join("|")}function toTokenAuthentication({installationId:e,token:t,createdAt:i,expiresAt:n,repositorySelection:r,permissions:s,repositoryIds:o,repositoryNames:a,singleFileName:l}){return Object.assign({type:"token",tokenType:"installation",token:t,installationId:e,permissions:s,createdAt:i,expiresAt:n,repositorySelection:r},o?{repositoryIds:o}:null,a?{repositoryNames:a}:null,l?{singleFileName:l}:null)}async function getInstallationAuthentication(e,t,i){const n=Number(t.installationId||e.installationId);if(!n){throw new Error("[@octokit/auth-app] installationId option is required for installation authentication.")}if(t.factory){const{type:i,factory:n,oauthApp:r,...s}={...e,...t};return n(s)}const r=i||e.request;return getInstallationAuthenticationConcurrently(e,{...t,installationId:n},r)}var ni=new Map;function getInstallationAuthenticationConcurrently(e,t,i){const n=optionsToCacheKey(t);if(ni.has(n)){return ni.get(n)}const r=getInstallationAuthenticationImpl(e,t,i).finally((()=>ni.delete(n)));ni.set(n,r);return r}async function getInstallationAuthenticationImpl(e,t,i){if(!t.refresh){const i=await dist_node_get(e.cache,t);if(i){const{token:e,createdAt:n,expiresAt:r,permissions:s,repositoryIds:o,repositoryNames:a,singleFileName:l,repositorySelection:p}=i;return toTokenAuthentication({installationId:t.installationId,token:e,createdAt:n,expiresAt:r,permissions:s,repositorySelection:p,repositoryIds:o,repositoryNames:a,singleFileName:l})}}const n=await getAppAuthentication(e);const r={installation_id:t.installationId,mediaType:{previews:["machine-man"]},headers:{authorization:`bearer ${n.token}`}};if(t.repositoryIds){Object.assign(r,{repository_ids:t.repositoryIds})}if(t.repositoryNames){Object.assign(r,{repositories:t.repositoryNames})}if(t.permissions){Object.assign(r,{permissions:t.permissions})}const{data:{token:s,expires_at:o,repositories:a,permissions:l,repository_selection:p,single_file:c}}=await i("POST /app/installations/{installation_id}/access_tokens",r);const d=l||{};const u=p||"all";const A=a?a.map((e=>e.id)):void 0;const f=a?a.map((e=>e.name)):void 0;const h=(new Date).toISOString();const g={token:s,createdAt:h,expiresAt:o,repositorySelection:u,permissions:d,repositoryIds:A,repositoryNames:f};if(c){Object.assign(r,{singleFileName:c})}await dist_node_set(e.cache,t,g);const y={installationId:t.installationId,token:s,createdAt:h,expiresAt:o,repositorySelection:u,permissions:d,repositoryIds:A,repositoryNames:f};if(c){Object.assign(y,{singleFileName:c})}return toTokenAuthentication(y)}async function dist_node_auth(e,t){switch(t.type){case"app":return getAppAuthentication(e);case"oauth-app":return e.oauthApp({type:"oauth-app"});case"installation":t;return getInstallationAuthentication(e,{...t,type:"installation"});case"oauth-user":return e.oauthApp(t);default:throw new Error(`Invalid auth type: ${t.type}`)}}var ri=["/app","/app/hook/config","/app/hook/deliveries","/app/hook/deliveries/{delivery_id}","/app/hook/deliveries/{delivery_id}/attempts","/app/installations","/app/installations/{installation_id}","/app/installations/{installation_id}/access_tokens","/app/installations/{installation_id}/suspended","/app/installation-requests","/marketplace_listing/accounts/{account_id}","/marketplace_listing/plan","/marketplace_listing/plans","/marketplace_listing/plans/{plan_id}/accounts","/marketplace_listing/stubbed/accounts/{account_id}","/marketplace_listing/stubbed/plan","/marketplace_listing/stubbed/plans","/marketplace_listing/stubbed/plans/{plan_id}/accounts","/orgs/{org}/installation","/repos/{owner}/{repo}/installation","/users/{username}/installation"];function dist_node_routeMatcher(e){const t=e.map((e=>e.split("/").map((e=>e.startsWith("{")?"(?:.+?)":e)).join("/")));const i=`^(?:${t.map((e=>`(?:${e})`)).join("|")})$`;return new RegExp(i,"i")}var si=dist_node_routeMatcher(ri);function requiresAppAuth(e){return!!e&&si.test(e.split("?")[0])}var oi=5*1e3;function isNotTimeSkewError(e){return!(e.message.match(/'Expiration time' claim \('exp'\) must be a numeric value representing the future time at which the assertion expires/)||e.message.match(/'Issued at' claim \('iat'\) must be an Integer representing the time that the assertion was issued/))}async function dist_node_hook(e,t,i,n){const r=t.endpoint.merge(i,n);const s=r.url;if(/\/login\/oauth\/access_token$/.test(s)){return t(r)}if(requiresAppAuth(s.replace(t.endpoint.DEFAULTS.baseUrl,""))){const{token:i}=await getAppAuthentication(e);r.headers.authorization=`bearer ${i}`;let n;try{n=await t(r)}catch(i){if(isNotTimeSkewError(i)){throw i}if(typeof i.response.headers.date==="undefined"){throw i}const n=Math.floor((Date.parse(i.response.headers.date)-Date.parse((new Date).toString()))/1e3);e.log.warn(i.message);e.log.warn(`[@octokit/auth-app] GitHub API time and system time are different by ${n} seconds. Retrying request with the difference accounted for.`);const{token:s}=await getAppAuthentication({...e,timeDifference:n});r.headers.authorization=`bearer ${s}`;return t(r)}return n}if(requiresBasicAuth(s)){const i=await e.oauthApp({type:"oauth-app"});r.headers.authorization=i.headers.authorization;return t(r)}const{token:o,createdAt:a}=await getInstallationAuthentication(e,{},t.defaults({baseUrl:r.baseUrl}));r.headers.authorization=`token ${o}`;return sendRequestWithRetries(e,t,r,a)}async function sendRequestWithRetries(e,t,i,n,r=0){const s=+new Date-+new Date(n);try{return await t(i)}catch(o){if(o.status!==401){throw o}if(s>=oi){if(r>0){o.message=`After ${r} retries within ${s/1e3}s of creating the installation access token, the response remains 401. At this point, the cause may be an authentication problem or a system outage. Please check https://www.githubstatus.com for status information`}throw o}++r;const a=r*1e3;e.log.warn(`[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${r}, wait: ${a/1e3}s)`);await new Promise((e=>setTimeout(e,a)));return sendRequestWithRetries(e,t,i,n,r)}}var ai="8.0.1";function createAppAuth(e){if(!e.appId){throw new Error("[@octokit/auth-app] appId option is required")}if(!e.privateKey){throw new Error("[@octokit/auth-app] privateKey option is required")}if("installationId"in e&&!e.installationId){throw new Error("[@octokit/auth-app] installationId is set to a falsy value")}const t=Object.assign({warn:console.warn.bind(console)},e.log);const i=e.request||mt.defaults({headers:{"user-agent":`octokit-auth-app.js/${ai} ${getUserAgent()}`}});const n=Object.assign({request:i,cache:getCache()},e,e.installationId?{installationId:Number(e.installationId)}:{},{log:t,oauthApp:createOAuthAppAuth({clientType:"github-app",clientId:e.clientId||"",clientSecret:e.clientSecret||"",request:i})});return Object.assign(dist_node_auth.bind(null,n),{hook:dist_node_hook.bind(null,n)})}async function auth_unauthenticated_dist_node_auth(e){return{type:"unauthenticated",reason:e}}function isRateLimitError(e){if(e.status!==403){return false}if(!e.response){return false}return e.response.headers["x-ratelimit-remaining"]==="0"}var li=/\babuse\b/i;function isAbuseLimitError(e){if(e.status!==403){return false}return li.test(e.message)}async function auth_unauthenticated_dist_node_hook(e,t,i,n){const r=t.endpoint.merge(i,n);return t(r).catch((t=>{if(t.status===404){t.message=`Not found. May be due to lack of authentication. Reason: ${e}`;throw t}if(isRateLimitError(t)){t.message=`API rate limit exceeded. This maybe caused by the lack of authentication. Reason: ${e}`;throw t}if(isAbuseLimitError(t)){t.message=`You have triggered an abuse detection mechanism. This maybe caused by the lack of authentication. Reason: ${e}`;throw t}if(t.status===401){t.message=`Unauthorized. "${r.method} ${r.url}" failed most likely due to lack of authentication. Reason: ${e}`;throw t}if(t.status>=400&&t.status<500){t.message=t.message.replace(/\.?$/,`. May be caused by lack of authentication (${e}).`)}throw t}))}var pi=function createUnauthenticatedAuth2(e){if(!e||!e.reason){throw new Error("[@octokit/auth-unauthenticated] No reason passed to createUnauthenticatedAuth")}return Object.assign(auth_unauthenticated_dist_node_auth.bind(null,e.reason),{hook:auth_unauthenticated_dist_node_hook.bind(null,e.reason)})};var ci="8.0.1";function addEventHandler(e,t,i){if(Array.isArray(t)){for(const n of t){addEventHandler(e,n,i)}return}if(!e.eventHandlers[t]){e.eventHandlers[t]=[]}e.eventHandlers[t].push(i)}var di=dist_src_Octokit.defaults({userAgent:`octokit-oauth-app.js/${ci} ${getUserAgent()}`});async function emitEvent(e,t){const{name:i,action:n}=t;if(e.eventHandlers[`${i}.${n}`]){for(const r of e.eventHandlers[`${i}.${n}`]){await r(t)}}if(e.eventHandlers[i]){for(const n of e.eventHandlers[i]){await n(t)}}}async function getUserOctokitWithState(e,t){return e.octokit.auth({type:"oauth-user",...t,async factory(t){const i=new e.Octokit({authStrategy:createOAuthUserAuth,auth:t});const n=await i.auth({type:"get"});await emitEvent(e,{name:"token",action:"created",token:n.token,scopes:n.scopes,authentication:n,octokit:i});return i}})}function getWebFlowAuthorizationUrlWithState(e,t){const i={clientId:e.clientId,request:e.octokit.request,...t,allowSignup:e.allowSignup??t.allowSignup,redirectUrl:t.redirectUrl??e.redirectUrl,scopes:t.scopes??e.defaultScopes};return getWebFlowAuthorizationUrl({clientType:e.clientType,...i})}async function createTokenWithState(e,t){const i=await e.octokit.auth({type:"oauth-user",...t});await emitEvent(e,{name:"token",action:"created",token:i.token,scopes:i.scopes,authentication:i,octokit:new e.Octokit({authStrategy:createOAuthUserAuth,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:i.token,scopes:i.scopes,refreshToken:i.refreshToken,expiresAt:i.expiresAt,refreshTokenExpiresAt:i.refreshTokenExpiresAt}})});return{authentication:i}}async function checkTokenWithState(e,t){const i=await checkToken({clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t});Object.assign(i.authentication,{type:"token",tokenType:"oauth"});return i}async function resetTokenWithState(e,t){const i={clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t};if(e.clientType==="oauth-app"){const t=await resetToken({clientType:"oauth-app",...i});const n=Object.assign(t.authentication,{type:"token",tokenType:"oauth"});await emitEvent(e,{name:"token",action:"reset",token:t.authentication.token,scopes:t.authentication.scopes||void 0,authentication:n,octokit:new e.Octokit({authStrategy:createOAuthUserAuth,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:t.authentication.token,scopes:t.authentication.scopes}})});return{...t,authentication:n}}const n=await resetToken({clientType:"github-app",...i});const r=Object.assign(n.authentication,{type:"token",tokenType:"oauth"});await emitEvent(e,{name:"token",action:"reset",token:n.authentication.token,authentication:r,octokit:new e.Octokit({authStrategy:createOAuthUserAuth,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:n.authentication.token}})});return{...n,authentication:r}}async function refreshTokenWithState(e,t){if(e.clientType==="oauth-app"){throw new Error("[@octokit/oauth-app] app.refreshToken() is not supported for OAuth Apps")}const i=await refreshToken({clientType:"github-app",clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,refreshToken:t.refreshToken});const n=Object.assign(i.authentication,{type:"token",tokenType:"oauth"});await emitEvent(e,{name:"token",action:"refreshed",token:i.authentication.token,authentication:n,octokit:new e.Octokit({authStrategy:createOAuthUserAuth,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:i.authentication.token}})});return{...i,authentication:n}}async function scopeTokenWithState(e,t){if(e.clientType==="oauth-app"){throw new Error("[@octokit/oauth-app] app.scopeToken() is not supported for OAuth Apps")}const i=await scopeToken({clientType:"github-app",clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t});const n=Object.assign(i.authentication,{type:"token",tokenType:"oauth"});await emitEvent(e,{name:"token",action:"scoped",token:i.authentication.token,authentication:n,octokit:new e.Octokit({authStrategy:createOAuthUserAuth,auth:{clientType:e.clientType,clientId:e.clientId,clientSecret:e.clientSecret,token:i.authentication.token}})});return{...i,authentication:n}}async function deleteTokenWithState(e,t){const i={clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t};const n=e.clientType==="oauth-app"?await deleteToken({clientType:"oauth-app",...i}):await deleteToken({clientType:"github-app",...i});await emitEvent(e,{name:"token",action:"deleted",token:t.token,octokit:new e.Octokit({authStrategy:pi,auth:{reason:`Handling "token.deleted" event. The access for the token has been revoked.`}})});return n}async function deleteAuthorizationWithState(e,t){const i={clientId:e.clientId,clientSecret:e.clientSecret,request:e.octokit.request,...t};const n=e.clientType==="oauth-app"?await deleteAuthorization({clientType:"oauth-app",...i}):await deleteAuthorization({clientType:"github-app",...i});await emitEvent(e,{name:"token",action:"deleted",token:t.token,octokit:new e.Octokit({authStrategy:pi,auth:{reason:`Handling "token.deleted" event. The access for the token has been revoked.`}})});await emitEvent(e,{name:"authorization",action:"deleted",token:t.token,octokit:new e.Octokit({authStrategy:pi,auth:{reason:`Handling "authorization.deleted" event. The access for the app has been revoked.`}})});return n}function dist_node_unknownRouteResponse(e){return{status:404,headers:{"content-type":"application/json"},text:JSON.stringify({error:`Unknown route: ${e.method} ${e.url}`})}}async function handleRequest(e,{pathPrefix:t="/api/github/oauth"},i){let{pathname:n}=new URL(i.url,"http://localhost");if(!n.startsWith(`${t}/`)){return void 0}if(i.method==="OPTIONS"){return{status:200,headers:{"access-control-allow-origin":"*","access-control-allow-methods":"*","access-control-allow-headers":"Content-Type, User-Agent, Authorization"}}}n=n.slice(t.length+1);const r=[i.method,n].join(" ");const s={getLogin:`GET login`,getCallback:`GET callback`,createToken:`POST token`,getToken:`GET token`,patchToken:`PATCH token`,patchRefreshToken:`PATCH refresh-token`,scopeToken:`POST token/scoped`,deleteToken:`DELETE token`,deleteGrant:`DELETE grant`};if(!Object.values(s).includes(r)){return dist_node_unknownRouteResponse(i)}let o;try{const e=await i.text();o=e?JSON.parse(e):{}}catch(e){return{status:400,headers:{"content-type":"application/json","access-control-allow-origin":"*"},text:JSON.stringify({error:"[@octokit/oauth-app] request error"})}}const{searchParams:a}=new URL(i.url,"http://localhost");const l=Object.fromEntries(a);const p=i.headers;try{if(r===s.getLogin){const t={};if(l.state){Object.assign(t,{state:l.state})}if(l.scopes){Object.assign(t,{scopes:l.scopes.split(",")})}if(l.allowSignup){Object.assign(t,{allowSignup:l.allowSignup==="true"})}if(l.redirectUrl){Object.assign(t,{redirectUrl:l.redirectUrl})}const{url:i}=e.getWebFlowAuthorizationUrl(t);return{status:302,headers:{location:i}}}if(r===s.getCallback){if(l.error){throw new Error(`[@octokit/oauth-app] ${l.error} ${l.error_description}`)}if(!l.code){throw new Error('[@octokit/oauth-app] "code" parameter is required')}const{authentication:{token:t}}=await e.createToken({code:l.code});return{status:200,headers:{"content-type":"text/html"},text:`

Token created successfully

\n\n

Your token is: ${t}. Copy it now as it cannot be shown again.

`}}if(r===s.createToken){const{code:t,redirectUrl:i}=o;if(!t){throw new Error('[@octokit/oauth-app] "code" parameter is required')}const n=await e.createToken({code:t,redirectUrl:i});delete n.authentication.clientSecret;return{status:201,headers:{"content-type":"application/json","access-control-allow-origin":"*"},text:JSON.stringify(n)}}if(r===s.getToken){const t=p.authorization?.substr("token ".length);if(!t){throw new Error('[@octokit/oauth-app] "Authorization" header is required')}const i=await e.checkToken({token:t});delete i.authentication.clientSecret;return{status:200,headers:{"content-type":"application/json","access-control-allow-origin":"*"},text:JSON.stringify(i)}}if(r===s.patchToken){const t=p.authorization?.substr("token ".length);if(!t){throw new Error('[@octokit/oauth-app] "Authorization" header is required')}const i=await e.resetToken({token:t});delete i.authentication.clientSecret;return{status:200,headers:{"content-type":"application/json","access-control-allow-origin":"*"},text:JSON.stringify(i)}}if(r===s.patchRefreshToken){const t=p.authorization?.substr("token ".length);if(!t){throw new Error('[@octokit/oauth-app] "Authorization" header is required')}const{refreshToken:i}=o;if(!i){throw new Error("[@octokit/oauth-app] refreshToken must be sent in request body")}const n=await e.refreshToken({refreshToken:i});delete n.authentication.clientSecret;return{status:200,headers:{"content-type":"application/json","access-control-allow-origin":"*"},text:JSON.stringify(n)}}if(r===s.scopeToken){const t=p.authorization?.substr("token ".length);if(!t){throw new Error('[@octokit/oauth-app] "Authorization" header is required')}const i=await e.scopeToken({token:t,...o});delete i.authentication.clientSecret;return{status:200,headers:{"content-type":"application/json","access-control-allow-origin":"*"},text:JSON.stringify(i)}}if(r===s.deleteToken){const t=p.authorization?.substr("token ".length);if(!t){throw new Error('[@octokit/oauth-app] "Authorization" header is required')}await e.deleteToken({token:t});return{status:204,headers:{"access-control-allow-origin":"*"}}}const t=p.authorization?.substr("token ".length);if(!t){throw new Error('[@octokit/oauth-app] "Authorization" header is required')}await e.deleteAuthorization({token:t});return{status:204,headers:{"access-control-allow-origin":"*"}}}catch(e){return{status:400,headers:{"content-type":"application/json","access-control-allow-origin":"*"},text:JSON.stringify({error:e.message})}}}function parseRequest(e){const{method:t,url:i,headers:n}=e;async function text(){const t=await new Promise(((t,i)=>{let n=[];e.on("error",i).on("data",(e=>n.push(e))).on("end",(()=>t(Buffer.concat(n).toString())))}));return t}return{method:t,url:i,headers:n,text:text}}function sendResponse(e,t){t.writeHead(e.status,e.headers);t.end(e.text)}function createNodeMiddleware(e,t={}){return async function(i,n,r){const s=await parseRequest(i);const o=await handleRequest(e,t,s);if(o){sendResponse(o,n);return true}else{r?.();return false}}}function parseRequest2(e){const t=Object.fromEntries(e.headers.entries());return{method:e.method,url:e.url,headers:t,text:()=>e.text()}}function sendResponse2(e){const t={status:e.status};if(e.headers){Object.assign(t,{headers:e.headers})}return new Response(e.text,t)}function createWebWorkerHandler(e,t={}){return async function(i){const n=await parseRequest2(i);const r=await handleRequest(e,t,n);return r?sendResponse2(r):void 0}}function parseRequest3(e){const{method:t}=e.requestContext.http;let i=e.rawPath;const{stage:n}=e.requestContext;if(i.startsWith("/"+n))i=i.substring(n.length+1);if(e.rawQueryString)i+="?"+e.rawQueryString;const r=e.headers;const text=async()=>e.body||"";return{method:t,url:i,headers:r,text:text}}function sendResponse3(e){return{statusCode:e.status,headers:e.headers,body:e.text}}function createAWSLambdaAPIGatewayV2Handler(e,t={}){return async function(i){const n=parseRequest3(i);const r=await handleRequest(e,t,n);return r?sendResponse3(r):void 0}}var ui=class{static VERSION=ci;static defaults(e){const t=class extends(this){constructor(...t){super({...e,...t[0]})}};return t}constructor(e){const t=e.Octokit||di;this.type=e.clientType||"oauth-app";const i=new t({authStrategy:createOAuthAppAuth,auth:{clientType:this.type,clientId:e.clientId,clientSecret:e.clientSecret}});const n={clientType:this.type,clientId:e.clientId,clientSecret:e.clientSecret,defaultScopes:e.defaultScopes||[],allowSignup:e.allowSignup,baseUrl:e.baseUrl,redirectUrl:e.redirectUrl,log:e.log,Octokit:t,octokit:i,eventHandlers:{}};this.on=addEventHandler.bind(null,n);this.octokit=i;this.getUserOctokit=getUserOctokitWithState.bind(null,n);this.getWebFlowAuthorizationUrl=getWebFlowAuthorizationUrlWithState.bind(null,n);this.createToken=createTokenWithState.bind(null,n);this.checkToken=checkTokenWithState.bind(null,n);this.resetToken=resetTokenWithState.bind(null,n);this.refreshToken=refreshTokenWithState.bind(null,n);this.scopeToken=scopeTokenWithState.bind(null,n);this.deleteToken=deleteTokenWithState.bind(null,n);this.deleteAuthorization=deleteAuthorizationWithState.bind(null,n)}type;on;octokit;getUserOctokit;getWebFlowAuthorizationUrl;createToken;checkToken;resetToken;refreshToken;scopeToken;deleteToken;deleteAuthorization};const Ai=e(import.meta.url)("node:buffer");var fi="6.0.0";async function sign(e,t){if(!e||!t){throw new TypeError("[@octokit/webhooks-methods] secret & payload required for sign()")}if(typeof t!=="string"){throw new TypeError("[@octokit/webhooks-methods] payload must be a string")}const i="sha256";return`${i}=${(0,ii.createHmac)(i,e).update(t).digest("hex")}`}sign.VERSION=fi;async function verify(e,t,i){if(!e||!t||!i){throw new TypeError("[@octokit/webhooks-methods] secret, eventPayload & signature required")}if(typeof t!=="string"){throw new TypeError("[@octokit/webhooks-methods] eventPayload must be a string")}const n=Ai.Buffer.from(i);const r=Ai.Buffer.from(await sign(e,t));if(n.length!==r.length){return false}return(0,ii.timingSafeEqual)(n,r)}verify.VERSION=fi;async function verifyWithFallback(e,t,i,n){const r=await verify(e,t,i);if(r){return true}if(n!==void 0){for(const e of n){const n=await verify(e,t,i);if(n){return n}}}return false}var createLogger=e=>({debug:()=>{},info:()=>{},warn:console.warn.bind(console),error:console.error.bind(console),...e});var hi=["branch_protection_configuration","branch_protection_configuration.disabled","branch_protection_configuration.enabled","branch_protection_rule","branch_protection_rule.created","branch_protection_rule.deleted","branch_protection_rule.edited","check_run","check_run.completed","check_run.created","check_run.requested_action","check_run.rerequested","check_suite","check_suite.completed","check_suite.requested","check_suite.rerequested","code_scanning_alert","code_scanning_alert.appeared_in_branch","code_scanning_alert.closed_by_user","code_scanning_alert.created","code_scanning_alert.fixed","code_scanning_alert.reopened","code_scanning_alert.reopened_by_user","commit_comment","commit_comment.created","create","custom_property","custom_property.created","custom_property.deleted","custom_property.promote_to_enterprise","custom_property.updated","custom_property_values","custom_property_values.updated","delete","dependabot_alert","dependabot_alert.auto_dismissed","dependabot_alert.auto_reopened","dependabot_alert.created","dependabot_alert.dismissed","dependabot_alert.fixed","dependabot_alert.reintroduced","dependabot_alert.reopened","deploy_key","deploy_key.created","deploy_key.deleted","deployment","deployment.created","deployment_protection_rule","deployment_protection_rule.requested","deployment_review","deployment_review.approved","deployment_review.rejected","deployment_review.requested","deployment_status","deployment_status.created","discussion","discussion.answered","discussion.category_changed","discussion.closed","discussion.created","discussion.deleted","discussion.edited","discussion.labeled","discussion.locked","discussion.pinned","discussion.reopened","discussion.transferred","discussion.unanswered","discussion.unlabeled","discussion.unlocked","discussion.unpinned","discussion_comment","discussion_comment.created","discussion_comment.deleted","discussion_comment.edited","fork","github_app_authorization","github_app_authorization.revoked","gollum","installation","installation.created","installation.deleted","installation.new_permissions_accepted","installation.suspend","installation.unsuspend","installation_repositories","installation_repositories.added","installation_repositories.removed","installation_target","installation_target.renamed","issue_comment","issue_comment.created","issue_comment.deleted","issue_comment.edited","issues","issues.assigned","issues.closed","issues.deleted","issues.demilestoned","issues.edited","issues.labeled","issues.locked","issues.milestoned","issues.opened","issues.pinned","issues.reopened","issues.transferred","issues.typed","issues.unassigned","issues.unlabeled","issues.unlocked","issues.unpinned","issues.untyped","label","label.created","label.deleted","label.edited","marketplace_purchase","marketplace_purchase.cancelled","marketplace_purchase.changed","marketplace_purchase.pending_change","marketplace_purchase.pending_change_cancelled","marketplace_purchase.purchased","member","member.added","member.edited","member.removed","membership","membership.added","membership.removed","merge_group","merge_group.checks_requested","merge_group.destroyed","meta","meta.deleted","milestone","milestone.closed","milestone.created","milestone.deleted","milestone.edited","milestone.opened","org_block","org_block.blocked","org_block.unblocked","organization","organization.deleted","organization.member_added","organization.member_invited","organization.member_removed","organization.renamed","package","package.published","package.updated","page_build","personal_access_token_request","personal_access_token_request.approved","personal_access_token_request.cancelled","personal_access_token_request.created","personal_access_token_request.denied","ping","project","project.closed","project.created","project.deleted","project.edited","project.reopened","project_card","project_card.converted","project_card.created","project_card.deleted","project_card.edited","project_card.moved","project_column","project_column.created","project_column.deleted","project_column.edited","project_column.moved","projects_v2","projects_v2.closed","projects_v2.created","projects_v2.deleted","projects_v2.edited","projects_v2.reopened","projects_v2_item","projects_v2_item.archived","projects_v2_item.converted","projects_v2_item.created","projects_v2_item.deleted","projects_v2_item.edited","projects_v2_item.reordered","projects_v2_item.restored","projects_v2_status_update","projects_v2_status_update.created","projects_v2_status_update.deleted","projects_v2_status_update.edited","public","pull_request","pull_request.assigned","pull_request.auto_merge_disabled","pull_request.auto_merge_enabled","pull_request.closed","pull_request.converted_to_draft","pull_request.demilestoned","pull_request.dequeued","pull_request.edited","pull_request.enqueued","pull_request.labeled","pull_request.locked","pull_request.milestoned","pull_request.opened","pull_request.ready_for_review","pull_request.reopened","pull_request.review_request_removed","pull_request.review_requested","pull_request.synchronize","pull_request.unassigned","pull_request.unlabeled","pull_request.unlocked","pull_request_review","pull_request_review.dismissed","pull_request_review.edited","pull_request_review.submitted","pull_request_review_comment","pull_request_review_comment.created","pull_request_review_comment.deleted","pull_request_review_comment.edited","pull_request_review_thread","pull_request_review_thread.resolved","pull_request_review_thread.unresolved","push","registry_package","registry_package.published","registry_package.updated","release","release.created","release.deleted","release.edited","release.prereleased","release.published","release.released","release.unpublished","repository","repository.archived","repository.created","repository.deleted","repository.edited","repository.privatized","repository.publicized","repository.renamed","repository.transferred","repository.unarchived","repository_advisory","repository_advisory.published","repository_advisory.reported","repository_dispatch","repository_dispatch.sample.collected","repository_import","repository_ruleset","repository_ruleset.created","repository_ruleset.deleted","repository_ruleset.edited","repository_vulnerability_alert","repository_vulnerability_alert.create","repository_vulnerability_alert.dismiss","repository_vulnerability_alert.reopen","repository_vulnerability_alert.resolve","secret_scanning_alert","secret_scanning_alert.created","secret_scanning_alert.publicly_leaked","secret_scanning_alert.reopened","secret_scanning_alert.resolved","secret_scanning_alert.validated","secret_scanning_alert_location","secret_scanning_alert_location.created","secret_scanning_scan","secret_scanning_scan.completed","security_advisory","security_advisory.published","security_advisory.updated","security_advisory.withdrawn","security_and_analysis","sponsorship","sponsorship.cancelled","sponsorship.created","sponsorship.edited","sponsorship.pending_cancellation","sponsorship.pending_tier_change","sponsorship.tier_changed","star","star.created","star.deleted","status","sub_issues","sub_issues.parent_issue_added","sub_issues.parent_issue_removed","sub_issues.sub_issue_added","sub_issues.sub_issue_removed","team","team.added_to_repository","team.created","team.deleted","team.edited","team.removed_from_repository","team_add","watch","watch.started","workflow_dispatch","workflow_job","workflow_job.completed","workflow_job.in_progress","workflow_job.queued","workflow_job.waiting","workflow_run","workflow_run.completed","workflow_run.in_progress","workflow_run.requested"];function validateEventName(e,t={}){if(typeof e!=="string"){throw new TypeError("eventName must be of type string")}if(e==="*"){throw new TypeError(`Using the "*" event with the regular Webhooks.on() function is not supported. Please use the Webhooks.onAny() method instead`)}if(e==="error"){throw new TypeError(`Using the "error" event with the regular Webhooks.on() function is not supported. Please use the Webhooks.onError() method instead`)}if(t.onUnknownEventName==="ignore"){return}if(!hi.includes(e)){if(t.onUnknownEventName!=="warn"){throw new TypeError(`"${e}" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`)}else{(t.log||console).warn(`"${e}" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`)}}}function handleEventHandlers(e,t,i){if(!e.hooks[t]){e.hooks[t]=[]}e.hooks[t].push(i)}function receiverOn(e,t,i){if(Array.isArray(t)){t.forEach((t=>receiverOn(e,t,i)));return}validateEventName(t,{onUnknownEventName:"warn",log:e.log});handleEventHandlers(e,t,i)}function receiverOnAny(e,t){handleEventHandlers(e,"*",t)}function receiverOnError(e,t){handleEventHandlers(e,"error",t)}function wrapErrorHandler(e,t){let i;try{i=e(t)}catch(e){console.log('FATAL: Error occurred in "error" event handler');console.log(e)}if(i&&i.catch){i.catch((e=>{console.log('FATAL: Error occurred in "error" event handler');console.log(e)}))}}function getHooks(e,t,i){const n=[e.hooks[i],e.hooks["*"]];if(t){n.unshift(e.hooks[`${i}.${t}`])}return[].concat(...n.filter(Boolean))}function receiverHandle(e,t){const i=e.hooks.error||[];if(t instanceof Error){const e=Object.assign(new AggregateError([t],t.message),{event:t});i.forEach((t=>wrapErrorHandler(t,e)));return Promise.reject(e)}if(!t||!t.name){const e=new Error("Event name not passed");throw new AggregateError([e],e.message)}if(!t.payload){const e=new Error("Event name not passed");throw new AggregateError([e],e.message)}const n=getHooks(e,"action"in t.payload?t.payload.action:null,t.name);if(n.length===0){return Promise.resolve()}const r=[];const s=n.map((i=>{let n=Promise.resolve(t);if(e.transform){n=n.then(e.transform)}return n.then((e=>i(e))).catch((e=>r.push(Object.assign(e,{event:t}))))}));return Promise.all(s).then((()=>{if(r.length===0){return}const e=new AggregateError(r,r.map((e=>e.message)).join("\n"));Object.assign(e,{event:t});i.forEach((t=>wrapErrorHandler(t,e)));throw e}))}function removeListener(e,t,i){if(Array.isArray(t)){t.forEach((t=>removeListener(e,t,i)));return}if(!e.hooks[t]){return}for(let n=e.hooks[t].length-1;n>=0;n--){if(e.hooks[t][n]===i){e.hooks[t].splice(n,1);return}}}function createEventHandler(e){const t={hooks:{},log:createLogger(e&&e.log)};if(e&&e.transform){t.transform=e.transform}return{on:receiverOn.bind(null,t),onAny:receiverOnAny.bind(null,t),onError:receiverOnError.bind(null,t),removeListener:removeListener.bind(null,t),receive:receiverHandle.bind(null,t)}}async function verifyAndReceive(e,t){const i=await verifyWithFallback(e.secret,t.payload,t.signature,e.additionalSecrets).catch((()=>false));if(!i){const i=new Error("[@octokit/webhooks] signature does not match event payload and secret");return e.eventHandler.receive(Object.assign(i,{event:t,status:400}))}let n;try{n=JSON.parse(t.payload)}catch(e){e.message="Invalid JSON";e.status=400;throw new AggregateError([e],e.message)}return e.eventHandler.receive({id:t.id,name:t.name,payload:n})}var mi=/^\s*(application\/json)\s*(?:;|$)/u;var gi=null&&["x-github-event","x-hub-signature-256","x-github-delivery"];function createMiddleware(e){const{handleResponse:t,getRequestHeader:i,getPayload:n}=e;return function middleware(e,r){return async function octokitWebhooksMiddleware(s,o,a){let l;try{l=new URL(s.url,"http://localhost").pathname}catch(e){return t(JSON.stringify({error:`Request URL could not be parsed: ${s.url}`}),422,{"content-type":"application/json"},o)}if(l!==r.path){a?.();return t(null)}else if(s.method!=="POST"){return t(JSON.stringify({error:`Unknown route: ${s.method} ${l}`}),404,{"content-type":"application/json"},o)}const p=i(s,"content-type");if(typeof p!=="string"||!mi.test(p)){return t(JSON.stringify({error:`Unsupported "Content-Type" header value. Must be "application/json"`}),415,{"content-type":"application/json",accept:"application/json"},o)}const c=gi.filter((e=>i(s,e)==void 0)).join(", ");if(c){return t(JSON.stringify({error:`Required headers missing: ${c}`}),400,{"content-type":"application/json",accept:"application/json"},o)}const d=i(s,"x-github-event");const u=i(s,"x-hub-signature-256");const A=i(s,"x-github-delivery");r.log.debug(`${d} event received (id: ${A})`);let f=false;let h;const g=new Promise((e=>{h=setTimeout((()=>{f=true;e(t("still processing\n",202,{"Content-Type":"text/plain",accept:"application/json"},o))}),r.timeout)}));const processWebhook=async()=>{try{const i=await n(s);await e.verifyAndReceive({id:A,name:d,payload:i,signature:u});clearTimeout(h);if(f)return t(null);return t("ok\n",200,{"content-type":"text/plain",accept:"application/json"},o)}catch(e){clearTimeout(h);if(f)return t(null);const i=Array.from(e.errors)[0];const n=i.message?`${i.name}: ${i.message}`:"Error: An Unspecified error occurred";const s=typeof i.status!=="undefined"?i.status:500;r.log.error(e);return t(JSON.stringify({error:n}),s,{"content-type":"application/json",accept:"application/json"},o)}};return await Promise.race([g,processWebhook()])}}}function handleResponse(e,t=200,i={},n){if(e===null){return false}i["content-length"]=e.length.toString();n.writeHead(t,i).end(e);return true}function getRequestHeader(e,t){return e.headers[t]}function concatUint8Array(e){if(e.length===0){return new Uint8Array(0)}let t=0;for(let i=0;i{let n=[];e.on("error",(e=>i(new AggregateError([e],e.message))));e.on("data",n.push.bind(n));e.on("end",(()=>{const e=concatUint8Array(n);queueMicrotask((()=>t(e)))}))}))}function dist_bundle_createNodeMiddleware(e,{path:t="/api/github/webhooks",log:i=createLogger(),timeout:n=9e3}={}){return createMiddleware({handleResponse:handleResponse,getRequestHeader:getRequestHeader,getPayload:getPayload})(e,{path:t,log:i,timeout:n})}function getPayload2(e){return e.text()}function getRequestHeader2(e,t){return e.headers.get(t)}function handleResponse2(e,t=200,i={}){if(e!==null){i["content-length"]=e.length.toString()}return new Response(e,{status:t,headers:i})}function createWebMiddleware(e,{path:t="/api/github/webhooks",log:i=createLogger(),timeout:n=9e3}={}){return createMiddleware({handleResponse:handleResponse2,getRequestHeader:getRequestHeader2,getPayload:getPayload2})(e,{path:t,log:i,timeout:n})}var Ii=class{sign;verify;on;onAny;onError;removeListener;receive;verifyAndReceive;constructor(e){if(!e||!e.secret){throw new Error("[@octokit/webhooks] options.secret required")}const t={eventHandler:createEventHandler(e),secret:e.secret,additionalSecrets:e.additionalSecrets,hooks:{},log:createLogger(e.log)};this.sign=sign.bind(null,e.secret);this.verify=verify.bind(null,e.secret);this.on=t.eventHandler.on;this.onAny=t.eventHandler.onAny;this.onError=t.eventHandler.onError;this.removeListener=t.eventHandler.removeListener;this.receive=t.eventHandler.receive;this.verifyAndReceive=verifyAndReceive.bind(null,t)}};var Ei="16.0.1";function webhooks(e,t){return new Ii({secret:t.secret,transform:async t=>{if(!("installation"in t.payload)||typeof t.payload.installation!=="object"){const i=new e.constructor({authStrategy:pi,auth:{reason:`"installation" key missing in webhook event payload`}});return{...t,octokit:i}}const i=t.payload.installation.id;const n=await e.auth({type:"installation",installationId:i,factory(e){return new e.octokit.constructor({...e.octokitOptions,authStrategy:createAppAuth,...{auth:{...e,installationId:i}}})}});n.hook.before("request",(e=>{e.headers["x-github-delivery"]=t.id}));return{...t,octokit:n}}})}async function getInstallationOctokit(e,t){return e.octokit.auth({type:"installation",installationId:t,factory(e){const i={...e.octokitOptions,authStrategy:createAppAuth,...{auth:{...e,installationId:t}}};return new e.octokit.constructor(i)}})}function eachInstallationFactory(e){return Object.assign(eachInstallation.bind(null,e),{iterator:eachInstallationIterator.bind(null,e)})}async function eachInstallation(e,t){const i=eachInstallationIterator(e)[Symbol.asyncIterator]();let n=await i.next();while(!n.done){await t(n.value);n=await i.next()}}function eachInstallationIterator(e){return{async*[Symbol.asyncIterator](){const t=xt.iterator(e.octokit,"GET /app/installations");for await(const{data:i}of t){for(const t of i){const i=await getInstallationOctokit(e,t.id);yield{octokit:i,installation:t}}}}}}function eachRepositoryFactory(e){return Object.assign(eachRepository.bind(null,e),{iterator:eachRepositoryIterator.bind(null,e)})}async function eachRepository(e,t,i){const n=eachRepositoryIterator(e,i?t:void 0)[Symbol.asyncIterator]();let r=await n.next();while(!r.done){if(i){await i(r.value)}else{await t(r.value)}r=await n.next()}}function singleInstallationIterator(e,t){return{async*[Symbol.asyncIterator](){yield{octokit:await e.getInstallationOctokit(t)}}}}function eachRepositoryIterator(e,t){return{async*[Symbol.asyncIterator](){const i=t?singleInstallationIterator(e,t.installationId):e.eachInstallation.iterator();for await(const{octokit:e}of i){const t=xt.iterator(e,"GET /installation/repositories");for await(const{data:i}of t){for(const t of i){yield{octokit:e,repository:t}}}}}}}function getInstallationUrlFactory(e){let t;return async function getInstallationUrl(i={}){if(!t){t=getInstallationUrlBase(e)}const n=await t;const r=new URL(n);if(i.target_id!==void 0){r.pathname+="/permissions";r.searchParams.append("target_id",i.target_id.toFixed())}if(i.state!==void 0){r.searchParams.append("state",i.state)}return r.href}}async function getInstallationUrlBase(e){const{data:t}=await e.octokit.request("GET /app");if(!t){throw new Error("[@octokit/app] unable to fetch metadata for app")}return`${t.html_url}/installations/new`}function dist_node_noop(){}function dist_node_createNodeMiddleware(e,t={}){const i=Object.assign({debug:dist_node_noop,info:dist_node_noop,warn:console.warn.bind(console),error:console.error.bind(console)},t.log);const n={pathPrefix:"/api/github",...t,log:i};const r=webhooksNodeMiddleware(e.webhooks,{path:n.pathPrefix+"/webhooks",log:i});const s=oauthNodeMiddleware(e.oauth,{pathPrefix:n.pathPrefix+"/oauth"});return middleware.bind(null,n.pathPrefix,r,s)}async function middleware(e,t,i,n,r,s){const{pathname:o}=new URL(n.url,"http://localhost");if(o.startsWith(`${e}/`)){if(o===`${e}/webhooks`){t(n,r)}else if(o.startsWith(`${e}/oauth/`)){i(n,r)}else{sendNodeResponse(unknownRouteResponse(n),r)}return true}else{s?.();return false}}var Ci=class{static VERSION=Ei;static defaults(e){const t=class extends(this){constructor(...t){super({...e,...t[0]})}};return t}octokit;webhooks;oauth;getInstallationOctokit;eachInstallation;eachRepository;getInstallationUrl;log;constructor(e){const t=e.Octokit||dist_src_Octokit;const i=Object.assign({appId:e.appId,privateKey:e.privateKey},e.oauth?{clientId:e.oauth.clientId,clientSecret:e.oauth.clientSecret}:{});const n={authStrategy:createAppAuth,auth:i};if("log"in e&&typeof e.log!=="undefined"){n.log=e.log}this.octokit=new t(n);this.log=Object.assign({debug:()=>{},info:()=>{},warn:console.warn.bind(console),error:console.error.bind(console)},e.log);if(e.webhooks){this.webhooks=webhooks(this.octokit,e.webhooks)}else{Object.defineProperty(this,"webhooks",{get(){throw new Error("[@octokit/app] webhooks option not set")}})}if(e.oauth){this.oauth=new ui({...e.oauth,clientType:"github-app",Octokit:t})}else{Object.defineProperty(this,"oauth",{get(){throw new Error("[@octokit/app] oauth.clientId / oauth.clientSecret options are not set")}})}this.getInstallationOctokit=getInstallationOctokit.bind(null,this);this.eachInstallation=eachInstallationFactory(this);this.eachRepository=eachRepositoryFactory(this);this.getInstallationUrl=getInstallationUrlFactory(this)}};var bi="0.0.0-development";var Ti=dist_src_Octokit.plugin(restEndpointMethods,paginateRest,paginateGraphQL,retry,throttling).defaults({userAgent:`octokit.js/${bi}`,throttle:{onRateLimit:onRateLimit,onSecondaryRateLimit:onSecondaryRateLimit}});function onRateLimit(e,t,i){i.log.warn(`Request quota exhausted for request ${t.method} ${t.url}`);if(t.request.retryCount===0){i.log.info(`Retrying after ${e} seconds!`);return true}}function onSecondaryRateLimit(e,t,i){i.log.warn(`SecondaryRateLimit detected for request ${t.method} ${t.url}`);if(t.request.retryCount===0){i.log.info(`Retrying after ${e} seconds!`);return true}}var wi=Ci.defaults({Octokit:Ti});var Ri=ui.defaults({Octokit:Ti});class Context{line=1;lines=[];options={noPrefix:false};constructor(e,t){this.lines=e.split("\n");this.options.noPrefix=!!t?.noPrefix}getCurLine(){return this.lines[this.line-1]}nextLine(){this.line++;return this.getCurLine()}isEof(){return this.line>this.lines.length}}const Bi={Added:"AddedLine",Deleted:"DeletedLine",Unchanged:"UnchangedLine",Message:"MessageLine"};const Qi={Changed:"ChangedFile",Added:"AddedFile",Deleted:"DeletedFile",Renamed:"RenamedFile"};const Di={Index:"index",Old:"old",Copy:"copy",Similarity:"similarity",Dissimilarity:"dissimilarity",Deleted:"deleted",NewFile:"new file",RenameFrom:"rename from",RenameTo:"rename to"};const Si=Object.values(Di);function parseGitDiff(e,t){const i=new Context(e,t);const n=parseFileChanges(i);return{type:"GitDiff",files:n}}function parseFileChanges(e){const t=[];while(!e.isEof()){const i=parseFileChange(e);if(!i){break}t.push(i)}return t}function parseFileChange(e){if(!isComparisonInputLine(e.getCurLine())){return}const t=parseComparisonInputLine(e);let i=false;let n=false;let r=false;let s="";let o="";while(!e.isEof()){const a=parseExtendedHeader(e);if(!a){break}if(a.type===Di.Deleted){i=true;s=t?.from||""}if(a.type===Di.NewFile){n=true;o=t?.to||""}if(a.type===Di.RenameFrom){r=true;s=a.path}if(a.type===Di.RenameTo){r=true;o=a.path}}const a=parseChangeMarkers(e);const l=parseChunks(e);if(i&&l.length&&l[0].type==="BinaryFilesChunk"){return{type:Qi.Deleted,chunks:l,path:l[0].pathBefore}}if(i){return{type:Qi.Deleted,chunks:l,path:a?.deleted||s}}else if(n&&l.length&&l[0].type==="BinaryFilesChunk"){return{type:Qi.Added,chunks:l,path:l[0].pathAfter}}else if(n){return{type:Qi.Added,chunks:l,path:a?.added||o}}else if(r){return{type:Qi.Renamed,pathAfter:o,pathBefore:s,chunks:l}}else if(a){return{type:Qi.Changed,chunks:l,path:a.added}}else if(l.length&&l[0].type==="BinaryFilesChunk"&&l[0].pathAfter){return{type:Qi.Changed,chunks:l,path:l[0].pathAfter}}return}function isComparisonInputLine(e){return e.indexOf("diff")===0}function parseComparisonInputLine(e){const t=e.getCurLine();const[i,n]=t.split(" ").reverse();e.nextLine();if(i&&n){return{from:getFilePath(e,n,"src"),to:getFilePath(e,i,"dst")}}return null}function parseChunks(e){const t=[];while(!e.isEof()){const i=parseChunk(e);if(!i){break}t.push(i)}return t}function parseChunk(e){const t=parseChunkHeader(e);if(!t){return}if(t.type==="Normal"){const i=parseChanges(e,t.fromFileRange,t.toFileRange);return{...t,type:"Chunk",changes:i}}else if(t.type==="Combined"&&t.fromFileRangeA&&t.fromFileRangeB){const i=parseChanges(e,t.fromFileRangeA.startt.startsWith(e)));if(i){e.nextLine()}if(i===Di.RenameFrom||i===Di.RenameTo){return{type:i,path:t.slice(`${i} `.length)}}else if(i){return{type:i}}return null}function parseChunkHeader(e){const t=e.getCurLine();const i=/^@@\s\-(\d+),?(\d+)?\s\+(\d+),?(\d+)?\s@@\s?(.+)?/.exec(t);if(!i){const i=/^@@@\s\-(\d+),?(\d+)?\s\-(\d+),?(\d+)?\s\+(\d+),?(\d+)?\s@@@\s?(.+)?/.exec(t);if(!i){const i=/^Binary\sfiles\s(.*)\sand\s(.*)\sdiffer$/.exec(t);if(i){const[t,n,r]=i;e.nextLine();return{type:"BinaryFiles",fileA:getFilePath(e,n,"src"),fileB:getFilePath(e,r,"dst")}}return null}const[n,r,s,o,a,l,p,c]=i;e.nextLine();return{context:c,type:"Combined",fromFileRangeA:getRange(r,s),fromFileRangeB:getRange(o,a),toFileRange:getRange(l,p)}}const[n,r,s,o,a,l]=i;e.nextLine();return{context:l,type:"Normal",toFileRange:getRange(o,a),fromFileRange:getRange(r,s)}}function getRange(e,t){const i=parseInt(e,10);return{start:i,lines:t===undefined?1:parseInt(t,10)}}function parseChangeMarkers(e){const t=parseMarker(e,"--- ");const i=t?getFilePath(e,t,"src"):t;const n=parseMarker(e,"+++ ");const r=n?getFilePath(e,n,"dst"):n;return r&&i?{added:r,deleted:i}:null}function parseMarker(e,t){const i=e.getCurLine();if(i?.startsWith(t)){e.nextLine();return i.replace(t,"")}return null}const ki={"+":Bi.Added,"-":Bi.Deleted," ":Bi.Unchanged,"\\":Bi.Message};function parseChanges(e,t,i){const n=[];let r=t.start;let s=i.start;while(!e.isEof()){const t=e.getCurLine();const i=getLineType(t);if(!i){break}e.nextLine();let o;const a=t.slice(1);switch(i){case Bi.Added:{o={type:i,lineAfter:s++,content:a};break}case Bi.Deleted:{o={type:i,lineBefore:r++,content:a};break}case Bi.Unchanged:{o={type:i,lineBefore:r++,lineAfter:s++,content:a};break}case Bi.Message:{o={type:i,content:a.trim()};break}}n.push(o)}return n}function getLineType(e){return ki[e[0]]||null}function getFilePath(e,t,i){if(e.options.noPrefix){return t}if(i==="src")return t.replace(/^a\//,"");if(i==="dst")return t.replace(/^b\//,"");throw new Error("Unexpected unreachable code")}const _i=parseGitDiff;function bind_bind(e,t){return function wrap(){return e.apply(t,arguments)}}const{toString:Pi}=Object.prototype;const{getPrototypeOf:xi}=Object;const{iterator:Oi,toStringTag:Vi}=Symbol;const Ui=(e=>t=>{const i=Pi.call(t);return e[i]||(e[i]=i.slice(8,-1).toLowerCase())})(Object.create(null));const kindOfTest=e=>{e=e.toLowerCase();return t=>Ui(t)===e};const typeOfTest=e=>t=>typeof t===e;const{isArray:Ni}=Array;const Fi=typeOfTest("undefined");function isBuffer(e){return e!==null&&!Fi(e)&&e.constructor!==null&&!Fi(e.constructor)&&Mi(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const qi=kindOfTest("ArrayBuffer");function isArrayBufferView(e){let t;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){t=ArrayBuffer.isView(e)}else{t=e&&e.buffer&&qi(e.buffer)}return t}const ji=typeOfTest("string");const Mi=typeOfTest("function");const Li=typeOfTest("number");const utils_isObject=e=>e!==null&&typeof e==="object";const isBoolean=e=>e===true||e===false;const utils_isPlainObject=e=>{if(Ui(e)!=="object"){return false}const t=xi(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Vi in e)&&!(Oi in e)};const Gi=kindOfTest("Date");const Hi=kindOfTest("File");const Wi=kindOfTest("Blob");const Ji=kindOfTest("FileList");const isStream=e=>utils_isObject(e)&&Mi(e.pipe);const isFormData=e=>{let t;return e&&(typeof FormData==="function"&&e instanceof FormData||Mi(e.append)&&((t=Ui(e))==="formdata"||t==="object"&&Mi(e.toString)&&e.toString()==="[object FormData]"))};const Yi=kindOfTest("URLSearchParams");const[zi,Ki,$i,Xi]=["ReadableStream","Request","Response","Headers"].map(kindOfTest);const trim=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach(e,t,{allOwnKeys:i=false}={}){if(e===null||typeof e==="undefined"){return}let n;let r;if(typeof e!=="object"){e=[e]}if(Ni(e)){for(n=0,r=e.length;n0){r=i[n];if(t===r.toLowerCase()){return r}}return null}const Zi=(()=>{if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global})();const isContextDefined=e=>!Fi(e)&&e!==Zi;function utils_merge(){const{caseless:e}=isContextDefined(this)&&this||{};const t={};const assignValue=(i,n)=>{const r=e&&findKey(t,n)||n;if(utils_isPlainObject(t[r])&&utils_isPlainObject(i)){t[r]=utils_merge(t[r],i)}else if(utils_isPlainObject(i)){t[r]=utils_merge({},i)}else if(Ni(i)){t[r]=i.slice()}else{t[r]=i}};for(let e=0,t=arguments.length;e{forEach(t,((t,n)=>{if(i&&Mi(t)){e[n]=bind_bind(t,i)}else{e[n]=t}}),{allOwnKeys:n});return e};const stripBOM=e=>{if(e.charCodeAt(0)===65279){e=e.slice(1)}return e};const inherits=(e,t,i,n)=>{e.prototype=Object.create(t.prototype,n);e.prototype.constructor=e;Object.defineProperty(e,"super",{value:t.prototype});i&&Object.assign(e.prototype,i)};const toFlatObject=(e,t,i,n)=>{let r;let s;let o;const a={};t=t||{};if(e==null)return t;do{r=Object.getOwnPropertyNames(e);s=r.length;while(s-- >0){o=r[s];if((!n||n(o,e,t))&&!a[o]){t[o]=e[o];a[o]=true}}e=i!==false&&xi(e)}while(e&&(!i||i(e,t))&&e!==Object.prototype);return t};const endsWith=(e,t,i)=>{e=String(e);if(i===undefined||i>e.length){i=e.length}i-=t.length;const n=e.indexOf(t,i);return n!==-1&&n===i};const toArray=e=>{if(!e)return null;if(Ni(e))return e;let t=e.length;if(!Li(t))return null;const i=new Array(t);while(t-- >0){i[t]=e[t]}return i};const en=(e=>t=>e&&t instanceof e)(typeof Uint8Array!=="undefined"&&xi(Uint8Array));const forEachEntry=(e,t)=>{const i=e&&e[Oi];const n=i.call(e);let r;while((r=n.next())&&!r.done){const i=r.value;t.call(e,i[0],i[1])}};const matchAll=(e,t)=>{let i;const n=[];while((i=e.exec(t))!==null){n.push(i)}return n};const tn=kindOfTest("HTMLFormElement");const toCamelCase=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function replacer(e,t,i){return t.toUpperCase()+i}));const nn=(({hasOwnProperty:e})=>(t,i)=>e.call(t,i))(Object.prototype);const rn=kindOfTest("RegExp");const reduceDescriptors=(e,t)=>{const i=Object.getOwnPropertyDescriptors(e);const n={};forEach(i,((i,r)=>{let s;if((s=t(i,r,e))!==false){n[r]=s||i}}));Object.defineProperties(e,n)};const freezeMethods=e=>{reduceDescriptors(e,((t,i)=>{if(Mi(e)&&["arguments","caller","callee"].indexOf(i)!==-1){return false}const n=e[i];if(!Mi(n))return;t.enumerable=false;if("writable"in t){t.writable=false;return}if(!t.set){t.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")}}}))};const toObjectSet=(e,t)=>{const i={};const define=e=>{e.forEach((e=>{i[e]=true}))};Ni(e)?define(e):define(String(e).split(t));return i};const utils_noop=()=>{};const toFiniteNumber=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function isSpecCompliantForm(e){return!!(e&&Mi(e.append)&&e[Vi]==="FormData"&&e[Oi])}const toJSONObject=e=>{const t=new Array(10);const visit=(e,i)=>{if(utils_isObject(e)){if(t.indexOf(e)>=0){return}if(!("toJSON"in e)){t[i]=e;const n=Ni(e)?[]:{};forEach(e,((e,t)=>{const r=visit(e,i+1);!Fi(r)&&(n[t]=r)}));t[i]=undefined;return n}}return e};return visit(e,0)};const sn=kindOfTest("AsyncFunction");const isThenable=e=>e&&(utils_isObject(e)||Mi(e))&&Mi(e.then)&&Mi(e.catch);const on=((e,t)=>{if(e){return setImmediate}return t?((e,t)=>{Zi.addEventListener("message",(({source:i,data:n})=>{if(i===Zi&&n===e){t.length&&t.shift()()}}),false);return i=>{t.push(i);Zi.postMessage(e,"*")}})(`axios@${Math.random()}`,[]):e=>setTimeout(e)})(typeof setImmediate==="function",Mi(Zi.postMessage));const an=typeof queueMicrotask!=="undefined"?queueMicrotask.bind(Zi):typeof process!=="undefined"&&process.nextTick||on;const isIterable=e=>e!=null&&Mi(e[Oi]);const ln={isArray:Ni,isArrayBuffer:qi,isBuffer:isBuffer,isFormData:isFormData,isArrayBufferView:isArrayBufferView,isString:ji,isNumber:Li,isBoolean:isBoolean,isObject:utils_isObject,isPlainObject:utils_isPlainObject,isReadableStream:zi,isRequest:Ki,isResponse:$i,isHeaders:Xi,isUndefined:Fi,isDate:Gi,isFile:Hi,isBlob:Wi,isRegExp:rn,isFunction:Mi,isStream:isStream,isURLSearchParams:Yi,isTypedArray:en,isFileList:Ji,forEach:forEach,merge:utils_merge,extend:extend,trim:trim,stripBOM:stripBOM,inherits:inherits,toFlatObject:toFlatObject,kindOf:Ui,kindOfTest:kindOfTest,endsWith:endsWith,toArray:toArray,forEachEntry:forEachEntry,matchAll:matchAll,isHTMLForm:tn,hasOwnProperty:nn,hasOwnProp:nn,reduceDescriptors:reduceDescriptors,freezeMethods:freezeMethods,toObjectSet:toObjectSet,toCamelCase:toCamelCase,noop:utils_noop,toFiniteNumber:toFiniteNumber,findKey:findKey,global:Zi,isContextDefined:isContextDefined,isSpecCompliantForm:isSpecCompliantForm,toJSONObject:toJSONObject,isAsyncFn:sn,isThenable:isThenable,setImmediate:on,asap:an,isIterable:isIterable};function AxiosError(e,t,i,n,r){Error.call(this);if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}else{this.stack=(new Error).stack}this.message=e;this.name="AxiosError";t&&(this.code=t);i&&(this.config=i);n&&(this.request=n);if(r){this.response=r;this.status=r.status?r.status:null}}ln.inherits(AxiosError,Error,{toJSON:function toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ln.toJSONObject(this.config),code:this.code,status:this.status}}});const pn=AxiosError.prototype;const cn={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{cn[e]={value:e}}));Object.defineProperties(AxiosError,cn);Object.defineProperty(pn,"isAxiosError",{value:true});AxiosError.from=(e,t,i,n,r,s)=>{const o=Object.create(pn);ln.toFlatObject(e,o,(function filter(e){return e!==Error.prototype}),(e=>e!=="isAxiosError"));AxiosError.call(o,e.message,t,i,n,r);o.cause=e;o.name=e.name;s&&Object.assign(o,s);return o};const dn=AxiosError;var un=__nccwpck_require__(6454);const An=un;function isVisitable(e){return ln.isPlainObject(e)||ln.isArray(e)}function removeBrackets(e){return ln.endsWith(e,"[]")?e.slice(0,-2):e}function renderKey(e,t,i){if(!e)return t;return e.concat(t).map((function each(e,t){e=removeBrackets(e);return!i&&t?"["+e+"]":e})).join(i?".":"")}function isFlatArray(e){return ln.isArray(e)&&!e.some(isVisitable)}const fn=ln.toFlatObject(ln,{},null,(function filter(e){return/^is[A-Z]/.test(e)}));function toFormData(e,t,i){if(!ln.isObject(e)){throw new TypeError("target must be an object")}t=t||new(An||FormData);i=ln.toFlatObject(i,{metaTokens:true,dots:false,indexes:false},false,(function defined(e,t){return!ln.isUndefined(t[e])}));const n=i.metaTokens;const r=i.visitor||defaultVisitor;const s=i.dots;const o=i.indexes;const a=i.Blob||typeof Blob!=="undefined"&&Blob;const l=a&&ln.isSpecCompliantForm(t);if(!ln.isFunction(r)){throw new TypeError("visitor must be a function")}function convertValue(e){if(e===null)return"";if(ln.isDate(e)){return e.toISOString()}if(ln.isBoolean(e)){return e.toString()}if(!l&&ln.isBlob(e)){throw new dn("Blob is not supported. Use a Buffer instead.")}if(ln.isArrayBuffer(e)||ln.isTypedArray(e)){return l&&typeof Blob==="function"?new Blob([e]):Buffer.from(e)}return e}function defaultVisitor(e,i,r){let a=e;if(e&&!r&&typeof e==="object"){if(ln.endsWith(i,"{}")){i=n?i:i.slice(0,-2);e=JSON.stringify(e)}else if(ln.isArray(e)&&isFlatArray(e)||(ln.isFileList(e)||ln.endsWith(i,"[]"))&&(a=ln.toArray(e))){i=removeBrackets(i);a.forEach((function each(e,n){!(ln.isUndefined(e)||e===null)&&t.append(o===true?renderKey([i],n,s):o===null?i:i+"[]",convertValue(e))}));return false}}if(isVisitable(e)){return true}t.append(renderKey(r,i,s),convertValue(e));return false}const p=[];const c=Object.assign(fn,{defaultVisitor:defaultVisitor,convertValue:convertValue,isVisitable:isVisitable});function build(e,i){if(ln.isUndefined(e))return;if(p.indexOf(e)!==-1){throw Error("Circular reference detected in "+i.join("."))}p.push(e);ln.forEach(e,(function each(e,n){const s=!(ln.isUndefined(e)||e===null)&&r.call(t,e,ln.isString(n)?n.trim():n,i,c);if(s===true){build(e,i?i.concat(n):[n])}}));p.pop()}if(!ln.isObject(e)){throw new TypeError("data must be an object")}build(e);return t}const hn=toFormData;function encode(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function replacer(e){return t[e]}))}function AxiosURLSearchParams(e,t){this._pairs=[];e&&hn(e,this,t)}const mn=AxiosURLSearchParams.prototype;mn.append=function append(e,t){this._pairs.push([e,t])};mn.toString=function toString(e){const t=e?function(t){return e.call(this,t,encode)}:encode;return this._pairs.map((function each(e){return t(e[0])+"="+t(e[1])}),"").join("&")};const gn=AxiosURLSearchParams;function buildURL_encode(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(e,t,i){if(!t){return e}const n=i&&i.encode||buildURL_encode;if(ln.isFunction(i)){i={serialize:i}}const r=i&&i.serialize;let s;if(r){s=r(t,i)}else{s=ln.isURLSearchParams(t)?t.toString():new gn(t,i).toString(n)}if(s){const t=e.indexOf("#");if(t!==-1){e=e.slice(0,t)}e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class InterceptorManager{constructor(){this.handlers=[]}use(e,t,i){this.handlers.push({fulfilled:e,rejected:t,synchronous:i?i.synchronous:false,runWhen:i?i.runWhen:null});return this.handlers.length-1}eject(e){if(this.handlers[e]){this.handlers[e]=null}}clear(){if(this.handlers){this.handlers=[]}}forEach(e){ln.forEach(this.handlers,(function forEachHandler(t){if(t!==null){e(t)}}))}}const yn=InterceptorManager;const vn={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};var In=__nccwpck_require__(6982);var En=__nccwpck_require__(7016);const Cn=En.URLSearchParams;const bn="abcdefghijklmnopqrstuvwxyz";const Tn="0123456789";const wn={DIGIT:Tn,ALPHA:bn,ALPHA_DIGIT:bn+bn.toUpperCase()+Tn};const generateString=(e=16,t=wn.ALPHA_DIGIT)=>{let i="";const{length:n}=t;const r=new Uint32Array(e);In.randomFillSync(r);for(let s=0;stypeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function")();const kn=Bn&&window.location.href||"http://localhost";const _n={...r,...Rn};function toURLEncodedForm(e,t){return hn(e,new _n.classes.URLSearchParams,Object.assign({visitor:function(e,t,i,n){if(_n.isNode&&ln.isBuffer(e)){this.append(t,e.toString("base64"));return false}return n.defaultVisitor.apply(this,arguments)}},t))}function parsePropPath(e){return ln.matchAll(/\w+|\[(\w*)]/g,e).map((e=>e[0]==="[]"?"":e[1]||e[0]))}function arrayToObject(e){const t={};const i=Object.keys(e);let n;const r=i.length;let s;for(n=0;n=e.length;r=!r&&ln.isArray(i)?i.length:r;if(o){if(ln.hasOwnProp(i,r)){i[r]=[i[r],t]}else{i[r]=t}return!s}if(!i[r]||!ln.isObject(i[r])){i[r]=[]}const a=buildPath(e,t,i[r],n);if(a&&ln.isArray(i[r])){i[r]=arrayToObject(i[r])}return!s}if(ln.isFormData(e)&&ln.isFunction(e.entries)){const t={};ln.forEachEntry(e,((e,i)=>{buildPath(parsePropPath(e),i,t,0)}));return t}return null}const Pn=formDataToJSON;function stringifySafely(e,t,i){if(ln.isString(e)){try{(t||JSON.parse)(e);return ln.trim(e)}catch(e){if(e.name!=="SyntaxError"){throw e}}}return(i||JSON.stringify)(e)}const xn={transitional:vn,adapter:["xhr","http","fetch"],transformRequest:[function transformRequest(e,t){const i=t.getContentType()||"";const n=i.indexOf("application/json")>-1;const r=ln.isObject(e);if(r&&ln.isHTMLForm(e)){e=new FormData(e)}const s=ln.isFormData(e);if(s){return n?JSON.stringify(Pn(e)):e}if(ln.isArrayBuffer(e)||ln.isBuffer(e)||ln.isStream(e)||ln.isFile(e)||ln.isBlob(e)||ln.isReadableStream(e)){return e}if(ln.isArrayBufferView(e)){return e.buffer}if(ln.isURLSearchParams(e)){t.setContentType("application/x-www-form-urlencoded;charset=utf-8",false);return e.toString()}let o;if(r){if(i.indexOf("application/x-www-form-urlencoded")>-1){return toURLEncodedForm(e,this.formSerializer).toString()}if((o=ln.isFileList(e))||i.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return hn(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}if(r||n){t.setContentType("application/json",false);return stringifySafely(e)}return e}],transformResponse:[function transformResponse(e){const t=this.transitional||xn.transitional;const i=t&&t.forcedJSONParsing;const n=this.responseType==="json";if(ln.isResponse(e)||ln.isReadableStream(e)){return e}if(e&&ln.isString(e)&&(i&&!this.responseType||n)){const i=t&&t.silentJSONParsing;const r=!i&&n;try{return JSON.parse(e)}catch(e){if(r){if(e.name==="SyntaxError"){throw dn.from(e,dn.ERR_BAD_RESPONSE,this,null,this.response)}throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_n.classes.FormData,Blob:_n.classes.Blob},validateStatus:function validateStatus(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":undefined}}};ln.forEach(["delete","get","head","post","put","patch"],(e=>{xn.headers[e]={}}));const On=xn;const Vn=ln.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const parseHeaders=e=>{const t={};let i;let n;let r;e&&e.split("\n").forEach((function parser(e){r=e.indexOf(":");i=e.substring(0,r).trim().toLowerCase();n=e.substring(r+1).trim();if(!i||t[i]&&Vn[i]){return}if(i==="set-cookie"){if(t[i]){t[i].push(n)}else{t[i]=[n]}}else{t[i]=t[i]?t[i]+", "+n:n}}));return t};const Un=Symbol("internals");function normalizeHeader(e){return e&&String(e).trim().toLowerCase()}function normalizeValue(e){if(e===false||e==null){return e}return ln.isArray(e)?e.map(normalizeValue):String(e)}function parseTokens(e){const t=Object.create(null);const i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;while(n=i.exec(e)){t[n[1]]=n[2]}return t}const isValidHeaderName=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function matchHeaderValue(e,t,i,n,r){if(ln.isFunction(n)){return n.call(this,t,i)}if(r){t=i}if(!ln.isString(t))return;if(ln.isString(n)){return t.indexOf(n)!==-1}if(ln.isRegExp(n)){return n.test(t)}}function formatHeader(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,i)=>t.toUpperCase()+i))}function buildAccessors(e,t){const i=ln.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+i,{value:function(e,i,r){return this[n].call(this,t,e,i,r)},configurable:true})}))}class AxiosHeaders{constructor(e){e&&this.set(e)}set(e,t,i){const n=this;function setHeader(e,t,i){const r=normalizeHeader(t);if(!r){throw new Error("header name must be a non-empty string")}const s=ln.findKey(n,r);if(!s||n[s]===undefined||i===true||i===undefined&&n[s]!==false){n[s||t]=normalizeValue(e)}}const setHeaders=(e,t)=>ln.forEach(e,((e,i)=>setHeader(e,i,t)));if(ln.isPlainObject(e)||e instanceof this.constructor){setHeaders(e,t)}else if(ln.isString(e)&&(e=e.trim())&&!isValidHeaderName(e)){setHeaders(parseHeaders(e),t)}else if(ln.isObject(e)&&ln.isIterable(e)){let i={},n,r;for(const t of e){if(!ln.isArray(t)){throw TypeError("Object iterator must return a key-value pair")}i[r=t[0]]=(n=i[r])?ln.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}setHeaders(i,t)}else{e!=null&&setHeader(t,e,i)}return this}get(e,t){e=normalizeHeader(e);if(e){const i=ln.findKey(this,e);if(i){const e=this[i];if(!t){return e}if(t===true){return parseTokens(e)}if(ln.isFunction(t)){return t.call(this,e,i)}if(ln.isRegExp(t)){return t.exec(e)}throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){e=normalizeHeader(e);if(e){const i=ln.findKey(this,e);return!!(i&&this[i]!==undefined&&(!t||matchHeaderValue(this,this[i],i,t)))}return false}delete(e,t){const i=this;let n=false;function deleteHeader(e){e=normalizeHeader(e);if(e){const r=ln.findKey(i,e);if(r&&(!t||matchHeaderValue(i,i[r],r,t))){delete i[r];n=true}}}if(ln.isArray(e)){e.forEach(deleteHeader)}else{deleteHeader(e)}return n}clear(e){const t=Object.keys(this);let i=t.length;let n=false;while(i--){const r=t[i];if(!e||matchHeaderValue(this,this[r],r,e,true)){delete this[r];n=true}}return n}normalize(e){const t=this;const i={};ln.forEach(this,((n,r)=>{const s=ln.findKey(i,r);if(s){t[s]=normalizeValue(n);delete t[r];return}const o=e?formatHeader(r):String(r).trim();if(o!==r){delete t[r]}t[o]=normalizeValue(n);i[o]=true}));return this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);ln.forEach(this,((i,n)=>{i!=null&&i!==false&&(t[n]=e&&ln.isArray(i)?i.join(", "):i)}));return t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);t.forEach((e=>i.set(e)));return i}static accessor(e){const t=this[Un]=this[Un]={accessors:{}};const i=t.accessors;const n=this.prototype;function defineAccessor(e){const t=normalizeHeader(e);if(!i[t]){buildAccessors(n,e);i[t]=true}}ln.isArray(e)?e.forEach(defineAccessor):defineAccessor(e);return this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ln.reduceDescriptors(AxiosHeaders.prototype,(({value:e},t)=>{let i=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[i]=e}}}));ln.freezeMethods(AxiosHeaders);const Nn=AxiosHeaders;function transformData(e,t){const i=this||On;const n=t||i;const r=Nn.from(n.headers);let s=n.data;ln.forEach(e,(function transform(e){s=e.call(i,s,r.normalize(),t?t.status:undefined)}));r.normalize();return s}function isCancel(e){return!!(e&&e.__CANCEL__)}function CanceledError(e,t,i){dn.call(this,e==null?"canceled":e,dn.ERR_CANCELED,t,i);this.name="CanceledError"}ln.inherits(CanceledError,dn,{__CANCEL__:true});const Fn=CanceledError;function settle(e,t,i){const n=i.config.validateStatus;if(!i.status||!n||n(i.status)){e(i)}else{t(new dn("Request failed with status code "+i.status,[dn.ERR_BAD_REQUEST,dn.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}}function isAbsoluteURL(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function combineURLs(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function buildFullPath(e,t,i){let n=!isAbsoluteURL(t);if(e&&(n||i==false)){return combineURLs(e,t)}return t}var qn=__nccwpck_require__(7777);var jn=__nccwpck_require__(8611);var Mn=__nccwpck_require__(5692);var Ln=__nccwpck_require__(1573);var Gn=__nccwpck_require__(3106);const Hn="1.10.0";function parseProtocol(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}const Wn=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function fromDataURI(e,t,i){const n=i&&i.Blob||_n.classes.Blob;const r=parseProtocol(e);if(t===undefined&&n){t=true}if(r==="data"){e=r.length?e.slice(r.length+1):e;const i=Wn.exec(e);if(!i){throw new dn("Invalid URL",dn.ERR_INVALID_URL)}const s=i[1];const o=i[2];const a=i[3];const l=Buffer.from(decodeURIComponent(a),o?"base64":"utf8");if(t){if(!n){throw new dn("Blob is not supported",dn.ERR_NOT_SUPPORT)}return new n([l],{type:s})}return l}throw new dn("Unsupported protocol "+r,dn.ERR_NOT_SUPPORT)}var Jn=__nccwpck_require__(2203);const Yn=Symbol("internals");class AxiosTransformStream extends Jn.Transform{constructor(e){e=ln.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,((e,t)=>!ln.isUndefined(t[e])));super({readableHighWaterMark:e.chunkSize});const t=this[Yn]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:false,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",(e=>{if(e==="progress"){if(!t.isCaptured){t.isCaptured=true}}}))}_read(e){const t=this[Yn];if(t.onReadCallback){t.onReadCallback()}return super._read(e)}_transform(e,t,i){const n=this[Yn];const r=n.maxRate;const s=this.readableHighWaterMark;const o=n.timeWindow;const a=1e3/o;const l=r/a;const p=n.minChunkSize!==false?Math.max(n.minChunkSize,l*.01):0;const pushChunk=(e,t)=>{const i=Buffer.byteLength(e);n.bytesSeen+=i;n.bytes+=i;n.isCaptured&&this.emit("progress",n.bytesSeen);if(this.push(e)){process.nextTick(t)}else{n.onReadCallback=()=>{n.onReadCallback=null;process.nextTick(t)}}};const transformChunk=(e,t)=>{const i=Buffer.byteLength(e);let a=null;let c=s;let d;let u=0;if(r){const e=Date.now();if(!n.ts||(u=e-n.ts)>=o){n.ts=e;d=l-n.bytes;n.bytes=d<0?-d:0;u=0}d=l-n.bytes}if(r){if(d<=0){return setTimeout((()=>{t(null,e)}),o-u)}if(dc&&i-c>p){a=e.subarray(c);e=e.subarray(0,c)}pushChunk(e,a?()=>{process.nextTick(t,null,a)}:t)};transformChunk(e,(function transformNextChunk(e,t){if(e){return i(e)}if(t){transformChunk(t,transformNextChunk)}else{i(null)}}))}}const zn=AxiosTransformStream;var Kn=__nccwpck_require__(4434);const{asyncIterator:$n}=Symbol;const readBlob=async function*(e){if(e.stream){yield*e.stream()}else if(e.arrayBuffer){yield await e.arrayBuffer()}else if(e[$n]){yield*e[$n]()}else{yield e}};const Xn=readBlob;const Zn=_n.ALPHABET.ALPHA_DIGIT+"-_";const er=typeof TextEncoder==="function"?new TextEncoder:new b.TextEncoder;const tr="\r\n";const ir=er.encode(tr);const nr=2;class FormDataPart{constructor(e,t){const{escapeName:i}=this.constructor;const n=ln.isString(t);let r=`Content-Disposition: form-data; name="${i(e)}"${!n&&t.name?`; filename="${i(t.name)}"`:""}${tr}`;if(n){t=er.encode(String(t).replace(/\r?\n|\r\n?/g,tr))}else{r+=`Content-Type: ${t.type||"application/octet-stream"}${tr}`}this.headers=er.encode(r+tr);this.contentLength=n?t.byteLength:t.size;this.size=this.headers.byteLength+this.contentLength+nr;this.name=e;this.value=t}async*encode(){yield this.headers;const{value:e}=this;if(ln.isTypedArray(e)){yield e}else{yield*Xn(e)}yield ir}static escapeName(e){return String(e).replace(/[\r\n"]/g,(e=>({"\r":"%0D","\n":"%0A",'"':"%22"}[e])))}}const formDataToStream=(e,t,i)=>{const{tag:n="form-data-boundary",size:r=25,boundary:s=n+"-"+_n.generateString(r,Zn)}=i||{};if(!ln.isFormData(e)){throw TypeError("FormData instance required")}if(s.length<1||s.length>70){throw Error("boundary must be 10-70 characters long")}const o=er.encode("--"+s+tr);const a=er.encode("--"+s+"--"+tr);let l=a.byteLength;const p=Array.from(e.entries()).map((([e,t])=>{const i=new FormDataPart(e,t);l+=i.size;return i}));l+=o.byteLength*p.length;l=ln.toFiniteNumber(l);const c={"Content-Type":`multipart/form-data; boundary=${s}`};if(Number.isFinite(l)){c["Content-Length"]=l}t&&t(c);return Jn.Readable.from(async function*(){for(const e of p){yield o;yield*e.encode()}yield a}())};const rr=formDataToStream;class ZlibHeaderTransformStream extends Jn.Transform{__transform(e,t,i){this.push(e);i()}_transform(e,t,i){if(e.length!==0){this._transform=this.__transform;if(e[0]!==120){const e=Buffer.alloc(2);e[0]=120;e[1]=156;this.push(e,t)}}this.__transform(e,t,i)}}const sr=ZlibHeaderTransformStream;const callbackify=(e,t)=>ln.isAsyncFn(e)?function(...i){const n=i.pop();e.apply(this,i).then((e=>{try{t?n(null,...t(e)):n(null,e)}catch(e){n(e)}}),n)}:e;const or=callbackify;function speedometer(e,t){e=e||10;const i=new Array(e);const n=new Array(e);let r=0;let s=0;let o;t=t!==undefined?t:1e3;return function push(a){const l=Date.now();const p=n[s];if(!o){o=l}i[r]=a;n[r]=l;let c=s;let d=0;while(c!==r){d+=i[c++];c=c%e}r=(r+1)%e;if(r===s){s=(s+1)%e}if(l-o{i=n;r=null;if(s){clearTimeout(s);s=null}e.apply(null,t)};const throttled=(...e)=>{const t=Date.now();const o=t-i;if(o>=n){invoke(e,t)}else{r=e;if(!s){s=setTimeout((()=>{s=null;invoke(r)}),n-o)}}};const flush=()=>r&&invoke(r);return[throttled,flush]}const lr=throttle;const progressEventReducer=(e,t,i=3)=>{let n=0;const r=ar(50,250);return lr((i=>{const s=i.loaded;const o=i.lengthComputable?i.total:undefined;const a=s-n;const l=r(a);const p=s<=o;n=s;const c={loaded:s,total:o,progress:o?s/o:undefined,bytes:a,rate:l?l:undefined,estimated:l&&o&&p?(o-s)/l:undefined,event:i,lengthComputable:o!=null,[t?"download":"upload"]:true};e(c)}),i)};const progressEventDecorator=(e,t)=>{const i=e!=null;return[n=>t[0]({lengthComputable:i,total:e,loaded:n}),t[1]]};const asyncDecorator=e=>(...t)=>ln.asap((()=>e(...t)));const pr={flush:Gn.constants.Z_SYNC_FLUSH,finishFlush:Gn.constants.Z_SYNC_FLUSH};const cr={flush:Gn.constants.BROTLI_OPERATION_FLUSH,finishFlush:Gn.constants.BROTLI_OPERATION_FLUSH};const dr=ln.isFunction(Gn.createBrotliDecompress);const{http:ur,https:Ar}=Ln;const fr=/https:?/;const hr=_n.protocols.map((e=>e+":"));const flushOnFinish=(e,[t,i])=>{e.on("end",i).on("error",i);return t};function dispatchBeforeRedirect(e,t){if(e.beforeRedirects.proxy){e.beforeRedirects.proxy(e)}if(e.beforeRedirects.config){e.beforeRedirects.config(e,t)}}function setProxy(e,t,i){let n=t;if(!n&&n!==false){const e=qn.getProxyForUrl(i);if(e){n=new URL(e)}}if(n){if(n.username){n.auth=(n.username||"")+":"+(n.password||"")}if(n.auth){if(n.auth.username||n.auth.password){n.auth=(n.auth.username||"")+":"+(n.auth.password||"")}const t=Buffer.from(n.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}e.headers.host=e.hostname+(e.port?":"+e.port:"");const t=n.hostname||n.host;e.hostname=t;e.host=t;e.port=n.port;e.path=i;if(n.protocol){e.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`}}e.beforeRedirects.proxy=function beforeRedirect(e){setProxy(e,t,e.href)}}const mr=typeof process!=="undefined"&&ln.kindOf(process)==="process";const wrapAsync=e=>new Promise(((t,i)=>{let n;let r;const done=(e,t)=>{if(r)return;r=true;n&&n(e,t)};const _resolve=e=>{done(e);t(e)};const _reject=e=>{done(e,true);i(e)};e(_resolve,_reject,(e=>n=e)).catch(_reject)}));const resolveFamily=({address:e,family:t})=>{if(!ln.isString(e)){throw TypeError("address must be a string")}return{address:e,family:t||(e.indexOf(".")<0?6:4)}};const buildAddressEntry=(e,t)=>resolveFamily(ln.isObject(e)?e:{address:e,family:t});const gr=mr&&function httpAdapter(e){return wrapAsync((async function dispatchHttpRequest(t,i,n){let{data:r,lookup:s,family:o}=e;const{responseType:a,responseEncoding:l}=e;const p=e.method.toUpperCase();let c;let d=false;let u;if(s){const e=or(s,(e=>ln.isArray(e)?e:[e]));s=(t,i,n)=>{e(t,i,((e,t,r)=>{if(e){return n(e)}const s=ln.isArray(t)?t.map((e=>buildAddressEntry(e))):[buildAddressEntry(t,r)];i.all?n(e,s):n(e,s[0].address,s[0].family)}))}}const A=new Kn.EventEmitter;const onFinished=()=>{if(e.cancelToken){e.cancelToken.unsubscribe(abort)}if(e.signal){e.signal.removeEventListener("abort",abort)}A.removeAllListeners()};n(((e,t)=>{c=true;if(t){d=true;onFinished()}}));function abort(t){A.emit("abort",!t||t.type?new Fn(null,e,u):t)}A.once("abort",i);if(e.cancelToken||e.signal){e.cancelToken&&e.cancelToken.subscribe(abort);if(e.signal){e.signal.aborted?abort():e.signal.addEventListener("abort",abort)}}const f=buildFullPath(e.baseURL,e.url,e.allowAbsoluteUrls);const h=new URL(f,_n.hasBrowserEnv?_n.origin:undefined);const g=h.protocol||hr[0];if(g==="data:"){let n;if(p!=="GET"){return settle(t,i,{status:405,statusText:"method not allowed",headers:{},config:e})}try{n=fromDataURI(e.url,a==="blob",{Blob:e.env&&e.env.Blob})}catch(t){throw dn.from(t,dn.ERR_BAD_REQUEST,e)}if(a==="text"){n=n.toString(l);if(!l||l==="utf8"){n=ln.stripBOM(n)}}else if(a==="stream"){n=Jn.Readable.from(n)}return settle(t,i,{data:n,status:200,statusText:"OK",headers:new Nn,config:e})}if(hr.indexOf(g)===-1){return i(new dn("Unsupported protocol "+g,dn.ERR_BAD_REQUEST,e))}const y=Nn.from(e.headers).normalize();y.set("User-Agent","axios/"+Hn,false);const{onUploadProgress:v,onDownloadProgress:I}=e;const E=e.maxRate;let C=undefined;let T=undefined;if(ln.isSpecCompliantForm(r)){const e=y.getContentType(/boundary=([-_\w\d]{10,70})/i);r=rr(r,(e=>{y.set(e)}),{tag:`axios-${Hn}-boundary`,boundary:e&&e[1]||undefined})}else if(ln.isFormData(r)&&ln.isFunction(r.getHeaders)){y.set(r.getHeaders());if(!y.hasContentLength()){try{const e=await b.promisify(r.getLength).call(r);Number.isFinite(e)&&e>=0&&y.setContentLength(e)}catch(e){}}}else if(ln.isBlob(r)||ln.isFile(r)){r.size&&y.setContentType(r.type||"application/octet-stream");y.setContentLength(r.size||0);r=Jn.Readable.from(Xn(r))}else if(r&&!ln.isStream(r)){if(Buffer.isBuffer(r)){}else if(ln.isArrayBuffer(r)){r=Buffer.from(new Uint8Array(r))}else if(ln.isString(r)){r=Buffer.from(r,"utf-8")}else{return i(new dn("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",dn.ERR_BAD_REQUEST,e))}y.setContentLength(r.length,false);if(e.maxBodyLength>-1&&r.length>e.maxBodyLength){return i(new dn("Request body larger than maxBodyLength limit",dn.ERR_BAD_REQUEST,e))}}const w=ln.toFiniteNumber(y.getContentLength());if(ln.isArray(E)){C=E[0];T=E[1]}else{C=T=E}if(r&&(v||C)){if(!ln.isStream(r)){r=Jn.Readable.from(r,{objectMode:false})}r=Jn.pipeline([r,new zn({maxRate:ln.toFiniteNumber(C)})],ln.noop);v&&r.on("progress",flushOnFinish(r,progressEventDecorator(w,progressEventReducer(asyncDecorator(v),false,3))))}let R=undefined;if(e.auth){const t=e.auth.username||"";const i=e.auth.password||"";R=t+":"+i}if(!R&&h.username){const e=h.username;const t=h.password;R=e+":"+t}R&&y.delete("authorization");let B;try{B=buildURL(h.pathname+h.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){const n=new Error(t.message);n.config=e;n.url=e.url;n.exists=true;return i(n)}y.set("Accept-Encoding","gzip, compress, deflate"+(dr?", br":""),false);const D={path:B,method:p,headers:y.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:R,protocol:g,family:o,beforeRedirect:dispatchBeforeRedirect,beforeRedirects:{}};!ln.isUndefined(s)&&(D.lookup=s);if(e.socketPath){D.socketPath=e.socketPath}else{D.hostname=h.hostname.startsWith("[")?h.hostname.slice(1,-1):h.hostname;D.port=h.port;setProxy(D,e.proxy,g+"//"+h.hostname+(h.port?":"+h.port:"")+D.path)}let S;const k=fr.test(D.protocol);D.agent=k?e.httpsAgent:e.httpAgent;if(e.transport){S=e.transport}else if(e.maxRedirects===0){S=k?Mn:jn}else{if(e.maxRedirects){D.maxRedirects=e.maxRedirects}if(e.beforeRedirect){D.beforeRedirects.config=e.beforeRedirect}S=k?Ar:ur}if(e.maxBodyLength>-1){D.maxBodyLength=e.maxBodyLength}else{D.maxBodyLength=Infinity}if(e.insecureHTTPParser){D.insecureHTTPParser=e.insecureHTTPParser}u=S.request(D,(function handleResponse(n){if(u.destroyed)return;const r=[n];const s=+n.headers["content-length"];if(I||T){const e=new zn({maxRate:ln.toFiniteNumber(T)});I&&e.on("progress",flushOnFinish(e,progressEventDecorator(s,progressEventReducer(asyncDecorator(I),true,3))));r.push(e)}let o=n;const c=n.req||u;if(e.decompress!==false&&n.headers["content-encoding"]){if(p==="HEAD"||n.statusCode===204){delete n.headers["content-encoding"]}switch((n.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":r.push(Gn.createUnzip(pr));delete n.headers["content-encoding"];break;case"deflate":r.push(new sr);r.push(Gn.createUnzip(pr));delete n.headers["content-encoding"];break;case"br":if(dr){r.push(Gn.createBrotliDecompress(cr));delete n.headers["content-encoding"]}}}o=r.length>1?Jn.pipeline(r,ln.noop):r[0];const f=Jn.finished(o,(()=>{f();onFinished()}));const h={status:n.statusCode,statusText:n.statusMessage,headers:new Nn(n.headers),config:e,request:c};if(a==="stream"){h.data=o;settle(t,i,h)}else{const n=[];let r=0;o.on("data",(function handleStreamData(t){n.push(t);r+=t.length;if(e.maxContentLength>-1&&r>e.maxContentLength){d=true;o.destroy();i(new dn("maxContentLength size of "+e.maxContentLength+" exceeded",dn.ERR_BAD_RESPONSE,e,c))}}));o.on("aborted",(function handlerStreamAborted(){if(d){return}const t=new dn("stream has been aborted",dn.ERR_BAD_RESPONSE,e,c);o.destroy(t);i(t)}));o.on("error",(function handleStreamError(t){if(u.destroyed)return;i(dn.from(t,null,e,c))}));o.on("end",(function handleStreamEnd(){try{let e=n.length===1?n[0]:Buffer.concat(n);if(a!=="arraybuffer"){e=e.toString(l);if(!l||l==="utf8"){e=ln.stripBOM(e)}}h.data=e}catch(t){return i(dn.from(t,null,e,h.request,h))}settle(t,i,h)}))}A.once("abort",(e=>{if(!o.destroyed){o.emit("error",e);o.destroy()}}))}));A.once("abort",(e=>{i(e);u.destroy(e)}));u.on("error",(function handleRequestError(t){i(dn.from(t,null,e,u))}));u.on("socket",(function handleRequestSocket(e){e.setKeepAlive(true,1e3*60)}));if(e.timeout){const t=parseInt(e.timeout,10);if(Number.isNaN(t)){i(new dn("error trying to parse `config.timeout` to int",dn.ERR_BAD_OPTION_VALUE,e,u));return}u.setTimeout(t,(function handleRequestTimeout(){if(c)return;let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||vn;if(e.timeoutErrorMessage){t=e.timeoutErrorMessage}i(new dn(t,n.clarifyTimeoutError?dn.ETIMEDOUT:dn.ECONNABORTED,e,u));abort()}))}if(ln.isStream(r)){let t=false;let i=false;r.on("end",(()=>{t=true}));r.once("error",(e=>{i=true;u.destroy(e)}));r.on("close",(()=>{if(!t&&!i){abort(new Fn("Request stream has been aborted",e,u))}}));r.pipe(u)}else{u.end(r)}}))};const yr=null&&setProxy;const vr=_n.hasStandardBrowserEnv?((e,t)=>i=>{i=new URL(i,_n.origin);return e.protocol===i.protocol&&e.host===i.host&&(t||e.port===i.port)})(new URL(_n.origin),_n.navigator&&/(msie|trident)/i.test(_n.navigator.userAgent)):()=>true;const Ir=_n.hasStandardBrowserEnv?{write(e,t,i,n,r,s){const o=[e+"="+encodeURIComponent(t)];ln.isNumber(i)&&o.push("expires="+new Date(i).toGMTString());ln.isString(n)&&o.push("path="+n);ln.isString(r)&&o.push("domain="+r);s===true&&o.push("secure");document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};const headersToObject=e=>e instanceof Nn?{...e}:e;function mergeConfig(e,t){t=t||{};const i={};function getMergedValue(e,t,i,n){if(ln.isPlainObject(e)&&ln.isPlainObject(t)){return ln.merge.call({caseless:n},e,t)}else if(ln.isPlainObject(t)){return ln.merge({},t)}else if(ln.isArray(t)){return t.slice()}return t}function mergeDeepProperties(e,t,i,n){if(!ln.isUndefined(t)){return getMergedValue(e,t,i,n)}else if(!ln.isUndefined(e)){return getMergedValue(undefined,e,i,n)}}function valueFromConfig2(e,t){if(!ln.isUndefined(t)){return getMergedValue(undefined,t)}}function defaultToConfig2(e,t){if(!ln.isUndefined(t)){return getMergedValue(undefined,t)}else if(!ln.isUndefined(e)){return getMergedValue(undefined,e)}}function mergeDirectKeys(i,n,r){if(r in t){return getMergedValue(i,n)}else if(r in e){return getMergedValue(undefined,i)}}const n={url:valueFromConfig2,method:valueFromConfig2,data:valueFromConfig2,baseURL:defaultToConfig2,transformRequest:defaultToConfig2,transformResponse:defaultToConfig2,paramsSerializer:defaultToConfig2,timeout:defaultToConfig2,timeoutMessage:defaultToConfig2,withCredentials:defaultToConfig2,withXSRFToken:defaultToConfig2,adapter:defaultToConfig2,responseType:defaultToConfig2,xsrfCookieName:defaultToConfig2,xsrfHeaderName:defaultToConfig2,onUploadProgress:defaultToConfig2,onDownloadProgress:defaultToConfig2,decompress:defaultToConfig2,maxContentLength:defaultToConfig2,maxBodyLength:defaultToConfig2,beforeRedirect:defaultToConfig2,transport:defaultToConfig2,httpAgent:defaultToConfig2,httpsAgent:defaultToConfig2,cancelToken:defaultToConfig2,socketPath:defaultToConfig2,responseEncoding:defaultToConfig2,validateStatus:mergeDirectKeys,headers:(e,t,i)=>mergeDeepProperties(headersToObject(e),headersToObject(t),i,true)};ln.forEach(Object.keys(Object.assign({},e,t)),(function computeConfigValue(r){const s=n[r]||mergeDeepProperties;const o=s(e[r],t[r],r);ln.isUndefined(o)&&s!==mergeDirectKeys||(i[r]=o)}));return i}const resolveConfig=e=>{const t=mergeConfig({},e);let{data:i,withXSRFToken:n,xsrfHeaderName:r,xsrfCookieName:s,headers:o,auth:a}=t;t.headers=o=Nn.from(o);t.url=buildURL(buildFullPath(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer);if(a){o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")))}let l;if(ln.isFormData(i)){if(_n.hasStandardBrowserEnv||_n.hasStandardBrowserWebWorkerEnv){o.setContentType(undefined)}else if((l=o.getContentType())!==false){const[e,...t]=l?l.split(";").map((e=>e.trim())).filter(Boolean):[];o.setContentType([e||"multipart/form-data",...t].join("; "))}}if(_n.hasStandardBrowserEnv){n&&ln.isFunction(n)&&(n=n(t));if(n||n!==false&&vr(t.url)){const e=r&&s&&Ir.read(s);if(e){o.set(r,e)}}}return t};const Er=typeof XMLHttpRequest!=="undefined";const Cr=Er&&function(e){return new Promise((function dispatchXhrRequest(t,i){const n=resolveConfig(e);let r=n.data;const s=Nn.from(n.headers).normalize();let{responseType:o,onUploadProgress:a,onDownloadProgress:l}=n;let p;let c,d;let u,A;function done(){u&&u();A&&A();n.cancelToken&&n.cancelToken.unsubscribe(p);n.signal&&n.signal.removeEventListener("abort",p)}let f=new XMLHttpRequest;f.open(n.method.toUpperCase(),n.url,true);f.timeout=n.timeout;function onloadend(){if(!f){return}const n=Nn.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders());const r=!o||o==="text"||o==="json"?f.responseText:f.response;const s={data:r,status:f.status,statusText:f.statusText,headers:n,config:e,request:f};settle((function _resolve(e){t(e);done()}),(function _reject(e){i(e);done()}),s);f=null}if("onloadend"in f){f.onloadend=onloadend}else{f.onreadystatechange=function handleLoad(){if(!f||f.readyState!==4){return}if(f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)){return}setTimeout(onloadend)}}f.onabort=function handleAbort(){if(!f){return}i(new dn("Request aborted",dn.ECONNABORTED,e,f));f=null};f.onerror=function handleError(){i(new dn("Network Error",dn.ERR_NETWORK,e,f));f=null};f.ontimeout=function handleTimeout(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const r=n.transitional||vn;if(n.timeoutErrorMessage){t=n.timeoutErrorMessage}i(new dn(t,r.clarifyTimeoutError?dn.ETIMEDOUT:dn.ECONNABORTED,e,f));f=null};r===undefined&&s.setContentType(null);if("setRequestHeader"in f){ln.forEach(s.toJSON(),(function setRequestHeader(e,t){f.setRequestHeader(t,e)}))}if(!ln.isUndefined(n.withCredentials)){f.withCredentials=!!n.withCredentials}if(o&&o!=="json"){f.responseType=n.responseType}if(l){[d,A]=progressEventReducer(l,true);f.addEventListener("progress",d)}if(a&&f.upload){[c,u]=progressEventReducer(a);f.upload.addEventListener("progress",c);f.upload.addEventListener("loadend",u)}if(n.cancelToken||n.signal){p=t=>{if(!f){return}i(!t||t.type?new Fn(null,e,f):t);f.abort();f=null};n.cancelToken&&n.cancelToken.subscribe(p);if(n.signal){n.signal.aborted?p():n.signal.addEventListener("abort",p)}}const h=parseProtocol(n.url);if(h&&_n.protocols.indexOf(h)===-1){i(new dn("Unsupported protocol "+h+":",dn.ERR_BAD_REQUEST,e));return}f.send(r||null)}))};const composeSignals=(e,t)=>{const{length:i}=e=e?e.filter(Boolean):[];if(t||i){let i=new AbortController;let n;const onabort=function(e){if(!n){n=true;unsubscribe();const t=e instanceof Error?e:this.reason;i.abort(t instanceof dn?t:new Fn(t instanceof Error?t.message:t))}};let r=t&&setTimeout((()=>{r=null;onabort(new dn(`timeout ${t} of ms exceeded`,dn.ETIMEDOUT))}),t);const unsubscribe=()=>{if(e){r&&clearTimeout(r);r=null;e.forEach((e=>{e.unsubscribe?e.unsubscribe(onabort):e.removeEventListener("abort",onabort)}));e=null}};e.forEach((e=>e.addEventListener("abort",onabort)));const{signal:s}=i;s.unsubscribe=()=>ln.asap(unsubscribe);return s}};const br=composeSignals;const streamChunk=function*(e,t){let i=e.byteLength;if(!t||i{const r=readBytes(e,t);let s=0;let o;let _onFinish=e=>{if(!o){o=true;n&&n(e)}};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await r.next();if(t){_onFinish();e.close();return}let o=n.byteLength;if(i){let e=s+=o;i(e)}e.enqueue(new Uint8Array(n))}catch(e){_onFinish(e);throw e}},cancel(e){_onFinish(e);return r.return()}},{highWaterMark:2})};const Tr=typeof fetch==="function"&&typeof Request==="function"&&typeof Response==="function";const wr=Tr&&typeof ReadableStream==="function";const Rr=Tr&&(typeof TextEncoder==="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer()));const test=(e,...t)=>{try{return!!e(...t)}catch(e){return false}};const Br=wr&&test((()=>{let e=false;const t=new Request(_n.origin,{body:new ReadableStream,method:"POST",get duplex(){e=true;return"half"}}).headers.has("Content-Type");return e&&!t}));const Qr=64*1024;const Dr=wr&&test((()=>ln.isReadableStream(new Response("").body)));const Sr={stream:Dr&&(e=>e.body)};Tr&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach((t=>{!Sr[t]&&(Sr[t]=ln.isFunction(e[t])?e=>e[t]():(e,i)=>{throw new dn(`Response type '${t}' is not supported`,dn.ERR_NOT_SUPPORT,i)})}))})(new Response);const getBodyLength=async e=>{if(e==null){return 0}if(ln.isBlob(e)){return e.size}if(ln.isSpecCompliantForm(e)){const t=new Request(_n.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}if(ln.isArrayBufferView(e)||ln.isArrayBuffer(e)){return e.byteLength}if(ln.isURLSearchParams(e)){e=e+""}if(ln.isString(e)){return(await Rr(e)).byteLength}};const resolveBodyLength=async(e,t)=>{const i=ln.toFiniteNumber(e.getContentLength());return i==null?getBodyLength(t):i};const kr=Tr&&(async e=>{let{url:t,method:i,data:n,signal:r,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:l,responseType:p,headers:c,withCredentials:d="same-origin",fetchOptions:u}=resolveConfig(e);p=p?(p+"").toLowerCase():"text";let A=br([r,s&&s.toAbortSignal()],o);let f;const h=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let g;try{if(l&&Br&&i!=="get"&&i!=="head"&&(g=await resolveBodyLength(c,n))!==0){let e=new Request(t,{method:"POST",body:n,duplex:"half"});let i;if(ln.isFormData(n)&&(i=e.headers.get("content-type"))){c.setContentType(i)}if(e.body){const[t,i]=progressEventDecorator(g,progressEventReducer(asyncDecorator(l)));n=trackStream(e.body,Qr,t,i)}}if(!ln.isString(d)){d=d?"include":"omit"}const r="credentials"in Request.prototype;f=new Request(t,{...u,signal:A,method:i.toUpperCase(),headers:c.normalize().toJSON(),body:n,duplex:"half",credentials:r?d:undefined});let s=await fetch(f,u);const o=Dr&&(p==="stream"||p==="response");if(Dr&&(a||o&&h)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=s[t]}));const t=ln.toFiniteNumber(s.headers.get("content-length"));const[i,n]=a&&progressEventDecorator(t,progressEventReducer(asyncDecorator(a),true))||[];s=new Response(trackStream(s.body,Qr,i,(()=>{n&&n();h&&h()})),e)}p=p||"text";let y=await Sr[ln.findKey(Sr,p)||"text"](s,e);!o&&h&&h();return await new Promise(((t,i)=>{settle(t,i,{data:y,headers:Nn.from(s.headers),status:s.status,statusText:s.statusText,config:e,request:f})}))}catch(t){h&&h();if(t&&t.name==="TypeError"&&/Load failed|fetch/i.test(t.message)){throw Object.assign(new dn("Network Error",dn.ERR_NETWORK,e,f),{cause:t.cause||t})}throw dn.from(t,t&&t.code,e,f)}});const _r={http:gr,xhr:Cr,fetch:kr};ln.forEach(_r,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const renderReason=e=>`- ${e}`;const isResolvedHandle=e=>ln.isFunction(e)||e===null||e===false;const Pr={getAdapter:e=>{e=ln.isArray(e)?e:[e];const{length:t}=e;let i;let n;const r={};for(let s=0;s`adapter ${e} `+(t===false?"is not supported by the environment":"is not available in the build")));let i=t?e.length>1?"since :\n"+e.map(renderReason).join("\n"):" "+renderReason(e[0]):"as no adapter specified";throw new dn(`There is no suitable adapter to dispatch the request `+i,"ERR_NOT_SUPPORT")}return n},adapters:_r};function throwIfCancellationRequested(e){if(e.cancelToken){e.cancelToken.throwIfRequested()}if(e.signal&&e.signal.aborted){throw new Fn(null,e)}}function dispatchRequest(e){throwIfCancellationRequested(e);e.headers=Nn.from(e.headers);e.data=transformData.call(e,e.transformRequest);if(["post","put","patch"].indexOf(e.method)!==-1){e.headers.setContentType("application/x-www-form-urlencoded",false)}const t=Pr.getAdapter(e.adapter||On.adapter);return t(e).then((function onAdapterResolution(t){throwIfCancellationRequested(e);t.data=transformData.call(e,e.transformResponse,t);t.headers=Nn.from(t.headers);return t}),(function onAdapterRejection(t){if(!isCancel(t)){throwIfCancellationRequested(e);if(t&&t.response){t.response.data=transformData.call(e,e.transformResponse,t.response);t.response.headers=Nn.from(t.response.headers)}}return Promise.reject(t)}))}const xr={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{xr[e]=function validator(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}}));const Or={};xr.transitional=function transitional(e,t,i){function formatMessage(e,t){return"[Axios v"+Hn+"] Transitional option '"+e+"'"+t+(i?". "+i:"")}return(i,n,r)=>{if(e===false){throw new dn(formatMessage(n," has been removed"+(t?" in "+t:"")),dn.ERR_DEPRECATED)}if(t&&!Or[n]){Or[n]=true;console.warn(formatMessage(n," has been deprecated since v"+t+" and will be removed in the near future"))}return e?e(i,n,r):true}};xr.spelling=function spelling(e){return(t,i)=>{console.warn(`${i} is likely a misspelling of ${e}`);return true}};function assertOptions(e,t,i){if(typeof e!=="object"){throw new dn("options must be an object",dn.ERR_BAD_OPTION_VALUE)}const n=Object.keys(e);let r=n.length;while(r-- >0){const s=n[r];const o=t[s];if(o){const t=e[s];const i=t===undefined||o(t,s,e);if(i!==true){throw new dn("option "+s+" must be "+i,dn.ERR_BAD_OPTION_VALUE)}continue}if(i!==true){throw new dn("Unknown option "+s,dn.ERR_BAD_OPTION)}}}const Vr={assertOptions:assertOptions,validators:xr};const Ur=Vr.validators;class Axios{constructor(e){this.defaults=e||{};this.interceptors={request:new yn,response:new yn}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const i=t.stack?t.stack.replace(/^.+\n/,""):"";try{if(!e.stack){e.stack=i}else if(i&&!String(e.stack).endsWith(i.replace(/^.+\n.+\n/,""))){e.stack+="\n"+i}}catch(e){}}throw e}}_request(e,t){if(typeof e==="string"){t=t||{};t.url=e}else{t=e||{}}t=mergeConfig(this.defaults,t);const{transitional:i,paramsSerializer:n,headers:r}=t;if(i!==undefined){Vr.assertOptions(i,{silentJSONParsing:Ur.transitional(Ur.boolean),forcedJSONParsing:Ur.transitional(Ur.boolean),clarifyTimeoutError:Ur.transitional(Ur.boolean)},false)}if(n!=null){if(ln.isFunction(n)){t.paramsSerializer={serialize:n}}else{Vr.assertOptions(n,{encode:Ur.function,serialize:Ur.function},true)}}if(t.allowAbsoluteUrls!==undefined){}else if(this.defaults.allowAbsoluteUrls!==undefined){t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls}else{t.allowAbsoluteUrls=true}Vr.assertOptions(t,{baseUrl:Ur.spelling("baseURL"),withXsrfToken:Ur.spelling("withXSRFToken")},true);t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=r&&ln.merge(r.common,r[t.method]);r&&ln.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete r[e]}));t.headers=Nn.concat(s,r);const o=[];let a=true;this.interceptors.request.forEach((function unshiftRequestInterceptors(e){if(typeof e.runWhen==="function"&&e.runWhen(t)===false){return}a=a&&e.synchronous;o.unshift(e.fulfilled,e.rejected)}));const l=[];this.interceptors.response.forEach((function pushResponseInterceptors(e){l.push(e.fulfilled,e.rejected)}));let p;let c=0;let d;if(!a){const e=[dispatchRequest.bind(this),undefined];e.unshift.apply(e,o);e.push.apply(e,l);d=e.length;p=Promise.resolve(t);while(c{if(!i._listeners)return;let t=i._listeners.length;while(t-- >0){i._listeners[t](e)}i._listeners=null}));this.promise.then=e=>{let t;const n=new Promise((e=>{i.subscribe(e);t=e})).then(e);n.cancel=function reject(){i.unsubscribe(t)};return n};e((function cancel(e,n,r){if(i.reason){return}i.reason=new Fn(e,n,r);t(i.reason)}))}throwIfRequested(){if(this.reason){throw this.reason}}subscribe(e){if(this.reason){e(this.reason);return}if(this._listeners){this._listeners.push(e)}else{this._listeners=[e]}}unsubscribe(e){if(!this._listeners){return}const t=this._listeners.indexOf(e);if(t!==-1){this._listeners.splice(t,1)}}toAbortSignal(){const e=new AbortController;const abort=t=>{e.abort(t)};this.subscribe(abort);e.signal.unsubscribe=()=>this.unsubscribe(abort);return e.signal}static source(){let e;const t=new CancelToken((function executor(t){e=t}));return{token:t,cancel:e}}}const Fr=CancelToken;function spread(e){return function wrap(t){return e.apply(null,t)}}function isAxiosError(e){return ln.isObject(e)&&e.isAxiosError===true}const qr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(qr).forEach((([e,t])=>{qr[t]=e}));const jr=qr;function createInstance(e){const t=new Nr(e);const i=bind_bind(Nr.prototype.request,t);ln.extend(i,Nr.prototype,t,{allOwnKeys:true});ln.extend(i,t,null,{allOwnKeys:true});i.create=function create(t){return createInstance(mergeConfig(e,t))};return i}const Mr=createInstance(On);Mr.Axios=Nr;Mr.CanceledError=Fn;Mr.CancelToken=Fr;Mr.isCancel=isCancel;Mr.VERSION=Hn;Mr.toFormData=hn;Mr.AxiosError=dn;Mr.Cancel=Mr.CanceledError;Mr.all=function all(e){return Promise.all(e)};Mr.spread=spread;Mr.isAxiosError=isAxiosError;Mr.mergeConfig=mergeConfig;Mr.AxiosHeaders=Nn;Mr.formToJSON=e=>Pn(ln.isHTMLForm(e)?new FormData(e):e);Mr.getAdapter=Pr.getAdapter;Mr.HttpStatusCode=jr;Mr.default=Mr;const Lr=Mr;var Gr=undefined&&undefined.__decorate||function(e,t,i,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)if(o=e[a])s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s;return r>3&&s&&Object.defineProperty(t,i,s),s};let Hr=class AxiosWrapper{async getUrl(e){const t=await Lr.get(e);return t.data}};Hr=Gr([(0,a.singleton)()],Hr);const Wr=Hr;var Jr=undefined&&undefined.__decorate||function(e,t,i,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)if(o=e[a])s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s;return r>3&&s&&Object.defineProperty(t,i,s),s};var Yr=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};let zr=class OctokitGitDiffParser{_axiosWrapper;_logger;_firstLineOfFiles=null;constructor(e,t){this._axiosWrapper=e;this._logger=t}async getFirstChangedLine(e,t,i,n,r){this._logger.logDebug("* OctokitGitDiffParser.getFirstChangedLine()");const s=await this.getFirstChangedLines(e,t,i,n);return s.get(r)??null}async getFirstChangedLines(e,t,i,n){this._logger.logDebug("* OctokitGitDiffParser.getFirstChangedLines()");if(this._firstLineOfFiles!==null){return this._firstLineOfFiles}const r=await this.getDiffs(e,t,i,n);this._firstLineOfFiles=this.processDiffs(r);return this._firstLineOfFiles}async getDiffs(e,t,i,n){this._logger.logDebug("* OctokitGitDiffParser.getDiffs()");const r=await e.getPull(t,i,n);const s=await this._axiosWrapper.getUrl(r.data.diff_url);const o=s.split(/^diff --git/gmu);const a=[];for(const e of o.slice(1)){a.push(`diff --git ${e}`)}return a}processDiffs(e){this._logger.logDebug("* OctokitGitDiffParser.processDiffs()");const t=new Map;for(const i of e){const e=_i(i);for(const i of e.files){switch(i.type){case"AddedFile":case"ChangedFile":{const e=i;const[n]=e.chunks;if(n?.type==="BinaryFilesChunk"){this._logger.logDebug(`Skipping '${i.type}' '${e.path}' while performing diff parsing.`);break}if(n){t.set(e.path,n.toFileRange.start)}break}case"RenamedFile":{const e=i;if(e.chunks[0]){t.set(e.pathAfter,e.chunks[0].toFileRange.start)}break}case"DeletedFile":default:this._logger.logDebug(`Skipping file type '${i.type}' while performing diff parsing.`);break}}}return t}};zr=Jr([(0,a.singleton)(),Yr("design:paramtypes",[Wr,L])],zr);const Kr=zr;var $r=undefined&&undefined.__decorate||function(e,t,i,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)if(o=e[a])s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s;return r>3&&s&&Object.defineProperty(t,i,s),s};var Xr=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};let Zr=class OctokitWrapper{_octokitGitDiffParser;_octokit=null;constructor(e){this._octokitGitDiffParser=e}initialize(e){if(this._octokit!==null){throw new Error("OctokitWrapper was already initialized prior to calling OctokitWrapper.initialize().")}this._octokit=new Ti(e)}async getPull(e,t,i){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.getPull().")}return this._octokit.rest.pulls.get({owner:e,pull_number:i,repo:t})}async updatePull(e,t,i,n,r){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.updatePull().")}const s={owner:e,pull_number:i,repo:t};if(n!==null){s.title=n}if(r!==null){s.body=r}return this._octokit.rest.pulls.update(s)}async getIssueComments(e,t,i){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.getIssueComments().")}return this._octokit.rest.issues.listComments({issue_number:i,owner:e,repo:t})}async getReviewComments(e,t,i){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.getReviewComments().")}return this._octokit.rest.pulls.listReviewComments({owner:e,pull_number:i,repo:t})}async createIssueComment(e,t,i,n){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.createIssueComment().")}return this._octokit.rest.issues.createComment({body:n,issue_number:i,owner:e,repo:t})}async listCommits(e,t,i,n){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.listCommits().")}return this._octokit.rest.pulls.listCommits({owner:e,page:n,pull_number:i,repo:t})}async createReviewComment(e,t,i,n,r,s){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.createReviewComment().")}const o=await this._octokitGitDiffParser.getFirstChangedLine(this,e,t,i,r);if(o===null){return null}return this._octokit.rest.pulls.createReviewComment({body:n,commit_id:s,line:o,owner:e,path:r,pull_number:i,repo:t})}async updateIssueComment(e,t,i,n,r){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.updateIssueComment().")}return this._octokit.rest.issues.updateComment({body:r,comment_id:n,issue_number:i,owner:e,repo:t})}async deleteReviewComment(e,t,i){if(this._octokit===null){throw new Error("OctokitWrapper was not initialized prior to calling OctokitWrapper.deleteReviewComment().")}return this._octokit.rest.pulls.deleteReviewComment({comment_id:i,owner:e,repo:t})}};Zr=$r([(0,a.singleton)(),Xr("design:paramtypes",[Kr])],Zr);const es=Zr;var ts=undefined&&undefined.__decorate||function(e,t,i,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)if(o=e[a])s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s;return r>3&&s&&Object.defineProperty(t,i,s),s};var is=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};let ns=class GitHubReposInvoker extends BaseReposInvoker{_gitInvoker;_logger;_octokitWrapper;_runnerInvoker;_isInitialized=false;_owner="";_repo="";_pullRequestId=0;_commitId="";constructor(e,t,i,n){super();this._gitInvoker=e;this._logger=t;this._octokitWrapper=i;this._runnerInvoker=n}async isAccessTokenAvailable(){this._logger.logDebug("* GitHubReposInvoker.isAccessTokenAvailable()");if(typeof process.env.PR_METRICS_ACCESS_TOKEN==="undefined"){return Promise.resolve(this._runnerInvoker.loc("repos.gitHubReposInvoker.noGitHubAccessToken"))}return Promise.resolve(null)}async getTitleAndDescription(){this._logger.logDebug("* GitHubReposInvoker.getTitleAndDescription()");this.initialize();const e=await this.invokeApiCall((async()=>{const e=await this._octokitWrapper.getPull(this._owner,this._repo,this._pullRequestId);this._logger.logDebug(JSON.stringify(e));return e}));return{description:e.data.body??null,title:e.data.title}}async getComments(){this._logger.logDebug("* GitHubReposInvoker.getComments()");this.initialize();let e=null;let t=null;await Promise.all([this.invokeApiCall((async()=>{e=await this._octokitWrapper.getIssueComments(this._owner,this._repo,this._pullRequestId);this._logger.logDebug(JSON.stringify(e))})),this.invokeApiCall((async()=>{t=await this._octokitWrapper.getReviewComments(this._owner,this._repo,this._pullRequestId);this._logger.logDebug(JSON.stringify(t))}))]);return this.convertPullRequestComments(e,t)}async setTitleAndDescription(e,t){this._logger.logDebug("* GitHubReposInvoker.setTitleAndDescription()");if(e===null&&t===null){return}this.initialize();await this.invokeApiCall((async()=>{const i=await this._octokitWrapper.updatePull(this._owner,this._repo,this._pullRequestId,e,t);this._logger.logDebug(JSON.stringify(i))}))}async createComment(e,t){this._logger.logDebug("* GitHubReposInvoker.createComment()");this.initialize();if(t===null){await this.invokeApiCall((async()=>{const t=await this._octokitWrapper.createIssueComment(this._owner,this._repo,this._pullRequestId,e);this._logger.logDebug(JSON.stringify(t))}))}else{if(this._commitId===""){await this.getCommitId()}await this.invokeApiCall((async()=>{try{const i=await this._octokitWrapper.createReviewComment(this._owner,this._repo,this._pullRequestId,e,t,this._commitId);this._logger.logDebug(JSON.stringify(i))}catch(e){if(e instanceof RequestError&&e.status===We.StatusCodes.UNPROCESSABLE_ENTITY&&e.message.includes("pull_request_review_thread.path diff too large")){this._logger.logInfo("GitHub createReviewComment() threw a 422 error related to a large diff. Ignoring as this is expected.");this._logger.logErrorObject(e)}else{throw e}}}))}}async updateComment(e,t){this._logger.logDebug("* GitHubReposInvoker.updateComment()");if(t===null){return}this.initialize();await this.invokeApiCall((async()=>{const i=await this._octokitWrapper.updateIssueComment(this._owner,this._repo,this._pullRequestId,e,t);this._logger.logDebug(JSON.stringify(i))}))}async deleteCommentThread(e){this._logger.logDebug("* GitHubReposInvoker.deleteCommentThread()");this.initialize();await this.invokeApiCall((async()=>{const t=await this._octokitWrapper.deleteReviewComment(this._owner,this._repo,e);this._logger.logDebug(JSON.stringify(t))}))}async invokeApiCall(e){return BaseReposInvoker.invokeApiCall(e,this._runnerInvoker.loc("repos.gitHubReposInvoker.insufficientGitHubAccessTokenPermissions"))}initialize(){this._logger.logDebug("* GitHubReposInvoker.initialize()");if(this._isInitialized){return}const e={auth:process.env.PR_METRICS_ACCESS_TOKEN,log:{debug:e=>{this._logger.logDebug(`Octokit – ${e}`)},error:e=>{this._logger.logError(`Octokit – ${e}`)},info:e=>{this._logger.logInfo(`Octokit – ${e}`)},warn:e=>{this._logger.logWarning(`Octokit – ${e}`)}},userAgent:"PRMetrics/v1.7.4"};if(N.isGitHub){e.baseUrl=this.initializeForGitHub()}else{e.baseUrl=this.initializeForAzureDevOps()}this._logger.logDebug(`Using Base URL '${converter_toString(e.baseUrl)}'.`);this._octokitWrapper.initialize(e);this._pullRequestId=this._gitInvoker.pullRequestId;this._isInitialized=true}initializeForGitHub(){this._logger.logDebug("* GitHubReposInvoker.initializeForGitHub()");const e=validateVariable("GITHUB_API_URL","GitHubReposInvoker.initializeForGitHub()");this._owner=validateVariable("GITHUB_REPOSITORY_OWNER","GitHubReposInvoker.initializeForGitHub()");const t=validateVariable("GITHUB_REPOSITORY","GitHubReposInvoker.initializeForGitHub()");const i=t.split("/");if(typeof i[1]==="undefined"){throw new Error(`GITHUB_REPOSITORY '${t}' is in an unexpected format.`)}[,this._repo]=i;return e}initializeForAzureDevOps(){this._logger.logDebug("* GitHubReposInvoker.initializeForAzureDevOps()");const e=validateVariable("SYSTEM_PULLREQUEST_SOURCEREPOSITORYURI","GitHubReposInvoker.initializeForAzureDevOps()");const t=e.split("/");if(typeof t[2]==="undefined"||typeof t[3]==="undefined"||typeof t[4]==="undefined"){throw new Error(`SYSTEM_PULLREQUEST_SOURCEREPOSITORYURI '${e}' is in an unexpected format.`)}let i="";let n;[,,n,this._owner,this._repo]=t;if(n!=="github.com"){i=`https://${n}/api/v3`}const r=".git";if(this._repo.endsWith(r)){this._repo=this._repo.substring(0,this._repo.length-r.length)}return i}convertPullRequestComments(e,t){this._logger.logDebug("* GitHubReposInvoker.convertPullRequestComments()");const i=new CommentData;if(e!==null){for(const t of e.data){const e=t.body;if(typeof e!=="undefined"){i.pullRequestComments.push(new PullRequestCommentData(t.id,e))}}}if(t!==null){for(const e of t.data){const t=e.body;const n=e.path;i.fileComments.push(new FileCommentData(e.id,t,n))}}return i}async getCommitId(){this._logger.logDebug("* GitHubReposInvoker.getCommitId()");let e=await this.invokeApiCall((async()=>{const e=await this._octokitWrapper.listCommits(this._owner,this._repo,this._pullRequestId,1);this._logger.logDebug(JSON.stringify(e));return e}));if(typeof e.headers.link!=="undefined"){const t=e.headers.link;const i=/<.+>; rel="next", <.+?page=(?\d+)>; rel="last"/u.exec(t);if(typeof i?.groups?.pageNumber==="undefined"){throw new Error(`The regular expression did not match '${t}'.`)}const n=parseInt(i.groups.pageNumber,G);e=await this.invokeApiCall((async()=>{const e=await this._octokitWrapper.listCommits(this._owner,this._repo,this._pullRequestId,n);this._logger.logDebug(JSON.stringify(e));return e}))}this._commitId=validateString(e.data[e.data.length-1]?.sha,`result.data[${String(e.data.length-1)}].sha`,"GitHubReposInvoker.getCommitId()")}};ns=ts([(0,a.singleton)(),is("design:paramtypes",[z,L,es,N])],ns);const rs=ns;var ss=undefined&&undefined.__decorate||function(e,t,i,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)if(o=e[a])s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s;return r>3&&s&&Object.defineProperty(t,i,s),s};var os=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};let as=class ReposInvoker{_azureReposInvoker;_gitHubReposInvoker;_logger;_reposInvoker=null;constructor(e,t,i){this._azureReposInvoker=e;this._gitHubReposInvoker=t;this._logger=i}async isAccessTokenAvailable(){this._logger.logDebug("* ReposInvoker.isAccessTokenAvailable()");const e=this.getReposInvoker();return e.isAccessTokenAvailable()}async getTitleAndDescription(){this._logger.logDebug("* ReposInvoker.getTitleAndDescription()");const e=this.getReposInvoker();return e.getTitleAndDescription()}async getComments(){this._logger.logDebug("* ReposInvoker.getComments()");const e=this.getReposInvoker();return e.getComments()}async setTitleAndDescription(e,t){this._logger.logDebug("* ReposInvoker.setTitleAndDescription()");const i=this.getReposInvoker();return i.setTitleAndDescription(e,t)}async createComment(e,t,i,n){this._logger.logDebug("* ReposInvoker.createComment()");const r=this.getReposInvoker();return r.createComment(e,t,i,n)}async updateComment(e,t,i){this._logger.logDebug("* ReposInvoker.updateComment()");const n=this.getReposInvoker();return n.updateComment(e,t,i)}async deleteCommentThread(e){this._logger.logDebug("* ReposInvoker.deleteCommentThread()");const t=this.getReposInvoker();return t.deleteCommentThread(e)}getReposInvoker(){this._logger.logDebug("* ReposInvoker.getReposInvoker()");if(this._reposInvoker!==null){return this._reposInvoker}if(N.isGitHub){this._reposInvoker=this._gitHubReposInvoker;return this._reposInvoker}const e=validateVariable("BUILD_REPOSITORY_PROVIDER","ReposInvoker.getReposInvoker()");switch(e){case"TfsGit":this._reposInvoker=this._azureReposInvoker;break;case"GitHub":case"GitHubEnterprise":this._reposInvoker=this._gitHubReposInvoker;break;default:throw new RangeError(`BUILD_REPOSITORY_PROVIDER '${e}' is unsupported.`)}return this._reposInvoker}};as=ss([(0,a.singleton)(),os("design:paramtypes",[tt,rs,L])],as);const ps=as;var cs=undefined&&undefined.__decorate||function(e,t,i,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)if(o=e[a])s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s;return r>3&&s&&Object.defineProperty(t,i,s),s};var ds=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};let us=class PullRequestComments{_codeMetrics;_inputs;_logger;_reposInvoker;_runnerInvoker;constructor(e,t,i,n,r){this._codeMetrics=e;this._inputs=t;this._logger=i;this._reposInvoker=n;this._runnerInvoker=r}get noReviewRequiredComment(){this._logger.logDebug("* PullRequestComments.noReviewRequiredComment");return this._runnerInvoker.loc("pullRequests.pullRequestComments.noReviewRequiredComment")}async getCommentData(){this._logger.logDebug("* PullRequestComments.getCommentData()");const e=await this._codeMetrics.getFilesNotRequiringReview();const t=await this._codeMetrics.getDeletedFilesNotRequiringReview();let i=new PullRequestCommentsData(e,t);const n=await this._reposInvoker.getComments();for(const e of n.pullRequestComments){i=this.getMetricsCommentData(i,e)}for(const e of n.fileComments){i=this.getFilesRequiringCommentUpdates(i,e)}return i}async getMetricsComment(){this._logger.logDebug("* PullRequestComments.getMetricsComment()");const e=await this._codeMetrics.getMetrics();let t=`${this._runnerInvoker.loc("pullRequests.pullRequestComments.commentTitle")}\n`;t+=await this.addCommentSizeStatus();t+=await this.addCommentTestStatus();t+=`||${this._runnerInvoker.loc("pullRequests.pullRequestComments.tableLines")}\n`;t+="-|-:\n";t+=this.addCommentMetrics(this._runnerInvoker.loc("pullRequests.pullRequestComments.tableProductCode"),e.productCode,false);t+=this.addCommentMetrics(this._runnerInvoker.loc("pullRequests.pullRequestComments.tableTestCode"),e.testCode,false);t+=this.addCommentMetrics(this._runnerInvoker.loc("pullRequests.pullRequestComments.tableSubtotal"),e.subtotal,true);t+=this.addCommentMetrics(this._runnerInvoker.loc("pullRequests.pullRequestComments.tableIgnoredCode"),e.ignoredCode,false);t+=this.addCommentMetrics(this._runnerInvoker.loc("pullRequests.pullRequestComments.tableTotal"),e.total,true);t+="\n";t+=this._runnerInvoker.loc("pullRequests.pullRequestComments.commentFooter");return t}async getMetricsCommentStatus(){this._logger.logDebug("* PullRequestComments.getMetricsCommentStatus()");if(this._inputs.alwaysCloseComment){return o.CommentThreadStatus.Closed}if(await this._codeMetrics.isSmall()){const e=await this._codeMetrics.isSufficientlyTested();if(e??true){return o.CommentThreadStatus.Closed}}return o.CommentThreadStatus.Active}getMetricsCommentData(e,t){this._logger.logDebug("* PullRequestComments.getMetricsCommentData()");if(!t.content.startsWith(`${this._runnerInvoker.loc("pullRequests.pullRequestComments.commentTitle")}\n`)){return e}e.metricsCommentThreadId=t.id;e.metricsCommentContent=t.content;e.metricsCommentThreadStatus=t.status;return e}getFilesRequiringCommentUpdates(e,t){this._logger.logDebug("* PullRequestComments.getFilesRequiringCommentUpdates()");if(t.content!==this.noReviewRequiredComment){return e}const i=-1;const n=e.filesNotRequiringReview.indexOf(t.fileName);if(n!==i){e.filesNotRequiringReview.splice(n,1);return e}const r=e.deletedFilesNotRequiringReview.indexOf(t.fileName);if(r!==i){e.deletedFilesNotRequiringReview.splice(r,1);return e}e.commentThreadsRequiringDeletion.push(t.id);return e}async addCommentSizeStatus(){this._logger.logDebug("* PullRequestComments.addCommentSizeStatus()");let e="";if(await this._codeMetrics.isSmall()){e+=this._runnerInvoker.loc("pullRequests.pullRequestComments.smallPullRequestComment")}else{const t=(this._inputs.baseSize*this._inputs.growthRate).toLocaleString();e+=this._runnerInvoker.loc("pullRequests.pullRequestComments.largePullRequestComment",t)}e+="\n";return e}async addCommentTestStatus(){this._logger.logDebug("* PullRequestComments.addCommentTestStatus()");let e="";const t=await this._codeMetrics.isSufficientlyTested();if(t!==null){if(t){e+=this._runnerInvoker.loc("pullRequests.pullRequestComments.testsSufficientComment")}else{e+=this._runnerInvoker.loc("pullRequests.pullRequestComments.testsInsufficientComment")}e+="\n"}return e}addCommentMetrics(e,t,i){this._logger.logDebug("* PullRequestComments.addCommentMetrics()");let n="";if(i){n="**"}let r=t.toLocaleString();if(r==="0"){r="-"}return`${n}${e}${n}|${n}${r}${n}\n`}};us=cs([(0,a.injectable)(),ds("design:paramtypes",[Ue,_e,L,ps,N])],us);const As=us;var fs=undefined&&undefined.__decorate||function(e,t,i,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)if(o=e[a])s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s;return r>3&&s&&Object.defineProperty(t,i,s),s};var hs=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};let ms=class CodeMetricsCalculator{_gitInvoker;_logger;_pullRequest;_pullRequestComments;_reposInvoker;_runnerInvoker;constructor(e,t,i,n,r,s){this._gitInvoker=e;this._logger=t;this._pullRequest=i;this._pullRequestComments=n;this._reposInvoker=r;this._runnerInvoker=s}get shouldSkip(){this._logger.logDebug("* CodeMetricsCalculator.shouldSkip");if(!this._pullRequest.isPullRequest){return this._runnerInvoker.loc("metrics.codeMetricsCalculator.noPullRequest")}const e=this._pullRequest.isSupportedProvider;if(e!==true){return this._runnerInvoker.loc("metrics.codeMetricsCalculator.unsupportedProvider",String(e))}return null}async shouldStop(){this._logger.logDebug("* CodeMetricsCalculator.shouldStop()");const e=await this._reposInvoker.isAccessTokenAvailable();if(e!==null){return e}if(!await this._gitInvoker.isGitRepo()){return N.isGitHub?this._runnerInvoker.loc("metrics.codeMetricsCalculator.noGitRepoGitHub"):this._runnerInvoker.loc("metrics.codeMetricsCalculator.noGitRepoAzureDevOps")}if(!this._gitInvoker.isPullRequestIdAvailable()){return N.isGitHub?this._runnerInvoker.loc("metrics.codeMetricsCalculator.noPullRequestIdGitHub"):this._runnerInvoker.loc("metrics.codeMetricsCalculator.noPullRequestIdAzureDevOps")}if(!await this._gitInvoker.isGitHistoryAvailable()){return N.isGitHub?this._runnerInvoker.loc("metrics.codeMetricsCalculator.noGitHistoryGitHub"):this._runnerInvoker.loc("metrics.codeMetricsCalculator.noGitHistoryAzureDevOps")}return null}async updateDetails(){this._logger.logDebug("* CodeMetricsCalculator.updateDetails()");const e=await this._reposInvoker.getTitleAndDescription();const t=await this._pullRequest.getUpdatedTitle(e.title);const i=this._pullRequest.getUpdatedDescription(e.description);await this._reposInvoker.setTitleAndDescription(t,i)}async updateComments(){this._logger.logDebug("* CodeMetricsCalculator.updateComments()");const e=[];const t=await this._pullRequestComments.getCommentData();e.push(this.updateMetricsComment(t));for(const i of t.commentThreadsRequiringDeletion){e.push(this._reposInvoker.deleteCommentThread(i))}await Promise.all(e);for(const e of t.filesNotRequiringReview){await this.updateNoReviewRequiredComment(e,false)}for(const e of t.deletedFilesNotRequiringReview){await this.updateNoReviewRequiredComment(e,true)}}async updateMetricsComment(e){this._logger.logDebug("* CodeMetricsCalculator.updateMetricsComment()");const t=await this._pullRequestComments.getMetricsComment();const i=await this._pullRequestComments.getMetricsCommentStatus();if(e.metricsCommentThreadId===null){await this._reposInvoker.createComment(t,null,i)}else{await this._reposInvoker.updateComment(e.metricsCommentThreadId,e.metricsCommentContent===t?null:t,e.metricsCommentThreadStatus===i?null:i)}}async updateNoReviewRequiredComment(e,t){this._logger.logDebug("* CodeMetricsCalculator.updateNoReviewRequiredComment()");await this._reposInvoker.createComment(this._pullRequestComments.noReviewRequiredComment,e,o.CommentThreadStatus.Closed,t)}};ms=fs([(0,a.injectable)(),hs("design:paramtypes",[z,L,je,As,ps,N])],ms);const gs=ms;var ys=undefined&&undefined.__decorate||function(e,t,i,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,i):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)if(o=e[a])s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s;return r>3&&s&&Object.defineProperty(t,i,s),s};var vs=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};let Is=class PullRequestMetrics{_codeMetricsCalculator;_logger;_runnerInvoker;constructor(e,t,i){this._codeMetricsCalculator=e;this._logger=t;this._runnerInvoker=i}async run(e){try{this._runnerInvoker.locInitialize(e);const t=this._codeMetricsCalculator.shouldSkip;if(t!==null){this._runnerInvoker.setStatusSkipped(t);return}const i=await this._codeMetricsCalculator.shouldStop();if(i!==null){this._runnerInvoker.setStatusFailed(i);return}await Promise.all([this._codeMetricsCalculator.updateDetails(),this._codeMetricsCalculator.updateComments()]);this._runnerInvoker.setStatusSucceeded(this._runnerInvoker.loc("pullRequestMetrics.succeeded"))}catch(e){const t=e;this._logger.logErrorObject(t);this._logger.replay();this._runnerInvoker.setStatusFailed(t.message)}}};Is=ys([(0,a.singleton)(),vs("design:paramtypes",[gs,L,N])],Is);const Es=Is;const run=async()=>{const e=a.container.resolve(Es);await e.run(u().dirname((0,En.fileURLToPath)(import.meta.url)))};run().catch((()=>{process.exit(H)})); \ No newline at end of file diff --git a/dist/resources.resjson b/dist/resources.resjson index 51666d309..46449ed29 100644 --- a/dist/resources.resjson +++ b/dist/resources.resjson @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/resjson.json", "loc.description": "Augments pull request titles to let reviewers quickly determine PR size and test coverage.", "loc.description.comment": "The description of the task.", - "loc.friendlyName": "PR Metrics v1.7.3", + "loc.friendlyName": "PR Metrics v1.7.4", "loc.friendlyName.comment": "The name of the task.", "loc.helpMarkDown": "[More information](https://aka.ms/PRMetrics/README)", "loc.helpMarkDown.comment": "The Markdown-formatted help text of the task.", diff --git a/package-lock.json b/package-lock.json index df51c92d1..f92c6a4fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "prmetrics", - "version": "1.7.3", + "version": "1.7.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "prmetrics", - "version": "1.7.3", + "version": "1.7.4", "license": "MIT", "dependencies": { "@actions/core": "1.11.1", diff --git a/package.json b/package.json index 26993a014..ec6a1f007 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/package.json", "name": "prmetrics", "publisher": "ms-omex", - "version": "1.7.3", + "version": "1.7.4", "description": "Augments pull request titles to let reviewers quickly determine PR size and test coverage.", "main": "dist/index.mjs", "type": "module", diff --git a/src/task/Strings/resources.resjson/en-US/resources.resjson b/src/task/Strings/resources.resjson/en-US/resources.resjson index 51666d309..46449ed29 100644 --- a/src/task/Strings/resources.resjson/en-US/resources.resjson +++ b/src/task/Strings/resources.resjson/en-US/resources.resjson @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/resjson.json", "loc.description": "Augments pull request titles to let reviewers quickly determine PR size and test coverage.", "loc.description.comment": "The description of the task.", - "loc.friendlyName": "PR Metrics v1.7.3", + "loc.friendlyName": "PR Metrics v1.7.4", "loc.friendlyName.comment": "The name of the task.", "loc.helpMarkDown": "[More information](https://aka.ms/PRMetrics/README)", "loc.helpMarkDown.comment": "The Markdown-formatted help text of the task.", diff --git a/src/task/src/repos/gitHubReposInvoker.ts b/src/task/src/repos/gitHubReposInvoker.ts index cbd111fb0..d06f56cbc 100644 --- a/src/task/src/repos/gitHubReposInvoker.ts +++ b/src/task/src/repos/gitHubReposInvoker.ts @@ -288,7 +288,7 @@ export default class GitHubReposInvoker extends BaseReposInvoker { this._logger.logWarning(`Octokit – ${message}`); }, }, - userAgent: "PRMetrics/v1.7.3", + userAgent: "PRMetrics/v1.7.4", }; if (RunnerInvoker.isGitHub) { diff --git a/src/task/task.json b/src/task/task.json index 9a9431da7..f2b78c350 100644 --- a/src/task/task.json +++ b/src/task/task.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/microsoft/azure-pipelines-task-lib/master/tasks.schema.json", "id": "907d3b28-6b37-4ac7-ac75-9631ee53e512", "name": "PRMetrics", - "friendlyName": "PR Metrics v1.7.3", + "friendlyName": "PR Metrics v1.7.4", "description": "Augments pull request titles to let reviewers quickly determine PR size and test coverage.", "helpUrl": "https://aka.ms/PRMetrics/README", "helpMarkDown": "[More information](https://aka.ms/PRMetrics/README)", @@ -13,7 +13,7 @@ "version": { "Major": 1, "Minor": 7, - "Patch": 3 + "Patch": 4 }, "instanceNameFormat": "PR Metrics", "showEnvironmentVariables": true, diff --git a/src/task/task.loc.json b/src/task/task.loc.json index 53d333383..1a83817d0 100644 --- a/src/task/task.loc.json +++ b/src/task/task.loc.json @@ -13,7 +13,7 @@ "version": { "Major": 1, "Minor": 7, - "Patch": 3 + "Patch": 4 }, "instanceNameFormat": "ms-resource:loc.instanceNameFormat", "showEnvironmentVariables": true, diff --git a/src/task/tests/repos/gitHubReposInvoker.spec.ts b/src/task/tests/repos/gitHubReposInvoker.spec.ts index 13fe46c7f..685e855af 100644 --- a/src/task/tests/repos/gitHubReposInvoker.spec.ts +++ b/src/task/tests/repos/gitHubReposInvoker.spec.ts @@ -34,7 +34,7 @@ describe("gitHubReposInvoker.ts", (): void => { let octokitWrapper: OctokitWrapper; let runnerInvoker: RunnerInvoker; - const expectedUserAgent = "PRMetrics/v1.7.3"; + const expectedUserAgent = "PRMetrics/v1.7.4"; beforeEach((): void => { process.env.PR_METRICS_ACCESS_TOKEN = "PAT"; diff --git a/src/vss-extension.json b/src/vss-extension.json index 09ad07709..bacbfced1 100644 --- a/src/vss-extension.json +++ b/src/vss-extension.json @@ -3,7 +3,7 @@ "manifestVersion": 1, "id": "PRMetrics", "name": "PR Metrics", - "version": "1.7.3", + "version": "1.7.4", "publisher": "ms-omex", "description": "Augments pull request titles to let reviewers quickly determine PR size and test coverage.", "public": true, @@ -26,9 +26,15 @@ "id": "Microsoft.VisualStudio.Services" } ], - "scopes": ["vso.code_write"], - "demands": ["api-version/5.1"], - "categories": ["Azure Pipelines"], + "scopes": [ + "vso.code_write" + ], + "demands": [ + "api-version/5.1" + ], + "categories": [ + "Azure Pipelines" + ], "content": { "details": { "path": "overview.md" @@ -74,7 +80,9 @@ { "id": "PRMetrics", "type": "ms.vss-distributed-task.task", - "targets": ["ms.vss-distributed-task.tasks"], + "targets": [ + "ms.vss-distributed-task.tasks" + ], "properties": { "name": "task" } From 46373dec1c9e949c0b9bebd1c03959075e1d1ce0 Mon Sep 17 00:00:00 2001 From: muiriswoulfe Date: Wed, 9 Jul 2025 13:05:37 +0100 Subject: [PATCH 20/20] Refactor vss-extension.json for consistency in formatting --- src/vss-extension.json | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/vss-extension.json b/src/vss-extension.json index bacbfced1..8afaa86af 100644 --- a/src/vss-extension.json +++ b/src/vss-extension.json @@ -26,15 +26,9 @@ "id": "Microsoft.VisualStudio.Services" } ], - "scopes": [ - "vso.code_write" - ], - "demands": [ - "api-version/5.1" - ], - "categories": [ - "Azure Pipelines" - ], + "scopes": ["vso.code_write"], + "demands": ["api-version/5.1"], + "categories": ["Azure Pipelines"], "content": { "details": { "path": "overview.md" @@ -80,9 +74,7 @@ { "id": "PRMetrics", "type": "ms.vss-distributed-task.task", - "targets": [ - "ms.vss-distributed-task.tasks" - ], + "targets": ["ms.vss-distributed-task.tasks"], "properties": { "name": "task" }