diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 2b7a0da..e13aee1 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -19,6 +19,23 @@ on:
S3BUCKET:
description: "S3BUCKET For Test"
required: true
+ EE_DB_ADDR:
+ description: "matrixone cloud host"
+ required: true
+ EE_DB_PORT:
+ description: "matrixone cloud port"
+ required: true
+ EE_DB_USER:
+ description: "matrixone cloud user"
+ required: true
+ EE_DB_PASSWORD:
+ description: "matrixone cloud password"
+ required: true
+ EE_DB_DB:
+ description: "matrixone cloud db"
+ required: true
+
+
jobs:
ut-linux-x86:
@@ -26,6 +43,20 @@ jobs:
runs-on: ubuntu-22.04
name: UT Test on Ubuntu/x86
steps:
+ - name: Parse Time for moc
+ id: time
+ run: |
+ export TZ='Asia/Shanghai'
+
+ #utcTime="2024-11-15T08:33:52Z"
+ action_time=${{ github.event.pull_request.head.repo.pushed_at }}
+ ACTION_TIME=$(date -d "${action_time}" '+%Y-%m-%d %H:%M:%S')
+
+ # 获取格式化的日期时间字符串
+ time=$(date '+%Y-%m-%d %H:%M:%S')
+
+ echo "ACTION_TIME=${ACTION_TIME}" >> $GITHUB_OUTPUT
+ echo "START_TIME=${time}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
with:
fetch-depth: "3"
@@ -45,6 +76,7 @@ jobs:
# set ut workdir
echo "UT_WORKDIR=${{ github.workspace }}" >> $GITHUB_ENV
- name: Unit Testing
+ id: ut
run: |
cd $GITHUB_WORKSPACE && make clean && make config
make ut UT_PARALLEL=6 UT_TIMEOUT=40
@@ -67,6 +99,7 @@ jobs:
cd $GITHUB_WORKSPACE;
find ./ut-report -name no-test.txt -exec cat {} \+;
- name: Print Failed Packages and Tests
+ id: failed
if: ${{ always() }}
continue-on-error: true
run: |
@@ -75,6 +108,7 @@ jobs:
exit 0;
fi
find ./ut-report/failed -name result.txt -exec cat {} \;
+ fail_ut_cases=''
files=($(find ./ut-report/failed | grep -v result.txt))
for file in "${files[@]}"; do
if [ -d "$file" ]; then
@@ -82,7 +116,25 @@ jobs:
fi
echo "============================================"
cat "${file}";
+ fail_ut_cases=${fail_ut_cases}$(basename "${file}")','
done
+
+ echo "steps.ut.conclusion: ${{ steps.ut.conclusion }}"
+ echo "FAIL_UT_CASES=${fail_ut_cases}"
+ echo "FAIL_UT_CASES=${fail_ut_cases}" >> $GITHUB_OUTPUT
+ - name: Insert Failed UT Cases to MOC
+ if: ${{ failure() }}
+ uses: matrixorigin/CI/actions/fail-ut-case@main
+ with:
+ action_time: ${{ steps.time.outputs.ACTION_TIME }}
+ ut_cases: ${{ steps.failed.outputs.FAIL_UT_CASES }}
+ pr_link: ${{ github.event.pull_request.html_url }}
+ job_time: ${{ steps.time.outputs.START_TIME }}
+ mo_host: ${{ secrets.EE_DB_ADDR }}
+ mo_port: ${{ secrets.EE_DB_PORT }}
+ mo_user: ${{ secrets.EE_DB_USER }}
+ mo_password: ${{ secrets.EE_DB_PASSWORD }}
+ mo_database: ${{ secrets.EE_DB_DB }}
- name: Print the Top 10 Time-Consuming Tests
if: ${{ always() }}
continue-on-error: true
diff --git a/.github/workflows/e2e-compose.yaml b/.github/workflows/e2e-compose.yaml
index f8533be..cc0c36e 100644
--- a/.github/workflows/e2e-compose.yaml
+++ b/.github/workflows/e2e-compose.yaml
@@ -21,6 +21,16 @@ jobs:
- name: Print run attempt
run: echo "run attempt is ${{ github.run_attempt }}"
+
+ - name: Print Disk Usage Before Container Start
+ if: ${{ always() }}
+ run: |
+ set +e;
+ sudo df -h /*;
+ echo "===========================================";
+ sudo du -hs /var/lib/docker;
+ echo "===========================================";
+ sudo docker system df -v;
- name: docker compose launch-multi-cn
timeout-minutes: 10
@@ -55,6 +65,23 @@ jobs:
done
docker ps
+ - name: Print Disk Usage After Container Start
+ if: ${{ always() }}
+ run: |
+ set +e;
+ sudo df -h /*;
+ echo "===========================================";
+ sudo du -hs /var/lib/docker;
+ echo "===========================================";
+ sudo docker system df -v;
+
+ - name: Clean Docker Image Build Cache
+ if: ${{ always() }}
+ run: |
+ sudo docker builder prune -f -a;
+ echo "===========================================";
+ sudo docker system df -v;
+
- name: Clone test-tool repository
# Node.js 12 actions are deprecated.
# For more information see:
@@ -69,6 +96,10 @@ jobs:
- name: Set up Go And Java
uses: matrixorigin/CI/actions/setup-env@main
+ - name: Update BVT SQL Timeout
+ run: |
+ cd $GITHUB_WORKSPACE/mo-tester
+ sed -i "s/socketTimeout:.*/socketTimeout: 300000/g" mo.yml
- name: Start BVT Test
id: bvt_on_pr_version
run: |
@@ -81,6 +112,16 @@ jobs:
./run.sh -n -g -o -p $GITHUB_WORKSPACE/test/distributed/cases -s /test/distributed/resources -e pessimistic_transaction 2>&1
+ - name: Print Disk Usage Before Container Shutdown
+ if: ${{ always() }}
+ run: |
+ set +e;
+ sudo df -h /*;
+ echo "===========================================";
+ sudo du -hs /var/lib/docker;
+ echo "===========================================";
+ sudo docker system df -v;
+
- name: export log
if: ${{ failure() || cancelled()}}
run: |
@@ -127,6 +168,16 @@ jobs:
- name: Print run attempt
run: echo "run attempt is ${{ github.run_attempt }}"
+ - name: Print Disk Usage Before Container Start
+ if: ${{ always() }}
+ run: |
+ set +e;
+ sudo df -h /*;
+ echo "===========================================";
+ sudo du -hs /var/lib/docker;
+ echo "===========================================";
+ sudo docker system df -v;
+
- name: docker compose launch-multi-cn
timeout-minutes: 10
run: |
@@ -149,6 +200,24 @@ jobs:
sleep 1
done
docker ps
+
+ - name: Print Disk Usage After Container Start
+ if: ${{ always() }}
+ run: |
+ set +e;
+ sudo df -h /*;
+ echo "===========================================";
+ sudo du -hs /var/lib/docker;
+ echo "===========================================";
+ sudo docker system df -v;
+
+ - name: Clean Docker Image Build Cache
+ if: ${{ always() }}
+ run: |
+ sudo docker builder prune -f -a;
+ echo "===========================================";
+ sudo docker system df -v;
+
- name: Clone test-tool repository
uses: actions/checkout@v4
with:
@@ -159,6 +228,11 @@ jobs:
- name: Set up Go And Java
uses: matrixorigin/CI/actions/setup-env@main
+ - name: Update BVT SQL Timeout
+ run: |
+ cd $GITHUB_WORKSPACE/mo-tester
+ sed -i "s/socketTimeout:.*/socketTimeout: 300000/g" mo.yml
+
- name: Start BVT Test
id: bvt_on_pr_version
run: |
@@ -170,6 +244,17 @@ jobs:
echo "============================="
./run.sh -n -g -o -p $GITHUB_WORKSPACE/test/distributed/cases -s /test/distributed/resources -e optimistic 2>&1
+
+ - name: Print Disk Usage Before Container Shutdown
+ if: ${{ always() }}
+ run: |
+ set +e;
+ sudo df -h /*;
+ echo "===========================================";
+ sudo du -hs /var/lib/docker;
+ echo "===========================================";
+ sudo docker system df -v;
+
- name: export log
if: ${{ failure() || cancelled()}}
run: |
diff --git a/.github/workflows/e2e-standalone.yaml b/.github/workflows/e2e-standalone.yaml
index 1194cec..1dc77cb 100644
--- a/.github/workflows/e2e-standalone.yaml
+++ b/.github/workflows/e2e-standalone.yaml
@@ -30,6 +30,8 @@ jobs:
echo "" >> ./etc/launch/cn.toml
echo '[cn.txn]' >> ./etc/launch/cn.toml
echo 'mode = "Optimistic"' >> ./etc/launch/cn.toml
+ echo " enable-leak-check = 1" >> ./etc/launch/cn.toml
+ echo ' max-active-ages = "2m"'>> ./etc/launch/cn.toml
echo "" >> ./etc/launch/tn.toml
echo '[tn.txn]' >> ./etc/launch/tn.toml
echo 'mode = "Optimistic"' >> ./etc/launch/tn.toml
@@ -45,6 +47,10 @@ jobs:
repository: matrixorigin/mo-tester
path: ./mo-tester
ref: main
+ - name: Update BVT SQL Timeout
+ run: |
+ cd $GITHUB_WORKSPACE/mo-tester
+ sed -i "s/socketTimeout:.*/socketTimeout: 300000/g" mo.yml
- name: Start BVT Test
id: bvt_on_pr_version
run: |
@@ -145,6 +151,14 @@ jobs:
run: |
sudo bash -c 'echo -e "127.0.0.1\tcn0" >> /etc/hosts;';
sudo bash -c 'echo -e "127.0.0.1\tcn1" >> /etc/hosts;';
+ - name: Add cn.txn
+ run: |
+ cd $GITHUB_WORKSPACE/head
+ echo "" >> ./etc/launch-dynamic-with-proxy/cn.toml.base
+ echo "" >> ./etc/launch-dynamic-with-proxy/cn.toml.base
+ echo "[cn.txn]" >> ./etc/launch-dynamic-with-proxy/cn.toml.base
+ echo " enable-leak-check = 1" >> ./etc/launch-dynamic-with-proxy/cn.toml.base
+ echo ' max-active-ages = "2m"'>> ./etc/launch-dynamic-with-proxy/cn.toml.base
- name: Start MO
run: |
sudo cat /etc/hosts | grep '127.0.0.1';
@@ -156,6 +170,10 @@ jobs:
repository: matrixorigin/mo-tester
path: ./mo-tester
ref: main
+ - name: Update BVT SQL Timeout
+ run: |
+ cd $GITHUB_WORKSPACE/mo-tester
+ sed -i "s/socketTimeout:.*/socketTimeout: 300000/g" mo.yml
- name: Start BVT Test
id: bvt_on_pr_version
run: |
@@ -219,6 +237,13 @@ jobs:
cd $GITHUB_WORKSPACE/head && make clean && make build
git rev-parse --short HEAD
+ - name: Add cn.txn
+ run: |
+ cd $GITHUB_WORKSPACE/head
+ echo "[cn.txn]" >> ./etc/launch/cn.toml
+ echo " enable-leak-check = 1" >> ./etc/launch/cn.toml
+ echo ' max-active-ages = "2m"'>> ./etc/launch/cn.toml
+
- name: echo config
run: |
cd $GITHUB_WORKSPACE/head
@@ -236,7 +261,10 @@ jobs:
repository: matrixorigin/mo-tester
path: ./mo-tester
ref: main
-
+ - name: Update BVT SQL Timeout
+ run: |
+ cd $GITHUB_WORKSPACE/mo-tester
+ sed -i "s/socketTimeout:.*/socketTimeout: 300000/g" mo.yml
- name: Start BVT Test
id: bvt_on_pr_version
run: |
diff --git a/.github/workflows/e2e-upgrade.yaml b/.github/workflows/e2e-upgrade.yaml
index 083d540..995697e 100644
--- a/.github/workflows/e2e-upgrade.yaml
+++ b/.github/workflows/e2e-upgrade.yaml
@@ -37,11 +37,25 @@ jobs:
- name: Set up Go And Java
uses: matrixorigin/CI/actions/setup-env@main
+ - name: Add cn.txn for head
+ run: |
+ cd $GITHUB_WORKSPACE/head
+ echo "[cn.txn]" >> ./etc/launch/cn.toml
+ echo " enable-leak-check = 1" >> ./etc/launch/cn.toml
+ echo ' max-active-ages = "2m"'>> ./etc/launch/cn.toml
+
- name: Build MatrixOne for head
run: |
cd $GITHUB_WORKSPACE/head && make clean && make build
git rev-parse --short HEAD
+ - name: Add cn.txn for upstream
+ run: |
+ cd $GITHUB_WORKSPACE/upstream
+ echo "[cn.txn]" >> ./etc/launch/cn.toml
+ echo " enable-leak-check = 1" >> ./etc/launch/cn.toml
+ echo ' max-active-ages = "2m"'>> ./etc/launch/cn.toml
+
- name: Build MatrixOne for upstream
run: |
cd $GITHUB_WORKSPACE/upstream && make clean && make build
@@ -67,7 +81,10 @@ jobs:
repository: matrixorigin/mo-tester
path: ./mo-tester
ref: main
-
+ - name: Update BVT SQL Timeout
+ run: |
+ cd $GITHUB_WORKSPACE/mo-tester
+ sed -i "s/socketTimeout:.*/socketTimeout: 300000/g" mo.yml
- name: Start BVT Test for Target Branch
id: bvt_on_latest_main_version
run: |
@@ -119,7 +136,10 @@ jobs:
fi
./optools/run_bvt.sh $GITHUB_WORKSPACE/workspace launch;
sleep 60;
-
+ - name: Update BVT SQL Timeout for Head Branch
+ run: |
+ cd $GITHUB_WORKSPACE/mo-tester
+ sed -i "s/socketTimeout:.*/socketTimeout: 300000/g" mo.yml
- name: Start BVT Test for Head Branch
id: bvt_on_latest_head_version
run: |
@@ -204,11 +224,25 @@ jobs:
- name: Set up Go And Java
uses: matrixorigin/CI/actions/setup-env@main
+ - name: Add cn.txn for head
+ run: |
+ cd $GITHUB_WORKSPACE/head
+ echo "[cn.txn]" >> ./etc/launch/cn.toml
+ echo " enable-leak-check = 1" >> ./etc/launch/cn.toml
+ echo ' max-active-ages = "2m"'>> ./etc/launch/cn.toml
+
- name: Build MatrixOne for head
run: |
cd $GITHUB_WORKSPACE/head && make clean && make build
git rev-parse --short HEAD
+ - name: Add cn.txn for upstream release
+ run: |
+ cd $GITHUB_WORKSPACE/upstream
+ echo "[cn.txn]" >> ./etc/launch/cn.toml
+ echo " enable-leak-check = 1" >> ./etc/launch/cn.toml
+ echo ' max-active-ages = "2m"'>> ./etc/launch/cn.toml
+
- name: Build MatrixOne for upstream release
run: |
cd $GITHUB_WORKSPACE/upstream && make clean && make build
@@ -234,7 +268,10 @@ jobs:
repository: matrixorigin/mo-tester
path: ./mo-tester
ref: main
-
+ - name: Update BVT SQL Timeout for Release ${{ inputs.release-version }}
+ run: |
+ cd $GITHUB_WORKSPACE/mo-tester
+ sed -i "s/socketTimeout:.*/socketTimeout: 300000/g" mo.yml
- name: Start BVT Test for Release ${{ inputs.release-version }}
id: bvt_on_latest_main_version
run: |
@@ -288,7 +325,10 @@ jobs:
fi
./optools/run_bvt.sh $GITHUB_WORKSPACE/workspace launch;
sleep 60;
-
+ - name: Update BVT SQL Timeout for Head Ref
+ run: |
+ cd $GITHUB_WORKSPACE/mo-tester
+ sed -i "s/socketTimeout:.*/socketTimeout: 300000/g" mo.yml
- name: Start BVT Test for Head Ref
id: bvt_on_latest_head_version
run: |
diff --git a/.github/workflows/merge-trigger-standalone.yaml b/.github/workflows/merge-trigger-standalone.yaml
index c734163..e376d05 100644
--- a/.github/workflows/merge-trigger-standalone.yaml
+++ b/.github/workflows/merge-trigger-standalone.yaml
@@ -27,6 +27,13 @@ jobs:
setup-java: false
cache: true
+ - name: Add cn.txn
+ run: |
+ cd $GITHUB_WORKSPACE/matrixone
+ echo "[cn.txn]" >> ./etc/launch/cn.toml
+ echo " enable-leak-check = 1" >> ./etc/launch/cn.toml
+ echo ' max-active-ages = "2m"'>> ./etc/launch/cn.toml
+
- name: Build MatrixOne
run: |
cd $GITHUB_WORKSPACE/matrixone && make clean && make build
@@ -57,7 +64,10 @@ jobs:
- name: Check Java Version
run: java -version
-
+ - name: Update BVT SQL Timeout
+ run: |
+ cd $GITHUB_WORKSPACE/mo-tester
+ sed -i "" "s/socketTimeout:.*/socketTimeout: 300000/g" mo.yml
- name: Start BVT Test
id: bvt_on_pr_version
run: |
@@ -126,6 +136,12 @@ jobs:
uses: matrixorigin/CI/actions/setup-env@main
with:
setup-java: false
+ - name: Add cn.txn
+ run: |
+ cd $GITHUB_WORKSPACE/head
+ echo "[cn.txn]" >> ./etc/launch/cn.toml
+ echo " enable-leak-check = 1" >> ./etc/launch/cn.toml
+ echo ' max-active-ages = "2m"'>> ./etc/launch/cn.toml
- name: Build MatrixOne
run: |
export GOPROXY='http://goproxy.goproxy.svc.cluster.local'
@@ -143,14 +159,13 @@ jobs:
ref: main
- name: Set up JDK 8 for x64
run: echo "$JAVA_HOME/bin" >> $GITHUB_PATH
-
- name: Start BVT Test
id: bvt_on_pr_version
run: |
export LC_ALL="C.UTF-8"
locale
cd $GITHUB_WORKSPACE/mo-tester
- sed -i 's/socketTimeout:.*/socketTimeout: 600000/g' mo.yml
+ sed -i 's/socketTimeout:.*/socketTimeout: 300000/g' mo.yml
sed -i 's/ port: [0-9]*/ port: 12345/g' mo.yml
cat mo.yml
echo "======================================"
diff --git a/.github/workflows/merge-trigger-tke.yaml b/.github/workflows/merge-trigger-tke.yaml
index 091feab..2a13573 100644
--- a/.github/workflows/merge-trigger-tke.yaml
+++ b/.github/workflows/merge-trigger-tke.yaml
@@ -2,6 +2,12 @@ name: MO Checkin Regression On TKE
on:
workflow_call:
+ inputs:
+ enable-txn-trace:
+ description: "enable txn trace"
+ type: boolean
+ required: false
+ default: false
secrets:
TCR_USERNAME:
description: 'TCR_USERNAME'
@@ -21,12 +27,11 @@ on:
TOKEN_ACTION:
description: 'TOKEN_ACTION'
required: true
-
jobs:
docker_image_build:
environment: ci
- runs-on: amd64-mo-guangzhou-dind #amd64-mo-shanghai-dind
+ runs-on: amd64-mo-shanghai-dind #amd64-mo-guangzhou-dind
if: ${{ github.event.pull_request.merged == true }}
timeout-minutes: 30
name: BUILD MO DOCKER IMAGE
@@ -152,6 +157,7 @@ jobs:
echo "cn_ips is $cn_ips"
echo "cn_ips=$cn_ips" >> $GITHUB_OUTPUT;
- name: Add TXN Filter
+ if: ${{ inputs.enable-txn-trace }}
run: |
export MYSQL_PWD=111;
for i in {1..300}; do
@@ -320,11 +326,12 @@ jobs:
timeout-minutes: 2
id: account_for_ssb_and_tpch
run: |
- mysql -h ${{ needs.setup_mo_test_env.outputs.mo_svc_ip }} -P 6001 -udump -p111 -e "create account ssb_tpch_test admin_name = 'admin' identified by '111' comment 'for ssb and tpch test';"
- echo "ssb_tpch_account=ssb_tpch_test:admin" >> $GITHUB_OUTPUT
+ #mysql -h ${{ needs.setup_mo_test_env.outputs.mo_svc_ip }} -P 6001 -udump -p111 -e "create account ssb_tpch_test admin_name = 'admin' identified by '111' comment 'for ssb and tpch test';"
+ echo "ssb_tpch_account=dump" >> $GITHUB_OUTPUT
echo "ssb_tpch_password=111" >> $GITHUB_OUTPUT
- name: Enable CN TXN Trace
+ if: ${{ inputs.enable-txn-trace }}
timeout-minutes: 2
run: |
export MYSQL_PWD='111'
@@ -548,6 +555,7 @@ jobs:
sleep 10
- name: Enable CN TXN Trace
+ if: ${{ inputs.enable-txn-trace }}
timeout-minutes: 2
run: |
export MYSQL_PWD='111'
@@ -648,7 +656,7 @@ jobs:
token: ${{secrets.TOKEN_ACTION}}
path: ./mo-nightly-regression
ref: main
-
+
- name: Create Account for Test
timeout-minutes: 2
id: account_for_tpcc
@@ -666,9 +674,9 @@ jobs:
sed -i '/.*SECRET_ACCESS_KEY: ""*/c\SECRET_ACCESS_KEY: "${{secrets.TENCENT_SK}}"' access.yml
echo "$JAVA_HOME/bin" >> $GITHUB_PATH
-
+
# start tpcc test
- - name: Load TPCC 10 Warehouse Data
+ - name: Load TPCC 50 Warehouse Data
if: ${{ always() && !cancelled() }}
timeout-minutes: 20
id: load_tpcc_data
@@ -679,9 +687,10 @@ jobs:
sleep 60s
cd $GITHUB_WORKSPACE/mo-load-data
mkdir -p report
- ./load.sh -u ${{ steps.account_for_tpcc.outputs.tpcc_account }} -p ${{ steps.account_for_tpcc.outputs.tpcc_password }} -h ${{ needs.setup_mo_test_env.outputs.mo_svc_ip }} -c cases/02_from_cos/tpcc_10 -r -m | tee report/mo-load-data-tpcc.log
+ ./load.sh -u ${{ steps.account_for_tpcc.outputs.tpcc_account }} -p ${{ steps.account_for_tpcc.outputs.tpcc_password }} -h ${{ needs.setup_mo_test_env.outputs.mo_svc_ip }} -c cases/02_from_cos/tpcc_50 -r -m | tee report/mo-load-data-tpcc.log
- name: Enable CN TXN Trace
+ if: ${{ inputs.enable-txn-trace }}
timeout-minutes: 2
run: |
export MYSQL_PWD='111'
@@ -699,7 +708,7 @@ jobs:
sleep 1;
done
- - name: Start TPCC 10 Warehouses 100 terminals Test
+ - name: Start TPCC 50 Warehouses 50 terminals Test
if: ${{ always() && !cancelled() && steps.load_tpcc_data.conclusion == 'success' }}
timeout-minutes: 25
run: |
@@ -709,23 +718,23 @@ jobs:
cd $GITHUB_WORKSPACE/mo-tpcc
mkdir -p report
- cp props.mo props_10.mo
- sed -i '/.*terminals=*/c\terminals=100' props_10.mo
- sed -i '/.*warehouses=*/c\warehouses=10' props_10.mo
- sed -i 's/tpcc/tpcc_10/g' props_10.mo
- sed -i 's/127.0.0.1/${{ needs.setup_mo_test_env.outputs.mo_svc_ip }}/g' props_10.mo
- sed -i '/runMins=*/c\runMins=15' props_10.mo
- sed -i '/.*expectedErrorCodes=*/c\expectedErrorCodes=20619,1062' props_10.mo
- sed -i 's/user=.*/user=${{ steps.account_for_tpcc.outputs.tpcc_account }}/g' props_10.mo
- sed -i 's/password=.*/password=${{ steps.account_for_tpcc.outputs.tpcc_password }}/g' props_10.mo
- ./runBenchmark.sh props_10.mo | tee report/tpcc-benchmark-10-100.log
- ./runVerify.sh props_10.mo | tee report/tpcc-verify-10-100.log
-
+ cp props.mo props_50.mo
+ sed -i '/.*terminals=*/c\terminals=50' props_50.mo
+ sed -i '/.*warehouses=*/c\warehouses=50' props_50.mo
+ sed -i 's/tpcc/tpcc_50/g' props_50.mo
+ sed -i 's/127.0.0.1/${{ needs.setup_mo_test_env.outputs.mo_svc_ip }}/g' props_50.mo
+ sed -i '/runMins=*/c\runMins=15' props_50.mo
+ sed -i '/.*expectedErrorCodes=*/c\expectedErrorCodes=20619,1062' props_50.mo
+ sed -i 's/user=.*/user=${{ steps.account_for_tpcc.outputs.tpcc_account }}/g' props_50.mo
+ sed -i 's/password=.*/password=${{ steps.account_for_tpcc.outputs.tpcc_password }}/g' props_50.mo
+ ./runBenchmark.sh props_50.mo | tee report/tpcc-benchmark-50-50.log
+ ./runVerify.sh props_50.mo | tee report/tpcc-verify-50-50.log
+
- name: Result Summary
if: ${{ always() && !cancelled() }}
run: |
cd $GITHUB_WORKSPACE/mo-tpcc
- files=("report/tpcc-benchmark-10-100.log")
+ files=("report/tpcc-benchmark-50-50.log")
for filename in "${files[@]}"
do
if [ ! -f $filename ]; then
@@ -742,7 +751,7 @@ jobs:
echo "..."
tail -n 3 tmp
done
-
+
- name: Collect Upload files
if: ${{ always() || cancelled() }}
run: |
@@ -750,7 +759,7 @@ jobs:
mkdir -p $GITHUB_WORKSPACE/reports/mo-tpcc
mkdir -p $GITHUB_WORKSPACE/mo-load-data/report && cp -r $GITHUB_WORKSPACE/mo-load-data/report $GITHUB_WORKSPACE/reports/mo-load-data
mkdir -p $GITHUB_WORKSPACE/mo-tpcc/report && cp -r $GITHUB_WORKSPACE/mo-tpcc/report $GITHUB_WORKSPACE/reports/mo-tpcc
-
+
- uses: actions/upload-artifact@v4
if: ${{ failure() || cancelled()}}
continue-on-error: true
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 42a0608..e289053 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -93,7 +93,7 @@ jobs:
token: ${{ secrets.TOKEN_ACTION }}
repository: matrixorigin/mo-nightly-regression
event-type: binary-test
- client-payload: '{"RUNNER": "runner-aron-shpc-2","GIT_WEBSITE": "github","MO_REPO": "${{ github.repository_owner }}","MO_VERSION": "${{ steps.get_release.outputs.tag_name }}","MO_DEPLOY_MODE": "binary","MO_BIN_URL": "https://github.com/${{ github.repository }}/releases/download/${{ steps.get_release.outputs.tag_name }}/mo-${{ steps.get_release.outputs.tag_name }}-linux-x86_64.zip","TEST_LIST": "bvt,tpcc,sysbench,ssb,tpch,customer","BVT_EXCLUDE_CASES": "","CUS_TEST_OPTION": "ddl,insert,query","CUS_DS_LIST": "cmcciot_001,dmt_001,etao_001,unre_004,slooong_003"}'
+ client-payload: '{"RUNNER": "runner-aron-shpc-1","GIT_WEBSITE": "github","MO_REPO": "${{ github.repository_owner }}","MO_VERSION": "${{ steps.get_release.outputs.tag_name }}","MO_DEPLOY_MODE": "binary","MO_BIN_URL": "https://github.com/${{ github.repository }}/releases/download/${{ steps.get_release.outputs.tag_name }}/mo-${{ steps.get_release.outputs.tag_name }}-linux-x86_64.zip","TEST_LIST": "bvt,tpcc,sysbench,ssb,tpch,customer","BVT_EXCLUDE_CASES": "","CUS_TEST_OPTION": "ddl,insert,query","CUS_DS_LIST": "cmcciot_001,dmt_001,etao_001,unre_004,slooong_003"}'
- name: Get binary test url
run: |
echo "you can find the binary test action on https://github.com/matrixorigin/mo-nightly-regression/actions/workflows/mo-release-test-binary.yaml "
diff --git a/.github/workflows/robot.yaml b/.github/workflows/robot.yaml
index ac19ca9..3704459 100644
--- a/.github/workflows/robot.yaml
+++ b/.github/workflows/robot.yaml
@@ -155,14 +155,22 @@ jobs:
repository: matrixorigin/mo-tester
path: ./mo-tester
ref: main
+ - name: Add cn.txn
+ run: |
+ cd $GITHUB_WORKSPACE/matrixone
+ echo "[cn.txn]" >> ./etc/launch/cn.toml
+ echo " enable-leak-check = 1" >> ./etc/launch/cn.toml
+ echo ' max-active-ages = "2m"'>> ./etc/launch/cn.toml
- name: Start Unit Test
+ id: ut_test
timeout-minutes: 120
run: |
+ set -o pipefail
cd $GITHUB_WORKSPACE/matrixone
test_scope=$(go list ./... | grep -v 'driver\|engine/aoe\|engine/memEngine\|pkg/catalog')
make clean && make config && make cgo
echo "ut start"
- CGO_CFLAGS="-I${GITHUB_WORKSPACE}/matrixone/cgo" CGO_LDFLAGS="-L${GITHUB_WORKSPACE}/matrixone/cgo -lmo" go test -v -tags matrixone_test -p 6 -covermode=count -coverprofile=${{ env.raw_ut_coverage }} -coverpkg=./pkg/... ${test_scope} | tee ${{ env.ut_report }}
+ CGO_CFLAGS="-I${GITHUB_WORKSPACE}/matrixone/cgo" CGO_LDFLAGS="-L${GITHUB_WORKSPACE}/matrixone/cgo -lmo" go test -short -v -tags matrixone_test -p 6 -covermode=count -coverprofile=${{ env.raw_ut_coverage }} -coverpkg=./pkg/... ${test_scope} | tee ${{ env.ut_report }}
echo "ut finished"
- name: Start BVT Test Service
if: ${{ always() && !cancelled() }}
@@ -175,6 +183,10 @@ jobs:
export GOCOVERDIR=$GITHUB_WORKSPACE/matrixone
go build -cover "$GOLDFLAGS" -o mo-service ./cmd/mo-service/
./optools/run_bvt.sh $GITHUB_WORKSPACE/matrixone launch
+ - name: Update BVT SQL Timeout
+ run: |
+ cd $GITHUB_WORKSPACE/mo-tester
+ sed -i "s/socketTimeout:.*/socketTimeout: 300000/g" mo.yml
- name: Start BVT Test
if: ${{ always() && !cancelled() }}
id: bvt_on_pr_version
@@ -282,7 +294,7 @@ jobs:
with:
msgtype: markdown
mentioned_list: '["@all"]'
- content: "Nightly Code Quality - ${{ env.Today }} \nUT Coverage Summary:${{ env.UT_CODE_COVERAGE }}\nBVT Coverage Summary:${{ env.BVT_CODE_COVERAGE }}\nGeneral Coverage Summary:${{ env.GENERAL_CODE_COVERAGE }}\nFor details, please visit [Action Run](${{ env.Url }})\n"
+ content: "Nightly Code Quality - ${{ env.Today }} \nUT result:${{ steps.ut_test.conclusion }}\nBVT result:${{ steps.bvt_on_pr_version.conclusion }}\nUT Coverage Summary:${{ env.UT_CODE_COVERAGE }}\nBVT Coverage Summary:${{ env.BVT_CODE_COVERAGE }}\nGeneral Coverage Summary:${{ env.GENERAL_CODE_COVERAGE }}\nFor details, please visit [Action Run](${{ env.Url }})\n"
- name: WeChat Work notification
if: ${{ always() && !cancelled() }}
id: detail-notification
diff --git a/.github/workflows/utils.yaml b/.github/workflows/utils.yaml
index ed52036..ee8496d 100644
--- a/.github/workflows/utils.yaml
+++ b/.github/workflows/utils.yaml
@@ -18,6 +18,12 @@ on:
required: true
OPENAI_API_KEY:
description: "OPENAI_API_KEY For get PR Suggestion"
+ required: false
+ TENCENT_AK:
+ description: "TENCENT_AK For UT Test"
+ required: true
+ TENCENT_SK:
+ description: "TENCENT_SK For UT Test"
required: true
EE_DB_ADDR:
description: "matrixone cloud host"
@@ -84,11 +90,59 @@ jobs:
pr_coverage:
if: ${{ needs.check_organization_user.outputs.safe_label == '1' || needs.check_organization_user.outputs.in_org == '1' }}
- name: PR Unit and BVT Test Coverage
+ name: Coverage
needs: [check_organization_user]
environment: ci
+ # if you change runner, must modify L117
runs-on: amd64-mo-guangzhou-2xlarge16
steps:
+ - name: Analyze test list
+ id: s1
+ run: |
+ echo "---------------------------------"
+ TEST_LIST='ut,bvt,tpcc,sysbench,ssb,tpch'
+ for test in $(echo ${TEST_LIST} | sed "s/,/ /g"); do
+ echo "Current test: ${test}"
+ case "${test}" in
+ "ut")
+ run_ut="true"
+ ;;
+ "bvt")
+ run_bvt="true"
+ ;;
+ "tpcc")
+ run_tpcc="true"
+ ;;
+ "sysbench")
+ run_sysbench="true"
+ ;;
+ "ssb")
+ run_ssb="true"
+ ;;
+ "tpch")
+ run_tpch="true"
+ ;;
+ *)
+ echo "Invalid test option: ${test}, skipping"
+ ;;
+ esac
+ done
+
+ echo "run_ut=${run_ut}"
+ echo "run_bvt=${run_bvt}"
+ echo "run_tpcc=${run_tpcc}"
+ echo "run_sysbench=${run_sysbench}"
+ echo "run_ssb=${run_ssb}"
+ echo "run_tpch=${run_tpch}"
+
+ echo "run_ut=${run_ut}" >> $GITHUB_OUTPUT
+ echo "run_bvt=${run_bvt}" >> $GITHUB_OUTPUT
+ echo "run_tpcc=${run_tpcc}" >> $GITHUB_OUTPUT
+ echo "run_sysbench=${run_sysbench}" >> $GITHUB_OUTPUT
+ echo "run_ssb=${run_ssb}" >> $GITHUB_OUTPUT
+ echo "run_tpch=${run_tpch}" >> $GITHUB_OUTPUT
+
+
- uses: actions/checkout@v4
with:
fetch-depth: "1"
@@ -128,6 +182,7 @@ jobs:
echo "bvt_html_coverage='bvt_coverage.html'" >> $GITHUB_ENV
echo "ut_excluded_pkg='pkg/pb\|pkg/sql/parsers/goyacc\|yaccpar'" >> $GITHUB_ENV
echo "bvt_excluded_pkg='pkg/pb\|yaccpar'" >> $GITHUB_ENV
+ echo 'GOPROXY=http://goproxy.goproxy.svc.cluster.local|https://goproxy.cn|direct' >> $GITHUB_ENV
- name: Set JAVA PATH
run: |
@@ -139,19 +194,25 @@ jobs:
repository: matrixorigin/mo-tester
path: ./mo-tester
ref: main
+ - name: Add cn.txn
+ run: |
+ cd $GITHUB_WORKSPACE/matrixone
+ echo "[cn.txn]" >> ./etc/launch/cn.toml
+ echo " enable-leak-check = 1" >> ./etc/launch/cn.toml
+ echo ' max-active-ages = "2m"'>> ./etc/launch/cn.toml
- name: Start Unit Test
timeout-minutes: 45
run: |
+ set -o pipefail
cd $GITHUB_WORKSPACE/matrixone
export TEST_S3FS_ALIYUN=${{ secrets.TEST_S3FS_ALIYUN }}
export TEST_S3FS_QCLOUD=${{ secrets.TEST_S3FS_QCLOUD }}
test_scope=$(go list ./... | grep -v 'driver\|engine/aoe\|engine/memEngine\|pkg/catalog')
make clean && make config && make cgo
echo "ut start"
- CGO_CFLAGS="-I${GITHUB_WORKSPACE}/matrixone/cgo" CGO_LDFLAGS="-L${GITHUB_WORKSPACE}/matrixone/cgo -lmo" go test -v -tags matrixone_test -p 6 -covermode=set -coverprofile=${{ env.raw_ut_coverage }} -coverpkg=./... ${test_scope} | tee ${{ env.ut_report }}
+ CGO_CFLAGS="-I${GITHUB_WORKSPACE}/matrixone/cgo" CGO_LDFLAGS="-L${GITHUB_WORKSPACE}/matrixone/cgo -lmo" go test -short -v -tags matrixone_test -p 6 -covermode=set -coverprofile=${{ env.raw_ut_coverage }} -coverpkg=./... ${test_scope} | tee ${{ env.ut_report }}
echo "ut finished"
- name: Start BVT Test Service
- if: ${{ always() && !cancelled() }}
timeout-minutes: 10
run: |
cd $GITHUB_WORKSPACE/matrixone
@@ -161,9 +222,12 @@ jobs:
export GOCOVERDIR=$GITHUB_WORKSPACE/matrixone
go build -cover "$GOLDFLAGS" -o mo-service ./cmd/mo-service/
./optools/run_bvt.sh $GITHUB_WORKSPACE/matrixone launch
+ - name: Update BVT SQL Timeout
+ run: |
+ cd $GITHUB_WORKSPACE/mo-tester
+ sed -i "s/socketTimeout:.*/socketTimeout: 300000/g" mo.yml
- name: Start BVT Test
timeout-minutes: 30
- if: ${{ always() && !cancelled() }}
id: bvt_on_pr_version
run: |
export LC_ALL="C.UTF-8"
@@ -187,9 +251,9 @@ jobs:
go tool cover -o ${{ env.ut_html_coverage }} -html=${{ env.ut_coverage }}
echo "ut_html_coverage finished"
rm -rf ${{ env.raw_ut_coverage }}
- ps -aux | grep 'mo-service' | grep -v 'grep' | awk '{print $2}' | xargs kill -s SIGINT
- i=1 && while [ -n "$(ps -aux|grep 'mo-service' | grep -v 'grep' | awk '{print $2}')" ] && [ $i -le 300 ]; do echo "mo-service kill not finished......$i/300"; i=$(($i+1)); sleep 1s; done
- if [ $i -gt 300 ]; then echo 'stop mo-service failed...'; exit 1; else echo 'stop mo-service successed...'; fi
+ #ps -aux | grep 'mo-service' | grep -v 'grep' | awk '{print $2}' | xargs kill -s SIGINT
+ #i=1 && while [ -n "$(ps -aux|grep 'mo-service' | grep -v 'grep' | awk '{print $2}')" ] && [ $i -le 300 ]; do echo "mo-service kill not finished......$i/300"; i=$(($i+1)); sleep 1s; done
+ #if [ $i -gt 300 ]; then echo 'stop mo-service failed...'; exit 1; else echo 'stop mo-service successed...'; fi
go tool covdata textfmt -i="$GITHUB_WORKSPACE/matrixone" -o ${{ env.raw_bvt_coverage }}
cat ${{ env.raw_bvt_coverage }} | grep -v ${{ env.bvt_excluded_pkg }} > ${{ env.bvt_coverage }}
echo "bvt_coverage finished"
@@ -226,6 +290,7 @@ jobs:
run: |
cd $GITHUB_WORKSPACE
cp $GITHUB_WORKSPACE/CI/scripts/parse_coverage.py $GITHUB_WORKSPACE/parse_coverage.py
+ cp $GITHUB_WORKSPACE/CI/scripts/.ignore $GITHUB_WORKSPACE/.ignore
- name: Run coverage Python script
run: |
cd $GITHUB_WORKSPACE
@@ -281,6 +346,313 @@ jobs:
${{ github.workspace }}/coverage_downloads/final_result_files.zip
retention-days: 7
+ - name: Other Test Need Repo
+ if: ${{ !cancelled() && !failure() }}
+ run: |
+ echo "tpcc need mo-load-data,mo-tpcc repo"
+ echo "sysbench need mo-load repo"
+ echo "ssb need mo-load-data,mo-ssb repo"
+ echo "tpch need mo-load-data,mo-tpch repo"
+ echo "========================================="
+ echo "tpcc=${{steps.s1.outputs.run_tpcc}}"
+ echo "sysbench=${{steps.s1.outputs.run_sysbench}}"
+ echo "ssb=${{steps.s1.outputs.run_ssb}}"
+ echo "tpch=${{steps.s1.outputs.run_tpch}}"
+
+ - name: Clone mo-load-data Repo
+ if: ${{ !cancelled() && !failure() && ( steps.s1.outputs.run_tpcc == 'true' || steps.s1.outputs.run_ssb == 'true' || steps.s1.outputs.run_tpch == 'true' ) }}
+ uses: actions/checkout@v4
+ with:
+ repository: matrixorigin/mo-load-data
+ token: ${{secrets.TOKEN_ACTION}}
+ path: ./mo-load-data
+ ref: main
+
+ - name: Clone mo-load Repo
+ if: ${{ !cancelled() && !failure() && steps.s1.outputs.run_sysbench == 'true' }}
+ uses: actions/checkout@v4
+ with:
+ repository: matrixorigin/mo-load
+ token: ${{secrets.TOKEN_ACTION}}
+ path: ./mo-load
+ ref: main
+
+ - name: Clone mo-tpcc Repo
+ if: ${{ !cancelled() && !failure() && steps.s1.outputs.run_tpcc == 'true' }}
+ uses: actions/checkout@v4
+ with:
+ repository: matrixorigin/mo-tpcc
+ token: ${{secrets.TOKEN_ACTION}}
+ path: ./mo-tpcc
+ ref: main
+
+ - name: Clone mo-ssb Repo
+ if: ${{ !cancelled() && !failure() && steps.s1.outputs.run_ssb == 'true' }}
+ uses: actions/checkout@v4
+ with:
+ repository: matrixorigin/mo-ssb
+ token: ${{secrets.TOKEN_ACTION}}
+ path: ./mo-ssb
+ ref: main
+
+ - name: Clone mo-tpch Repo
+ if: ${{ !cancelled() && !failure() && steps.s1.outputs.run_tpch == 'true' }}
+ uses: actions/checkout@v4
+ with:
+ repository: matrixorigin/mo-tpch
+ token: ${{secrets.TOKEN_ACTION}}
+ path: ./mo-tpch
+ ref: main
+
+ - name: TPCC/Create Account for Test
+ if: ${{ !cancelled() && !failure() && steps.s1.outputs.run_tpcc == 'true' }}
+ timeout-minutes: 2
+ id: account_for_tpcc
+ run: |
+ mysql -h 127.0.0.1 -P 6001 -udump -p111 -e "create account tpcc_test admin_name = 'admin' identified by '111' comment 'for tpcc test';"
+ echo "tpcc_account=tpcc_test:admin" >> $GITHUB_OUTPUT
+ echo "tpcc_password=111" >> $GITHUB_OUTPUT
+
+ - name: TPCC/Modify Tool's Setting And Set PATH
+ if: ${{ !cancelled() && !failure() && steps.s1.outputs.run_tpcc == 'true' }}
+ run: |
+ cd $GITHUB_WORKSPACE/mo-load-data
+ sed -i '/.*ENDPOINT: ""*/c\ENDPOINT: "cos.ap-guangzhou.myqcloud.com"' access.yml
+ sed -i '/.*ACCESS_KEY_ID: ""*/c\ACCESS_KEY_ID: "${{secrets.TENCENT_AK}}"' access.yml
+ sed -i '/.*SECRET_ACCESS_KEY: ""*/c\SECRET_ACCESS_KEY: "${{secrets.TENCENT_SK}}"' access.yml
+
+ echo "$JAVA_HOME/bin" >> $GITHUB_PATH
+
+ # start tpcc test
+ - name: TPCC/Load TPCC 10 Warehouse Data
+ if: ${{ !cancelled() && !failure() && steps.s1.outputs.run_tpcc == 'true' }}
+ timeout-minutes: 20
+ id: load_tpcc_data
+ run: |
+ set -uo pipefail
+ export LC_ALL="C.UTF-8"
+ locale
+ sleep 60s
+ cd $GITHUB_WORKSPACE/mo-load-data
+ mkdir -p report
+ ./load.sh -u ${{ steps.account_for_tpcc.outputs.tpcc_account }} -p ${{ steps.account_for_tpcc.outputs.tpcc_password }} -h 127.0.0.1 -c cases/02_from_cos/tpcc_10 -r -m | tee report/mo-load-data-tpcc.log
+ - name: TPCC/Start TPCC 10 Warehouses 10 terminals Test
+ if: ${{ !cancelled() && !failure() && steps.load_tpcc_data.conclusion == 'success' }}
+ timeout-minutes: 25
+ run: |
+ set -uo pipefail
+ export LC_ALL="C.UTF-8"
+ locale
+
+ cd $GITHUB_WORKSPACE/mo-tpcc
+ mkdir -p report
+ cp props.mo props_10.mo
+ sed -i '/.*terminals=*/c\terminals=10' props_10.mo
+ sed -i '/.*warehouses=*/c\warehouses=10' props_10.mo
+ sed -i 's/tpcc/tpcc_10/g' props_10.mo
+ #sed -i 's/127.0.0.1/${{ needs.setup_mo_test_env.outputs.mo_svc_ip }}/g' props_10.mo
+ sed -i '/runMins=*/c\runMins=5' props_10.mo
+ sed -i '/.*expectedErrorCodes=*/c\expectedErrorCodes=20619,1062' props_10.mo
+ sed -i 's/user=.*/user=${{ steps.account_for_tpcc.outputs.tpcc_account }}/g' props_10.mo
+ sed -i 's/password=.*/password=${{ steps.account_for_tpcc.outputs.tpcc_password }}/g' props_10.mo
+ ./runBenchmark.sh props_10.mo | tee report/tpcc-benchmark-10-10.log
+ ./runVerify.sh props_10.mo | tee report/tpcc-verify-10-10.log
+ - name: TPCC/Result Summary
+ if: ${{ !cancelled() && !failure() && steps.s1.outputs.run_tpcc == 'true' }}
+ run: |
+ cd $GITHUB_WORKSPACE/mo-tpcc
+ files=("report/tpcc-benchmark-10-10.log")
+ for filename in "${files[@]}"
+ do
+ if [ ! -f $filename ]; then
+ continue
+ fi
+ echo -e "\n[$filename]"
+ grep "Running" $filename > tmp
+ N=$(wc -l < tmp)
+ head -n 3 tmp
+ echo "..."
+ middle_start=$((N / 2 - 1))
+ middle_end=$((N / 2 + 1))
+ head -n $middle_end tmp | tail -n +$middle_start
+ echo "..."
+ tail -n 3 tmp
+ done
+
+ - name: TPCC/Collect Upload files
+ if: ${{ !cancelled() && !failure() && steps.s1.outputs.run_tpcc == 'true' }}
+ run: |
+ mkdir -p $GITHUB_WORKSPACE/reports/mo-load-data
+ mkdir -p $GITHUB_WORKSPACE/reports/mo-tpcc
+ mkdir -p $GITHUB_WORKSPACE/mo-load-data/report && cp -r $GITHUB_WORKSPACE/mo-load-data/report $GITHUB_WORKSPACE/reports/mo-load-data
+ mkdir -p $GITHUB_WORKSPACE/mo-tpcc/report && cp -r $GITHUB_WORKSPACE/mo-tpcc/report $GITHUB_WORKSPACE/reports/mo-tpcc
+
+ - name: Sysbench/Create Account for Test And Set PATH
+ if: ${{ !cancelled() && !failure() && steps.s1.outputs.run_sysbench == 'true' }}
+ timeout-minutes: 2
+ id: account_for_sysbench
+ run: |
+ echo "sysbench_account=dump" >> $GITHUB_OUTPUT
+ echo "sysbench_password=111" >> $GITHUB_OUTPUT
+ echo "$JAVA_HOME/bin" >> $GITHUB_PATH
+
+ # start sysbench test
+ - name: Sysbench/Prepare Sysbench Database and Tables
+ if: ${{ !cancelled() && !failure() && steps.s1.outputs.run_sysbench == 'true' }}
+ timeout-minutes: 5
+ run: |
+ set -uo pipefail
+ export LC_ALL="C.UTF-8"
+ locale
+
+ cd $GITHUB_WORKSPACE/mo-load
+ mkdir -p report
+ #sed -i 's/127.0.0.1/${{ needs.setup_mo_test_env.outputs.mo_svc_ip }}/g' mo.yml
+ sed -i 's/name:.*$/name: "${{ steps.account_for_sysbench.outputs.sysbench_account }}"/g' mo.yml
+ sed -i 's/password:.*$/password: "${{ steps.account_for_sysbench.outputs.sysbench_password }}"/g' mo.yml
+
+ echo 'Start Prepare Data of 10-tables-100000-per-table'
+ ./start.sh -m SYSBENCH -n 10 -s 100000 -t 1 | tee report/load-oltp-mix.log
+ sleep 10
+
+ # start sysbench test
+ - name: Sysbench/Start OLTP Mixed Test With 10 Threads
+ if: ${{ !cancelled() && !failure() && steps.s1.outputs.run_sysbench == 'true' }}
+ timeout-minutes: 40
+ run: |
+ set -uo pipefail
+ export LC_ALL="C.UTF-8"
+ locale
+
+ cd $GITHUB_WORKSPACE/mo-load
+ mkdir -p report
+ echo 'Start OLTP Insert Test With 10 threads'
+ ./start.sh -c cases/sysbench/mixed_10_100000 -t 10 -d 5 -g -b sbtest | tee report/oltp-mix.log
+
+ - name: Sysbench/Result Summary
+ if: ${{ !cancelled() && !failure() && steps.s1.outputs.run_sysbench == 'true' }}
+ run: |
+ cd $GITHUB_WORKSPACE/mo-load
+
+ files=("report/oltp-mix.log")
+ for filename in "${files[@]}"
+ do
+ if [ ! -f $filename ]; then
+ continue
+ fi
+ echo -e "\n[$filename]"
+ grep "tps=" $filename > tmp
+ N=$(wc -l < tmp)
+ head -n 3 tmp
+ echo "..."
+ middle_start=$((N / 2 - 1))
+ middle_end=$((N / 2 + 1))
+ head -n $middle_end tmp | tail -n +$middle_start
+ echo "..."
+ tail -n 3 tmp
+ done
+
+ - name: Sysbench/Collect Upload files
+ if: ${{ (steps.s1.outputs.run_sysbench == 'true') && (always() || cancelled()) }}
+ run: |
+ mkdir -p $GITHUB_WORKSPACE/reports/mo-load
+ mkdir -p $GITHUB_WORKSPACE/mo-load/report && cp -r $GITHUB_WORKSPACE/mo-load/report $GITHUB_WORKSPACE/reports/mo-load
+
+ - name: TPCH/SSB/Create Account for Test
+ if: ${{ !cancelled() && !failure() && (steps.s1.outputs.run_tpch == 'true' || steps.s1.outputs.run_ssb == 'true') }}
+ timeout-minutes: 2
+ id: account_for_ssb_and_tpch
+ run: |
+ #mysql -h 127.0.0.1 -P 6001 -udump -p111 -e "create account ssb_tpch_test admin_name = 'admin' identified by '111' comment 'for ssb_tpch test';"
+ echo "ssb_tpch_account=dump" >> $GITHUB_OUTPUT
+ echo "ssb_tpch_password=111" >> $GITHUB_OUTPUT
+
+ - name: TPCH/SSB/Modify Tool's Setting And Set PATH
+ if: ${{ !cancelled() && !failure() && (steps.s1.outputs.run_tpch == 'true' || steps.s1.outputs.run_ssb == 'true') }}
+ run: |
+ cd $GITHUB_WORKSPACE/mo-load-data
+ sed -i '/.*ENDPOINT: ""*/c\ENDPOINT: "cos.ap-guangzhou.myqcloud.com"' access.yml
+ sed -i '/.*ACCESS_KEY_ID: ""*/c\ACCESS_KEY_ID: "${{secrets.TENCENT_AK}}"' access.yml
+ sed -i '/.*SECRET_ACCESS_KEY: ""*/c\SECRET_ACCESS_KEY: "${{secrets.TENCENT_SK}}"' access.yml
+ echo "$JAVA_HOME/bin" >> $GITHUB_PATH
+
+ - name: SSB/Start Load SSB 1G Data And Test
+ if: ${{ !cancelled() && !failure() && steps.s1.outputs.run_ssb == 'true' }}
+ id: step_ssb_test
+ timeout-minutes: 20
+ run: |
+ set -uo pipefail
+ export LC_ALL="C.UTF-8"
+ locale
+ sleep 60s
+ cd $GITHUB_WORKSPACE/mo-load-data
+ mkdir -p report
+ ./load.sh -u ${{ steps.account_for_ssb_and_tpch.outputs.ssb_tpch_account }} -p ${{ steps.account_for_ssb_and_tpch.outputs.ssb_tpch_password }} -h 127.0.0.1 -c cases/02_from_cos/ssb_1 -r -m | tee report/mo-load-data-ssb.log
+ # start test
+ cd $GITHUB_WORKSPACE/mo-ssb
+ mkdir -p report
+ ./run.sh -u ${{ steps.account_for_ssb_and_tpch.outputs.ssb_tpch_account }} -p ${{ steps.account_for_ssb_and_tpch.outputs.ssb_tpch_password }} -h 127.0.0.1 -q all -s 1 -t 5 | tee report/mo-ssb.log
+
+ - name: TPCH/Load TPCH 1G Test Data
+ if: ${{ !cancelled() && !failure() && steps.s1.outputs.run_tpch == 'true' }}
+ timeout-minutes: 20
+ id: load_tpch_data
+ run: |
+ set -uo pipefail
+ export LC_ALL="C.UTF-8"
+ locale
+ sleep 60s
+ cd $GITHUB_WORKSPACE/mo-load-data
+ mkdir -p report
+ ./load.sh -u ${{ steps.account_for_ssb_and_tpch.outputs.ssb_tpch_account }} -p ${{ steps.account_for_ssb_and_tpch.outputs.ssb_tpch_password }} -h 127.0.0.1 -c cases/02_from_cos/tpch_1 -r -m | tee report/mo-load-data-tpch.log
+
+
+ - name: TPCH/Start TPCH 1G Test
+ if: ${{ !cancelled() && !failure() && steps.load_tpch_data.conclusion == 'success' && steps.s1.outputs.run_tpch == 'true' }}
+ id: step_tpch_test
+ timeout-minutes: 20
+ run: |
+ set -uo pipefail
+ export LC_ALL="C.UTF-8"
+ locale
+ sleep 60s
+ cd $GITHUB_WORKSPACE/mo-tpch
+ mkdir -p report
+ ./run.sh -u ${{ steps.account_for_ssb_and_tpch.outputs.ssb_tpch_account }} -p ${{ steps.account_for_ssb_and_tpch.outputs.ssb_tpch_password }} -h 127.0.0.1 -q all -s 1 -t 5 | tee report/tpch.log
+
+ - name: TPCH/SSB/Collect SSB AND TPCH Upload files
+ if: ${{ (failure() || cancelled()) && (steps.s1.outputs.run_tpch == 'true' || steps.s1.outputs.run_ssb == 'true') }}
+ run: |
+ mkdir -p $GITHUB_WORKSPACE/reports
+ mkdir -p $GITHUB_WORKSPACE/reports/mo-ssb
+ mkdir -p $GITHUB_WORKSPACE/reports/mo-load-data
+ mkdir -p $GITHUB_WORKSPACE/reports/mo-tpch
+ mkdir -p $GITHUB_WORKSPACE/mo-ssb/report && cp -r $GITHUB_WORKSPACE/mo-ssb/report $GITHUB_WORKSPACE/reports/mo-ssb
+ mkdir -p $GITHUB_WORKSPACE/mo-load-data/report && cp -r $GITHUB_WORKSPACE/mo-load-data/report $GITHUB_WORKSPACE/reports/mo-load-data
+ mkdir -p $GITHUB_WORKSPACE/mo-tpch/report && cp -r $GITHUB_WORKSPACE/mo-tpch/report $GITHUB_WORKSPACE/reports/mo-tpch
+
+ - name: Clean mo-service
+ if: ${{ always() }}
+ run: |
+ ps -aux | grep 'mo-service' | grep -v 'grep' | awk '{print $2}' | xargs kill -s SIGINT
+ i=1 && while [ -n "$(ps -aux|grep 'mo-service' | grep -v 'grep' | awk '{print $2}')" ] && [ $i -le 300 ]; do echo "mo-service kill not finished......$i/300"; i=$(($i+1)); sleep 1s; done
+ if [ $i -gt 300 ]; then echo 'stop mo-service failed...'; exit 1; else echo 'stop mo-service successed...'; fi
+
+ - name: Download mo-log
+ if: ${{ always() }}
+ run: |
+ cp $GITHUB_WORKSPACE/matrixone/mo-service.log $GITHUB_WORKSPACE/reports/mo-service.log
+
+ - uses: actions/upload-artifact@v4
+ if: ${{ always() }}
+ continue-on-error: true
+ with:
+ name: reports
+ path: |
+ ${{ github.workspace }}/reports
+ retention-days: 7
+
+
pr-size-label:
environment: ci
runs-on: ubuntu-22.04
diff --git a/actions/assign-issue/dist/index.js b/actions/assign-issue/dist/index.js
index 76aa79e..05235e1 100644
--- a/actions/assign-issue/dist/index.js
+++ b/actions/assign-issue/dist/index.js
@@ -43,6 +43,7 @@ const correponding = new Map([
["storage-group", 35],
["matrixonecloud", 18],
["us-group", 13],
+ ["compute-group-3", 68],
]);
// if assignees' team include any special team, we will add not delete any project
const specialTeams = new Array("qa", "pm");
diff --git a/actions/assign-issue/src/index.ts b/actions/assign-issue/src/index.ts
index 4c007ad..f4a06f6 100644
--- a/actions/assign-issue/src/index.ts
+++ b/actions/assign-issue/src/index.ts
@@ -22,6 +22,7 @@ const correponding = new Map([
["storage-group",35],
["matrixonecloud",18],
["us-group",13],
+ ["compute-group-3",68],
])
// if assignees' team include any special team, we will add not delete any project
const specialTeams = new Array("qa","pm")
diff --git a/actions/fail-ut-case/action.yaml b/actions/fail-ut-case/action.yaml
new file mode 100644
index 0000000..ced6c86
--- /dev/null
+++ b/actions/fail-ut-case/action.yaml
@@ -0,0 +1,34 @@
+name: Coverage Comparison Action
+description: 'Compares coverage and updates database.'
+inputs:
+ action_time:
+ description: 'This action time'
+ required: true
+ ut_cases:
+ description: 'These failed ut cases'
+ required: true
+ default: ''
+ pr_link:
+ description: 'This pr link'
+ required: true
+ job_time:
+ description: 'This job time'
+ required: true
+ mo_host:
+ description: 'This mo host'
+ required: true
+ mo_port:
+ description: 'This mo port'
+ required: true
+ mo_user:
+ description: 'This mo user'
+ required: true
+ mo_password:
+ description: 'This mo password'
+ required: true
+ mo_database:
+ description: 'This mo datavase Name'
+ required: true
+runs:
+ using: 'node20'
+ main: 'dist/index.js'
\ No newline at end of file
diff --git a/actions/fail-ut-case/dist/index.js b/actions/fail-ut-case/dist/index.js
new file mode 100644
index 0000000..c373d28
--- /dev/null
+++ b/actions/fail-ut-case/dist/index.js
@@ -0,0 +1,64838 @@
+/******/ (() => { // webpackBootstrap
+/******/ var __webpack_modules__ = ({
+
+/***/ 25:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+
+"use strict";
+
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.issue = exports.issueCommand = void 0;
+const os = __importStar(__nccwpck_require__(857));
+const utils_1 = __nccwpck_require__(8525);
+/**
+ * Commands
+ *
+ * Command Format:
+ * ::name key=value,key=value::message
+ *
+ * Examples:
+ * ::warning::This is the message
+ * ::set-env name=MY_VAR::some value
+ */
+function issueCommand(command, properties, message) {
+ const cmd = new Command(command, properties, message);
+ process.stdout.write(cmd.toString() + os.EOL);
+}
+exports.issueCommand = issueCommand;
+function issue(name, message = '') {
+ issueCommand(name, {}, message);
+}
+exports.issue = issue;
+const CMD_STRING = '::';
+class Command {
+ constructor(command, properties, message) {
+ if (!command) {
+ command = 'missing.command';
+ }
+ this.command = command;
+ this.properties = properties;
+ this.message = message;
+ }
+ toString() {
+ let cmdStr = CMD_STRING + this.command;
+ if (this.properties && Object.keys(this.properties).length > 0) {
+ cmdStr += ' ';
+ let first = true;
+ for (const key in this.properties) {
+ if (this.properties.hasOwnProperty(key)) {
+ const val = this.properties[key];
+ if (val) {
+ if (first) {
+ first = false;
+ }
+ else {
+ cmdStr += ',';
+ }
+ cmdStr += `${key}=${escapeProperty(val)}`;
+ }
+ }
+ }
+ }
+ cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
+ return cmdStr;
+ }
+}
+function escapeData(s) {
+ return utils_1.toCommandValue(s)
+ .replace(/%/g, '%25')
+ .replace(/\r/g, '%0D')
+ .replace(/\n/g, '%0A');
+}
+function escapeProperty(s) {
+ return utils_1.toCommandValue(s)
+ .replace(/%/g, '%25')
+ .replace(/\r/g, '%0D')
+ .replace(/\n/g, '%0A')
+ .replace(/:/g, '%3A')
+ .replace(/,/g, '%2C');
+}
+//# sourceMappingURL=command.js.map
+
+/***/ }),
+
+/***/ 4557:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+
+"use strict";
+
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
+const command_1 = __nccwpck_require__(25);
+const file_command_1 = __nccwpck_require__(4324);
+const utils_1 = __nccwpck_require__(8525);
+const os = __importStar(__nccwpck_require__(857));
+const path = __importStar(__nccwpck_require__(6928));
+const oidc_utils_1 = __nccwpck_require__(1379);
+/**
+ * The code to exit an action
+ */
+var ExitCode;
+(function (ExitCode) {
+ /**
+ * A code indicating that the action was successful
+ */
+ ExitCode[ExitCode["Success"] = 0] = "Success";
+ /**
+ * A code indicating that the action was a failure
+ */
+ ExitCode[ExitCode["Failure"] = 1] = "Failure";
+})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
+//-----------------------------------------------------------------------
+// Variables
+//-----------------------------------------------------------------------
+/**
+ * Sets env variable for this action and future actions in the job
+ * @param name the name of the variable to set
+ * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
+ */
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function exportVariable(name, val) {
+ const convertedVal = utils_1.toCommandValue(val);
+ process.env[name] = convertedVal;
+ const filePath = process.env['GITHUB_ENV'] || '';
+ if (filePath) {
+ return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
+ }
+ command_1.issueCommand('set-env', { name }, convertedVal);
+}
+exports.exportVariable = exportVariable;
+/**
+ * Registers a secret which will get masked from logs
+ * @param secret value of the secret
+ */
+function setSecret(secret) {
+ command_1.issueCommand('add-mask', {}, secret);
+}
+exports.setSecret = setSecret;
+/**
+ * Prepends inputPath to the PATH (for this action and future actions)
+ * @param inputPath
+ */
+function addPath(inputPath) {
+ const filePath = process.env['GITHUB_PATH'] || '';
+ if (filePath) {
+ file_command_1.issueFileCommand('PATH', inputPath);
+ }
+ else {
+ command_1.issueCommand('add-path', {}, inputPath);
+ }
+ process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
+}
+exports.addPath = addPath;
+/**
+ * Gets the value of an input.
+ * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
+ * Returns an empty string if the value is not defined.
+ *
+ * @param name name of the input to get
+ * @param options optional. See InputOptions.
+ * @returns string
+ */
+function getInput(name, options) {
+ const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
+ if (options && options.required && !val) {
+ throw new Error(`Input required and not supplied: ${name}`);
+ }
+ if (options && options.trimWhitespace === false) {
+ return val;
+ }
+ return val.trim();
+}
+exports.getInput = getInput;
+/**
+ * Gets the values of an multiline input. Each value is also trimmed.
+ *
+ * @param name name of the input to get
+ * @param options optional. See InputOptions.
+ * @returns string[]
+ *
+ */
+function getMultilineInput(name, options) {
+ const inputs = getInput(name, options)
+ .split('\n')
+ .filter(x => x !== '');
+ if (options && options.trimWhitespace === false) {
+ return inputs;
+ }
+ return inputs.map(input => input.trim());
+}
+exports.getMultilineInput = getMultilineInput;
+/**
+ * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
+ * Support boolean input list: `true | True | TRUE | false | False | FALSE` .
+ * The return value is also in boolean type.
+ * ref: https://yaml.org/spec/1.2/spec.html#id2804923
+ *
+ * @param name name of the input to get
+ * @param options optional. See InputOptions.
+ * @returns boolean
+ */
+function getBooleanInput(name, options) {
+ const trueValue = ['true', 'True', 'TRUE'];
+ const falseValue = ['false', 'False', 'FALSE'];
+ const val = getInput(name, options);
+ if (trueValue.includes(val))
+ return true;
+ if (falseValue.includes(val))
+ return false;
+ throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
+ `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
+}
+exports.getBooleanInput = getBooleanInput;
+/**
+ * Sets the value of an output.
+ *
+ * @param name name of the output to set
+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
+ */
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function setOutput(name, value) {
+ const filePath = process.env['GITHUB_OUTPUT'] || '';
+ if (filePath) {
+ return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
+ }
+ process.stdout.write(os.EOL);
+ command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
+}
+exports.setOutput = setOutput;
+/**
+ * Enables or disables the echoing of commands into stdout for the rest of the step.
+ * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
+ *
+ */
+function setCommandEcho(enabled) {
+ command_1.issue('echo', enabled ? 'on' : 'off');
+}
+exports.setCommandEcho = setCommandEcho;
+//-----------------------------------------------------------------------
+// Results
+//-----------------------------------------------------------------------
+/**
+ * Sets the action status to failed.
+ * When the action exits it will be with an exit code of 1
+ * @param message add error issue message
+ */
+function setFailed(message) {
+ process.exitCode = ExitCode.Failure;
+ error(message);
+}
+exports.setFailed = setFailed;
+//-----------------------------------------------------------------------
+// Logging Commands
+//-----------------------------------------------------------------------
+/**
+ * Gets whether Actions Step Debug is on or not
+ */
+function isDebug() {
+ return process.env['RUNNER_DEBUG'] === '1';
+}
+exports.isDebug = isDebug;
+/**
+ * Writes debug message to user log
+ * @param message debug message
+ */
+function debug(message) {
+ command_1.issueCommand('debug', {}, message);
+}
+exports.debug = debug;
+/**
+ * Adds an error issue
+ * @param message error issue message. Errors will be converted to string via toString()
+ * @param properties optional properties to add to the annotation.
+ */
+function error(message, properties = {}) {
+ command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
+}
+exports.error = error;
+/**
+ * Adds a warning issue
+ * @param message warning issue message. Errors will be converted to string via toString()
+ * @param properties optional properties to add to the annotation.
+ */
+function warning(message, properties = {}) {
+ command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
+}
+exports.warning = warning;
+/**
+ * Adds a notice issue
+ * @param message notice issue message. Errors will be converted to string via toString()
+ * @param properties optional properties to add to the annotation.
+ */
+function notice(message, properties = {}) {
+ command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
+}
+exports.notice = notice;
+/**
+ * Writes info to log with console.log.
+ * @param message info message
+ */
+function info(message) {
+ process.stdout.write(message + os.EOL);
+}
+exports.info = info;
+/**
+ * Begin an output group.
+ *
+ * Output until the next `groupEnd` will be foldable in this group
+ *
+ * @param name The name of the output group
+ */
+function startGroup(name) {
+ command_1.issue('group', name);
+}
+exports.startGroup = startGroup;
+/**
+ * End an output group.
+ */
+function endGroup() {
+ command_1.issue('endgroup');
+}
+exports.endGroup = endGroup;
+/**
+ * Wrap an asynchronous function call in a group.
+ *
+ * Returns the same type as the function itself.
+ *
+ * @param name The name of the group
+ * @param fn The function to wrap in the group
+ */
+function group(name, fn) {
+ return __awaiter(this, void 0, void 0, function* () {
+ startGroup(name);
+ let result;
+ try {
+ result = yield fn();
+ }
+ finally {
+ endGroup();
+ }
+ return result;
+ });
+}
+exports.group = group;
+//-----------------------------------------------------------------------
+// Wrapper action state
+//-----------------------------------------------------------------------
+/**
+ * Saves state for current action, the state can only be retrieved by this action's post job execution.
+ *
+ * @param name name of the state to store
+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
+ */
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function saveState(name, value) {
+ const filePath = process.env['GITHUB_STATE'] || '';
+ if (filePath) {
+ return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
+ }
+ command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
+}
+exports.saveState = saveState;
+/**
+ * Gets the value of an state set by this action's main execution.
+ *
+ * @param name name of the state to get
+ * @returns string
+ */
+function getState(name) {
+ return process.env[`STATE_${name}`] || '';
+}
+exports.getState = getState;
+function getIDToken(aud) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return yield oidc_utils_1.OidcClient.getIDToken(aud);
+ });
+}
+exports.getIDToken = getIDToken;
+/**
+ * Summary exports
+ */
+var summary_1 = __nccwpck_require__(6652);
+Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } }));
+/**
+ * @deprecated use core.summary
+ */
+var summary_2 = __nccwpck_require__(6652);
+Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } }));
+/**
+ * Path exports
+ */
+var path_utils_1 = __nccwpck_require__(2193);
+Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } }));
+Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } }));
+Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } }));
+//# sourceMappingURL=core.js.map
+
+/***/ }),
+
+/***/ 4324:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+
+"use strict";
+
+// For internal use, subject to change.
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
+// We use any as a valid input type
+/* eslint-disable @typescript-eslint/no-explicit-any */
+const fs = __importStar(__nccwpck_require__(9896));
+const os = __importStar(__nccwpck_require__(857));
+const uuid_1 = __nccwpck_require__(3703);
+const utils_1 = __nccwpck_require__(8525);
+function issueFileCommand(command, message) {
+ const filePath = process.env[`GITHUB_${command}`];
+ if (!filePath) {
+ throw new Error(`Unable to find environment variable for file command ${command}`);
+ }
+ if (!fs.existsSync(filePath)) {
+ throw new Error(`Missing file at path: ${filePath}`);
+ }
+ fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
+ encoding: 'utf8'
+ });
+}
+exports.issueFileCommand = issueFileCommand;
+function prepareKeyValueMessage(key, value) {
+ const delimiter = `ghadelimiter_${uuid_1.v4()}`;
+ const convertedValue = utils_1.toCommandValue(value);
+ // These should realistically never happen, but just in case someone finds a
+ // way to exploit uuid generation let's not allow keys or values that contain
+ // the delimiter.
+ if (key.includes(delimiter)) {
+ throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
+ }
+ if (convertedValue.includes(delimiter)) {
+ throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
+ }
+ return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
+}
+exports.prepareKeyValueMessage = prepareKeyValueMessage;
+//# sourceMappingURL=file-command.js.map
+
+/***/ }),
+
+/***/ 1379:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+
+"use strict";
+
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.OidcClient = void 0;
+const http_client_1 = __nccwpck_require__(3697);
+const auth_1 = __nccwpck_require__(9511);
+const core_1 = __nccwpck_require__(4557);
+class OidcClient {
+ static createHttpClient(allowRetry = true, maxRetry = 10) {
+ const requestOptions = {
+ allowRetries: allowRetry,
+ maxRetries: maxRetry
+ };
+ return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions);
+ }
+ static getRequestToken() {
+ const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];
+ if (!token) {
+ throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');
+ }
+ return token;
+ }
+ static getIDTokenUrl() {
+ const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];
+ if (!runtimeUrl) {
+ throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');
+ }
+ return runtimeUrl;
+ }
+ static getCall(id_token_url) {
+ var _a;
+ return __awaiter(this, void 0, void 0, function* () {
+ const httpclient = OidcClient.createHttpClient();
+ const res = yield httpclient
+ .getJson(id_token_url)
+ .catch(error => {
+ throw new Error(`Failed to get ID Token. \n
+ Error Code : ${error.statusCode}\n
+ Error Message: ${error.message}`);
+ });
+ const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
+ if (!id_token) {
+ throw new Error('Response json body do not have ID Token field');
+ }
+ return id_token;
+ });
+ }
+ static getIDToken(audience) {
+ return __awaiter(this, void 0, void 0, function* () {
+ try {
+ // New ID Token is requested from action service
+ let id_token_url = OidcClient.getIDTokenUrl();
+ if (audience) {
+ const encodedAudience = encodeURIComponent(audience);
+ id_token_url = `${id_token_url}&audience=${encodedAudience}`;
+ }
+ core_1.debug(`ID token url is ${id_token_url}`);
+ const id_token = yield OidcClient.getCall(id_token_url);
+ core_1.setSecret(id_token);
+ return id_token;
+ }
+ catch (error) {
+ throw new Error(`Error message: ${error.message}`);
+ }
+ });
+ }
+}
+exports.OidcClient = OidcClient;
+//# sourceMappingURL=oidc-utils.js.map
+
+/***/ }),
+
+/***/ 2193:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+
+"use strict";
+
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0;
+const path = __importStar(__nccwpck_require__(6928));
+/**
+ * toPosixPath converts the given path to the posix form. On Windows, \\ will be
+ * replaced with /.
+ *
+ * @param pth. Path to transform.
+ * @return string Posix path.
+ */
+function toPosixPath(pth) {
+ return pth.replace(/[\\]/g, '/');
+}
+exports.toPosixPath = toPosixPath;
+/**
+ * toWin32Path converts the given path to the win32 form. On Linux, / will be
+ * replaced with \\.
+ *
+ * @param pth. Path to transform.
+ * @return string Win32 path.
+ */
+function toWin32Path(pth) {
+ return pth.replace(/[/]/g, '\\');
+}
+exports.toWin32Path = toWin32Path;
+/**
+ * toPlatformPath converts the given path to a platform-specific path. It does
+ * this by replacing instances of / and \ with the platform-specific path
+ * separator.
+ *
+ * @param pth The path to platformize.
+ * @return string The platform-specific path.
+ */
+function toPlatformPath(pth) {
+ return pth.replace(/[/\\]/g, path.sep);
+}
+exports.toPlatformPath = toPlatformPath;
+//# sourceMappingURL=path-utils.js.map
+
+/***/ }),
+
+/***/ 6652:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+
+"use strict";
+
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0;
+const os_1 = __nccwpck_require__(857);
+const fs_1 = __nccwpck_require__(9896);
+const { access, appendFile, writeFile } = fs_1.promises;
+exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY';
+exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary';
+class Summary {
+ constructor() {
+ this._buffer = '';
+ }
+ /**
+ * Finds the summary file path from the environment, rejects if env var is not found or file does not exist
+ * Also checks r/w permissions.
+ *
+ * @returns step summary file path
+ */
+ filePath() {
+ return __awaiter(this, void 0, void 0, function* () {
+ if (this._filePath) {
+ return this._filePath;
+ }
+ const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR];
+ if (!pathFromEnv) {
+ throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);
+ }
+ try {
+ yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK);
+ }
+ catch (_a) {
+ throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`);
+ }
+ this._filePath = pathFromEnv;
+ return this._filePath;
+ });
+ }
+ /**
+ * Wraps content in an HTML tag, adding any HTML attributes
+ *
+ * @param {string} tag HTML tag to wrap
+ * @param {string | null} content content within the tag
+ * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add
+ *
+ * @returns {string} content wrapped in HTML element
+ */
+ wrap(tag, content, attrs = {}) {
+ const htmlAttrs = Object.entries(attrs)
+ .map(([key, value]) => ` ${key}="${value}"`)
+ .join('');
+ if (!content) {
+ return `<${tag}${htmlAttrs}>`;
+ }
+ return `<${tag}${htmlAttrs}>${content}${tag}>`;
+ }
+ /**
+ * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.
+ *
+ * @param {SummaryWriteOptions} [options] (optional) options for write operation
+ *
+ * @returns {Promise} summary instance
+ */
+ write(options) {
+ return __awaiter(this, void 0, void 0, function* () {
+ const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite);
+ const filePath = yield this.filePath();
+ const writeFunc = overwrite ? writeFile : appendFile;
+ yield writeFunc(filePath, this._buffer, { encoding: 'utf8' });
+ return this.emptyBuffer();
+ });
+ }
+ /**
+ * Clears the summary buffer and wipes the summary file
+ *
+ * @returns {Summary} summary instance
+ */
+ clear() {
+ return __awaiter(this, void 0, void 0, function* () {
+ return this.emptyBuffer().write({ overwrite: true });
+ });
+ }
+ /**
+ * Returns the current summary buffer as a string
+ *
+ * @returns {string} string of summary buffer
+ */
+ stringify() {
+ return this._buffer;
+ }
+ /**
+ * If the summary buffer is empty
+ *
+ * @returns {boolen} true if the buffer is empty
+ */
+ isEmptyBuffer() {
+ return this._buffer.length === 0;
+ }
+ /**
+ * Resets the summary buffer without writing to summary file
+ *
+ * @returns {Summary} summary instance
+ */
+ emptyBuffer() {
+ this._buffer = '';
+ return this;
+ }
+ /**
+ * Adds raw text to the summary buffer
+ *
+ * @param {string} text content to add
+ * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)
+ *
+ * @returns {Summary} summary instance
+ */
+ addRaw(text, addEOL = false) {
+ this._buffer += text;
+ return addEOL ? this.addEOL() : this;
+ }
+ /**
+ * Adds the operating system-specific end-of-line marker to the buffer
+ *
+ * @returns {Summary} summary instance
+ */
+ addEOL() {
+ return this.addRaw(os_1.EOL);
+ }
+ /**
+ * Adds an HTML codeblock to the summary buffer
+ *
+ * @param {string} code content to render within fenced code block
+ * @param {string} lang (optional) language to syntax highlight code
+ *
+ * @returns {Summary} summary instance
+ */
+ addCodeBlock(code, lang) {
+ const attrs = Object.assign({}, (lang && { lang }));
+ const element = this.wrap('pre', this.wrap('code', code), attrs);
+ return this.addRaw(element).addEOL();
+ }
+ /**
+ * Adds an HTML list to the summary buffer
+ *
+ * @param {string[]} items list of items to render
+ * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)
+ *
+ * @returns {Summary} summary instance
+ */
+ addList(items, ordered = false) {
+ const tag = ordered ? 'ol' : 'ul';
+ const listItems = items.map(item => this.wrap('li', item)).join('');
+ const element = this.wrap(tag, listItems);
+ return this.addRaw(element).addEOL();
+ }
+ /**
+ * Adds an HTML table to the summary buffer
+ *
+ * @param {SummaryTableCell[]} rows table rows
+ *
+ * @returns {Summary} summary instance
+ */
+ addTable(rows) {
+ const tableBody = rows
+ .map(row => {
+ const cells = row
+ .map(cell => {
+ if (typeof cell === 'string') {
+ return this.wrap('td', cell);
+ }
+ const { header, data, colspan, rowspan } = cell;
+ const tag = header ? 'th' : 'td';
+ const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan }));
+ return this.wrap(tag, data, attrs);
+ })
+ .join('');
+ return this.wrap('tr', cells);
+ })
+ .join('');
+ const element = this.wrap('table', tableBody);
+ return this.addRaw(element).addEOL();
+ }
+ /**
+ * Adds a collapsable HTML details element to the summary buffer
+ *
+ * @param {string} label text for the closed state
+ * @param {string} content collapsable content
+ *
+ * @returns {Summary} summary instance
+ */
+ addDetails(label, content) {
+ const element = this.wrap('details', this.wrap('summary', label) + content);
+ return this.addRaw(element).addEOL();
+ }
+ /**
+ * Adds an HTML image tag to the summary buffer
+ *
+ * @param {string} src path to the image you to embed
+ * @param {string} alt text description of the image
+ * @param {SummaryImageOptions} options (optional) addition image attributes
+ *
+ * @returns {Summary} summary instance
+ */
+ addImage(src, alt, options) {
+ const { width, height } = options || {};
+ const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height }));
+ const element = this.wrap('img', null, Object.assign({ src, alt }, attrs));
+ return this.addRaw(element).addEOL();
+ }
+ /**
+ * Adds an HTML section heading element
+ *
+ * @param {string} text heading text
+ * @param {number | string} [level=1] (optional) the heading level, default: 1
+ *
+ * @returns {Summary} summary instance
+ */
+ addHeading(text, level) {
+ const tag = `h${level}`;
+ const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag)
+ ? tag
+ : 'h1';
+ const element = this.wrap(allowedTag, text);
+ return this.addRaw(element).addEOL();
+ }
+ /**
+ * Adds an HTML thematic break (
) to the summary buffer
+ *
+ * @returns {Summary} summary instance
+ */
+ addSeparator() {
+ const element = this.wrap('hr', null);
+ return this.addRaw(element).addEOL();
+ }
+ /**
+ * Adds an HTML line break (
) to the summary buffer
+ *
+ * @returns {Summary} summary instance
+ */
+ addBreak() {
+ const element = this.wrap('br', null);
+ return this.addRaw(element).addEOL();
+ }
+ /**
+ * Adds an HTML blockquote to the summary buffer
+ *
+ * @param {string} text quote text
+ * @param {string} cite (optional) citation url
+ *
+ * @returns {Summary} summary instance
+ */
+ addQuote(text, cite) {
+ const attrs = Object.assign({}, (cite && { cite }));
+ const element = this.wrap('blockquote', text, attrs);
+ return this.addRaw(element).addEOL();
+ }
+ /**
+ * Adds an HTML anchor tag to the summary buffer
+ *
+ * @param {string} text link text/content
+ * @param {string} href hyperlink
+ *
+ * @returns {Summary} summary instance
+ */
+ addLink(text, href) {
+ const element = this.wrap('a', text, { href });
+ return this.addRaw(element).addEOL();
+ }
+}
+const _summary = new Summary();
+/**
+ * @deprecated use `core.summary`
+ */
+exports.markdownSummary = _summary;
+exports.summary = _summary;
+//# sourceMappingURL=summary.js.map
+
+/***/ }),
+
+/***/ 8525:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+// We use any as a valid input type
+/* eslint-disable @typescript-eslint/no-explicit-any */
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.toCommandProperties = exports.toCommandValue = void 0;
+/**
+ * Sanitizes an input into a string so it can be passed into issueCommand safely
+ * @param input input to sanitize into a string
+ */
+function toCommandValue(input) {
+ if (input === null || input === undefined) {
+ return '';
+ }
+ else if (typeof input === 'string' || input instanceof String) {
+ return input;
+ }
+ return JSON.stringify(input);
+}
+exports.toCommandValue = toCommandValue;
+/**
+ *
+ * @param annotationProperties
+ * @returns The command properties to send with the actual annotation command
+ * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
+ */
+function toCommandProperties(annotationProperties) {
+ if (!Object.keys(annotationProperties).length) {
+ return {};
+ }
+ return {
+ title: annotationProperties.title,
+ file: annotationProperties.file,
+ line: annotationProperties.startLine,
+ endLine: annotationProperties.endLine,
+ col: annotationProperties.startColumn,
+ endColumn: annotationProperties.endColumn
+ };
+}
+exports.toCommandProperties = toCommandProperties;
+//# sourceMappingURL=utils.js.map
+
+/***/ }),
+
+/***/ 9511:
+/***/ (function(__unused_webpack_module, exports) {
+
+"use strict";
+
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0;
+class BasicCredentialHandler {
+ constructor(username, password) {
+ this.username = username;
+ this.password = password;
+ }
+ prepareRequest(options) {
+ if (!options.headers) {
+ throw Error('The request has no headers');
+ }
+ options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`;
+ }
+ // This handler cannot handle 401
+ canHandleAuthentication() {
+ return false;
+ }
+ handleAuthentication() {
+ return __awaiter(this, void 0, void 0, function* () {
+ throw new Error('not implemented');
+ });
+ }
+}
+exports.BasicCredentialHandler = BasicCredentialHandler;
+class BearerCredentialHandler {
+ constructor(token) {
+ this.token = token;
+ }
+ // currently implements pre-authorization
+ // TODO: support preAuth = false where it hooks on 401
+ prepareRequest(options) {
+ if (!options.headers) {
+ throw Error('The request has no headers');
+ }
+ options.headers['Authorization'] = `Bearer ${this.token}`;
+ }
+ // This handler cannot handle 401
+ canHandleAuthentication() {
+ return false;
+ }
+ handleAuthentication() {
+ return __awaiter(this, void 0, void 0, function* () {
+ throw new Error('not implemented');
+ });
+ }
+}
+exports.BearerCredentialHandler = BearerCredentialHandler;
+class PersonalAccessTokenCredentialHandler {
+ constructor(token) {
+ this.token = token;
+ }
+ // currently implements pre-authorization
+ // TODO: support preAuth = false where it hooks on 401
+ prepareRequest(options) {
+ if (!options.headers) {
+ throw Error('The request has no headers');
+ }
+ options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;
+ }
+ // This handler cannot handle 401
+ canHandleAuthentication() {
+ return false;
+ }
+ handleAuthentication() {
+ return __awaiter(this, void 0, void 0, function* () {
+ throw new Error('not implemented');
+ });
+ }
+}
+exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
+//# sourceMappingURL=auth.js.map
+
+/***/ }),
+
+/***/ 3697:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+
+"use strict";
+
+/* eslint-disable @typescript-eslint/no-explicit-any */
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0;
+const http = __importStar(__nccwpck_require__(8611));
+const https = __importStar(__nccwpck_require__(5692));
+const pm = __importStar(__nccwpck_require__(1497));
+const tunnel = __importStar(__nccwpck_require__(3863));
+const undici_1 = __nccwpck_require__(1729);
+var HttpCodes;
+(function (HttpCodes) {
+ HttpCodes[HttpCodes["OK"] = 200] = "OK";
+ HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
+ HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
+ HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
+ HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
+ HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
+ HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
+ HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
+ HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
+ HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
+ HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
+ HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
+ HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
+ HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
+ HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
+ HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
+ HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
+ HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
+ HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
+ HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
+ HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
+ HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
+ HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
+ HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
+ HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
+ HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
+ HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
+})(HttpCodes || (exports.HttpCodes = HttpCodes = {}));
+var Headers;
+(function (Headers) {
+ Headers["Accept"] = "accept";
+ Headers["ContentType"] = "content-type";
+})(Headers || (exports.Headers = Headers = {}));
+var MediaTypes;
+(function (MediaTypes) {
+ MediaTypes["ApplicationJson"] = "application/json";
+})(MediaTypes || (exports.MediaTypes = MediaTypes = {}));
+/**
+ * Returns the proxy URL, depending upon the supplied url and proxy environment variables.
+ * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
+ */
+function getProxyUrl(serverUrl) {
+ const proxyUrl = pm.getProxyUrl(new URL(serverUrl));
+ return proxyUrl ? proxyUrl.href : '';
+}
+exports.getProxyUrl = getProxyUrl;
+const HttpRedirectCodes = [
+ HttpCodes.MovedPermanently,
+ HttpCodes.ResourceMoved,
+ HttpCodes.SeeOther,
+ HttpCodes.TemporaryRedirect,
+ HttpCodes.PermanentRedirect
+];
+const HttpResponseRetryCodes = [
+ HttpCodes.BadGateway,
+ HttpCodes.ServiceUnavailable,
+ HttpCodes.GatewayTimeout
+];
+const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
+const ExponentialBackoffCeiling = 10;
+const ExponentialBackoffTimeSlice = 5;
+class HttpClientError extends Error {
+ constructor(message, statusCode) {
+ super(message);
+ this.name = 'HttpClientError';
+ this.statusCode = statusCode;
+ Object.setPrototypeOf(this, HttpClientError.prototype);
+ }
+}
+exports.HttpClientError = HttpClientError;
+class HttpClientResponse {
+ constructor(message) {
+ this.message = message;
+ }
+ readBody() {
+ return __awaiter(this, void 0, void 0, function* () {
+ return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
+ let output = Buffer.alloc(0);
+ this.message.on('data', (chunk) => {
+ output = Buffer.concat([output, chunk]);
+ });
+ this.message.on('end', () => {
+ resolve(output.toString());
+ });
+ }));
+ });
+ }
+ readBodyBuffer() {
+ return __awaiter(this, void 0, void 0, function* () {
+ return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
+ const chunks = [];
+ this.message.on('data', (chunk) => {
+ chunks.push(chunk);
+ });
+ this.message.on('end', () => {
+ resolve(Buffer.concat(chunks));
+ });
+ }));
+ });
+ }
+}
+exports.HttpClientResponse = HttpClientResponse;
+function isHttps(requestUrl) {
+ const parsedUrl = new URL(requestUrl);
+ return parsedUrl.protocol === 'https:';
+}
+exports.isHttps = isHttps;
+class HttpClient {
+ constructor(userAgent, handlers, requestOptions) {
+ this._ignoreSslError = false;
+ this._allowRedirects = true;
+ this._allowRedirectDowngrade = false;
+ this._maxRedirects = 50;
+ this._allowRetries = false;
+ this._maxRetries = 1;
+ this._keepAlive = false;
+ this._disposed = false;
+ this.userAgent = userAgent;
+ this.handlers = handlers || [];
+ this.requestOptions = requestOptions;
+ if (requestOptions) {
+ if (requestOptions.ignoreSslError != null) {
+ this._ignoreSslError = requestOptions.ignoreSslError;
+ }
+ this._socketTimeout = requestOptions.socketTimeout;
+ if (requestOptions.allowRedirects != null) {
+ this._allowRedirects = requestOptions.allowRedirects;
+ }
+ if (requestOptions.allowRedirectDowngrade != null) {
+ this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
+ }
+ if (requestOptions.maxRedirects != null) {
+ this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
+ }
+ if (requestOptions.keepAlive != null) {
+ this._keepAlive = requestOptions.keepAlive;
+ }
+ if (requestOptions.allowRetries != null) {
+ this._allowRetries = requestOptions.allowRetries;
+ }
+ if (requestOptions.maxRetries != null) {
+ this._maxRetries = requestOptions.maxRetries;
+ }
+ }
+ }
+ options(requestUrl, additionalHeaders) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
+ });
+ }
+ get(requestUrl, additionalHeaders) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return this.request('GET', requestUrl, null, additionalHeaders || {});
+ });
+ }
+ del(requestUrl, additionalHeaders) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return this.request('DELETE', requestUrl, null, additionalHeaders || {});
+ });
+ }
+ post(requestUrl, data, additionalHeaders) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return this.request('POST', requestUrl, data, additionalHeaders || {});
+ });
+ }
+ patch(requestUrl, data, additionalHeaders) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return this.request('PATCH', requestUrl, data, additionalHeaders || {});
+ });
+ }
+ put(requestUrl, data, additionalHeaders) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return this.request('PUT', requestUrl, data, additionalHeaders || {});
+ });
+ }
+ head(requestUrl, additionalHeaders) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return this.request('HEAD', requestUrl, null, additionalHeaders || {});
+ });
+ }
+ sendStream(verb, requestUrl, stream, additionalHeaders) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return this.request(verb, requestUrl, stream, additionalHeaders);
+ });
+ }
+ /**
+ * Gets a typed object from an endpoint
+ * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
+ */
+ getJson(requestUrl, additionalHeaders = {}) {
+ return __awaiter(this, void 0, void 0, function* () {
+ additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
+ const res = yield this.get(requestUrl, additionalHeaders);
+ return this._processResponse(res, this.requestOptions);
+ });
+ }
+ postJson(requestUrl, obj, additionalHeaders = {}) {
+ return __awaiter(this, void 0, void 0, function* () {
+ const data = JSON.stringify(obj, null, 2);
+ additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
+ additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
+ const res = yield this.post(requestUrl, data, additionalHeaders);
+ return this._processResponse(res, this.requestOptions);
+ });
+ }
+ putJson(requestUrl, obj, additionalHeaders = {}) {
+ return __awaiter(this, void 0, void 0, function* () {
+ const data = JSON.stringify(obj, null, 2);
+ additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
+ additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
+ const res = yield this.put(requestUrl, data, additionalHeaders);
+ return this._processResponse(res, this.requestOptions);
+ });
+ }
+ patchJson(requestUrl, obj, additionalHeaders = {}) {
+ return __awaiter(this, void 0, void 0, function* () {
+ const data = JSON.stringify(obj, null, 2);
+ additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
+ additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
+ const res = yield this.patch(requestUrl, data, additionalHeaders);
+ return this._processResponse(res, this.requestOptions);
+ });
+ }
+ /**
+ * Makes a raw http request.
+ * All other methods such as get, post, patch, and request ultimately call this.
+ * Prefer get, del, post and patch
+ */
+ request(verb, requestUrl, data, headers) {
+ return __awaiter(this, void 0, void 0, function* () {
+ if (this._disposed) {
+ throw new Error('Client has already been disposed.');
+ }
+ const parsedUrl = new URL(requestUrl);
+ let info = this._prepareRequest(verb, parsedUrl, headers);
+ // Only perform retries on reads since writes may not be idempotent.
+ const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)
+ ? this._maxRetries + 1
+ : 1;
+ let numTries = 0;
+ let response;
+ do {
+ response = yield this.requestRaw(info, data);
+ // Check if it's an authentication challenge
+ if (response &&
+ response.message &&
+ response.message.statusCode === HttpCodes.Unauthorized) {
+ let authenticationHandler;
+ for (const handler of this.handlers) {
+ if (handler.canHandleAuthentication(response)) {
+ authenticationHandler = handler;
+ break;
+ }
+ }
+ if (authenticationHandler) {
+ return authenticationHandler.handleAuthentication(this, info, data);
+ }
+ else {
+ // We have received an unauthorized response but have no handlers to handle it.
+ // Let the response return to the caller.
+ return response;
+ }
+ }
+ let redirectsRemaining = this._maxRedirects;
+ while (response.message.statusCode &&
+ HttpRedirectCodes.includes(response.message.statusCode) &&
+ this._allowRedirects &&
+ redirectsRemaining > 0) {
+ const redirectUrl = response.message.headers['location'];
+ if (!redirectUrl) {
+ // if there's no location to redirect to, we won't
+ break;
+ }
+ const parsedRedirectUrl = new URL(redirectUrl);
+ if (parsedUrl.protocol === 'https:' &&
+ parsedUrl.protocol !== parsedRedirectUrl.protocol &&
+ !this._allowRedirectDowngrade) {
+ throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
+ }
+ // we need to finish reading the response before reassigning response
+ // which will leak the open socket.
+ yield response.readBody();
+ // strip authorization header if redirected to a different hostname
+ if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
+ for (const header in headers) {
+ // header names are case insensitive
+ if (header.toLowerCase() === 'authorization') {
+ delete headers[header];
+ }
+ }
+ }
+ // let's make the request with the new redirectUrl
+ info = this._prepareRequest(verb, parsedRedirectUrl, headers);
+ response = yield this.requestRaw(info, data);
+ redirectsRemaining--;
+ }
+ if (!response.message.statusCode ||
+ !HttpResponseRetryCodes.includes(response.message.statusCode)) {
+ // If not a retry code, return immediately instead of retrying
+ return response;
+ }
+ numTries += 1;
+ if (numTries < maxTries) {
+ yield response.readBody();
+ yield this._performExponentialBackoff(numTries);
+ }
+ } while (numTries < maxTries);
+ return response;
+ });
+ }
+ /**
+ * Needs to be called if keepAlive is set to true in request options.
+ */
+ dispose() {
+ if (this._agent) {
+ this._agent.destroy();
+ }
+ this._disposed = true;
+ }
+ /**
+ * Raw request.
+ * @param info
+ * @param data
+ */
+ requestRaw(info, data) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return new Promise((resolve, reject) => {
+ function callbackForResult(err, res) {
+ if (err) {
+ reject(err);
+ }
+ else if (!res) {
+ // If `err` is not passed, then `res` must be passed.
+ reject(new Error('Unknown error'));
+ }
+ else {
+ resolve(res);
+ }
+ }
+ this.requestRawWithCallback(info, data, callbackForResult);
+ });
+ });
+ }
+ /**
+ * Raw request with callback.
+ * @param info
+ * @param data
+ * @param onResult
+ */
+ requestRawWithCallback(info, data, onResult) {
+ if (typeof data === 'string') {
+ if (!info.options.headers) {
+ info.options.headers = {};
+ }
+ info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
+ }
+ let callbackCalled = false;
+ function handleResult(err, res) {
+ if (!callbackCalled) {
+ callbackCalled = true;
+ onResult(err, res);
+ }
+ }
+ const req = info.httpModule.request(info.options, (msg) => {
+ const res = new HttpClientResponse(msg);
+ handleResult(undefined, res);
+ });
+ let socket;
+ req.on('socket', sock => {
+ socket = sock;
+ });
+ // If we ever get disconnected, we want the socket to timeout eventually
+ req.setTimeout(this._socketTimeout || 3 * 60000, () => {
+ if (socket) {
+ socket.end();
+ }
+ handleResult(new Error(`Request timeout: ${info.options.path}`));
+ });
+ req.on('error', function (err) {
+ // err has statusCode property
+ // res should have headers
+ handleResult(err);
+ });
+ if (data && typeof data === 'string') {
+ req.write(data, 'utf8');
+ }
+ if (data && typeof data !== 'string') {
+ data.on('close', function () {
+ req.end();
+ });
+ data.pipe(req);
+ }
+ else {
+ req.end();
+ }
+ }
+ /**
+ * Gets an http agent. This function is useful when you need an http agent that handles
+ * routing through a proxy server - depending upon the url and proxy environment variables.
+ * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
+ */
+ getAgent(serverUrl) {
+ const parsedUrl = new URL(serverUrl);
+ return this._getAgent(parsedUrl);
+ }
+ getAgentDispatcher(serverUrl) {
+ const parsedUrl = new URL(serverUrl);
+ const proxyUrl = pm.getProxyUrl(parsedUrl);
+ const useProxy = proxyUrl && proxyUrl.hostname;
+ if (!useProxy) {
+ return;
+ }
+ return this._getProxyAgentDispatcher(parsedUrl, proxyUrl);
+ }
+ _prepareRequest(method, requestUrl, headers) {
+ const info = {};
+ info.parsedUrl = requestUrl;
+ const usingSsl = info.parsedUrl.protocol === 'https:';
+ info.httpModule = usingSsl ? https : http;
+ const defaultPort = usingSsl ? 443 : 80;
+ info.options = {};
+ info.options.host = info.parsedUrl.hostname;
+ info.options.port = info.parsedUrl.port
+ ? parseInt(info.parsedUrl.port)
+ : defaultPort;
+ info.options.path =
+ (info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
+ info.options.method = method;
+ info.options.headers = this._mergeHeaders(headers);
+ if (this.userAgent != null) {
+ info.options.headers['user-agent'] = this.userAgent;
+ }
+ info.options.agent = this._getAgent(info.parsedUrl);
+ // gives handlers an opportunity to participate
+ if (this.handlers) {
+ for (const handler of this.handlers) {
+ handler.prepareRequest(info.options);
+ }
+ }
+ return info;
+ }
+ _mergeHeaders(headers) {
+ if (this.requestOptions && this.requestOptions.headers) {
+ return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {}));
+ }
+ return lowercaseKeys(headers || {});
+ }
+ _getExistingOrDefaultHeader(additionalHeaders, header, _default) {
+ let clientHeader;
+ if (this.requestOptions && this.requestOptions.headers) {
+ clientHeader = lowercaseKeys(this.requestOptions.headers)[header];
+ }
+ return additionalHeaders[header] || clientHeader || _default;
+ }
+ _getAgent(parsedUrl) {
+ let agent;
+ const proxyUrl = pm.getProxyUrl(parsedUrl);
+ const useProxy = proxyUrl && proxyUrl.hostname;
+ if (this._keepAlive && useProxy) {
+ agent = this._proxyAgent;
+ }
+ if (!useProxy) {
+ agent = this._agent;
+ }
+ // if agent is already assigned use that agent.
+ if (agent) {
+ return agent;
+ }
+ const usingSsl = parsedUrl.protocol === 'https:';
+ let maxSockets = 100;
+ if (this.requestOptions) {
+ maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
+ }
+ // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis.
+ if (proxyUrl && proxyUrl.hostname) {
+ const agentOptions = {
+ maxSockets,
+ keepAlive: this._keepAlive,
+ proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && {
+ proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
+ })), { host: proxyUrl.hostname, port: proxyUrl.port })
+ };
+ let tunnelAgent;
+ const overHttps = proxyUrl.protocol === 'https:';
+ if (usingSsl) {
+ tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
+ }
+ else {
+ tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
+ }
+ agent = tunnelAgent(agentOptions);
+ this._proxyAgent = agent;
+ }
+ // if tunneling agent isn't assigned create a new agent
+ if (!agent) {
+ const options = { keepAlive: this._keepAlive, maxSockets };
+ agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
+ this._agent = agent;
+ }
+ if (usingSsl && this._ignoreSslError) {
+ // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
+ // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
+ // we have to cast it to any and change it directly
+ agent.options = Object.assign(agent.options || {}, {
+ rejectUnauthorized: false
+ });
+ }
+ return agent;
+ }
+ _getProxyAgentDispatcher(parsedUrl, proxyUrl) {
+ let proxyAgent;
+ if (this._keepAlive) {
+ proxyAgent = this._proxyAgentDispatcher;
+ }
+ // if agent is already assigned use that agent.
+ if (proxyAgent) {
+ return proxyAgent;
+ }
+ const usingSsl = parsedUrl.protocol === 'https:';
+ proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl.href, pipelining: !this._keepAlive ? 0 : 1 }, ((proxyUrl.username || proxyUrl.password) && {
+ token: `${proxyUrl.username}:${proxyUrl.password}`
+ })));
+ this._proxyAgentDispatcher = proxyAgent;
+ if (usingSsl && this._ignoreSslError) {
+ // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
+ // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
+ // we have to cast it to any and change it directly
+ proxyAgent.options = Object.assign(proxyAgent.options.requestTls || {}, {
+ rejectUnauthorized: false
+ });
+ }
+ return proxyAgent;
+ }
+ _performExponentialBackoff(retryNumber) {
+ return __awaiter(this, void 0, void 0, function* () {
+ retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
+ const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
+ return new Promise(resolve => setTimeout(() => resolve(), ms));
+ });
+ }
+ _processResponse(res, options) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
+ const statusCode = res.message.statusCode || 0;
+ const response = {
+ statusCode,
+ result: null,
+ headers: {}
+ };
+ // not found leads to null obj returned
+ if (statusCode === HttpCodes.NotFound) {
+ resolve(response);
+ }
+ // get the result from the body
+ function dateTimeDeserializer(key, value) {
+ if (typeof value === 'string') {
+ const a = new Date(value);
+ if (!isNaN(a.valueOf())) {
+ return a;
+ }
+ }
+ return value;
+ }
+ let obj;
+ let contents;
+ try {
+ contents = yield res.readBody();
+ if (contents && contents.length > 0) {
+ if (options && options.deserializeDates) {
+ obj = JSON.parse(contents, dateTimeDeserializer);
+ }
+ else {
+ obj = JSON.parse(contents);
+ }
+ response.result = obj;
+ }
+ response.headers = res.message.headers;
+ }
+ catch (err) {
+ // Invalid resource (contents not json); leaving result obj null
+ }
+ // note that 3xx redirects are handled by the http layer.
+ if (statusCode > 299) {
+ let msg;
+ // if exception/error in body, attempt to get better error
+ if (obj && obj.message) {
+ msg = obj.message;
+ }
+ else if (contents && contents.length > 0) {
+ // it may be the case that the exception is in the body message as string
+ msg = contents;
+ }
+ else {
+ msg = `Failed request: (${statusCode})`;
+ }
+ const err = new HttpClientError(msg, statusCode);
+ err.result = response.result;
+ reject(err);
+ }
+ else {
+ resolve(response);
+ }
+ }));
+ });
+ }
+}
+exports.HttpClient = HttpClient;
+const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
+//# sourceMappingURL=index.js.map
+
+/***/ }),
+
+/***/ 1497:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.checkBypass = exports.getProxyUrl = void 0;
+function getProxyUrl(reqUrl) {
+ const usingSsl = reqUrl.protocol === 'https:';
+ if (checkBypass(reqUrl)) {
+ return undefined;
+ }
+ const proxyVar = (() => {
+ if (usingSsl) {
+ return process.env['https_proxy'] || process.env['HTTPS_PROXY'];
+ }
+ else {
+ return process.env['http_proxy'] || process.env['HTTP_PROXY'];
+ }
+ })();
+ if (proxyVar) {
+ try {
+ return new DecodedURL(proxyVar);
+ }
+ catch (_a) {
+ if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://'))
+ return new DecodedURL(`http://${proxyVar}`);
+ }
+ }
+ else {
+ return undefined;
+ }
+}
+exports.getProxyUrl = getProxyUrl;
+function checkBypass(reqUrl) {
+ if (!reqUrl.hostname) {
+ return false;
+ }
+ const reqHost = reqUrl.hostname;
+ if (isLoopbackAddress(reqHost)) {
+ return true;
+ }
+ const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
+ if (!noProxy) {
+ return false;
+ }
+ // Determine the request port
+ let reqPort;
+ if (reqUrl.port) {
+ reqPort = Number(reqUrl.port);
+ }
+ else if (reqUrl.protocol === 'http:') {
+ reqPort = 80;
+ }
+ else if (reqUrl.protocol === 'https:') {
+ reqPort = 443;
+ }
+ // Format the request hostname and hostname with port
+ const upperReqHosts = [reqUrl.hostname.toUpperCase()];
+ if (typeof reqPort === 'number') {
+ upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
+ }
+ // Compare request host against noproxy
+ for (const upperNoProxyItem of noProxy
+ .split(',')
+ .map(x => x.trim().toUpperCase())
+ .filter(x => x)) {
+ if (upperNoProxyItem === '*' ||
+ upperReqHosts.some(x => x === upperNoProxyItem ||
+ x.endsWith(`.${upperNoProxyItem}`) ||
+ (upperNoProxyItem.startsWith('.') &&
+ x.endsWith(`${upperNoProxyItem}`)))) {
+ return true;
+ }
+ }
+ return false;
+}
+exports.checkBypass = checkBypass;
+function isLoopbackAddress(host) {
+ const hostLower = host.toLowerCase();
+ return (hostLower === 'localhost' ||
+ hostLower.startsWith('127.') ||
+ hostLower.startsWith('[::1]') ||
+ hostLower.startsWith('[0:0:0:0:0:0:0:1]'));
+}
+class DecodedURL extends URL {
+ constructor(url, base) {
+ super(url, base);
+ this._decodedUsername = decodeURIComponent(super.username);
+ this._decodedPassword = decodeURIComponent(super.password);
+ }
+ get username() {
+ return this._decodedUsername;
+ }
+ get password() {
+ return this._decodedPassword;
+ }
+}
+//# sourceMappingURL=proxy.js.map
+
+/***/ }),
+
+/***/ 902:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+/*
+
+The MIT License (MIT)
+
+Original Library
+ - Copyright (c) Marak Squires
+
+Additional functionality
+ - Copyright (c) Sindre Sorhus (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+*/
+
+var colors = {};
+module['exports'] = colors;
+
+colors.themes = {};
+
+var util = __nccwpck_require__(9023);
+var ansiStyles = colors.styles = __nccwpck_require__(3000);
+var defineProps = Object.defineProperties;
+var newLineRegex = new RegExp(/[\r\n]+/g);
+
+colors.supportsColor = (__nccwpck_require__(415).supportsColor);
+
+if (typeof colors.enabled === 'undefined') {
+ colors.enabled = colors.supportsColor() !== false;
+}
+
+colors.enable = function() {
+ colors.enabled = true;
+};
+
+colors.disable = function() {
+ colors.enabled = false;
+};
+
+colors.stripColors = colors.strip = function(str) {
+ return ('' + str).replace(/\x1B\[\d+m/g, '');
+};
+
+// eslint-disable-next-line no-unused-vars
+var stylize = colors.stylize = function stylize(str, style) {
+ if (!colors.enabled) {
+ return str+'';
+ }
+
+ var styleMap = ansiStyles[style];
+
+ // Stylize should work for non-ANSI styles, too
+ if (!styleMap && style in colors) {
+ // Style maps like trap operate as functions on strings;
+ // they don't have properties like open or close.
+ return colors[style](str);
+ }
+
+ return styleMap.open + str + styleMap.close;
+};
+
+var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
+var escapeStringRegexp = function(str) {
+ if (typeof str !== 'string') {
+ throw new TypeError('Expected a string');
+ }
+ return str.replace(matchOperatorsRe, '\\$&');
+};
+
+function build(_styles) {
+ var builder = function builder() {
+ return applyStyle.apply(builder, arguments);
+ };
+ builder._styles = _styles;
+ // __proto__ is used because we must return a function, but there is
+ // no way to create a function with a different prototype.
+ builder.__proto__ = proto;
+ return builder;
+}
+
+var styles = (function() {
+ var ret = {};
+ ansiStyles.grey = ansiStyles.gray;
+ Object.keys(ansiStyles).forEach(function(key) {
+ ansiStyles[key].closeRe =
+ new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
+ ret[key] = {
+ get: function() {
+ return build(this._styles.concat(key));
+ },
+ };
+ });
+ return ret;
+})();
+
+var proto = defineProps(function colors() {}, styles);
+
+function applyStyle() {
+ var args = Array.prototype.slice.call(arguments);
+
+ var str = args.map(function(arg) {
+ // Use weak equality check so we can colorize null/undefined in safe mode
+ if (arg != null && arg.constructor === String) {
+ return arg;
+ } else {
+ return util.inspect(arg);
+ }
+ }).join(' ');
+
+ if (!colors.enabled || !str) {
+ return str;
+ }
+
+ var newLinesPresent = str.indexOf('\n') != -1;
+
+ var nestedStyles = this._styles;
+
+ var i = nestedStyles.length;
+ while (i--) {
+ var code = ansiStyles[nestedStyles[i]];
+ str = code.open + str.replace(code.closeRe, code.open) + code.close;
+ if (newLinesPresent) {
+ str = str.replace(newLineRegex, function(match) {
+ return code.close + match + code.open;
+ });
+ }
+ }
+
+ return str;
+}
+
+colors.setTheme = function(theme) {
+ if (typeof theme === 'string') {
+ console.log('colors.setTheme now only accepts an object, not a string. ' +
+ 'If you are trying to set a theme from a file, it is now your (the ' +
+ 'caller\'s) responsibility to require the file. The old syntax ' +
+ 'looked like colors.setTheme(__dirname + ' +
+ '\'/../themes/generic-logging.js\'); The new syntax looks like '+
+ 'colors.setTheme(require(__dirname + ' +
+ '\'/../themes/generic-logging.js\'));');
+ return;
+ }
+ for (var style in theme) {
+ (function(style) {
+ colors[style] = function(str) {
+ if (typeof theme[style] === 'object') {
+ var out = str;
+ for (var i in theme[style]) {
+ out = colors[theme[style][i]](out);
+ }
+ return out;
+ }
+ return colors[theme[style]](str);
+ };
+ })(style);
+ }
+};
+
+function init() {
+ var ret = {};
+ Object.keys(styles).forEach(function(name) {
+ ret[name] = {
+ get: function() {
+ return build([name]);
+ },
+ };
+ });
+ return ret;
+}
+
+var sequencer = function sequencer(map, str) {
+ var exploded = str.split('');
+ exploded = exploded.map(map);
+ return exploded.join('');
+};
+
+// custom formatter methods
+colors.trap = __nccwpck_require__(4919);
+colors.zalgo = __nccwpck_require__(6231);
+
+// maps
+colors.maps = {};
+colors.maps.america = __nccwpck_require__(5122)(colors);
+colors.maps.zebra = __nccwpck_require__(6562)(colors);
+colors.maps.rainbow = __nccwpck_require__(3496)(colors);
+colors.maps.random = __nccwpck_require__(8719)(colors);
+
+for (var map in colors.maps) {
+ (function(map) {
+ colors[map] = function(str) {
+ return sequencer(colors.maps[map], str);
+ };
+ })(map);
+}
+
+defineProps(colors, init());
+
+
+/***/ }),
+
+/***/ 4919:
+/***/ ((module) => {
+
+module['exports'] = function runTheTrap(text, options) {
+ var result = '';
+ text = text || 'Run the trap, drop the bass';
+ text = text.split('');
+ var trap = {
+ a: ['\u0040', '\u0104', '\u023a', '\u0245', '\u0394', '\u039b', '\u0414'],
+ b: ['\u00df', '\u0181', '\u0243', '\u026e', '\u03b2', '\u0e3f'],
+ c: ['\u00a9', '\u023b', '\u03fe'],
+ d: ['\u00d0', '\u018a', '\u0500', '\u0501', '\u0502', '\u0503'],
+ e: ['\u00cb', '\u0115', '\u018e', '\u0258', '\u03a3', '\u03be', '\u04bc',
+ '\u0a6c'],
+ f: ['\u04fa'],
+ g: ['\u0262'],
+ h: ['\u0126', '\u0195', '\u04a2', '\u04ba', '\u04c7', '\u050a'],
+ i: ['\u0f0f'],
+ j: ['\u0134'],
+ k: ['\u0138', '\u04a0', '\u04c3', '\u051e'],
+ l: ['\u0139'],
+ m: ['\u028d', '\u04cd', '\u04ce', '\u0520', '\u0521', '\u0d69'],
+ n: ['\u00d1', '\u014b', '\u019d', '\u0376', '\u03a0', '\u048a'],
+ o: ['\u00d8', '\u00f5', '\u00f8', '\u01fe', '\u0298', '\u047a', '\u05dd',
+ '\u06dd', '\u0e4f'],
+ p: ['\u01f7', '\u048e'],
+ q: ['\u09cd'],
+ r: ['\u00ae', '\u01a6', '\u0210', '\u024c', '\u0280', '\u042f'],
+ s: ['\u00a7', '\u03de', '\u03df', '\u03e8'],
+ t: ['\u0141', '\u0166', '\u0373'],
+ u: ['\u01b1', '\u054d'],
+ v: ['\u05d8'],
+ w: ['\u0428', '\u0460', '\u047c', '\u0d70'],
+ x: ['\u04b2', '\u04fe', '\u04fc', '\u04fd'],
+ y: ['\u00a5', '\u04b0', '\u04cb'],
+ z: ['\u01b5', '\u0240'],
+ };
+ text.forEach(function(c) {
+ c = c.toLowerCase();
+ var chars = trap[c] || [' '];
+ var rand = Math.floor(Math.random() * chars.length);
+ if (typeof trap[c] !== 'undefined') {
+ result += trap[c][rand];
+ } else {
+ result += c;
+ }
+ });
+ return result;
+};
+
+
+/***/ }),
+
+/***/ 6231:
+/***/ ((module) => {
+
+// please no
+module['exports'] = function zalgo(text, options) {
+ text = text || ' he is here ';
+ var soul = {
+ 'up': [
+ '̍', '̎', '̄', '̅',
+ '̿', '̑', '̆', '̐',
+ '͒', '͗', '͑', '̇',
+ '̈', '̊', '͂', '̓',
+ '̈', '͊', '͋', '͌',
+ '̃', '̂', '̌', '͐',
+ '̀', '́', '̋', '̏',
+ '̒', '̓', '̔', '̽',
+ '̉', 'ͣ', 'ͤ', 'ͥ',
+ 'ͦ', 'ͧ', 'ͨ', 'ͩ',
+ 'ͪ', 'ͫ', 'ͬ', 'ͭ',
+ 'ͮ', 'ͯ', '̾', '͛',
+ '͆', '̚',
+ ],
+ 'down': [
+ '̖', '̗', '̘', '̙',
+ '̜', '̝', '̞', '̟',
+ '̠', '̤', '̥', '̦',
+ '̩', '̪', '̫', '̬',
+ '̭', '̮', '̯', '̰',
+ '̱', '̲', '̳', '̹',
+ '̺', '̻', '̼', 'ͅ',
+ '͇', '͈', '͉', '͍',
+ '͎', '͓', '͔', '͕',
+ '͖', '͙', '͚', '̣',
+ ],
+ 'mid': [
+ '̕', '̛', '̀', '́',
+ '͘', '̡', '̢', '̧',
+ '̨', '̴', '̵', '̶',
+ '͜', '͝', '͞',
+ '͟', '͠', '͢', '̸',
+ '̷', '͡', ' ҉',
+ ],
+ };
+ var all = [].concat(soul.up, soul.down, soul.mid);
+
+ function randomNumber(range) {
+ var r = Math.floor(Math.random() * range);
+ return r;
+ }
+
+ function isChar(character) {
+ var bool = false;
+ all.filter(function(i) {
+ bool = (i === character);
+ });
+ return bool;
+ }
+
+
+ function heComes(text, options) {
+ var result = '';
+ var counts;
+ var l;
+ options = options || {};
+ options['up'] =
+ typeof options['up'] !== 'undefined' ? options['up'] : true;
+ options['mid'] =
+ typeof options['mid'] !== 'undefined' ? options['mid'] : true;
+ options['down'] =
+ typeof options['down'] !== 'undefined' ? options['down'] : true;
+ options['size'] =
+ typeof options['size'] !== 'undefined' ? options['size'] : 'maxi';
+ text = text.split('');
+ for (l in text) {
+ if (isChar(l)) {
+ continue;
+ }
+ result = result + text[l];
+ counts = {'up': 0, 'down': 0, 'mid': 0};
+ switch (options.size) {
+ case 'mini':
+ counts.up = randomNumber(8);
+ counts.mid = randomNumber(2);
+ counts.down = randomNumber(8);
+ break;
+ case 'maxi':
+ counts.up = randomNumber(16) + 3;
+ counts.mid = randomNumber(4) + 1;
+ counts.down = randomNumber(64) + 3;
+ break;
+ default:
+ counts.up = randomNumber(8) + 1;
+ counts.mid = randomNumber(6) / 2;
+ counts.down = randomNumber(8) + 1;
+ break;
+ }
+
+ var arr = ['up', 'mid', 'down'];
+ for (var d in arr) {
+ var index = arr[d];
+ for (var i = 0; i <= counts[index]; i++) {
+ if (options[index]) {
+ result = result + soul[index][randomNumber(soul[index].length)];
+ }
+ }
+ }
+ }
+ return result;
+ }
+ // don't summon him
+ return heComes(text, options);
+};
+
+
+
+/***/ }),
+
+/***/ 5122:
+/***/ ((module) => {
+
+module['exports'] = function(colors) {
+ return function(letter, i, exploded) {
+ if (letter === ' ') return letter;
+ switch (i%3) {
+ case 0: return colors.red(letter);
+ case 1: return colors.white(letter);
+ case 2: return colors.blue(letter);
+ }
+ };
+};
+
+
+/***/ }),
+
+/***/ 3496:
+/***/ ((module) => {
+
+module['exports'] = function(colors) {
+ // RoY G BiV
+ var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta'];
+ return function(letter, i, exploded) {
+ if (letter === ' ') {
+ return letter;
+ } else {
+ return colors[rainbowColors[i++ % rainbowColors.length]](letter);
+ }
+ };
+};
+
+
+
+/***/ }),
+
+/***/ 8719:
+/***/ ((module) => {
+
+module['exports'] = function(colors) {
+ var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green',
+ 'blue', 'white', 'cyan', 'magenta', 'brightYellow', 'brightRed',
+ 'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan', 'brightMagenta'];
+ return function(letter, i, exploded) {
+ return letter === ' ' ? letter :
+ colors[
+ available[Math.round(Math.random() * (available.length - 2))]
+ ](letter);
+ };
+};
+
+
+/***/ }),
+
+/***/ 6562:
+/***/ ((module) => {
+
+module['exports'] = function(colors) {
+ return function(letter, i, exploded) {
+ return i % 2 === 0 ? letter : colors.inverse(letter);
+ };
+};
+
+
+/***/ }),
+
+/***/ 3000:
+/***/ ((module) => {
+
+/*
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+*/
+
+var styles = {};
+module['exports'] = styles;
+
+var codes = {
+ reset: [0, 0],
+
+ bold: [1, 22],
+ dim: [2, 22],
+ italic: [3, 23],
+ underline: [4, 24],
+ inverse: [7, 27],
+ hidden: [8, 28],
+ strikethrough: [9, 29],
+
+ black: [30, 39],
+ red: [31, 39],
+ green: [32, 39],
+ yellow: [33, 39],
+ blue: [34, 39],
+ magenta: [35, 39],
+ cyan: [36, 39],
+ white: [37, 39],
+ gray: [90, 39],
+ grey: [90, 39],
+
+ brightRed: [91, 39],
+ brightGreen: [92, 39],
+ brightYellow: [93, 39],
+ brightBlue: [94, 39],
+ brightMagenta: [95, 39],
+ brightCyan: [96, 39],
+ brightWhite: [97, 39],
+
+ bgBlack: [40, 49],
+ bgRed: [41, 49],
+ bgGreen: [42, 49],
+ bgYellow: [43, 49],
+ bgBlue: [44, 49],
+ bgMagenta: [45, 49],
+ bgCyan: [46, 49],
+ bgWhite: [47, 49],
+ bgGray: [100, 49],
+ bgGrey: [100, 49],
+
+ bgBrightRed: [101, 49],
+ bgBrightGreen: [102, 49],
+ bgBrightYellow: [103, 49],
+ bgBrightBlue: [104, 49],
+ bgBrightMagenta: [105, 49],
+ bgBrightCyan: [106, 49],
+ bgBrightWhite: [107, 49],
+
+ // legacy styles for colors pre v1.0.0
+ blackBG: [40, 49],
+ redBG: [41, 49],
+ greenBG: [42, 49],
+ yellowBG: [43, 49],
+ blueBG: [44, 49],
+ magentaBG: [45, 49],
+ cyanBG: [46, 49],
+ whiteBG: [47, 49],
+
+};
+
+Object.keys(codes).forEach(function(key) {
+ var val = codes[key];
+ var style = styles[key] = [];
+ style.open = '\u001b[' + val[0] + 'm';
+ style.close = '\u001b[' + val[1] + 'm';
+});
+
+
+/***/ }),
+
+/***/ 5027:
+/***/ ((module) => {
+
+"use strict";
+/*
+MIT License
+
+Copyright (c) Sindre Sorhus (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+
+
+module.exports = function(flag, argv) {
+ argv = argv || process.argv || [];
+
+ var terminatorPos = argv.indexOf('--');
+ var prefix = /^-{1,2}/.test(flag) ? '' : '--';
+ var pos = argv.indexOf(prefix + flag);
+
+ return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
+};
+
+
+/***/ }),
+
+/***/ 415:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+"use strict";
+/*
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+*/
+
+
+
+var os = __nccwpck_require__(857);
+var hasFlag = __nccwpck_require__(5027);
+
+var env = process.env;
+
+var forceColor = void 0;
+if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
+ forceColor = false;
+} else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true')
+ || hasFlag('color=always')) {
+ forceColor = true;
+}
+if ('FORCE_COLOR' in env) {
+ forceColor = env.FORCE_COLOR.length === 0
+ || parseInt(env.FORCE_COLOR, 10) !== 0;
+}
+
+function translateLevel(level) {
+ if (level === 0) {
+ return false;
+ }
+
+ return {
+ level: level,
+ hasBasic: true,
+ has256: level >= 2,
+ has16m: level >= 3,
+ };
+}
+
+function supportsColor(stream) {
+ if (forceColor === false) {
+ return 0;
+ }
+
+ if (hasFlag('color=16m') || hasFlag('color=full')
+ || hasFlag('color=truecolor')) {
+ return 3;
+ }
+
+ if (hasFlag('color=256')) {
+ return 2;
+ }
+
+ if (stream && !stream.isTTY && forceColor !== true) {
+ return 0;
+ }
+
+ var min = forceColor ? 1 : 0;
+
+ if (process.platform === 'win32') {
+ // Node.js 7.5.0 is the first version of Node.js to include a patch to
+ // libuv that enables 256 color output on Windows. Anything earlier and it
+ // won't work. However, here we target Node.js 8 at minimum as it is an LTS
+ // release, and Node.js 7 is not. Windows 10 build 10586 is the first
+ // Windows release that supports 256 colors. Windows 10 build 14931 is the
+ // first release that supports 16m/TrueColor.
+ var osRelease = os.release().split('.');
+ if (Number(process.versions.node.split('.')[0]) >= 8
+ && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
+ }
+
+ return 1;
+ }
+
+ if ('CI' in env) {
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(function(sign) {
+ return sign in env;
+ }) || env.CI_NAME === 'codeship') {
+ return 1;
+ }
+
+ return min;
+ }
+
+ if ('TEAMCITY_VERSION' in env) {
+ return (/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0
+ );
+ }
+
+ if ('TERM_PROGRAM' in env) {
+ var version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
+
+ switch (env.TERM_PROGRAM) {
+ case 'iTerm.app':
+ return version >= 3 ? 3 : 2;
+ case 'Hyper':
+ return 3;
+ case 'Apple_Terminal':
+ return 2;
+ // No default
+ }
+ }
+
+ if (/-256(color)?$/i.test(env.TERM)) {
+ return 2;
+ }
+
+ if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
+ return 1;
+ }
+
+ if ('COLORTERM' in env) {
+ return 1;
+ }
+
+ if (env.TERM === 'dumb') {
+ return min;
+ }
+
+ return min;
+}
+
+function getSupportLevel(stream) {
+ var level = supportsColor(stream);
+ return translateLevel(level);
+}
+
+module.exports = {
+ supportsColor: getSupportLevel,
+ stdout: getSupportLevel(process.stdout),
+ stderr: getSupportLevel(process.stderr),
+};
+
+
+/***/ }),
+
+/***/ 4647:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+//
+// Remark: Requiring this file will use the "safe" colors API,
+// which will not touch String.prototype.
+//
+// var colors = require('colors/safe');
+// colors.red("foo")
+//
+//
+var colors = __nccwpck_require__(902);
+module['exports'] = colors;
+
+
+/***/ }),
+
+/***/ 7938:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+var enabled = __nccwpck_require__(7454);
+
+/**
+ * Creates a new Adapter.
+ *
+ * @param {Function} fn Function that returns the value.
+ * @returns {Function} The adapter logic.
+ * @public
+ */
+module.exports = function create(fn) {
+ return function adapter(namespace) {
+ try {
+ return enabled(namespace, fn());
+ } catch (e) { /* Any failure means that we found nothing */ }
+
+ return false;
+ };
+}
+
+
+/***/ }),
+
+/***/ 3438:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+var adapter = __nccwpck_require__(7938);
+
+/**
+ * Extracts the values from process.env.
+ *
+ * @type {Function}
+ * @public
+ */
+module.exports = adapter(function processenv() {
+ return process.env.DEBUG || process.env.DIAGNOSTICS;
+});
+
+
+/***/ }),
+
+/***/ 9549:
+/***/ ((module) => {
+
+/**
+ * Contains all configured adapters for the given environment.
+ *
+ * @type {Array}
+ * @public
+ */
+var adapters = [];
+
+/**
+ * Contains all modifier functions.
+ *
+ * @typs {Array}
+ * @public
+ */
+var modifiers = [];
+
+/**
+ * Our default logger.
+ *
+ * @public
+ */
+var logger = function devnull() {};
+
+/**
+ * Register a new adapter that will used to find environments.
+ *
+ * @param {Function} adapter A function that will return the possible env.
+ * @returns {Boolean} Indication of a successful add.
+ * @public
+ */
+function use(adapter) {
+ if (~adapters.indexOf(adapter)) return false;
+
+ adapters.push(adapter);
+ return true;
+}
+
+/**
+ * Assign a new log method.
+ *
+ * @param {Function} custom The log method.
+ * @public
+ */
+function set(custom) {
+ logger = custom;
+}
+
+/**
+ * Check if the namespace is allowed by any of our adapters.
+ *
+ * @param {String} namespace The namespace that needs to be enabled
+ * @returns {Boolean|Promise} Indication if the namespace is enabled by our adapters.
+ * @public
+ */
+function enabled(namespace) {
+ var async = [];
+
+ for (var i = 0; i < adapters.length; i++) {
+ if (adapters[i].async) {
+ async.push(adapters[i]);
+ continue;
+ }
+
+ if (adapters[i](namespace)) return true;
+ }
+
+ if (!async.length) return false;
+
+ //
+ // Now that we know that we Async functions, we know we run in an ES6
+ // environment and can use all the API's that they offer, in this case
+ // we want to return a Promise so that we can `await` in React-Native
+ // for an async adapter.
+ //
+ return new Promise(function pinky(resolve) {
+ Promise.all(
+ async.map(function prebind(fn) {
+ return fn(namespace);
+ })
+ ).then(function resolved(values) {
+ resolve(values.some(Boolean));
+ });
+ });
+}
+
+/**
+ * Add a new message modifier to the debugger.
+ *
+ * @param {Function} fn Modification function.
+ * @returns {Boolean} Indication of a successful add.
+ * @public
+ */
+function modify(fn) {
+ if (~modifiers.indexOf(fn)) return false;
+
+ modifiers.push(fn);
+ return true;
+}
+
+/**
+ * Write data to the supplied logger.
+ *
+ * @param {Object} meta Meta information about the log.
+ * @param {Array} args Arguments for console.log.
+ * @public
+ */
+function write() {
+ logger.apply(logger, arguments);
+}
+
+/**
+ * Process the message with the modifiers.
+ *
+ * @param {Mixed} message The message to be transformed by modifers.
+ * @returns {String} Transformed message.
+ * @public
+ */
+function process(message) {
+ for (var i = 0; i < modifiers.length; i++) {
+ message = modifiers[i].apply(modifiers[i], arguments);
+ }
+
+ return message;
+}
+
+/**
+ * Introduce options to the logger function.
+ *
+ * @param {Function} fn Calback function.
+ * @param {Object} options Properties to introduce on fn.
+ * @returns {Function} The passed function
+ * @public
+ */
+function introduce(fn, options) {
+ var has = Object.prototype.hasOwnProperty;
+
+ for (var key in options) {
+ if (has.call(options, key)) {
+ fn[key] = options[key];
+ }
+ }
+
+ return fn;
+}
+
+/**
+ * Nope, we're not allowed to write messages.
+ *
+ * @returns {Boolean} false
+ * @public
+ */
+function nope(options) {
+ options.enabled = false;
+ options.modify = modify;
+ options.set = set;
+ options.use = use;
+
+ return introduce(function diagnopes() {
+ return false;
+ }, options);
+}
+
+/**
+ * Yep, we're allowed to write debug messages.
+ *
+ * @param {Object} options The options for the process.
+ * @returns {Function} The function that does the logging.
+ * @public
+ */
+function yep(options) {
+ /**
+ * The function that receives the actual debug information.
+ *
+ * @returns {Boolean} indication that we're logging.
+ * @public
+ */
+ function diagnostics() {
+ var args = Array.prototype.slice.call(arguments, 0);
+
+ write.call(write, options, process(args, options));
+ return true;
+ }
+
+ options.enabled = true;
+ options.modify = modify;
+ options.set = set;
+ options.use = use;
+
+ return introduce(diagnostics, options);
+}
+
+/**
+ * Simple helper function to introduce various of helper methods to our given
+ * diagnostics function.
+ *
+ * @param {Function} diagnostics The diagnostics function.
+ * @returns {Function} diagnostics
+ * @public
+ */
+module.exports = function create(diagnostics) {
+ diagnostics.introduce = introduce;
+ diagnostics.enabled = enabled;
+ diagnostics.process = process;
+ diagnostics.modify = modify;
+ diagnostics.write = write;
+ diagnostics.nope = nope;
+ diagnostics.yep = yep;
+ diagnostics.set = set;
+ diagnostics.use = use;
+
+ return diagnostics;
+}
+
+
+/***/ }),
+
+/***/ 543:
+/***/ ((module) => {
+
+/**
+ * An idiot proof logger to be used as default. We've wrapped it in a try/catch
+ * statement to ensure the environments without the `console` API do not crash
+ * as well as an additional fix for ancient browsers like IE8 where the
+ * `console.log` API doesn't have an `apply`, so we need to use the Function's
+ * apply functionality to apply the arguments.
+ *
+ * @param {Object} meta Options of the logger.
+ * @param {Array} messages The actuall message that needs to be logged.
+ * @public
+ */
+module.exports = function (meta, messages) {
+ //
+ // So yea. IE8 doesn't have an apply so we need a work around to puke the
+ // arguments in place.
+ //
+ try { Function.prototype.apply.call(console.log, console, messages); }
+ catch (e) {}
+}
+
+
+/***/ }),
+
+/***/ 7311:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+var colorspace = __nccwpck_require__(4798);
+var kuler = __nccwpck_require__(3972);
+
+/**
+ * Prefix the messages with a colored namespace.
+ *
+ * @param {Array} args The messages array that is getting written.
+ * @param {Object} options Options for diagnostics.
+ * @returns {Array} Altered messages array.
+ * @public
+ */
+module.exports = function ansiModifier(args, options) {
+ var namespace = options.namespace;
+ var ansi = options.colors !== false
+ ? kuler(namespace +':', colorspace(namespace))
+ : namespace +':';
+
+ args[0] = ansi +' '+ args[0];
+ return args;
+};
+
+
+/***/ }),
+
+/***/ 6255:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+var create = __nccwpck_require__(9549);
+var tty = (__nccwpck_require__(2018).isatty)(1);
+
+/**
+ * Create a new diagnostics logger.
+ *
+ * @param {String} namespace The namespace it should enable.
+ * @param {Object} options Additional options.
+ * @returns {Function} The logger.
+ * @public
+ */
+var diagnostics = create(function dev(namespace, options) {
+ options = options || {};
+ options.colors = 'colors' in options ? options.colors : tty;
+ options.namespace = namespace;
+ options.prod = false;
+ options.dev = true;
+
+ if (!dev.enabled(namespace) && !(options.force || dev.force)) {
+ return dev.nope(options);
+ }
+
+ return dev.yep(options);
+});
+
+//
+// Configure the logger for the given environment.
+//
+diagnostics.modify(__nccwpck_require__(7311));
+diagnostics.use(__nccwpck_require__(3438));
+diagnostics.set(__nccwpck_require__(543));
+
+//
+// Expose the diagnostics logger.
+//
+module.exports = diagnostics;
+
+
+/***/ }),
+
+/***/ 8466:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+//
+// Select the correct build version depending on the environment.
+//
+if (process.env.NODE_ENV === 'production') {
+ module.exports = __nccwpck_require__(3195);
+} else {
+ module.exports = __nccwpck_require__(6255);
+}
+
+
+/***/ }),
+
+/***/ 3195:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+var create = __nccwpck_require__(9549);
+
+/**
+ * Create a new diagnostics logger.
+ *
+ * @param {String} namespace The namespace it should enable.
+ * @param {Object} options Additional options.
+ * @returns {Function} The logger.
+ * @public
+ */
+var diagnostics = create(function prod(namespace, options) {
+ options = options || {};
+ options.namespace = namespace;
+ options.prod = true;
+ options.dev = false;
+
+ if (!(options.force || prod.force)) return prod.nope(options);
+ return prod.yep(options);
+});
+
+//
+// Expose the diagnostics logger.
+//
+module.exports = diagnostics;
+
+
+/***/ }),
+
+/***/ 4972:
+/***/ ((module, exports, __nccwpck_require__) => {
+
+"use strict";
+/**
+ * @author Toru Nagashima
+ * See LICENSE file in root directory for full license.
+ */
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+
+var eventTargetShim = __nccwpck_require__(4608);
+
+/**
+ * The signal class.
+ * @see https://dom.spec.whatwg.org/#abortsignal
+ */
+class AbortSignal extends eventTargetShim.EventTarget {
+ /**
+ * AbortSignal cannot be constructed directly.
+ */
+ constructor() {
+ super();
+ throw new TypeError("AbortSignal cannot be constructed directly");
+ }
+ /**
+ * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.
+ */
+ get aborted() {
+ const aborted = abortedFlags.get(this);
+ if (typeof aborted !== "boolean") {
+ throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`);
+ }
+ return aborted;
+ }
+}
+eventTargetShim.defineEventAttribute(AbortSignal.prototype, "abort");
+/**
+ * Create an AbortSignal object.
+ */
+function createAbortSignal() {
+ const signal = Object.create(AbortSignal.prototype);
+ eventTargetShim.EventTarget.call(signal);
+ abortedFlags.set(signal, false);
+ return signal;
+}
+/**
+ * Abort a given signal.
+ */
+function abortSignal(signal) {
+ if (abortedFlags.get(signal) !== false) {
+ return;
+ }
+ abortedFlags.set(signal, true);
+ signal.dispatchEvent({ type: "abort" });
+}
+/**
+ * Aborted flag for each instances.
+ */
+const abortedFlags = new WeakMap();
+// Properties should be enumerable.
+Object.defineProperties(AbortSignal.prototype, {
+ aborted: { enumerable: true },
+});
+// `toString()` should return `"[object AbortSignal]"`
+if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
+ Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {
+ configurable: true,
+ value: "AbortSignal",
+ });
+}
+
+/**
+ * The AbortController.
+ * @see https://dom.spec.whatwg.org/#abortcontroller
+ */
+class AbortController {
+ /**
+ * Initialize this controller.
+ */
+ constructor() {
+ signals.set(this, createAbortSignal());
+ }
+ /**
+ * Returns the `AbortSignal` object associated with this object.
+ */
+ get signal() {
+ return getSignal(this);
+ }
+ /**
+ * Abort and signal to any observers that the associated activity is to be aborted.
+ */
+ abort() {
+ abortSignal(getSignal(this));
+ }
+}
+/**
+ * Associated signals.
+ */
+const signals = new WeakMap();
+/**
+ * Get the associated signal of a given controller.
+ */
+function getSignal(controller) {
+ const signal = signals.get(controller);
+ if (signal == null) {
+ throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`);
+ }
+ return signal;
+}
+// Properties should be enumerable.
+Object.defineProperties(AbortController.prototype, {
+ signal: { enumerable: true },
+ abort: { enumerable: true },
+});
+if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
+ Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {
+ configurable: true,
+ value: "AbortController",
+ });
+}
+
+exports.AbortController = AbortController;
+exports.AbortSignal = AbortSignal;
+exports["default"] = AbortController;
+
+module.exports = AbortController
+module.exports.AbortController = module.exports["default"] = AbortController
+module.exports.AbortSignal = AbortSignal
+//# sourceMappingURL=abort-controller.js.map
+
+
+/***/ }),
+
+/***/ 9765:
+/***/ ((module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = asyncify;
+
+var _initialParams = __nccwpck_require__(8031);
+
+var _initialParams2 = _interopRequireDefault(_initialParams);
+
+var _setImmediate = __nccwpck_require__(6527);
+
+var _setImmediate2 = _interopRequireDefault(_setImmediate);
+
+var _wrapAsync = __nccwpck_require__(673);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/**
+ * Take a sync function and make it async, passing its return value to a
+ * callback. This is useful for plugging sync functions into a waterfall,
+ * series, or other async functions. Any arguments passed to the generated
+ * function will be passed to the wrapped function (except for the final
+ * callback argument). Errors thrown will be passed to the callback.
+ *
+ * If the function passed to `asyncify` returns a Promise, that promises's
+ * resolved/rejected state will be used to call the callback, rather than simply
+ * the synchronous return value.
+ *
+ * This also means you can asyncify ES2017 `async` functions.
+ *
+ * @name asyncify
+ * @static
+ * @memberOf module:Utils
+ * @method
+ * @alias wrapSync
+ * @category Util
+ * @param {Function} func - The synchronous function, or Promise-returning
+ * function to convert to an {@link AsyncFunction}.
+ * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be
+ * invoked with `(args..., callback)`.
+ * @example
+ *
+ * // passing a regular synchronous function
+ * async.waterfall([
+ * async.apply(fs.readFile, filename, "utf8"),
+ * async.asyncify(JSON.parse),
+ * function (data, next) {
+ * // data is the result of parsing the text.
+ * // If there was a parsing error, it would have been caught.
+ * }
+ * ], callback);
+ *
+ * // passing a function returning a promise
+ * async.waterfall([
+ * async.apply(fs.readFile, filename, "utf8"),
+ * async.asyncify(function (contents) {
+ * return db.model.create(contents);
+ * }),
+ * function (model, next) {
+ * // `model` is the instantiated model object.
+ * // If there was an error, this function would be skipped.
+ * }
+ * ], callback);
+ *
+ * // es2017 example, though `asyncify` is not needed if your JS environment
+ * // supports async functions out of the box
+ * var q = async.queue(async.asyncify(async function(file) {
+ * var intermediateStep = await processFile(file);
+ * return await somePromise(intermediateStep)
+ * }));
+ *
+ * q.push(files);
+ */
+function asyncify(func) {
+ if ((0, _wrapAsync.isAsync)(func)) {
+ return function (...args /*, callback*/) {
+ const callback = args.pop();
+ const promise = func.apply(this, args);
+ return handlePromise(promise, callback);
+ };
+ }
+
+ return (0, _initialParams2.default)(function (args, callback) {
+ var result;
+ try {
+ result = func.apply(this, args);
+ } catch (e) {
+ return callback(e);
+ }
+ // if result is Promise object
+ if (result && typeof result.then === 'function') {
+ return handlePromise(result, callback);
+ } else {
+ callback(null, result);
+ }
+ });
+}
+
+function handlePromise(promise, callback) {
+ return promise.then(value => {
+ invokeCallback(callback, null, value);
+ }, err => {
+ invokeCallback(callback, err && (err instanceof Error || err.message) ? err : new Error(err));
+ });
+}
+
+function invokeCallback(callback, error, value) {
+ try {
+ callback(error, value);
+ } catch (err) {
+ (0, _setImmediate2.default)(e => {
+ throw e;
+ }, err);
+ }
+}
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 6479:
+/***/ ((module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+
+var _isArrayLike = __nccwpck_require__(1127);
+
+var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
+
+var _breakLoop = __nccwpck_require__(3896);
+
+var _breakLoop2 = _interopRequireDefault(_breakLoop);
+
+var _eachOfLimit = __nccwpck_require__(5800);
+
+var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
+
+var _once = __nccwpck_require__(6264);
+
+var _once2 = _interopRequireDefault(_once);
+
+var _onlyOnce = __nccwpck_require__(8034);
+
+var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
+
+var _wrapAsync = __nccwpck_require__(673);
+
+var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
+
+var _awaitify = __nccwpck_require__(7197);
+
+var _awaitify2 = _interopRequireDefault(_awaitify);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// eachOf implementation optimized for array-likes
+function eachOfArrayLike(coll, iteratee, callback) {
+ callback = (0, _once2.default)(callback);
+ var index = 0,
+ completed = 0,
+ { length } = coll,
+ canceled = false;
+ if (length === 0) {
+ callback(null);
+ }
+
+ function iteratorCallback(err, value) {
+ if (err === false) {
+ canceled = true;
+ }
+ if (canceled === true) return;
+ if (err) {
+ callback(err);
+ } else if (++completed === length || value === _breakLoop2.default) {
+ callback(null);
+ }
+ }
+
+ for (; index < length; index++) {
+ iteratee(coll[index], index, (0, _onlyOnce2.default)(iteratorCallback));
+ }
+}
+
+// a generic version of eachOf which can handle array, object, and iterator cases.
+function eachOfGeneric(coll, iteratee, callback) {
+ return (0, _eachOfLimit2.default)(coll, Infinity, iteratee, callback);
+}
+
+/**
+ * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument
+ * to the iteratee.
+ *
+ * @name eachOf
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @alias forEachOf
+ * @category Collection
+ * @see [async.each]{@link module:Collections.each}
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - A function to apply to each
+ * item in `coll`.
+ * The `key` is the item's key, or index in the case of an array.
+ * Invoked with (item, key, callback).
+ * @param {Function} [callback] - A callback which is called when all
+ * `iteratee` functions have finished, or an error occurs. Invoked with (err).
+ * @returns {Promise} a promise, if a callback is omitted
+ * @example
+ *
+ * // dev.json is a file containing a valid json object config for dev environment
+ * // dev.json is a file containing a valid json object config for test environment
+ * // prod.json is a file containing a valid json object config for prod environment
+ * // invalid.json is a file with a malformed json object
+ *
+ * let configs = {}; //global variable
+ * let validConfigFileMap = {dev: 'dev.json', test: 'test.json', prod: 'prod.json'};
+ * let invalidConfigFileMap = {dev: 'dev.json', test: 'test.json', invalid: 'invalid.json'};
+ *
+ * // asynchronous function that reads a json file and parses the contents as json object
+ * function parseFile(file, key, callback) {
+ * fs.readFile(file, "utf8", function(err, data) {
+ * if (err) return calback(err);
+ * try {
+ * configs[key] = JSON.parse(data);
+ * } catch (e) {
+ * return callback(e);
+ * }
+ * callback();
+ * });
+ * }
+ *
+ * // Using callbacks
+ * async.forEachOf(validConfigFileMap, parseFile, function (err) {
+ * if (err) {
+ * console.error(err);
+ * } else {
+ * console.log(configs);
+ * // configs is now a map of JSON data, e.g.
+ * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
+ * }
+ * });
+ *
+ * //Error handing
+ * async.forEachOf(invalidConfigFileMap, parseFile, function (err) {
+ * if (err) {
+ * console.error(err);
+ * // JSON parse error exception
+ * } else {
+ * console.log(configs);
+ * }
+ * });
+ *
+ * // Using Promises
+ * async.forEachOf(validConfigFileMap, parseFile)
+ * .then( () => {
+ * console.log(configs);
+ * // configs is now a map of JSON data, e.g.
+ * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
+ * }).catch( err => {
+ * console.error(err);
+ * });
+ *
+ * //Error handing
+ * async.forEachOf(invalidConfigFileMap, parseFile)
+ * .then( () => {
+ * console.log(configs);
+ * }).catch( err => {
+ * console.error(err);
+ * // JSON parse error exception
+ * });
+ *
+ * // Using async/await
+ * async () => {
+ * try {
+ * let result = await async.forEachOf(validConfigFileMap, parseFile);
+ * console.log(configs);
+ * // configs is now a map of JSON data, e.g.
+ * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
+ * }
+ * catch (err) {
+ * console.log(err);
+ * }
+ * }
+ *
+ * //Error handing
+ * async () => {
+ * try {
+ * let result = await async.forEachOf(invalidConfigFileMap, parseFile);
+ * console.log(configs);
+ * }
+ * catch (err) {
+ * console.log(err);
+ * // JSON parse error exception
+ * }
+ * }
+ *
+ */
+function eachOf(coll, iteratee, callback) {
+ var eachOfImplementation = (0, _isArrayLike2.default)(coll) ? eachOfArrayLike : eachOfGeneric;
+ return eachOfImplementation(coll, (0, _wrapAsync2.default)(iteratee), callback);
+}
+
+exports["default"] = (0, _awaitify2.default)(eachOf, 3);
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 5800:
+/***/ ((module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+
+var _eachOfLimit2 = __nccwpck_require__(9086);
+
+var _eachOfLimit3 = _interopRequireDefault(_eachOfLimit2);
+
+var _wrapAsync = __nccwpck_require__(673);
+
+var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
+
+var _awaitify = __nccwpck_require__(7197);
+
+var _awaitify2 = _interopRequireDefault(_awaitify);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/**
+ * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a
+ * time.
+ *
+ * @name eachOfLimit
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.eachOf]{@link module:Collections.eachOf}
+ * @alias forEachOfLimit
+ * @category Collection
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
+ * @param {number} limit - The maximum number of async operations at a time.
+ * @param {AsyncFunction} iteratee - An async function to apply to each
+ * item in `coll`. The `key` is the item's key, or index in the case of an
+ * array.
+ * Invoked with (item, key, callback).
+ * @param {Function} [callback] - A callback which is called when all
+ * `iteratee` functions have finished, or an error occurs. Invoked with (err).
+ * @returns {Promise} a promise, if a callback is omitted
+ */
+function eachOfLimit(coll, limit, iteratee, callback) {
+ return (0, _eachOfLimit3.default)(limit)(coll, (0, _wrapAsync2.default)(iteratee), callback);
+}
+
+exports["default"] = (0, _awaitify2.default)(eachOfLimit, 4);
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 6622:
+/***/ ((module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+
+var _eachOfLimit = __nccwpck_require__(5800);
+
+var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
+
+var _awaitify = __nccwpck_require__(7197);
+
+var _awaitify2 = _interopRequireDefault(_awaitify);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/**
+ * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time.
+ *
+ * @name eachOfSeries
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.eachOf]{@link module:Collections.eachOf}
+ * @alias forEachOfSeries
+ * @category Collection
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
+ * `coll`.
+ * Invoked with (item, key, callback).
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
+ * functions have finished, or an error occurs. Invoked with (err).
+ * @returns {Promise} a promise, if a callback is omitted
+ */
+function eachOfSeries(coll, iteratee, callback) {
+ return (0, _eachOfLimit2.default)(coll, 1, iteratee, callback);
+}
+exports["default"] = (0, _awaitify2.default)(eachOfSeries, 3);
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 205:
+/***/ ((module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+
+var _eachOf = __nccwpck_require__(6479);
+
+var _eachOf2 = _interopRequireDefault(_eachOf);
+
+var _withoutIndex = __nccwpck_require__(8341);
+
+var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
+
+var _wrapAsync = __nccwpck_require__(673);
+
+var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
+
+var _awaitify = __nccwpck_require__(7197);
+
+var _awaitify2 = _interopRequireDefault(_awaitify);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/**
+ * Applies the function `iteratee` to each item in `coll`, in parallel.
+ * The `iteratee` is called with an item from the list, and a callback for when
+ * it has finished. If the `iteratee` passes an error to its `callback`, the
+ * main `callback` (for the `each` function) is immediately called with the
+ * error.
+ *
+ * Note, that since this function applies `iteratee` to each item in parallel,
+ * there is no guarantee that the iteratee functions will complete in order.
+ *
+ * @name each
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @alias forEach
+ * @category Collection
+ * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - An async function to apply to
+ * each item in `coll`. Invoked with (item, callback).
+ * The array index is not passed to the iteratee.
+ * If you need the index, use `eachOf`.
+ * @param {Function} [callback] - A callback which is called when all
+ * `iteratee` functions have finished, or an error occurs. Invoked with (err).
+ * @returns {Promise} a promise, if a callback is omitted
+ * @example
+ *
+ * // dir1 is a directory that contains file1.txt, file2.txt
+ * // dir2 is a directory that contains file3.txt, file4.txt
+ * // dir3 is a directory that contains file5.txt
+ * // dir4 does not exist
+ *
+ * const fileList = [ 'dir1/file2.txt', 'dir2/file3.txt', 'dir/file5.txt'];
+ * const withMissingFileList = ['dir1/file1.txt', 'dir4/file2.txt'];
+ *
+ * // asynchronous function that deletes a file
+ * const deleteFile = function(file, callback) {
+ * fs.unlink(file, callback);
+ * };
+ *
+ * // Using callbacks
+ * async.each(fileList, deleteFile, function(err) {
+ * if( err ) {
+ * console.log(err);
+ * } else {
+ * console.log('All files have been deleted successfully');
+ * }
+ * });
+ *
+ * // Error Handling
+ * async.each(withMissingFileList, deleteFile, function(err){
+ * console.log(err);
+ * // [ Error: ENOENT: no such file or directory ]
+ * // since dir4/file2.txt does not exist
+ * // dir1/file1.txt could have been deleted
+ * });
+ *
+ * // Using Promises
+ * async.each(fileList, deleteFile)
+ * .then( () => {
+ * console.log('All files have been deleted successfully');
+ * }).catch( err => {
+ * console.log(err);
+ * });
+ *
+ * // Error Handling
+ * async.each(fileList, deleteFile)
+ * .then( () => {
+ * console.log('All files have been deleted successfully');
+ * }).catch( err => {
+ * console.log(err);
+ * // [ Error: ENOENT: no such file or directory ]
+ * // since dir4/file2.txt does not exist
+ * // dir1/file1.txt could have been deleted
+ * });
+ *
+ * // Using async/await
+ * async () => {
+ * try {
+ * await async.each(files, deleteFile);
+ * }
+ * catch (err) {
+ * console.log(err);
+ * }
+ * }
+ *
+ * // Error Handling
+ * async () => {
+ * try {
+ * await async.each(withMissingFileList, deleteFile);
+ * }
+ * catch (err) {
+ * console.log(err);
+ * // [ Error: ENOENT: no such file or directory ]
+ * // since dir4/file2.txt does not exist
+ * // dir1/file1.txt could have been deleted
+ * }
+ * }
+ *
+ */
+function eachLimit(coll, iteratee, callback) {
+ return (0, _eachOf2.default)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);
+}
+
+exports["default"] = (0, _awaitify2.default)(eachLimit, 3);
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 4898:
+/***/ ((module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = asyncEachOfLimit;
+
+var _breakLoop = __nccwpck_require__(3896);
+
+var _breakLoop2 = _interopRequireDefault(_breakLoop);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// for async generators
+function asyncEachOfLimit(generator, limit, iteratee, callback) {
+ let done = false;
+ let canceled = false;
+ let awaiting = false;
+ let running = 0;
+ let idx = 0;
+
+ function replenish() {
+ //console.log('replenish')
+ if (running >= limit || awaiting || done) return;
+ //console.log('replenish awaiting')
+ awaiting = true;
+ generator.next().then(({ value, done: iterDone }) => {
+ //console.log('got value', value)
+ if (canceled || done) return;
+ awaiting = false;
+ if (iterDone) {
+ done = true;
+ if (running <= 0) {
+ //console.log('done nextCb')
+ callback(null);
+ }
+ return;
+ }
+ running++;
+ iteratee(value, idx, iterateeCallback);
+ idx++;
+ replenish();
+ }).catch(handleError);
+ }
+
+ function iterateeCallback(err, result) {
+ //console.log('iterateeCallback')
+ running -= 1;
+ if (canceled) return;
+ if (err) return handleError(err);
+
+ if (err === false) {
+ done = true;
+ canceled = true;
+ return;
+ }
+
+ if (result === _breakLoop2.default || done && running <= 0) {
+ done = true;
+ //console.log('done iterCb')
+ return callback(null);
+ }
+ replenish();
+ }
+
+ function handleError(err) {
+ if (canceled) return;
+ awaiting = false;
+ done = true;
+ callback(err);
+ }
+
+ replenish();
+}
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 7197:
+/***/ ((module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = awaitify;
+// conditionally promisify a function.
+// only return a promise if a callback is omitted
+function awaitify(asyncFn, arity) {
+ if (!arity) arity = asyncFn.length;
+ if (!arity) throw new Error('arity is undefined');
+ function awaitable(...args) {
+ if (typeof args[arity - 1] === 'function') {
+ return asyncFn.apply(this, args);
+ }
+
+ return new Promise((resolve, reject) => {
+ args[arity - 1] = (err, ...cbArgs) => {
+ if (err) return reject(err);
+ resolve(cbArgs.length > 1 ? cbArgs : cbArgs[0]);
+ };
+ asyncFn.apply(this, args);
+ });
+ }
+
+ return awaitable;
+}
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 3896:
+/***/ ((module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+// A temporary value used to identify if the loop should be broken.
+// See #1064, #1293
+const breakLoop = {};
+exports["default"] = breakLoop;
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 9086:
+/***/ ((module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+
+var _once = __nccwpck_require__(6264);
+
+var _once2 = _interopRequireDefault(_once);
+
+var _iterator = __nccwpck_require__(5611);
+
+var _iterator2 = _interopRequireDefault(_iterator);
+
+var _onlyOnce = __nccwpck_require__(8034);
+
+var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
+
+var _wrapAsync = __nccwpck_require__(673);
+
+var _asyncEachOfLimit = __nccwpck_require__(4898);
+
+var _asyncEachOfLimit2 = _interopRequireDefault(_asyncEachOfLimit);
+
+var _breakLoop = __nccwpck_require__(3896);
+
+var _breakLoop2 = _interopRequireDefault(_breakLoop);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+exports["default"] = limit => {
+ return (obj, iteratee, callback) => {
+ callback = (0, _once2.default)(callback);
+ if (limit <= 0) {
+ throw new RangeError('concurrency limit cannot be less than 1');
+ }
+ if (!obj) {
+ return callback(null);
+ }
+ if ((0, _wrapAsync.isAsyncGenerator)(obj)) {
+ return (0, _asyncEachOfLimit2.default)(obj, limit, iteratee, callback);
+ }
+ if ((0, _wrapAsync.isAsyncIterable)(obj)) {
+ return (0, _asyncEachOfLimit2.default)(obj[Symbol.asyncIterator](), limit, iteratee, callback);
+ }
+ var nextElem = (0, _iterator2.default)(obj);
+ var done = false;
+ var canceled = false;
+ var running = 0;
+ var looping = false;
+
+ function iterateeCallback(err, value) {
+ if (canceled) return;
+ running -= 1;
+ if (err) {
+ done = true;
+ callback(err);
+ } else if (err === false) {
+ done = true;
+ canceled = true;
+ } else if (value === _breakLoop2.default || done && running <= 0) {
+ done = true;
+ return callback(null);
+ } else if (!looping) {
+ replenish();
+ }
+ }
+
+ function replenish() {
+ looping = true;
+ while (running < limit && !done) {
+ var elem = nextElem();
+ if (elem === null) {
+ done = true;
+ if (running <= 0) {
+ callback(null);
+ }
+ return;
+ }
+ running += 1;
+ iteratee(elem.value, elem.key, (0, _onlyOnce2.default)(iterateeCallback));
+ }
+ looping = false;
+ }
+
+ replenish();
+ };
+};
+
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 5151:
+/***/ ((module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+
+exports["default"] = function (coll) {
+ return coll[Symbol.iterator] && coll[Symbol.iterator]();
+};
+
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 8031:
+/***/ ((module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+
+exports["default"] = function (fn) {
+ return function (...args /*, callback*/) {
+ var callback = args.pop();
+ return fn.call(this, args, callback);
+ };
+};
+
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 1127:
+/***/ ((module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = isArrayLike;
+function isArrayLike(value) {
+ return value && typeof value.length === 'number' && value.length >= 0 && value.length % 1 === 0;
+}
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 5611:
+/***/ ((module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = createIterator;
+
+var _isArrayLike = __nccwpck_require__(1127);
+
+var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
+
+var _getIterator = __nccwpck_require__(5151);
+
+var _getIterator2 = _interopRequireDefault(_getIterator);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function createArrayIterator(coll) {
+ var i = -1;
+ var len = coll.length;
+ return function next() {
+ return ++i < len ? { value: coll[i], key: i } : null;
+ };
+}
+
+function createES2015Iterator(iterator) {
+ var i = -1;
+ return function next() {
+ var item = iterator.next();
+ if (item.done) return null;
+ i++;
+ return { value: item.value, key: i };
+ };
+}
+
+function createObjectIterator(obj) {
+ var okeys = obj ? Object.keys(obj) : [];
+ var i = -1;
+ var len = okeys.length;
+ return function next() {
+ var key = okeys[++i];
+ if (key === '__proto__') {
+ return next();
+ }
+ return i < len ? { value: obj[key], key } : null;
+ };
+}
+
+function createIterator(coll) {
+ if ((0, _isArrayLike2.default)(coll)) {
+ return createArrayIterator(coll);
+ }
+
+ var iterator = (0, _getIterator2.default)(coll);
+ return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll);
+}
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 6264:
+/***/ ((module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = once;
+function once(fn) {
+ function wrapper(...args) {
+ if (fn === null) return;
+ var callFn = fn;
+ fn = null;
+ callFn.apply(this, args);
+ }
+ Object.assign(wrapper, fn);
+ return wrapper;
+}
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 8034:
+/***/ ((module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = onlyOnce;
+function onlyOnce(fn) {
+ return function (...args) {
+ if (fn === null) throw new Error("Callback was already called.");
+ var callFn = fn;
+ fn = null;
+ callFn.apply(this, args);
+ };
+}
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 1570:
+/***/ ((module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+
+var _isArrayLike = __nccwpck_require__(1127);
+
+var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
+
+var _wrapAsync = __nccwpck_require__(673);
+
+var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
+
+var _awaitify = __nccwpck_require__(7197);
+
+var _awaitify2 = _interopRequireDefault(_awaitify);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+exports["default"] = (0, _awaitify2.default)((eachfn, tasks, callback) => {
+ var results = (0, _isArrayLike2.default)(tasks) ? [] : {};
+
+ eachfn(tasks, (task, key, taskCb) => {
+ (0, _wrapAsync2.default)(task)((err, ...result) => {
+ if (result.length < 2) {
+ [result] = result;
+ }
+ results[key] = result;
+ taskCb(err);
+ });
+ }, err => callback(err, results));
+}, 3);
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 6527:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.fallback = fallback;
+exports.wrap = wrap;
+/* istanbul ignore file */
+
+var hasQueueMicrotask = exports.hasQueueMicrotask = typeof queueMicrotask === 'function' && queueMicrotask;
+var hasSetImmediate = exports.hasSetImmediate = typeof setImmediate === 'function' && setImmediate;
+var hasNextTick = exports.hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function';
+
+function fallback(fn) {
+ setTimeout(fn, 0);
+}
+
+function wrap(defer) {
+ return (fn, ...args) => defer(() => fn(...args));
+}
+
+var _defer;
+
+if (hasQueueMicrotask) {
+ _defer = queueMicrotask;
+} else if (hasSetImmediate) {
+ _defer = setImmediate;
+} else if (hasNextTick) {
+ _defer = process.nextTick;
+} else {
+ _defer = fallback;
+}
+
+exports["default"] = wrap(_defer);
+
+/***/ }),
+
+/***/ 8341:
+/***/ ((module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = _withoutIndex;
+function _withoutIndex(iteratee) {
+ return (value, index, callback) => iteratee(value, callback);
+}
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 673:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports.isAsyncIterable = exports.isAsyncGenerator = exports.isAsync = undefined;
+
+var _asyncify = __nccwpck_require__(9765);
+
+var _asyncify2 = _interopRequireDefault(_asyncify);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function isAsync(fn) {
+ return fn[Symbol.toStringTag] === 'AsyncFunction';
+}
+
+function isAsyncGenerator(fn) {
+ return fn[Symbol.toStringTag] === 'AsyncGenerator';
+}
+
+function isAsyncIterable(obj) {
+ return typeof obj[Symbol.asyncIterator] === 'function';
+}
+
+function wrapAsync(asyncFn) {
+ if (typeof asyncFn !== 'function') throw new Error('expected a function');
+ return isAsync(asyncFn) ? (0, _asyncify2.default)(asyncFn) : asyncFn;
+}
+
+exports["default"] = wrapAsync;
+exports.isAsync = isAsync;
+exports.isAsyncGenerator = isAsyncGenerator;
+exports.isAsyncIterable = isAsyncIterable;
+
+/***/ }),
+
+/***/ 9370:
+/***/ ((module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({
+ value: true
+}));
+exports["default"] = series;
+
+var _parallel2 = __nccwpck_require__(1570);
+
+var _parallel3 = _interopRequireDefault(_parallel2);
+
+var _eachOfSeries = __nccwpck_require__(6622);
+
+var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/**
+ * Run the functions in the `tasks` collection in series, each one running once
+ * the previous function has completed. If any functions in the series pass an
+ * error to its callback, no more functions are run, and `callback` is
+ * immediately called with the value of the error. Otherwise, `callback`
+ * receives an array of results when `tasks` have completed.
+ *
+ * It is also possible to use an object instead of an array. Each property will
+ * be run as a function, and the results will be passed to the final `callback`
+ * as an object instead of an array. This can be a more readable way of handling
+ * results from {@link async.series}.
+ *
+ * **Note** that while many implementations preserve the order of object
+ * properties, the [ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6)
+ * explicitly states that
+ *
+ * > The mechanics and order of enumerating the properties is not specified.
+ *
+ * So if you rely on the order in which your series of functions are executed,
+ * and want this to work on all platforms, consider using an array.
+ *
+ * @name series
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @category Control Flow
+ * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing
+ * [async functions]{@link AsyncFunction} to run in series.
+ * Each function can complete with any number of optional `result` values.
+ * @param {Function} [callback] - An optional callback to run once all the
+ * functions have completed. This function gets a results array (or object)
+ * containing all the result arguments passed to the `task` callbacks. Invoked
+ * with (err, result).
+ * @return {Promise} a promise, if no callback is passed
+ * @example
+ *
+ * //Using Callbacks
+ * async.series([
+ * function(callback) {
+ * setTimeout(function() {
+ * // do some async task
+ * callback(null, 'one');
+ * }, 200);
+ * },
+ * function(callback) {
+ * setTimeout(function() {
+ * // then do another async task
+ * callback(null, 'two');
+ * }, 100);
+ * }
+ * ], function(err, results) {
+ * console.log(results);
+ * // results is equal to ['one','two']
+ * });
+ *
+ * // an example using objects instead of arrays
+ * async.series({
+ * one: function(callback) {
+ * setTimeout(function() {
+ * // do some async task
+ * callback(null, 1);
+ * }, 200);
+ * },
+ * two: function(callback) {
+ * setTimeout(function() {
+ * // then do another async task
+ * callback(null, 2);
+ * }, 100);
+ * }
+ * }, function(err, results) {
+ * console.log(results);
+ * // results is equal to: { one: 1, two: 2 }
+ * });
+ *
+ * //Using Promises
+ * async.series([
+ * function(callback) {
+ * setTimeout(function() {
+ * callback(null, 'one');
+ * }, 200);
+ * },
+ * function(callback) {
+ * setTimeout(function() {
+ * callback(null, 'two');
+ * }, 100);
+ * }
+ * ]).then(results => {
+ * console.log(results);
+ * // results is equal to ['one','two']
+ * }).catch(err => {
+ * console.log(err);
+ * });
+ *
+ * // an example using an object instead of an array
+ * async.series({
+ * one: function(callback) {
+ * setTimeout(function() {
+ * // do some async task
+ * callback(null, 1);
+ * }, 200);
+ * },
+ * two: function(callback) {
+ * setTimeout(function() {
+ * // then do another async task
+ * callback(null, 2);
+ * }, 100);
+ * }
+ * }).then(results => {
+ * console.log(results);
+ * // results is equal to: { one: 1, two: 2 }
+ * }).catch(err => {
+ * console.log(err);
+ * });
+ *
+ * //Using async/await
+ * async () => {
+ * try {
+ * let results = await async.series([
+ * function(callback) {
+ * setTimeout(function() {
+ * // do some async task
+ * callback(null, 'one');
+ * }, 200);
+ * },
+ * function(callback) {
+ * setTimeout(function() {
+ * // then do another async task
+ * callback(null, 'two');
+ * }, 100);
+ * }
+ * ]);
+ * console.log(results);
+ * // results is equal to ['one','two']
+ * }
+ * catch (err) {
+ * console.log(err);
+ * }
+ * }
+ *
+ * // an example using an object instead of an array
+ * async () => {
+ * try {
+ * let results = await async.parallel({
+ * one: function(callback) {
+ * setTimeout(function() {
+ * // do some async task
+ * callback(null, 1);
+ * }, 200);
+ * },
+ * two: function(callback) {
+ * setTimeout(function() {
+ * // then do another async task
+ * callback(null, 2);
+ * }, 100);
+ * }
+ * });
+ * console.log(results);
+ * // results is equal to: { one: 1, two: 2 }
+ * }
+ * catch (err) {
+ * console.log(err);
+ * }
+ * }
+ *
+ */
+function series(tasks, callback) {
+ return (0, _parallel3.default)(_eachOfSeries2.default, tasks, callback);
+}
+module.exports = exports.default;
+
+/***/ }),
+
+/***/ 5374:
+/***/ (function(module) {
+
+;(function (globalObject) {
+ 'use strict';
+
+/*
+ * bignumber.js v9.0.0
+ * A JavaScript library for arbitrary-precision arithmetic.
+ * https://github.com/MikeMcl/bignumber.js
+ * Copyright (c) 2019 Michael Mclaughlin
+ * MIT Licensed.
+ *
+ * BigNumber.prototype methods | BigNumber methods
+ * |
+ * absoluteValue abs | clone
+ * comparedTo | config set
+ * decimalPlaces dp | DECIMAL_PLACES
+ * dividedBy div | ROUNDING_MODE
+ * dividedToIntegerBy idiv | EXPONENTIAL_AT
+ * exponentiatedBy pow | RANGE
+ * integerValue | CRYPTO
+ * isEqualTo eq | MODULO_MODE
+ * isFinite | POW_PRECISION
+ * isGreaterThan gt | FORMAT
+ * isGreaterThanOrEqualTo gte | ALPHABET
+ * isInteger | isBigNumber
+ * isLessThan lt | maximum max
+ * isLessThanOrEqualTo lte | minimum min
+ * isNaN | random
+ * isNegative | sum
+ * isPositive |
+ * isZero |
+ * minus |
+ * modulo mod |
+ * multipliedBy times |
+ * negated |
+ * plus |
+ * precision sd |
+ * shiftedBy |
+ * squareRoot sqrt |
+ * toExponential |
+ * toFixed |
+ * toFormat |
+ * toFraction |
+ * toJSON |
+ * toNumber |
+ * toPrecision |
+ * toString |
+ * valueOf |
+ *
+ */
+
+
+ var BigNumber,
+ isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,
+ mathceil = Math.ceil,
+ mathfloor = Math.floor,
+
+ bignumberError = '[BigNumber Error] ',
+ tooManyDigits = bignumberError + 'Number primitive has more than 15 significant digits: ',
+
+ BASE = 1e14,
+ LOG_BASE = 14,
+ MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1
+ // MAX_INT32 = 0x7fffffff, // 2^31 - 1
+ POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13],
+ SQRT_BASE = 1e7,
+
+ // EDITABLE
+ // The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and
+ // the arguments to toExponential, toFixed, toFormat, and toPrecision.
+ MAX = 1E9; // 0 to MAX_INT32
+
+
+ /*
+ * Create and return a BigNumber constructor.
+ */
+ function clone(configObject) {
+ var div, convertBase, parseNumeric,
+ P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },
+ ONE = new BigNumber(1),
+
+
+ //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------
+
+
+ // The default values below must be integers within the inclusive ranges stated.
+ // The values can also be changed at run-time using BigNumber.set.
+
+ // The maximum number of decimal places for operations involving division.
+ DECIMAL_PLACES = 20, // 0 to MAX
+
+ // The rounding mode used when rounding to the above decimal places, and when using
+ // toExponential, toFixed, toFormat and toPrecision, and round (default value).
+ // UP 0 Away from zero.
+ // DOWN 1 Towards zero.
+ // CEIL 2 Towards +Infinity.
+ // FLOOR 3 Towards -Infinity.
+ // HALF_UP 4 Towards nearest neighbour. If equidistant, up.
+ // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
+ // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
+ // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
+ // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
+ ROUNDING_MODE = 4, // 0 to 8
+
+ // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]
+
+ // The exponent value at and beneath which toString returns exponential notation.
+ // Number type: -7
+ TO_EXP_NEG = -7, // 0 to -MAX
+
+ // The exponent value at and above which toString returns exponential notation.
+ // Number type: 21
+ TO_EXP_POS = 21, // 0 to MAX
+
+ // RANGE : [MIN_EXP, MAX_EXP]
+
+ // The minimum exponent value, beneath which underflow to zero occurs.
+ // Number type: -324 (5e-324)
+ MIN_EXP = -1e7, // -1 to -MAX
+
+ // The maximum exponent value, above which overflow to Infinity occurs.
+ // Number type: 308 (1.7976931348623157e+308)
+ // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.
+ MAX_EXP = 1e7, // 1 to MAX
+
+ // Whether to use cryptographically-secure random number generation, if available.
+ CRYPTO = false, // true or false
+
+ // The modulo mode used when calculating the modulus: a mod n.
+ // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
+ // The remainder (r) is calculated as: r = a - n * q.
+ //
+ // UP 0 The remainder is positive if the dividend is negative, else is negative.
+ // DOWN 1 The remainder has the same sign as the dividend.
+ // This modulo mode is commonly known as 'truncated division' and is
+ // equivalent to (a % n) in JavaScript.
+ // FLOOR 3 The remainder has the same sign as the divisor (Python %).
+ // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.
+ // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).
+ // The remainder is always positive.
+ //
+ // The truncated division, floored division, Euclidian division and IEEE 754 remainder
+ // modes are commonly used for the modulus operation.
+ // Although the other rounding modes can also be used, they may not give useful results.
+ MODULO_MODE = 1, // 0 to 9
+
+ // The maximum number of significant digits of the result of the exponentiatedBy operation.
+ // If POW_PRECISION is 0, there will be unlimited significant digits.
+ POW_PRECISION = 0, // 0 to MAX
+
+ // The format specification used by the BigNumber.prototype.toFormat method.
+ FORMAT = {
+ prefix: '',
+ groupSize: 3,
+ secondaryGroupSize: 0,
+ groupSeparator: ',',
+ decimalSeparator: '.',
+ fractionGroupSize: 0,
+ fractionGroupSeparator: '\xA0', // non-breaking space
+ suffix: ''
+ },
+
+ // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',
+ // '-', '.', whitespace, or repeated character.
+ // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'
+ ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';
+
+
+ //------------------------------------------------------------------------------------------
+
+
+ // CONSTRUCTOR
+
+
+ /*
+ * The BigNumber constructor and exported function.
+ * Create and return a new instance of a BigNumber object.
+ *
+ * v {number|string|BigNumber} A numeric value.
+ * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive.
+ */
+ function BigNumber(v, b) {
+ var alphabet, c, caseChanged, e, i, isNum, len, str,
+ x = this;
+
+ // Enable constructor call without `new`.
+ if (!(x instanceof BigNumber)) return new BigNumber(v, b);
+
+ if (b == null) {
+
+ if (v && v._isBigNumber === true) {
+ x.s = v.s;
+
+ if (!v.c || v.e > MAX_EXP) {
+ x.c = x.e = null;
+ } else if (v.e < MIN_EXP) {
+ x.c = [x.e = 0];
+ } else {
+ x.e = v.e;
+ x.c = v.c.slice();
+ }
+
+ return;
+ }
+
+ if ((isNum = typeof v == 'number') && v * 0 == 0) {
+
+ // Use `1 / n` to handle minus zero also.
+ x.s = 1 / v < 0 ? (v = -v, -1) : 1;
+
+ // Fast path for integers, where n < 2147483648 (2**31).
+ if (v === ~~v) {
+ for (e = 0, i = v; i >= 10; i /= 10, e++);
+
+ if (e > MAX_EXP) {
+ x.c = x.e = null;
+ } else {
+ x.e = e;
+ x.c = [v];
+ }
+
+ return;
+ }
+
+ str = String(v);
+ } else {
+
+ if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);
+
+ x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
+ }
+
+ // Decimal point?
+ if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
+
+ // Exponential form?
+ if ((i = str.search(/e/i)) > 0) {
+
+ // Determine exponent.
+ if (e < 0) e = i;
+ e += +str.slice(i + 1);
+ str = str.substring(0, i);
+ } else if (e < 0) {
+
+ // Integer.
+ e = str.length;
+ }
+
+ } else {
+
+ // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'
+ intCheck(b, 2, ALPHABET.length, 'Base');
+
+ // Allow exponential notation to be used with base 10 argument, while
+ // also rounding to DECIMAL_PLACES as with other bases.
+ if (b == 10) {
+ x = new BigNumber(v);
+ return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);
+ }
+
+ str = String(v);
+
+ if (isNum = typeof v == 'number') {
+
+ // Avoid potential interpretation of Infinity and NaN as base 44+ values.
+ if (v * 0 != 0) return parseNumeric(x, str, isNum, b);
+
+ x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;
+
+ // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'
+ if (BigNumber.DEBUG && str.replace(/^0\.0*|\./, '').length > 15) {
+ throw Error
+ (tooManyDigits + v);
+ }
+ } else {
+ x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
+ }
+
+ alphabet = ALPHABET.slice(0, b);
+ e = i = 0;
+
+ // Check that str is a valid base b number.
+ // Don't use RegExp, so alphabet can contain special characters.
+ for (len = str.length; i < len; i++) {
+ if (alphabet.indexOf(c = str.charAt(i)) < 0) {
+ if (c == '.') {
+
+ // If '.' is not the first character and it has not be found before.
+ if (i > e) {
+ e = len;
+ continue;
+ }
+ } else if (!caseChanged) {
+
+ // Allow e.g. hexadecimal 'FF' as well as 'ff'.
+ if (str == str.toUpperCase() && (str = str.toLowerCase()) ||
+ str == str.toLowerCase() && (str = str.toUpperCase())) {
+ caseChanged = true;
+ i = -1;
+ e = 0;
+ continue;
+ }
+ }
+
+ return parseNumeric(x, String(v), isNum, b);
+ }
+ }
+
+ // Prevent later check for length on converted number.
+ isNum = false;
+ str = convertBase(str, b, 10, x.s);
+
+ // Decimal point?
+ if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
+ else e = str.length;
+ }
+
+ // Determine leading zeros.
+ for (i = 0; str.charCodeAt(i) === 48; i++);
+
+ // Determine trailing zeros.
+ for (len = str.length; str.charCodeAt(--len) === 48;);
+
+ if (str = str.slice(i, ++len)) {
+ len -= i;
+
+ // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'
+ if (isNum && BigNumber.DEBUG &&
+ len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {
+ throw Error
+ (tooManyDigits + (x.s * v));
+ }
+
+ // Overflow?
+ if ((e = e - i - 1) > MAX_EXP) {
+
+ // Infinity.
+ x.c = x.e = null;
+
+ // Underflow?
+ } else if (e < MIN_EXP) {
+
+ // Zero.
+ x.c = [x.e = 0];
+ } else {
+ x.e = e;
+ x.c = [];
+
+ // Transform base
+
+ // e is the base 10 exponent.
+ // i is where to slice str to get the first element of the coefficient array.
+ i = (e + 1) % LOG_BASE;
+ if (e < 0) i += LOG_BASE; // i < 1
+
+ if (i < len) {
+ if (i) x.c.push(+str.slice(0, i));
+
+ for (len -= LOG_BASE; i < len;) {
+ x.c.push(+str.slice(i, i += LOG_BASE));
+ }
+
+ i = LOG_BASE - (str = str.slice(i)).length;
+ } else {
+ i -= len;
+ }
+
+ for (; i--; str += '0');
+ x.c.push(+str);
+ }
+ } else {
+
+ // Zero.
+ x.c = [x.e = 0];
+ }
+ }
+
+
+ // CONSTRUCTOR PROPERTIES
+
+
+ BigNumber.clone = clone;
+
+ BigNumber.ROUND_UP = 0;
+ BigNumber.ROUND_DOWN = 1;
+ BigNumber.ROUND_CEIL = 2;
+ BigNumber.ROUND_FLOOR = 3;
+ BigNumber.ROUND_HALF_UP = 4;
+ BigNumber.ROUND_HALF_DOWN = 5;
+ BigNumber.ROUND_HALF_EVEN = 6;
+ BigNumber.ROUND_HALF_CEIL = 7;
+ BigNumber.ROUND_HALF_FLOOR = 8;
+ BigNumber.EUCLID = 9;
+
+
+ /*
+ * Configure infrequently-changing library-wide settings.
+ *
+ * Accept an object with the following optional properties (if the value of a property is
+ * a number, it must be an integer within the inclusive range stated):
+ *
+ * DECIMAL_PLACES {number} 0 to MAX
+ * ROUNDING_MODE {number} 0 to 8
+ * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]
+ * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]
+ * CRYPTO {boolean} true or false
+ * MODULO_MODE {number} 0 to 9
+ * POW_PRECISION {number} 0 to MAX
+ * ALPHABET {string} A string of two or more unique characters which does
+ * not contain '.'.
+ * FORMAT {object} An object with some of the following properties:
+ * prefix {string}
+ * groupSize {number}
+ * secondaryGroupSize {number}
+ * groupSeparator {string}
+ * decimalSeparator {string}
+ * fractionGroupSize {number}
+ * fractionGroupSeparator {string}
+ * suffix {string}
+ *
+ * (The values assigned to the above FORMAT object properties are not checked for validity.)
+ *
+ * E.g.
+ * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })
+ *
+ * Ignore properties/parameters set to null or undefined, except for ALPHABET.
+ *
+ * Return an object with the properties current values.
+ */
+ BigNumber.config = BigNumber.set = function (obj) {
+ var p, v;
+
+ if (obj != null) {
+
+ if (typeof obj == 'object') {
+
+ // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.
+ // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'
+ if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {
+ v = obj[p];
+ intCheck(v, 0, MAX, p);
+ DECIMAL_PLACES = v;
+ }
+
+ // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.
+ // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'
+ if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {
+ v = obj[p];
+ intCheck(v, 0, 8, p);
+ ROUNDING_MODE = v;
+ }
+
+ // EXPONENTIAL_AT {number|number[]}
+ // Integer, -MAX to MAX inclusive or
+ // [integer -MAX to 0 inclusive, 0 to MAX inclusive].
+ // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'
+ if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {
+ v = obj[p];
+ if (v && v.pop) {
+ intCheck(v[0], -MAX, 0, p);
+ intCheck(v[1], 0, MAX, p);
+ TO_EXP_NEG = v[0];
+ TO_EXP_POS = v[1];
+ } else {
+ intCheck(v, -MAX, MAX, p);
+ TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);
+ }
+ }
+
+ // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or
+ // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].
+ // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'
+ if (obj.hasOwnProperty(p = 'RANGE')) {
+ v = obj[p];
+ if (v && v.pop) {
+ intCheck(v[0], -MAX, -1, p);
+ intCheck(v[1], 1, MAX, p);
+ MIN_EXP = v[0];
+ MAX_EXP = v[1];
+ } else {
+ intCheck(v, -MAX, MAX, p);
+ if (v) {
+ MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);
+ } else {
+ throw Error
+ (bignumberError + p + ' cannot be zero: ' + v);
+ }
+ }
+ }
+
+ // CRYPTO {boolean} true or false.
+ // '[BigNumber Error] CRYPTO not true or false: {v}'
+ // '[BigNumber Error] crypto unavailable'
+ if (obj.hasOwnProperty(p = 'CRYPTO')) {
+ v = obj[p];
+ if (v === !!v) {
+ if (v) {
+ if (typeof crypto != 'undefined' && crypto &&
+ (crypto.getRandomValues || crypto.randomBytes)) {
+ CRYPTO = v;
+ } else {
+ CRYPTO = !v;
+ throw Error
+ (bignumberError + 'crypto unavailable');
+ }
+ } else {
+ CRYPTO = v;
+ }
+ } else {
+ throw Error
+ (bignumberError + p + ' not true or false: ' + v);
+ }
+ }
+
+ // MODULO_MODE {number} Integer, 0 to 9 inclusive.
+ // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'
+ if (obj.hasOwnProperty(p = 'MODULO_MODE')) {
+ v = obj[p];
+ intCheck(v, 0, 9, p);
+ MODULO_MODE = v;
+ }
+
+ // POW_PRECISION {number} Integer, 0 to MAX inclusive.
+ // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'
+ if (obj.hasOwnProperty(p = 'POW_PRECISION')) {
+ v = obj[p];
+ intCheck(v, 0, MAX, p);
+ POW_PRECISION = v;
+ }
+
+ // FORMAT {object}
+ // '[BigNumber Error] FORMAT not an object: {v}'
+ if (obj.hasOwnProperty(p = 'FORMAT')) {
+ v = obj[p];
+ if (typeof v == 'object') FORMAT = v;
+ else throw Error
+ (bignumberError + p + ' not an object: ' + v);
+ }
+
+ // ALPHABET {string}
+ // '[BigNumber Error] ALPHABET invalid: {v}'
+ if (obj.hasOwnProperty(p = 'ALPHABET')) {
+ v = obj[p];
+
+ // Disallow if only one character,
+ // or if it contains '+', '-', '.', whitespace, or a repeated character.
+ if (typeof v == 'string' && !/^.$|[+-.\s]|(.).*\1/.test(v)) {
+ ALPHABET = v;
+ } else {
+ throw Error
+ (bignumberError + p + ' invalid: ' + v);
+ }
+ }
+
+ } else {
+
+ // '[BigNumber Error] Object expected: {v}'
+ throw Error
+ (bignumberError + 'Object expected: ' + obj);
+ }
+ }
+
+ return {
+ DECIMAL_PLACES: DECIMAL_PLACES,
+ ROUNDING_MODE: ROUNDING_MODE,
+ EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
+ RANGE: [MIN_EXP, MAX_EXP],
+ CRYPTO: CRYPTO,
+ MODULO_MODE: MODULO_MODE,
+ POW_PRECISION: POW_PRECISION,
+ FORMAT: FORMAT,
+ ALPHABET: ALPHABET
+ };
+ };
+
+
+ /*
+ * Return true if v is a BigNumber instance, otherwise return false.
+ *
+ * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed.
+ *
+ * v {any}
+ *
+ * '[BigNumber Error] Invalid BigNumber: {v}'
+ */
+ BigNumber.isBigNumber = function (v) {
+ if (!v || v._isBigNumber !== true) return false;
+ if (!BigNumber.DEBUG) return true;
+
+ var i, n,
+ c = v.c,
+ e = v.e,
+ s = v.s;
+
+ out: if ({}.toString.call(c) == '[object Array]') {
+
+ if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {
+
+ // If the first element is zero, the BigNumber value must be zero.
+ if (c[0] === 0) {
+ if (e === 0 && c.length === 1) return true;
+ break out;
+ }
+
+ // Calculate number of digits that c[0] should have, based on the exponent.
+ i = (e + 1) % LOG_BASE;
+ if (i < 1) i += LOG_BASE;
+
+ // Calculate number of digits of c[0].
+ //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) {
+ if (String(c[0]).length == i) {
+
+ for (i = 0; i < c.length; i++) {
+ n = c[i];
+ if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;
+ }
+
+ // Last element cannot be zero, unless it is the only element.
+ if (n !== 0) return true;
+ }
+ }
+
+ // Infinity/NaN
+ } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {
+ return true;
+ }
+
+ throw Error
+ (bignumberError + 'Invalid BigNumber: ' + v);
+ };
+
+
+ /*
+ * Return a new BigNumber whose value is the maximum of the arguments.
+ *
+ * arguments {number|string|BigNumber}
+ */
+ BigNumber.maximum = BigNumber.max = function () {
+ return maxOrMin(arguments, P.lt);
+ };
+
+
+ /*
+ * Return a new BigNumber whose value is the minimum of the arguments.
+ *
+ * arguments {number|string|BigNumber}
+ */
+ BigNumber.minimum = BigNumber.min = function () {
+ return maxOrMin(arguments, P.gt);
+ };
+
+
+ /*
+ * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,
+ * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing
+ * zeros are produced).
+ *
+ * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
+ *
+ * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'
+ * '[BigNumber Error] crypto unavailable'
+ */
+ BigNumber.random = (function () {
+ var pow2_53 = 0x20000000000000;
+
+ // Return a 53 bit integer n, where 0 <= n < 9007199254740992.
+ // Check if Math.random() produces more than 32 bits of randomness.
+ // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.
+ // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.
+ var random53bitInt = (Math.random() * pow2_53) & 0x1fffff
+ ? function () { return mathfloor(Math.random() * pow2_53); }
+ : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +
+ (Math.random() * 0x800000 | 0); };
+
+ return function (dp) {
+ var a, b, e, k, v,
+ i = 0,
+ c = [],
+ rand = new BigNumber(ONE);
+
+ if (dp == null) dp = DECIMAL_PLACES;
+ else intCheck(dp, 0, MAX);
+
+ k = mathceil(dp / LOG_BASE);
+
+ if (CRYPTO) {
+
+ // Browsers supporting crypto.getRandomValues.
+ if (crypto.getRandomValues) {
+
+ a = crypto.getRandomValues(new Uint32Array(k *= 2));
+
+ for (; i < k;) {
+
+ // 53 bits:
+ // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)
+ // 11111 11111111 11111111 11111111 11100000 00000000 00000000
+ // ((Math.pow(2, 32) - 1) >>> 11).toString(2)
+ // 11111 11111111 11111111
+ // 0x20000 is 2^21.
+ v = a[i] * 0x20000 + (a[i + 1] >>> 11);
+
+ // Rejection sampling:
+ // 0 <= v < 9007199254740992
+ // Probability that v >= 9e15, is
+ // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251
+ if (v >= 9e15) {
+ b = crypto.getRandomValues(new Uint32Array(2));
+ a[i] = b[0];
+ a[i + 1] = b[1];
+ } else {
+
+ // 0 <= v <= 8999999999999999
+ // 0 <= (v % 1e14) <= 99999999999999
+ c.push(v % 1e14);
+ i += 2;
+ }
+ }
+ i = k / 2;
+
+ // Node.js supporting crypto.randomBytes.
+ } else if (crypto.randomBytes) {
+
+ // buffer
+ a = crypto.randomBytes(k *= 7);
+
+ for (; i < k;) {
+
+ // 0x1000000000000 is 2^48, 0x10000000000 is 2^40
+ // 0x100000000 is 2^32, 0x1000000 is 2^24
+ // 11111 11111111 11111111 11111111 11111111 11111111 11111111
+ // 0 <= v < 9007199254740992
+ v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +
+ (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +
+ (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];
+
+ if (v >= 9e15) {
+ crypto.randomBytes(7).copy(a, i);
+ } else {
+
+ // 0 <= (v % 1e14) <= 99999999999999
+ c.push(v % 1e14);
+ i += 7;
+ }
+ }
+ i = k / 7;
+ } else {
+ CRYPTO = false;
+ throw Error
+ (bignumberError + 'crypto unavailable');
+ }
+ }
+
+ // Use Math.random.
+ if (!CRYPTO) {
+
+ for (; i < k;) {
+ v = random53bitInt();
+ if (v < 9e15) c[i++] = v % 1e14;
+ }
+ }
+
+ k = c[--i];
+ dp %= LOG_BASE;
+
+ // Convert trailing digits to zeros according to dp.
+ if (k && dp) {
+ v = POWS_TEN[LOG_BASE - dp];
+ c[i] = mathfloor(k / v) * v;
+ }
+
+ // Remove trailing elements which are zero.
+ for (; c[i] === 0; c.pop(), i--);
+
+ // Zero?
+ if (i < 0) {
+ c = [e = 0];
+ } else {
+
+ // Remove leading elements which are zero and adjust exponent accordingly.
+ for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);
+
+ // Count the digits of the first element of c to determine leading zeros, and...
+ for (i = 1, v = c[0]; v >= 10; v /= 10, i++);
+
+ // adjust the exponent accordingly.
+ if (i < LOG_BASE) e -= LOG_BASE - i;
+ }
+
+ rand.e = e;
+ rand.c = c;
+ return rand;
+ };
+ })();
+
+
+ /*
+ * Return a BigNumber whose value is the sum of the arguments.
+ *
+ * arguments {number|string|BigNumber}
+ */
+ BigNumber.sum = function () {
+ var i = 1,
+ args = arguments,
+ sum = new BigNumber(args[0]);
+ for (; i < args.length;) sum = sum.plus(args[i++]);
+ return sum;
+ };
+
+
+ // PRIVATE FUNCTIONS
+
+
+ // Called by BigNumber and BigNumber.prototype.toString.
+ convertBase = (function () {
+ var decimal = '0123456789';
+
+ /*
+ * Convert string of baseIn to an array of numbers of baseOut.
+ * Eg. toBaseOut('255', 10, 16) returns [15, 15].
+ * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].
+ */
+ function toBaseOut(str, baseIn, baseOut, alphabet) {
+ var j,
+ arr = [0],
+ arrL,
+ i = 0,
+ len = str.length;
+
+ for (; i < len;) {
+ for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);
+
+ arr[0] += alphabet.indexOf(str.charAt(i++));
+
+ for (j = 0; j < arr.length; j++) {
+
+ if (arr[j] > baseOut - 1) {
+ if (arr[j + 1] == null) arr[j + 1] = 0;
+ arr[j + 1] += arr[j] / baseOut | 0;
+ arr[j] %= baseOut;
+ }
+ }
+ }
+
+ return arr.reverse();
+ }
+
+ // Convert a numeric string of baseIn to a numeric string of baseOut.
+ // If the caller is toString, we are converting from base 10 to baseOut.
+ // If the caller is BigNumber, we are converting from baseIn to base 10.
+ return function (str, baseIn, baseOut, sign, callerIsToString) {
+ var alphabet, d, e, k, r, x, xc, y,
+ i = str.indexOf('.'),
+ dp = DECIMAL_PLACES,
+ rm = ROUNDING_MODE;
+
+ // Non-integer.
+ if (i >= 0) {
+ k = POW_PRECISION;
+
+ // Unlimited precision.
+ POW_PRECISION = 0;
+ str = str.replace('.', '');
+ y = new BigNumber(baseIn);
+ x = y.pow(str.length - i);
+ POW_PRECISION = k;
+
+ // Convert str as if an integer, then restore the fraction part by dividing the
+ // result by its base raised to a power.
+
+ y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),
+ 10, baseOut, decimal);
+ y.e = y.c.length;
+ }
+
+ // Convert the number as integer.
+
+ xc = toBaseOut(str, baseIn, baseOut, callerIsToString
+ ? (alphabet = ALPHABET, decimal)
+ : (alphabet = decimal, ALPHABET));
+
+ // xc now represents str as an integer and converted to baseOut. e is the exponent.
+ e = k = xc.length;
+
+ // Remove trailing zeros.
+ for (; xc[--k] == 0; xc.pop());
+
+ // Zero?
+ if (!xc[0]) return alphabet.charAt(0);
+
+ // Does str represent an integer? If so, no need for the division.
+ if (i < 0) {
+ --e;
+ } else {
+ x.c = xc;
+ x.e = e;
+
+ // The sign is needed for correct rounding.
+ x.s = sign;
+ x = div(x, y, dp, rm, baseOut);
+ xc = x.c;
+ r = x.r;
+ e = x.e;
+ }
+
+ // xc now represents str converted to baseOut.
+
+ // THe index of the rounding digit.
+ d = e + dp + 1;
+
+ // The rounding digit: the digit to the right of the digit that may be rounded up.
+ i = xc[d];
+
+ // Look at the rounding digits and mode to determine whether to round up.
+
+ k = baseOut / 2;
+ r = r || d < 0 || xc[d + 1] != null;
+
+ r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))
+ : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||
+ rm == (x.s < 0 ? 8 : 7));
+
+ // If the index of the rounding digit is not greater than zero, or xc represents
+ // zero, then the result of the base conversion is zero or, if rounding up, a value
+ // such as 0.00001.
+ if (d < 1 || !xc[0]) {
+
+ // 1^-dp or 0
+ str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
+ } else {
+
+ // Truncate xc to the required number of decimal places.
+ xc.length = d;
+
+ // Round up?
+ if (r) {
+
+ // Rounding up may mean the previous digit has to be rounded up and so on.
+ for (--baseOut; ++xc[--d] > baseOut;) {
+ xc[d] = 0;
+
+ if (!d) {
+ ++e;
+ xc = [1].concat(xc);
+ }
+ }
+ }
+
+ // Determine trailing zeros.
+ for (k = xc.length; !xc[--k];);
+
+ // E.g. [4, 11, 15] becomes 4bf.
+ for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));
+
+ // Add leading zeros, decimal point and trailing zeros as required.
+ str = toFixedPoint(str, e, alphabet.charAt(0));
+ }
+
+ // The caller will add the sign.
+ return str;
+ };
+ })();
+
+
+ // Perform division in the specified base. Called by div and convertBase.
+ div = (function () {
+
+ // Assume non-zero x and k.
+ function multiply(x, k, base) {
+ var m, temp, xlo, xhi,
+ carry = 0,
+ i = x.length,
+ klo = k % SQRT_BASE,
+ khi = k / SQRT_BASE | 0;
+
+ for (x = x.slice(); i--;) {
+ xlo = x[i] % SQRT_BASE;
+ xhi = x[i] / SQRT_BASE | 0;
+ m = khi * xlo + xhi * klo;
+ temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;
+ carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;
+ x[i] = temp % base;
+ }
+
+ if (carry) x = [carry].concat(x);
+
+ return x;
+ }
+
+ function compare(a, b, aL, bL) {
+ var i, cmp;
+
+ if (aL != bL) {
+ cmp = aL > bL ? 1 : -1;
+ } else {
+
+ for (i = cmp = 0; i < aL; i++) {
+
+ if (a[i] != b[i]) {
+ cmp = a[i] > b[i] ? 1 : -1;
+ break;
+ }
+ }
+ }
+
+ return cmp;
+ }
+
+ function subtract(a, b, aL, base) {
+ var i = 0;
+
+ // Subtract b from a.
+ for (; aL--;) {
+ a[aL] -= i;
+ i = a[aL] < b[aL] ? 1 : 0;
+ a[aL] = i * base + a[aL] - b[aL];
+ }
+
+ // Remove leading zeros.
+ for (; !a[0] && a.length > 1; a.splice(0, 1));
+ }
+
+ // x: dividend, y: divisor.
+ return function (x, y, dp, rm, base) {
+ var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,
+ yL, yz,
+ s = x.s == y.s ? 1 : -1,
+ xc = x.c,
+ yc = y.c;
+
+ // Either NaN, Infinity or 0?
+ if (!xc || !xc[0] || !yc || !yc[0]) {
+
+ return new BigNumber(
+
+ // Return NaN if either NaN, or both Infinity or 0.
+ !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :
+
+ // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
+ xc && xc[0] == 0 || !yc ? s * 0 : s / 0
+ );
+ }
+
+ q = new BigNumber(s);
+ qc = q.c = [];
+ e = x.e - y.e;
+ s = dp + e + 1;
+
+ if (!base) {
+ base = BASE;
+ e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);
+ s = s / LOG_BASE | 0;
+ }
+
+ // Result exponent may be one less then the current value of e.
+ // The coefficients of the BigNumbers from convertBase may have trailing zeros.
+ for (i = 0; yc[i] == (xc[i] || 0); i++);
+
+ if (yc[i] > (xc[i] || 0)) e--;
+
+ if (s < 0) {
+ qc.push(1);
+ more = true;
+ } else {
+ xL = xc.length;
+ yL = yc.length;
+ i = 0;
+ s += 2;
+
+ // Normalise xc and yc so highest order digit of yc is >= base / 2.
+
+ n = mathfloor(base / (yc[0] + 1));
+
+ // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.
+ // if (n > 1 || n++ == 1 && yc[0] < base / 2) {
+ if (n > 1) {
+ yc = multiply(yc, n, base);
+ xc = multiply(xc, n, base);
+ yL = yc.length;
+ xL = xc.length;
+ }
+
+ xi = yL;
+ rem = xc.slice(0, yL);
+ remL = rem.length;
+
+ // Add zeros to make remainder as long as divisor.
+ for (; remL < yL; rem[remL++] = 0);
+ yz = yc.slice();
+ yz = [0].concat(yz);
+ yc0 = yc[0];
+ if (yc[1] >= base / 2) yc0++;
+ // Not necessary, but to prevent trial digit n > base, when using base 3.
+ // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;
+
+ do {
+ n = 0;
+
+ // Compare divisor and remainder.
+ cmp = compare(yc, rem, yL, remL);
+
+ // If divisor < remainder.
+ if (cmp < 0) {
+
+ // Calculate trial digit, n.
+
+ rem0 = rem[0];
+ if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
+
+ // n is how many times the divisor goes into the current remainder.
+ n = mathfloor(rem0 / yc0);
+
+ // Algorithm:
+ // product = divisor multiplied by trial digit (n).
+ // Compare product and remainder.
+ // If product is greater than remainder:
+ // Subtract divisor from product, decrement trial digit.
+ // Subtract product from remainder.
+ // If product was less than remainder at the last compare:
+ // Compare new remainder and divisor.
+ // If remainder is greater than divisor:
+ // Subtract divisor from remainder, increment trial digit.
+
+ if (n > 1) {
+
+ // n may be > base only when base is 3.
+ if (n >= base) n = base - 1;
+
+ // product = divisor * trial digit.
+ prod = multiply(yc, n, base);
+ prodL = prod.length;
+ remL = rem.length;
+
+ // Compare product and remainder.
+ // If product > remainder then trial digit n too high.
+ // n is 1 too high about 5% of the time, and is not known to have
+ // ever been more than 1 too high.
+ while (compare(prod, rem, prodL, remL) == 1) {
+ n--;
+
+ // Subtract divisor from product.
+ subtract(prod, yL < prodL ? yz : yc, prodL, base);
+ prodL = prod.length;
+ cmp = 1;
+ }
+ } else {
+
+ // n is 0 or 1, cmp is -1.
+ // If n is 0, there is no need to compare yc and rem again below,
+ // so change cmp to 1 to avoid it.
+ // If n is 1, leave cmp as -1, so yc and rem are compared again.
+ if (n == 0) {
+
+ // divisor < remainder, so n must be at least 1.
+ cmp = n = 1;
+ }
+
+ // product = divisor
+ prod = yc.slice();
+ prodL = prod.length;
+ }
+
+ if (prodL < remL) prod = [0].concat(prod);
+
+ // Subtract product from remainder.
+ subtract(rem, prod, remL, base);
+ remL = rem.length;
+
+ // If product was < remainder.
+ if (cmp == -1) {
+
+ // Compare divisor and new remainder.
+ // If divisor < new remainder, subtract divisor from remainder.
+ // Trial digit n too low.
+ // n is 1 too low about 5% of the time, and very rarely 2 too low.
+ while (compare(yc, rem, yL, remL) < 1) {
+ n++;
+
+ // Subtract divisor from remainder.
+ subtract(rem, yL < remL ? yz : yc, remL, base);
+ remL = rem.length;
+ }
+ }
+ } else if (cmp === 0) {
+ n++;
+ rem = [0];
+ } // else cmp === 1 and n will be 0
+
+ // Add the next digit, n, to the result array.
+ qc[i++] = n;
+
+ // Update the remainder.
+ if (rem[0]) {
+ rem[remL++] = xc[xi] || 0;
+ } else {
+ rem = [xc[xi]];
+ remL = 1;
+ }
+ } while ((xi++ < xL || rem[0] != null) && s--);
+
+ more = rem[0] != null;
+
+ // Leading zero?
+ if (!qc[0]) qc.splice(0, 1);
+ }
+
+ if (base == BASE) {
+
+ // To calculate q.e, first get the number of digits of qc[0].
+ for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);
+
+ round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);
+
+ // Caller is convertBase.
+ } else {
+ q.e = e;
+ q.r = +more;
+ }
+
+ return q;
+ };
+ })();
+
+
+ /*
+ * Return a string representing the value of BigNumber n in fixed-point or exponential
+ * notation rounded to the specified decimal places or significant digits.
+ *
+ * n: a BigNumber.
+ * i: the index of the last digit required (i.e. the digit that may be rounded up).
+ * rm: the rounding mode.
+ * id: 1 (toExponential) or 2 (toPrecision).
+ */
+ function format(n, i, rm, id) {
+ var c0, e, ne, len, str;
+
+ if (rm == null) rm = ROUNDING_MODE;
+ else intCheck(rm, 0, 8);
+
+ if (!n.c) return n.toString();
+
+ c0 = n.c[0];
+ ne = n.e;
+
+ if (i == null) {
+ str = coeffToString(n.c);
+ str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)
+ ? toExponential(str, ne)
+ : toFixedPoint(str, ne, '0');
+ } else {
+ n = round(new BigNumber(n), i, rm);
+
+ // n.e may have changed if the value was rounded up.
+ e = n.e;
+
+ str = coeffToString(n.c);
+ len = str.length;
+
+ // toPrecision returns exponential notation if the number of significant digits
+ // specified is less than the number of digits necessary to represent the integer
+ // part of the value in fixed-point notation.
+
+ // Exponential notation.
+ if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {
+
+ // Append zeros?
+ for (; len < i; str += '0', len++);
+ str = toExponential(str, e);
+
+ // Fixed-point notation.
+ } else {
+ i -= ne;
+ str = toFixedPoint(str, e, '0');
+
+ // Append zeros?
+ if (e + 1 > len) {
+ if (--i > 0) for (str += '.'; i--; str += '0');
+ } else {
+ i += e - len;
+ if (i > 0) {
+ if (e + 1 == len) str += '.';
+ for (; i--; str += '0');
+ }
+ }
+ }
+ }
+
+ return n.s < 0 && c0 ? '-' + str : str;
+ }
+
+
+ // Handle BigNumber.max and BigNumber.min.
+ function maxOrMin(args, method) {
+ var n,
+ i = 1,
+ m = new BigNumber(args[0]);
+
+ for (; i < args.length; i++) {
+ n = new BigNumber(args[i]);
+
+ // If any number is NaN, return NaN.
+ if (!n.s) {
+ m = n;
+ break;
+ } else if (method.call(m, n)) {
+ m = n;
+ }
+ }
+
+ return m;
+ }
+
+
+ /*
+ * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.
+ * Called by minus, plus and times.
+ */
+ function normalise(n, c, e) {
+ var i = 1,
+ j = c.length;
+
+ // Remove trailing zeros.
+ for (; !c[--j]; c.pop());
+
+ // Calculate the base 10 exponent. First get the number of digits of c[0].
+ for (j = c[0]; j >= 10; j /= 10, i++);
+
+ // Overflow?
+ if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {
+
+ // Infinity.
+ n.c = n.e = null;
+
+ // Underflow?
+ } else if (e < MIN_EXP) {
+
+ // Zero.
+ n.c = [n.e = 0];
+ } else {
+ n.e = e;
+ n.c = c;
+ }
+
+ return n;
+ }
+
+
+ // Handle values that fail the validity test in BigNumber.
+ parseNumeric = (function () {
+ var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i,
+ dotAfter = /^([^.]+)\.$/,
+ dotBefore = /^\.([^.]+)$/,
+ isInfinityOrNaN = /^-?(Infinity|NaN)$/,
+ whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
+
+ return function (x, str, isNum, b) {
+ var base,
+ s = isNum ? str : str.replace(whitespaceOrPlus, '');
+
+ // No exception on ±Infinity or NaN.
+ if (isInfinityOrNaN.test(s)) {
+ x.s = isNaN(s) ? null : s < 0 ? -1 : 1;
+ } else {
+ if (!isNum) {
+
+ // basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i
+ s = s.replace(basePrefix, function (m, p1, p2) {
+ base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;
+ return !b || b == base ? p1 : m;
+ });
+
+ if (b) {
+ base = b;
+
+ // E.g. '1.' to '1', '.1' to '0.1'
+ s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');
+ }
+
+ if (str != s) return new BigNumber(s, base);
+ }
+
+ // '[BigNumber Error] Not a number: {n}'
+ // '[BigNumber Error] Not a base {b} number: {n}'
+ if (BigNumber.DEBUG) {
+ throw Error
+ (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);
+ }
+
+ // NaN
+ x.s = null;
+ }
+
+ x.c = x.e = null;
+ }
+ })();
+
+
+ /*
+ * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.
+ * If r is truthy, it is known that there are more digits after the rounding digit.
+ */
+ function round(x, sd, rm, r) {
+ var d, i, j, k, n, ni, rd,
+ xc = x.c,
+ pows10 = POWS_TEN;
+
+ // if x is not Infinity or NaN...
+ if (xc) {
+
+ // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.
+ // n is a base 1e14 number, the value of the element of array x.c containing rd.
+ // ni is the index of n within x.c.
+ // d is the number of digits of n.
+ // i is the index of rd within n including leading zeros.
+ // j is the actual index of rd within n (if < 0, rd is a leading zero).
+ out: {
+
+ // Get the number of digits of the first element of xc.
+ for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);
+ i = sd - d;
+
+ // If the rounding digit is in the first element of xc...
+ if (i < 0) {
+ i += LOG_BASE;
+ j = sd;
+ n = xc[ni = 0];
+
+ // Get the rounding digit at index j of n.
+ rd = n / pows10[d - j - 1] % 10 | 0;
+ } else {
+ ni = mathceil((i + 1) / LOG_BASE);
+
+ if (ni >= xc.length) {
+
+ if (r) {
+
+ // Needed by sqrt.
+ for (; xc.length <= ni; xc.push(0));
+ n = rd = 0;
+ d = 1;
+ i %= LOG_BASE;
+ j = i - LOG_BASE + 1;
+ } else {
+ break out;
+ }
+ } else {
+ n = k = xc[ni];
+
+ // Get the number of digits of n.
+ for (d = 1; k >= 10; k /= 10, d++);
+
+ // Get the index of rd within n.
+ i %= LOG_BASE;
+
+ // Get the index of rd within n, adjusted for leading zeros.
+ // The number of leading zeros of n is given by LOG_BASE - d.
+ j = i - LOG_BASE + d;
+
+ // Get the rounding digit at index j of n.
+ rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;
+ }
+ }
+
+ r = r || sd < 0 ||
+
+ // Are there any non-zero digits after the rounding digit?
+ // The expression n % pows10[d - j - 1] returns all digits of n to the right
+ // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
+ xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);
+
+ r = rm < 4
+ ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))
+ : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&
+
+ // Check whether the digit to the left of the rounding digit is odd.
+ ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||
+ rm == (x.s < 0 ? 8 : 7));
+
+ if (sd < 1 || !xc[0]) {
+ xc.length = 0;
+
+ if (r) {
+
+ // Convert sd to decimal places.
+ sd -= x.e + 1;
+
+ // 1, 0.1, 0.01, 0.001, 0.0001 etc.
+ xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
+ x.e = -sd || 0;
+ } else {
+
+ // Zero.
+ xc[0] = x.e = 0;
+ }
+
+ return x;
+ }
+
+ // Remove excess digits.
+ if (i == 0) {
+ xc.length = ni;
+ k = 1;
+ ni--;
+ } else {
+ xc.length = ni + 1;
+ k = pows10[LOG_BASE - i];
+
+ // E.g. 56700 becomes 56000 if 7 is the rounding digit.
+ // j > 0 means i > number of leading zeros of n.
+ xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;
+ }
+
+ // Round up?
+ if (r) {
+
+ for (; ;) {
+
+ // If the digit to be rounded up is in the first element of xc...
+ if (ni == 0) {
+
+ // i will be the length of xc[0] before k is added.
+ for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);
+ j = xc[0] += k;
+ for (k = 1; j >= 10; j /= 10, k++);
+
+ // if i != k the length has increased.
+ if (i != k) {
+ x.e++;
+ if (xc[0] == BASE) xc[0] = 1;
+ }
+
+ break;
+ } else {
+ xc[ni] += k;
+ if (xc[ni] != BASE) break;
+ xc[ni--] = 0;
+ k = 1;
+ }
+ }
+ }
+
+ // Remove trailing zeros.
+ for (i = xc.length; xc[--i] === 0; xc.pop());
+ }
+
+ // Overflow? Infinity.
+ if (x.e > MAX_EXP) {
+ x.c = x.e = null;
+
+ // Underflow? Zero.
+ } else if (x.e < MIN_EXP) {
+ x.c = [x.e = 0];
+ }
+ }
+
+ return x;
+ }
+
+
+ function valueOf(n) {
+ var str,
+ e = n.e;
+
+ if (e === null) return n.toString();
+
+ str = coeffToString(n.c);
+
+ str = e <= TO_EXP_NEG || e >= TO_EXP_POS
+ ? toExponential(str, e)
+ : toFixedPoint(str, e, '0');
+
+ return n.s < 0 ? '-' + str : str;
+ }
+
+
+ // PROTOTYPE/INSTANCE METHODS
+
+
+ /*
+ * Return a new BigNumber whose value is the absolute value of this BigNumber.
+ */
+ P.absoluteValue = P.abs = function () {
+ var x = new BigNumber(this);
+ if (x.s < 0) x.s = 1;
+ return x;
+ };
+
+
+ /*
+ * Return
+ * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),
+ * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),
+ * 0 if they have the same value,
+ * or null if the value of either is NaN.
+ */
+ P.comparedTo = function (y, b) {
+ return compare(this, new BigNumber(y, b));
+ };
+
+
+ /*
+ * If dp is undefined or null or true or false, return the number of decimal places of the
+ * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.
+ *
+ * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this
+ * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or
+ * ROUNDING_MODE if rm is omitted.
+ *
+ * [dp] {number} Decimal places: integer, 0 to MAX inclusive.
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+ *
+ * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'
+ */
+ P.decimalPlaces = P.dp = function (dp, rm) {
+ var c, n, v,
+ x = this;
+
+ if (dp != null) {
+ intCheck(dp, 0, MAX);
+ if (rm == null) rm = ROUNDING_MODE;
+ else intCheck(rm, 0, 8);
+
+ return round(new BigNumber(x), dp + x.e + 1, rm);
+ }
+
+ if (!(c = x.c)) return null;
+ n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
+
+ // Subtract the number of trailing zeros of the last number.
+ if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);
+ if (n < 0) n = 0;
+
+ return n;
+ };
+
+
+ /*
+ * n / 0 = I
+ * n / N = N
+ * n / I = 0
+ * 0 / n = 0
+ * 0 / 0 = N
+ * 0 / N = N
+ * 0 / I = 0
+ * N / n = N
+ * N / 0 = N
+ * N / N = N
+ * N / I = N
+ * I / n = I
+ * I / 0 = I
+ * I / N = N
+ * I / I = N
+ *
+ * Return a new BigNumber whose value is the value of this BigNumber divided by the value of
+ * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.
+ */
+ P.dividedBy = P.div = function (y, b) {
+ return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);
+ };
+
+
+ /*
+ * Return a new BigNumber whose value is the integer part of dividing the value of this
+ * BigNumber by the value of BigNumber(y, b).
+ */
+ P.dividedToIntegerBy = P.idiv = function (y, b) {
+ return div(this, new BigNumber(y, b), 0, 1);
+ };
+
+
+ /*
+ * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.
+ *
+ * If m is present, return the result modulo m.
+ * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.
+ * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.
+ *
+ * The modular power operation works efficiently when x, n, and m are integers, otherwise it
+ * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.
+ *
+ * n {number|string|BigNumber} The exponent. An integer.
+ * [m] {number|string|BigNumber} The modulus.
+ *
+ * '[BigNumber Error] Exponent not an integer: {n}'
+ */
+ P.exponentiatedBy = P.pow = function (n, m) {
+ var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,
+ x = this;
+
+ n = new BigNumber(n);
+
+ // Allow NaN and ±Infinity, but not other non-integers.
+ if (n.c && !n.isInteger()) {
+ throw Error
+ (bignumberError + 'Exponent not an integer: ' + valueOf(n));
+ }
+
+ if (m != null) m = new BigNumber(m);
+
+ // Exponent of MAX_SAFE_INTEGER is 15.
+ nIsBig = n.e > 14;
+
+ // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.
+ if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {
+
+ // The sign of the result of pow when x is negative depends on the evenness of n.
+ // If +n overflows to ±Infinity, the evenness of n would be not be known.
+ y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));
+ return m ? y.mod(m) : y;
+ }
+
+ nIsNeg = n.s < 0;
+
+ if (m) {
+
+ // x % m returns NaN if abs(m) is zero, or m is NaN.
+ if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);
+
+ isModExp = !nIsNeg && x.isInteger() && m.isInteger();
+
+ if (isModExp) x = x.mod(m);
+
+ // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.
+ // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.
+ } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0
+ // [1, 240000000]
+ ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7
+ // [80000000000000] [99999750000000]
+ : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {
+
+ // If x is negative and n is odd, k = -0, else k = 0.
+ k = x.s < 0 && isOdd(n) ? -0 : 0;
+
+ // If x >= 1, k = ±Infinity.
+ if (x.e > -1) k = 1 / k;
+
+ // If n is negative return ±0, else return ±Infinity.
+ return new BigNumber(nIsNeg ? 1 / k : k);
+
+ } else if (POW_PRECISION) {
+
+ // Truncating each coefficient array to a length of k after each multiplication
+ // equates to truncating significant digits to POW_PRECISION + [28, 41],
+ // i.e. there will be a minimum of 28 guard digits retained.
+ k = mathceil(POW_PRECISION / LOG_BASE + 2);
+ }
+
+ if (nIsBig) {
+ half = new BigNumber(0.5);
+ if (nIsNeg) n.s = 1;
+ nIsOdd = isOdd(n);
+ } else {
+ i = Math.abs(+valueOf(n));
+ nIsOdd = i % 2;
+ }
+
+ y = new BigNumber(ONE);
+
+ // Performs 54 loop iterations for n of 9007199254740991.
+ for (; ;) {
+
+ if (nIsOdd) {
+ y = y.times(x);
+ if (!y.c) break;
+
+ if (k) {
+ if (y.c.length > k) y.c.length = k;
+ } else if (isModExp) {
+ y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));
+ }
+ }
+
+ if (i) {
+ i = mathfloor(i / 2);
+ if (i === 0) break;
+ nIsOdd = i % 2;
+ } else {
+ n = n.times(half);
+ round(n, n.e + 1, 1);
+
+ if (n.e > 14) {
+ nIsOdd = isOdd(n);
+ } else {
+ i = +valueOf(n);
+ if (i === 0) break;
+ nIsOdd = i % 2;
+ }
+ }
+
+ x = x.times(x);
+
+ if (k) {
+ if (x.c && x.c.length > k) x.c.length = k;
+ } else if (isModExp) {
+ x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));
+ }
+ }
+
+ if (isModExp) return y;
+ if (nIsNeg) y = ONE.div(y);
+
+ return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;
+ };
+
+
+ /*
+ * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer
+ * using rounding mode rm, or ROUNDING_MODE if rm is omitted.
+ *
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+ *
+ * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'
+ */
+ P.integerValue = function (rm) {
+ var n = new BigNumber(this);
+ if (rm == null) rm = ROUNDING_MODE;
+ else intCheck(rm, 0, 8);
+ return round(n, n.e + 1, rm);
+ };
+
+
+ /*
+ * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),
+ * otherwise return false.
+ */
+ P.isEqualTo = P.eq = function (y, b) {
+ return compare(this, new BigNumber(y, b)) === 0;
+ };
+
+
+ /*
+ * Return true if the value of this BigNumber is a finite number, otherwise return false.
+ */
+ P.isFinite = function () {
+ return !!this.c;
+ };
+
+
+ /*
+ * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),
+ * otherwise return false.
+ */
+ P.isGreaterThan = P.gt = function (y, b) {
+ return compare(this, new BigNumber(y, b)) > 0;
+ };
+
+
+ /*
+ * Return true if the value of this BigNumber is greater than or equal to the value of
+ * BigNumber(y, b), otherwise return false.
+ */
+ P.isGreaterThanOrEqualTo = P.gte = function (y, b) {
+ return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;
+
+ };
+
+
+ /*
+ * Return true if the value of this BigNumber is an integer, otherwise return false.
+ */
+ P.isInteger = function () {
+ return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
+ };
+
+
+ /*
+ * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),
+ * otherwise return false.
+ */
+ P.isLessThan = P.lt = function (y, b) {
+ return compare(this, new BigNumber(y, b)) < 0;
+ };
+
+
+ /*
+ * Return true if the value of this BigNumber is less than or equal to the value of
+ * BigNumber(y, b), otherwise return false.
+ */
+ P.isLessThanOrEqualTo = P.lte = function (y, b) {
+ return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;
+ };
+
+
+ /*
+ * Return true if the value of this BigNumber is NaN, otherwise return false.
+ */
+ P.isNaN = function () {
+ return !this.s;
+ };
+
+
+ /*
+ * Return true if the value of this BigNumber is negative, otherwise return false.
+ */
+ P.isNegative = function () {
+ return this.s < 0;
+ };
+
+
+ /*
+ * Return true if the value of this BigNumber is positive, otherwise return false.
+ */
+ P.isPositive = function () {
+ return this.s > 0;
+ };
+
+
+ /*
+ * Return true if the value of this BigNumber is 0 or -0, otherwise return false.
+ */
+ P.isZero = function () {
+ return !!this.c && this.c[0] == 0;
+ };
+
+
+ /*
+ * n - 0 = n
+ * n - N = N
+ * n - I = -I
+ * 0 - n = -n
+ * 0 - 0 = 0
+ * 0 - N = N
+ * 0 - I = -I
+ * N - n = N
+ * N - 0 = N
+ * N - N = N
+ * N - I = N
+ * I - n = I
+ * I - 0 = I
+ * I - N = N
+ * I - I = N
+ *
+ * Return a new BigNumber whose value is the value of this BigNumber minus the value of
+ * BigNumber(y, b).
+ */
+ P.minus = function (y, b) {
+ var i, j, t, xLTy,
+ x = this,
+ a = x.s;
+
+ y = new BigNumber(y, b);
+ b = y.s;
+
+ // Either NaN?
+ if (!a || !b) return new BigNumber(NaN);
+
+ // Signs differ?
+ if (a != b) {
+ y.s = -b;
+ return x.plus(y);
+ }
+
+ var xe = x.e / LOG_BASE,
+ ye = y.e / LOG_BASE,
+ xc = x.c,
+ yc = y.c;
+
+ if (!xe || !ye) {
+
+ // Either Infinity?
+ if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);
+
+ // Either zero?
+ if (!xc[0] || !yc[0]) {
+
+ // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.
+ return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :
+
+ // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
+ ROUNDING_MODE == 3 ? -0 : 0);
+ }
+ }
+
+ xe = bitFloor(xe);
+ ye = bitFloor(ye);
+ xc = xc.slice();
+
+ // Determine which is the bigger number.
+ if (a = xe - ye) {
+
+ if (xLTy = a < 0) {
+ a = -a;
+ t = xc;
+ } else {
+ ye = xe;
+ t = yc;
+ }
+
+ t.reverse();
+
+ // Prepend zeros to equalise exponents.
+ for (b = a; b--; t.push(0));
+ t.reverse();
+ } else {
+
+ // Exponents equal. Check digit by digit.
+ j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;
+
+ for (a = b = 0; b < j; b++) {
+
+ if (xc[b] != yc[b]) {
+ xLTy = xc[b] < yc[b];
+ break;
+ }
+ }
+ }
+
+ // x < y? Point xc to the array of the bigger number.
+ if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;
+
+ b = (j = yc.length) - (i = xc.length);
+
+ // Append zeros to xc if shorter.
+ // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.
+ if (b > 0) for (; b--; xc[i++] = 0);
+ b = BASE - 1;
+
+ // Subtract yc from xc.
+ for (; j > a;) {
+
+ if (xc[--j] < yc[j]) {
+ for (i = j; i && !xc[--i]; xc[i] = b);
+ --xc[i];
+ xc[j] += BASE;
+ }
+
+ xc[j] -= yc[j];
+ }
+
+ // Remove leading zeros and adjust exponent accordingly.
+ for (; xc[0] == 0; xc.splice(0, 1), --ye);
+
+ // Zero?
+ if (!xc[0]) {
+
+ // Following IEEE 754 (2008) 6.3,
+ // n - n = +0 but n - n = -0 when rounding towards -Infinity.
+ y.s = ROUNDING_MODE == 3 ? -1 : 1;
+ y.c = [y.e = 0];
+ return y;
+ }
+
+ // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity
+ // for finite x and y.
+ return normalise(y, xc, ye);
+ };
+
+
+ /*
+ * n % 0 = N
+ * n % N = N
+ * n % I = n
+ * 0 % n = 0
+ * -0 % n = -0
+ * 0 % 0 = N
+ * 0 % N = N
+ * 0 % I = 0
+ * N % n = N
+ * N % 0 = N
+ * N % N = N
+ * N % I = N
+ * I % n = N
+ * I % 0 = N
+ * I % N = N
+ * I % I = N
+ *
+ * Return a new BigNumber whose value is the value of this BigNumber modulo the value of
+ * BigNumber(y, b). The result depends on the value of MODULO_MODE.
+ */
+ P.modulo = P.mod = function (y, b) {
+ var q, s,
+ x = this;
+
+ y = new BigNumber(y, b);
+
+ // Return NaN if x is Infinity or NaN, or y is NaN or zero.
+ if (!x.c || !y.s || y.c && !y.c[0]) {
+ return new BigNumber(NaN);
+
+ // Return x if y is Infinity or x is zero.
+ } else if (!y.c || x.c && !x.c[0]) {
+ return new BigNumber(x);
+ }
+
+ if (MODULO_MODE == 9) {
+
+ // Euclidian division: q = sign(y) * floor(x / abs(y))
+ // r = x - qy where 0 <= r < abs(y)
+ s = y.s;
+ y.s = 1;
+ q = div(x, y, 0, 3);
+ y.s = s;
+ q.s *= s;
+ } else {
+ q = div(x, y, 0, MODULO_MODE);
+ }
+
+ y = x.minus(q.times(y));
+
+ // To match JavaScript %, ensure sign of zero is sign of dividend.
+ if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;
+
+ return y;
+ };
+
+
+ /*
+ * n * 0 = 0
+ * n * N = N
+ * n * I = I
+ * 0 * n = 0
+ * 0 * 0 = 0
+ * 0 * N = N
+ * 0 * I = N
+ * N * n = N
+ * N * 0 = N
+ * N * N = N
+ * N * I = N
+ * I * n = I
+ * I * 0 = N
+ * I * N = N
+ * I * I = I
+ *
+ * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value
+ * of BigNumber(y, b).
+ */
+ P.multipliedBy = P.times = function (y, b) {
+ var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,
+ base, sqrtBase,
+ x = this,
+ xc = x.c,
+ yc = (y = new BigNumber(y, b)).c;
+
+ // Either NaN, ±Infinity or ±0?
+ if (!xc || !yc || !xc[0] || !yc[0]) {
+
+ // Return NaN if either is NaN, or one is 0 and the other is Infinity.
+ if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
+ y.c = y.e = y.s = null;
+ } else {
+ y.s *= x.s;
+
+ // Return ±Infinity if either is ±Infinity.
+ if (!xc || !yc) {
+ y.c = y.e = null;
+
+ // Return ±0 if either is ±0.
+ } else {
+ y.c = [0];
+ y.e = 0;
+ }
+ }
+
+ return y;
+ }
+
+ e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);
+ y.s *= x.s;
+ xcL = xc.length;
+ ycL = yc.length;
+
+ // Ensure xc points to longer array and xcL to its length.
+ if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;
+
+ // Initialise the result array with zeros.
+ for (i = xcL + ycL, zc = []; i--; zc.push(0));
+
+ base = BASE;
+ sqrtBase = SQRT_BASE;
+
+ for (i = ycL; --i >= 0;) {
+ c = 0;
+ ylo = yc[i] % sqrtBase;
+ yhi = yc[i] / sqrtBase | 0;
+
+ for (k = xcL, j = i + k; j > i;) {
+ xlo = xc[--k] % sqrtBase;
+ xhi = xc[k] / sqrtBase | 0;
+ m = yhi * xlo + xhi * ylo;
+ xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;
+ c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;
+ zc[j--] = xlo % base;
+ }
+
+ zc[j] = c;
+ }
+
+ if (c) {
+ ++e;
+ } else {
+ zc.splice(0, 1);
+ }
+
+ return normalise(y, zc, e);
+ };
+
+
+ /*
+ * Return a new BigNumber whose value is the value of this BigNumber negated,
+ * i.e. multiplied by -1.
+ */
+ P.negated = function () {
+ var x = new BigNumber(this);
+ x.s = -x.s || null;
+ return x;
+ };
+
+
+ /*
+ * n + 0 = n
+ * n + N = N
+ * n + I = I
+ * 0 + n = n
+ * 0 + 0 = 0
+ * 0 + N = N
+ * 0 + I = I
+ * N + n = N
+ * N + 0 = N
+ * N + N = N
+ * N + I = N
+ * I + n = I
+ * I + 0 = I
+ * I + N = N
+ * I + I = I
+ *
+ * Return a new BigNumber whose value is the value of this BigNumber plus the value of
+ * BigNumber(y, b).
+ */
+ P.plus = function (y, b) {
+ var t,
+ x = this,
+ a = x.s;
+
+ y = new BigNumber(y, b);
+ b = y.s;
+
+ // Either NaN?
+ if (!a || !b) return new BigNumber(NaN);
+
+ // Signs differ?
+ if (a != b) {
+ y.s = -b;
+ return x.minus(y);
+ }
+
+ var xe = x.e / LOG_BASE,
+ ye = y.e / LOG_BASE,
+ xc = x.c,
+ yc = y.c;
+
+ if (!xe || !ye) {
+
+ // Return ±Infinity if either ±Infinity.
+ if (!xc || !yc) return new BigNumber(a / 0);
+
+ // Either zero?
+ // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.
+ if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);
+ }
+
+ xe = bitFloor(xe);
+ ye = bitFloor(ye);
+ xc = xc.slice();
+
+ // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.
+ if (a = xe - ye) {
+ if (a > 0) {
+ ye = xe;
+ t = yc;
+ } else {
+ a = -a;
+ t = xc;
+ }
+
+ t.reverse();
+ for (; a--; t.push(0));
+ t.reverse();
+ }
+
+ a = xc.length;
+ b = yc.length;
+
+ // Point xc to the longer array, and b to the shorter length.
+ if (a - b < 0) t = yc, yc = xc, xc = t, b = a;
+
+ // Only start adding at yc.length - 1 as the further digits of xc can be ignored.
+ for (a = 0; b;) {
+ a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;
+ xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;
+ }
+
+ if (a) {
+ xc = [a].concat(xc);
+ ++ye;
+ }
+
+ // No need to check for zero, as +x + +y != 0 && -x + -y != 0
+ // ye = MAX_EXP + 1 possible
+ return normalise(y, xc, ye);
+ };
+
+
+ /*
+ * If sd is undefined or null or true or false, return the number of significant digits of
+ * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.
+ * If sd is true include integer-part trailing zeros in the count.
+ *
+ * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this
+ * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or
+ * ROUNDING_MODE if rm is omitted.
+ *
+ * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.
+ * boolean: whether to count integer-part trailing zeros: true or false.
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+ *
+ * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'
+ */
+ P.precision = P.sd = function (sd, rm) {
+ var c, n, v,
+ x = this;
+
+ if (sd != null && sd !== !!sd) {
+ intCheck(sd, 1, MAX);
+ if (rm == null) rm = ROUNDING_MODE;
+ else intCheck(rm, 0, 8);
+
+ return round(new BigNumber(x), sd, rm);
+ }
+
+ if (!(c = x.c)) return null;
+ v = c.length - 1;
+ n = v * LOG_BASE + 1;
+
+ if (v = c[v]) {
+
+ // Subtract the number of trailing zeros of the last element.
+ for (; v % 10 == 0; v /= 10, n--);
+
+ // Add the number of digits of the first element.
+ for (v = c[0]; v >= 10; v /= 10, n++);
+ }
+
+ if (sd && x.e + 1 > n) n = x.e + 1;
+
+ return n;
+ };
+
+
+ /*
+ * Return a new BigNumber whose value is the value of this BigNumber shifted by k places
+ * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.
+ *
+ * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.
+ *
+ * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'
+ */
+ P.shiftedBy = function (k) {
+ intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
+ return this.times('1e' + k);
+ };
+
+
+ /*
+ * sqrt(-n) = N
+ * sqrt(N) = N
+ * sqrt(-I) = N
+ * sqrt(I) = I
+ * sqrt(0) = 0
+ * sqrt(-0) = -0
+ *
+ * Return a new BigNumber whose value is the square root of the value of this BigNumber,
+ * rounded according to DECIMAL_PLACES and ROUNDING_MODE.
+ */
+ P.squareRoot = P.sqrt = function () {
+ var m, n, r, rep, t,
+ x = this,
+ c = x.c,
+ s = x.s,
+ e = x.e,
+ dp = DECIMAL_PLACES + 4,
+ half = new BigNumber('0.5');
+
+ // Negative/NaN/Infinity/zero?
+ if (s !== 1 || !c || !c[0]) {
+ return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);
+ }
+
+ // Initial estimate.
+ s = Math.sqrt(+valueOf(x));
+
+ // Math.sqrt underflow/overflow?
+ // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
+ if (s == 0 || s == 1 / 0) {
+ n = coeffToString(c);
+ if ((n.length + e) % 2 == 0) n += '0';
+ s = Math.sqrt(+n);
+ e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);
+
+ if (s == 1 / 0) {
+ n = '1e' + e;
+ } else {
+ n = s.toExponential();
+ n = n.slice(0, n.indexOf('e') + 1) + e;
+ }
+
+ r = new BigNumber(n);
+ } else {
+ r = new BigNumber(s + '');
+ }
+
+ // Check for zero.
+ // r could be zero if MIN_EXP is changed after the this value was created.
+ // This would cause a division by zero (x/t) and hence Infinity below, which would cause
+ // coeffToString to throw.
+ if (r.c[0]) {
+ e = r.e;
+ s = e + dp;
+ if (s < 3) s = 0;
+
+ // Newton-Raphson iteration.
+ for (; ;) {
+ t = r;
+ r = half.times(t.plus(div(x, t, dp, 1)));
+
+ if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {
+
+ // The exponent of r may here be one less than the final result exponent,
+ // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits
+ // are indexed correctly.
+ if (r.e < e) --s;
+ n = n.slice(s - 3, s + 1);
+
+ // The 4th rounding digit may be in error by -1 so if the 4 rounding digits
+ // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the
+ // iteration.
+ if (n == '9999' || !rep && n == '4999') {
+
+ // On the first iteration only, check to see if rounding up gives the
+ // exact result as the nines may infinitely repeat.
+ if (!rep) {
+ round(t, t.e + DECIMAL_PLACES + 2, 0);
+
+ if (t.times(t).eq(x)) {
+ r = t;
+ break;
+ }
+ }
+
+ dp += 4;
+ s += 4;
+ rep = 1;
+ } else {
+
+ // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact
+ // result. If not, then there are further digits and m will be truthy.
+ if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
+
+ // Truncate to the first rounding digit.
+ round(r, r.e + DECIMAL_PLACES + 2, 1);
+ m = !r.times(r).eq(x);
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);
+ };
+
+
+ /*
+ * Return a string representing the value of this BigNumber in exponential notation and
+ * rounded using ROUNDING_MODE to dp fixed decimal places.
+ *
+ * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+ *
+ * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'
+ */
+ P.toExponential = function (dp, rm) {
+ if (dp != null) {
+ intCheck(dp, 0, MAX);
+ dp++;
+ }
+ return format(this, dp, rm, 1);
+ };
+
+
+ /*
+ * Return a string representing the value of this BigNumber in fixed-point notation rounding
+ * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.
+ *
+ * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',
+ * but e.g. (-0.00001).toFixed(0) is '-0'.
+ *
+ * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+ *
+ * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'
+ */
+ P.toFixed = function (dp, rm) {
+ if (dp != null) {
+ intCheck(dp, 0, MAX);
+ dp = dp + this.e + 1;
+ }
+ return format(this, dp, rm);
+ };
+
+
+ /*
+ * Return a string representing the value of this BigNumber in fixed-point notation rounded
+ * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties
+ * of the format or FORMAT object (see BigNumber.set).
+ *
+ * The formatting object may contain some or all of the properties shown below.
+ *
+ * FORMAT = {
+ * prefix: '',
+ * groupSize: 3,
+ * secondaryGroupSize: 0,
+ * groupSeparator: ',',
+ * decimalSeparator: '.',
+ * fractionGroupSize: 0,
+ * fractionGroupSeparator: '\xA0', // non-breaking space
+ * suffix: ''
+ * };
+ *
+ * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+ * [format] {object} Formatting options. See FORMAT pbject above.
+ *
+ * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'
+ * '[BigNumber Error] Argument not an object: {format}'
+ */
+ P.toFormat = function (dp, rm, format) {
+ var str,
+ x = this;
+
+ if (format == null) {
+ if (dp != null && rm && typeof rm == 'object') {
+ format = rm;
+ rm = null;
+ } else if (dp && typeof dp == 'object') {
+ format = dp;
+ dp = rm = null;
+ } else {
+ format = FORMAT;
+ }
+ } else if (typeof format != 'object') {
+ throw Error
+ (bignumberError + 'Argument not an object: ' + format);
+ }
+
+ str = x.toFixed(dp, rm);
+
+ if (x.c) {
+ var i,
+ arr = str.split('.'),
+ g1 = +format.groupSize,
+ g2 = +format.secondaryGroupSize,
+ groupSeparator = format.groupSeparator || '',
+ intPart = arr[0],
+ fractionPart = arr[1],
+ isNeg = x.s < 0,
+ intDigits = isNeg ? intPart.slice(1) : intPart,
+ len = intDigits.length;
+
+ if (g2) i = g1, g1 = g2, g2 = i, len -= i;
+
+ if (g1 > 0 && len > 0) {
+ i = len % g1 || g1;
+ intPart = intDigits.substr(0, i);
+ for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);
+ if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);
+ if (isNeg) intPart = '-' + intPart;
+ }
+
+ str = fractionPart
+ ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)
+ ? fractionPart.replace(new RegExp('\\d{' + g2 + '}\\B', 'g'),
+ '$&' + (format.fractionGroupSeparator || ''))
+ : fractionPart)
+ : intPart;
+ }
+
+ return (format.prefix || '') + str + (format.suffix || '');
+ };
+
+
+ /*
+ * Return an array of two BigNumbers representing the value of this BigNumber as a simple
+ * fraction with an integer numerator and an integer denominator.
+ * The denominator will be a positive non-zero value less than or equal to the specified
+ * maximum denominator. If a maximum denominator is not specified, the denominator will be
+ * the lowest value necessary to represent the number exactly.
+ *
+ * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.
+ *
+ * '[BigNumber Error] Argument {not an integer|out of range} : {md}'
+ */
+ P.toFraction = function (md) {
+ var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,
+ x = this,
+ xc = x.c;
+
+ if (md != null) {
+ n = new BigNumber(md);
+
+ // Throw if md is less than one or is not an integer, unless it is Infinity.
+ if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {
+ throw Error
+ (bignumberError + 'Argument ' +
+ (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));
+ }
+ }
+
+ if (!xc) return new BigNumber(x);
+
+ d = new BigNumber(ONE);
+ n1 = d0 = new BigNumber(ONE);
+ d1 = n0 = new BigNumber(ONE);
+ s = coeffToString(xc);
+
+ // Determine initial denominator.
+ // d is a power of 10 and the minimum max denominator that specifies the value exactly.
+ e = d.e = s.length - x.e - 1;
+ d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];
+ md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;
+
+ exp = MAX_EXP;
+ MAX_EXP = 1 / 0;
+ n = new BigNumber(s);
+
+ // n0 = d1 = 0
+ n0.c[0] = 0;
+
+ for (; ;) {
+ q = div(n, d, 0, 1);
+ d2 = d0.plus(q.times(d1));
+ if (d2.comparedTo(md) == 1) break;
+ d0 = d1;
+ d1 = d2;
+ n1 = n0.plus(q.times(d2 = n1));
+ n0 = d2;
+ d = n.minus(q.times(d2 = d));
+ n = d2;
+ }
+
+ d2 = div(md.minus(d0), d1, 0, 1);
+ n0 = n0.plus(d2.times(n1));
+ d0 = d0.plus(d2.times(d1));
+ n0.s = n1.s = x.s;
+ e = e * 2;
+
+ // Determine which fraction is closer to x, n0/d0 or n1/d1
+ r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(
+ div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
+
+ MAX_EXP = exp;
+
+ return r;
+ };
+
+
+ /*
+ * Return the value of this BigNumber converted to a number primitive.
+ */
+ P.toNumber = function () {
+ return +valueOf(this);
+ };
+
+
+ /*
+ * Return a string representing the value of this BigNumber rounded to sd significant digits
+ * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits
+ * necessary to represent the integer part of the value in fixed-point notation, then use
+ * exponential notation.
+ *
+ * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+ *
+ * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'
+ */
+ P.toPrecision = function (sd, rm) {
+ if (sd != null) intCheck(sd, 1, MAX);
+ return format(this, sd, rm, 2);
+ };
+
+
+ /*
+ * Return a string representing the value of this BigNumber in base b, or base 10 if b is
+ * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and
+ * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent
+ * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than
+ * TO_EXP_NEG, return exponential notation.
+ *
+ * [b] {number} Integer, 2 to ALPHABET.length inclusive.
+ *
+ * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'
+ */
+ P.toString = function (b) {
+ var str,
+ n = this,
+ s = n.s,
+ e = n.e;
+
+ // Infinity or NaN?
+ if (e === null) {
+ if (s) {
+ str = 'Infinity';
+ if (s < 0) str = '-' + str;
+ } else {
+ str = 'NaN';
+ }
+ } else {
+ if (b == null) {
+ str = e <= TO_EXP_NEG || e >= TO_EXP_POS
+ ? toExponential(coeffToString(n.c), e)
+ : toFixedPoint(coeffToString(n.c), e, '0');
+ } else if (b === 10) {
+ n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);
+ str = toFixedPoint(coeffToString(n.c), n.e, '0');
+ } else {
+ intCheck(b, 2, ALPHABET.length, 'Base');
+ str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);
+ }
+
+ if (s < 0 && n.c[0]) str = '-' + str;
+ }
+
+ return str;
+ };
+
+
+ /*
+ * Return as toString, but do not accept a base argument, and include the minus sign for
+ * negative zero.
+ */
+ P.valueOf = P.toJSON = function () {
+ return valueOf(this);
+ };
+
+
+ P._isBigNumber = true;
+
+ if (configObject != null) BigNumber.set(configObject);
+
+ return BigNumber;
+ }
+
+
+ // PRIVATE HELPER FUNCTIONS
+
+ // These functions don't need access to variables,
+ // e.g. DECIMAL_PLACES, in the scope of the `clone` function above.
+
+
+ function bitFloor(n) {
+ var i = n | 0;
+ return n > 0 || n === i ? i : i - 1;
+ }
+
+
+ // Return a coefficient array as a string of base 10 digits.
+ function coeffToString(a) {
+ var s, z,
+ i = 1,
+ j = a.length,
+ r = a[0] + '';
+
+ for (; i < j;) {
+ s = a[i++] + '';
+ z = LOG_BASE - s.length;
+ for (; z--; s = '0' + s);
+ r += s;
+ }
+
+ // Determine trailing zeros.
+ for (j = r.length; r.charCodeAt(--j) === 48;);
+
+ return r.slice(0, j + 1 || 1);
+ }
+
+
+ // Compare the value of BigNumbers x and y.
+ function compare(x, y) {
+ var a, b,
+ xc = x.c,
+ yc = y.c,
+ i = x.s,
+ j = y.s,
+ k = x.e,
+ l = y.e;
+
+ // Either NaN?
+ if (!i || !j) return null;
+
+ a = xc && !xc[0];
+ b = yc && !yc[0];
+
+ // Either zero?
+ if (a || b) return a ? b ? 0 : -j : i;
+
+ // Signs differ?
+ if (i != j) return i;
+
+ a = i < 0;
+ b = k == l;
+
+ // Either Infinity?
+ if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1;
+
+ // Compare exponents.
+ if (!b) return k > l ^ a ? 1 : -1;
+
+ j = (k = xc.length) < (l = yc.length) ? k : l;
+
+ // Compare digit by digit.
+ for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;
+
+ // Compare lengths.
+ return k == l ? 0 : k > l ^ a ? 1 : -1;
+ }
+
+
+ /*
+ * Check that n is a primitive number, an integer, and in range, otherwise throw.
+ */
+ function intCheck(n, min, max, name) {
+ if (n < min || n > max || n !== mathfloor(n)) {
+ throw Error
+ (bignumberError + (name || 'Argument') + (typeof n == 'number'
+ ? n < min || n > max ? ' out of range: ' : ' not an integer: '
+ : ' not a primitive number: ') + String(n));
+ }
+ }
+
+
+ // Assumes finite n.
+ function isOdd(n) {
+ var k = n.c.length - 1;
+ return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0;
+ }
+
+
+ function toExponential(str, e) {
+ return (str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str) +
+ (e < 0 ? 'e' : 'e+') + e;
+ }
+
+
+ function toFixedPoint(str, e, z) {
+ var len, zs;
+
+ // Negative exponent?
+ if (e < 0) {
+
+ // Prepend zeros.
+ for (zs = z + '.'; ++e; zs += z);
+ str = zs + str;
+
+ // Positive exponent
+ } else {
+ len = str.length;
+
+ // Append zeros.
+ if (++e > len) {
+ for (zs = z, e -= len; --e; zs += z);
+ str += zs;
+ } else if (e < len) {
+ str = str.slice(0, e) + '.' + str.slice(e);
+ }
+ }
+
+ return str;
+ }
+
+
+ // EXPORT
+
+
+ BigNumber = clone();
+ BigNumber['default'] = BigNumber.BigNumber = BigNumber;
+
+ // AMD.
+ if (typeof define == 'function' && define.amd) {
+ define(function () { return BigNumber; });
+
+ // Node.js and other environments that support module.exports.
+ } else if ( true && module.exports) {
+ module.exports = BigNumber;
+
+ // Browser.
+ } else {
+ if (!globalObject) {
+ globalObject = typeof self != 'undefined' && self ? self : window;
+ }
+
+ globalObject.BigNumber = BigNumber;
+ }
+})(this);
+
+
+/***/ }),
+
+/***/ 1079:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+/* MIT license */
+var cssKeywords = __nccwpck_require__(1640);
+
+// NOTE: conversions should only return primitive values (i.e. arrays, or
+// values that give correct `typeof` results).
+// do not use box values types (i.e. Number(), String(), etc.)
+
+var reverseKeywords = {};
+for (var key in cssKeywords) {
+ if (cssKeywords.hasOwnProperty(key)) {
+ reverseKeywords[cssKeywords[key]] = key;
+ }
+}
+
+var convert = module.exports = {
+ rgb: {channels: 3, labels: 'rgb'},
+ hsl: {channels: 3, labels: 'hsl'},
+ hsv: {channels: 3, labels: 'hsv'},
+ hwb: {channels: 3, labels: 'hwb'},
+ cmyk: {channels: 4, labels: 'cmyk'},
+ xyz: {channels: 3, labels: 'xyz'},
+ lab: {channels: 3, labels: 'lab'},
+ lch: {channels: 3, labels: 'lch'},
+ hex: {channels: 1, labels: ['hex']},
+ keyword: {channels: 1, labels: ['keyword']},
+ ansi16: {channels: 1, labels: ['ansi16']},
+ ansi256: {channels: 1, labels: ['ansi256']},
+ hcg: {channels: 3, labels: ['h', 'c', 'g']},
+ apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
+ gray: {channels: 1, labels: ['gray']}
+};
+
+// hide .channels and .labels properties
+for (var model in convert) {
+ if (convert.hasOwnProperty(model)) {
+ if (!('channels' in convert[model])) {
+ throw new Error('missing channels property: ' + model);
+ }
+
+ if (!('labels' in convert[model])) {
+ throw new Error('missing channel labels property: ' + model);
+ }
+
+ if (convert[model].labels.length !== convert[model].channels) {
+ throw new Error('channel and label counts mismatch: ' + model);
+ }
+
+ var channels = convert[model].channels;
+ var labels = convert[model].labels;
+ delete convert[model].channels;
+ delete convert[model].labels;
+ Object.defineProperty(convert[model], 'channels', {value: channels});
+ Object.defineProperty(convert[model], 'labels', {value: labels});
+ }
+}
+
+convert.rgb.hsl = function (rgb) {
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+ var min = Math.min(r, g, b);
+ var max = Math.max(r, g, b);
+ var delta = max - min;
+ var h;
+ var s;
+ var l;
+
+ if (max === min) {
+ h = 0;
+ } else if (r === max) {
+ h = (g - b) / delta;
+ } else if (g === max) {
+ h = 2 + (b - r) / delta;
+ } else if (b === max) {
+ h = 4 + (r - g) / delta;
+ }
+
+ h = Math.min(h * 60, 360);
+
+ if (h < 0) {
+ h += 360;
+ }
+
+ l = (min + max) / 2;
+
+ if (max === min) {
+ s = 0;
+ } else if (l <= 0.5) {
+ s = delta / (max + min);
+ } else {
+ s = delta / (2 - max - min);
+ }
+
+ return [h, s * 100, l * 100];
+};
+
+convert.rgb.hsv = function (rgb) {
+ var rdif;
+ var gdif;
+ var bdif;
+ var h;
+ var s;
+
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+ var v = Math.max(r, g, b);
+ var diff = v - Math.min(r, g, b);
+ var diffc = function (c) {
+ return (v - c) / 6 / diff + 1 / 2;
+ };
+
+ if (diff === 0) {
+ h = s = 0;
+ } else {
+ s = diff / v;
+ rdif = diffc(r);
+ gdif = diffc(g);
+ bdif = diffc(b);
+
+ if (r === v) {
+ h = bdif - gdif;
+ } else if (g === v) {
+ h = (1 / 3) + rdif - bdif;
+ } else if (b === v) {
+ h = (2 / 3) + gdif - rdif;
+ }
+ if (h < 0) {
+ h += 1;
+ } else if (h > 1) {
+ h -= 1;
+ }
+ }
+
+ return [
+ h * 360,
+ s * 100,
+ v * 100
+ ];
+};
+
+convert.rgb.hwb = function (rgb) {
+ var r = rgb[0];
+ var g = rgb[1];
+ var b = rgb[2];
+ var h = convert.rgb.hsl(rgb)[0];
+ var w = 1 / 255 * Math.min(r, Math.min(g, b));
+
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
+
+ return [h, w * 100, b * 100];
+};
+
+convert.rgb.cmyk = function (rgb) {
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+ var c;
+ var m;
+ var y;
+ var k;
+
+ k = Math.min(1 - r, 1 - g, 1 - b);
+ c = (1 - r - k) / (1 - k) || 0;
+ m = (1 - g - k) / (1 - k) || 0;
+ y = (1 - b - k) / (1 - k) || 0;
+
+ return [c * 100, m * 100, y * 100, k * 100];
+};
+
+/**
+ * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
+ * */
+function comparativeDistance(x, y) {
+ return (
+ Math.pow(x[0] - y[0], 2) +
+ Math.pow(x[1] - y[1], 2) +
+ Math.pow(x[2] - y[2], 2)
+ );
+}
+
+convert.rgb.keyword = function (rgb) {
+ var reversed = reverseKeywords[rgb];
+ if (reversed) {
+ return reversed;
+ }
+
+ var currentClosestDistance = Infinity;
+ var currentClosestKeyword;
+
+ for (var keyword in cssKeywords) {
+ if (cssKeywords.hasOwnProperty(keyword)) {
+ var value = cssKeywords[keyword];
+
+ // Compute comparative distance
+ var distance = comparativeDistance(rgb, value);
+
+ // Check if its less, if so set as closest
+ if (distance < currentClosestDistance) {
+ currentClosestDistance = distance;
+ currentClosestKeyword = keyword;
+ }
+ }
+ }
+
+ return currentClosestKeyword;
+};
+
+convert.keyword.rgb = function (keyword) {
+ return cssKeywords[keyword];
+};
+
+convert.rgb.xyz = function (rgb) {
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+
+ // assume sRGB
+ r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
+ g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
+ b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
+
+ var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
+ var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
+ var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
+
+ return [x * 100, y * 100, z * 100];
+};
+
+convert.rgb.lab = function (rgb) {
+ var xyz = convert.rgb.xyz(rgb);
+ var x = xyz[0];
+ var y = xyz[1];
+ var z = xyz[2];
+ var l;
+ var a;
+ var b;
+
+ x /= 95.047;
+ y /= 100;
+ z /= 108.883;
+
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
+
+ l = (116 * y) - 16;
+ a = 500 * (x - y);
+ b = 200 * (y - z);
+
+ return [l, a, b];
+};
+
+convert.hsl.rgb = function (hsl) {
+ var h = hsl[0] / 360;
+ var s = hsl[1] / 100;
+ var l = hsl[2] / 100;
+ var t1;
+ var t2;
+ var t3;
+ var rgb;
+ var val;
+
+ if (s === 0) {
+ val = l * 255;
+ return [val, val, val];
+ }
+
+ if (l < 0.5) {
+ t2 = l * (1 + s);
+ } else {
+ t2 = l + s - l * s;
+ }
+
+ t1 = 2 * l - t2;
+
+ rgb = [0, 0, 0];
+ for (var i = 0; i < 3; i++) {
+ t3 = h + 1 / 3 * -(i - 1);
+ if (t3 < 0) {
+ t3++;
+ }
+ if (t3 > 1) {
+ t3--;
+ }
+
+ if (6 * t3 < 1) {
+ val = t1 + (t2 - t1) * 6 * t3;
+ } else if (2 * t3 < 1) {
+ val = t2;
+ } else if (3 * t3 < 2) {
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
+ } else {
+ val = t1;
+ }
+
+ rgb[i] = val * 255;
+ }
+
+ return rgb;
+};
+
+convert.hsl.hsv = function (hsl) {
+ var h = hsl[0];
+ var s = hsl[1] / 100;
+ var l = hsl[2] / 100;
+ var smin = s;
+ var lmin = Math.max(l, 0.01);
+ var sv;
+ var v;
+
+ l *= 2;
+ s *= (l <= 1) ? l : 2 - l;
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
+ v = (l + s) / 2;
+ sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
+
+ return [h, sv * 100, v * 100];
+};
+
+convert.hsv.rgb = function (hsv) {
+ var h = hsv[0] / 60;
+ var s = hsv[1] / 100;
+ var v = hsv[2] / 100;
+ var hi = Math.floor(h) % 6;
+
+ var f = h - Math.floor(h);
+ var p = 255 * v * (1 - s);
+ var q = 255 * v * (1 - (s * f));
+ var t = 255 * v * (1 - (s * (1 - f)));
+ v *= 255;
+
+ switch (hi) {
+ case 0:
+ return [v, t, p];
+ case 1:
+ return [q, v, p];
+ case 2:
+ return [p, v, t];
+ case 3:
+ return [p, q, v];
+ case 4:
+ return [t, p, v];
+ case 5:
+ return [v, p, q];
+ }
+};
+
+convert.hsv.hsl = function (hsv) {
+ var h = hsv[0];
+ var s = hsv[1] / 100;
+ var v = hsv[2] / 100;
+ var vmin = Math.max(v, 0.01);
+ var lmin;
+ var sl;
+ var l;
+
+ l = (2 - s) * v;
+ lmin = (2 - s) * vmin;
+ sl = s * vmin;
+ sl /= (lmin <= 1) ? lmin : 2 - lmin;
+ sl = sl || 0;
+ l /= 2;
+
+ return [h, sl * 100, l * 100];
+};
+
+// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
+convert.hwb.rgb = function (hwb) {
+ var h = hwb[0] / 360;
+ var wh = hwb[1] / 100;
+ var bl = hwb[2] / 100;
+ var ratio = wh + bl;
+ var i;
+ var v;
+ var f;
+ var n;
+
+ // wh + bl cant be > 1
+ if (ratio > 1) {
+ wh /= ratio;
+ bl /= ratio;
+ }
+
+ i = Math.floor(6 * h);
+ v = 1 - bl;
+ f = 6 * h - i;
+
+ if ((i & 0x01) !== 0) {
+ f = 1 - f;
+ }
+
+ n = wh + f * (v - wh); // linear interpolation
+
+ var r;
+ var g;
+ var b;
+ switch (i) {
+ default:
+ case 6:
+ case 0: r = v; g = n; b = wh; break;
+ case 1: r = n; g = v; b = wh; break;
+ case 2: r = wh; g = v; b = n; break;
+ case 3: r = wh; g = n; b = v; break;
+ case 4: r = n; g = wh; b = v; break;
+ case 5: r = v; g = wh; b = n; break;
+ }
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.cmyk.rgb = function (cmyk) {
+ var c = cmyk[0] / 100;
+ var m = cmyk[1] / 100;
+ var y = cmyk[2] / 100;
+ var k = cmyk[3] / 100;
+ var r;
+ var g;
+ var b;
+
+ r = 1 - Math.min(1, c * (1 - k) + k);
+ g = 1 - Math.min(1, m * (1 - k) + k);
+ b = 1 - Math.min(1, y * (1 - k) + k);
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.xyz.rgb = function (xyz) {
+ var x = xyz[0] / 100;
+ var y = xyz[1] / 100;
+ var z = xyz[2] / 100;
+ var r;
+ var g;
+ var b;
+
+ r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
+ g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
+ b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
+
+ // assume sRGB
+ r = r > 0.0031308
+ ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
+ : r * 12.92;
+
+ g = g > 0.0031308
+ ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
+ : g * 12.92;
+
+ b = b > 0.0031308
+ ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
+ : b * 12.92;
+
+ r = Math.min(Math.max(0, r), 1);
+ g = Math.min(Math.max(0, g), 1);
+ b = Math.min(Math.max(0, b), 1);
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.xyz.lab = function (xyz) {
+ var x = xyz[0];
+ var y = xyz[1];
+ var z = xyz[2];
+ var l;
+ var a;
+ var b;
+
+ x /= 95.047;
+ y /= 100;
+ z /= 108.883;
+
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
+
+ l = (116 * y) - 16;
+ a = 500 * (x - y);
+ b = 200 * (y - z);
+
+ return [l, a, b];
+};
+
+convert.lab.xyz = function (lab) {
+ var l = lab[0];
+ var a = lab[1];
+ var b = lab[2];
+ var x;
+ var y;
+ var z;
+
+ y = (l + 16) / 116;
+ x = a / 500 + y;
+ z = y - b / 200;
+
+ var y2 = Math.pow(y, 3);
+ var x2 = Math.pow(x, 3);
+ var z2 = Math.pow(z, 3);
+ y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
+ x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
+ z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
+
+ x *= 95.047;
+ y *= 100;
+ z *= 108.883;
+
+ return [x, y, z];
+};
+
+convert.lab.lch = function (lab) {
+ var l = lab[0];
+ var a = lab[1];
+ var b = lab[2];
+ var hr;
+ var h;
+ var c;
+
+ hr = Math.atan2(b, a);
+ h = hr * 360 / 2 / Math.PI;
+
+ if (h < 0) {
+ h += 360;
+ }
+
+ c = Math.sqrt(a * a + b * b);
+
+ return [l, c, h];
+};
+
+convert.lch.lab = function (lch) {
+ var l = lch[0];
+ var c = lch[1];
+ var h = lch[2];
+ var a;
+ var b;
+ var hr;
+
+ hr = h / 360 * 2 * Math.PI;
+ a = c * Math.cos(hr);
+ b = c * Math.sin(hr);
+
+ return [l, a, b];
+};
+
+convert.rgb.ansi16 = function (args) {
+ var r = args[0];
+ var g = args[1];
+ var b = args[2];
+ var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
+
+ value = Math.round(value / 50);
+
+ if (value === 0) {
+ return 30;
+ }
+
+ var ansi = 30
+ + ((Math.round(b / 255) << 2)
+ | (Math.round(g / 255) << 1)
+ | Math.round(r / 255));
+
+ if (value === 2) {
+ ansi += 60;
+ }
+
+ return ansi;
+};
+
+convert.hsv.ansi16 = function (args) {
+ // optimization here; we already know the value and don't need to get
+ // it converted for us.
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
+};
+
+convert.rgb.ansi256 = function (args) {
+ var r = args[0];
+ var g = args[1];
+ var b = args[2];
+
+ // we use the extended greyscale palette here, with the exception of
+ // black and white. normal palette only has 4 greyscale shades.
+ if (r === g && g === b) {
+ if (r < 8) {
+ return 16;
+ }
+
+ if (r > 248) {
+ return 231;
+ }
+
+ return Math.round(((r - 8) / 247) * 24) + 232;
+ }
+
+ var ansi = 16
+ + (36 * Math.round(r / 255 * 5))
+ + (6 * Math.round(g / 255 * 5))
+ + Math.round(b / 255 * 5);
+
+ return ansi;
+};
+
+convert.ansi16.rgb = function (args) {
+ var color = args % 10;
+
+ // handle greyscale
+ if (color === 0 || color === 7) {
+ if (args > 50) {
+ color += 3.5;
+ }
+
+ color = color / 10.5 * 255;
+
+ return [color, color, color];
+ }
+
+ var mult = (~~(args > 50) + 1) * 0.5;
+ var r = ((color & 1) * mult) * 255;
+ var g = (((color >> 1) & 1) * mult) * 255;
+ var b = (((color >> 2) & 1) * mult) * 255;
+
+ return [r, g, b];
+};
+
+convert.ansi256.rgb = function (args) {
+ // handle greyscale
+ if (args >= 232) {
+ var c = (args - 232) * 10 + 8;
+ return [c, c, c];
+ }
+
+ args -= 16;
+
+ var rem;
+ var r = Math.floor(args / 36) / 5 * 255;
+ var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
+ var b = (rem % 6) / 5 * 255;
+
+ return [r, g, b];
+};
+
+convert.rgb.hex = function (args) {
+ var integer = ((Math.round(args[0]) & 0xFF) << 16)
+ + ((Math.round(args[1]) & 0xFF) << 8)
+ + (Math.round(args[2]) & 0xFF);
+
+ var string = integer.toString(16).toUpperCase();
+ return '000000'.substring(string.length) + string;
+};
+
+convert.hex.rgb = function (args) {
+ var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
+ if (!match) {
+ return [0, 0, 0];
+ }
+
+ var colorString = match[0];
+
+ if (match[0].length === 3) {
+ colorString = colorString.split('').map(function (char) {
+ return char + char;
+ }).join('');
+ }
+
+ var integer = parseInt(colorString, 16);
+ var r = (integer >> 16) & 0xFF;
+ var g = (integer >> 8) & 0xFF;
+ var b = integer & 0xFF;
+
+ return [r, g, b];
+};
+
+convert.rgb.hcg = function (rgb) {
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+ var max = Math.max(Math.max(r, g), b);
+ var min = Math.min(Math.min(r, g), b);
+ var chroma = (max - min);
+ var grayscale;
+ var hue;
+
+ if (chroma < 1) {
+ grayscale = min / (1 - chroma);
+ } else {
+ grayscale = 0;
+ }
+
+ if (chroma <= 0) {
+ hue = 0;
+ } else
+ if (max === r) {
+ hue = ((g - b) / chroma) % 6;
+ } else
+ if (max === g) {
+ hue = 2 + (b - r) / chroma;
+ } else {
+ hue = 4 + (r - g) / chroma + 4;
+ }
+
+ hue /= 6;
+ hue %= 1;
+
+ return [hue * 360, chroma * 100, grayscale * 100];
+};
+
+convert.hsl.hcg = function (hsl) {
+ var s = hsl[1] / 100;
+ var l = hsl[2] / 100;
+ var c = 1;
+ var f = 0;
+
+ if (l < 0.5) {
+ c = 2.0 * s * l;
+ } else {
+ c = 2.0 * s * (1.0 - l);
+ }
+
+ if (c < 1.0) {
+ f = (l - 0.5 * c) / (1.0 - c);
+ }
+
+ return [hsl[0], c * 100, f * 100];
+};
+
+convert.hsv.hcg = function (hsv) {
+ var s = hsv[1] / 100;
+ var v = hsv[2] / 100;
+
+ var c = s * v;
+ var f = 0;
+
+ if (c < 1.0) {
+ f = (v - c) / (1 - c);
+ }
+
+ return [hsv[0], c * 100, f * 100];
+};
+
+convert.hcg.rgb = function (hcg) {
+ var h = hcg[0] / 360;
+ var c = hcg[1] / 100;
+ var g = hcg[2] / 100;
+
+ if (c === 0.0) {
+ return [g * 255, g * 255, g * 255];
+ }
+
+ var pure = [0, 0, 0];
+ var hi = (h % 1) * 6;
+ var v = hi % 1;
+ var w = 1 - v;
+ var mg = 0;
+
+ switch (Math.floor(hi)) {
+ case 0:
+ pure[0] = 1; pure[1] = v; pure[2] = 0; break;
+ case 1:
+ pure[0] = w; pure[1] = 1; pure[2] = 0; break;
+ case 2:
+ pure[0] = 0; pure[1] = 1; pure[2] = v; break;
+ case 3:
+ pure[0] = 0; pure[1] = w; pure[2] = 1; break;
+ case 4:
+ pure[0] = v; pure[1] = 0; pure[2] = 1; break;
+ default:
+ pure[0] = 1; pure[1] = 0; pure[2] = w;
+ }
+
+ mg = (1.0 - c) * g;
+
+ return [
+ (c * pure[0] + mg) * 255,
+ (c * pure[1] + mg) * 255,
+ (c * pure[2] + mg) * 255
+ ];
+};
+
+convert.hcg.hsv = function (hcg) {
+ var c = hcg[1] / 100;
+ var g = hcg[2] / 100;
+
+ var v = c + g * (1.0 - c);
+ var f = 0;
+
+ if (v > 0.0) {
+ f = c / v;
+ }
+
+ return [hcg[0], f * 100, v * 100];
+};
+
+convert.hcg.hsl = function (hcg) {
+ var c = hcg[1] / 100;
+ var g = hcg[2] / 100;
+
+ var l = g * (1.0 - c) + 0.5 * c;
+ var s = 0;
+
+ if (l > 0.0 && l < 0.5) {
+ s = c / (2 * l);
+ } else
+ if (l >= 0.5 && l < 1.0) {
+ s = c / (2 * (1 - l));
+ }
+
+ return [hcg[0], s * 100, l * 100];
+};
+
+convert.hcg.hwb = function (hcg) {
+ var c = hcg[1] / 100;
+ var g = hcg[2] / 100;
+ var v = c + g * (1.0 - c);
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
+};
+
+convert.hwb.hcg = function (hwb) {
+ var w = hwb[1] / 100;
+ var b = hwb[2] / 100;
+ var v = 1 - b;
+ var c = v - w;
+ var g = 0;
+
+ if (c < 1) {
+ g = (v - c) / (1 - c);
+ }
+
+ return [hwb[0], c * 100, g * 100];
+};
+
+convert.apple.rgb = function (apple) {
+ return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
+};
+
+convert.rgb.apple = function (rgb) {
+ return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
+};
+
+convert.gray.rgb = function (args) {
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
+};
+
+convert.gray.hsl = convert.gray.hsv = function (args) {
+ return [0, 0, args[0]];
+};
+
+convert.gray.hwb = function (gray) {
+ return [0, 100, gray[0]];
+};
+
+convert.gray.cmyk = function (gray) {
+ return [0, 0, 0, gray[0]];
+};
+
+convert.gray.lab = function (gray) {
+ return [gray[0], 0, 0];
+};
+
+convert.gray.hex = function (gray) {
+ var val = Math.round(gray[0] / 100 * 255) & 0xFF;
+ var integer = (val << 16) + (val << 8) + val;
+
+ var string = integer.toString(16).toUpperCase();
+ return '000000'.substring(string.length) + string;
+};
+
+convert.rgb.gray = function (rgb) {
+ var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
+ return [val / 255 * 100];
+};
+
+
+/***/ }),
+
+/***/ 4162:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+var conversions = __nccwpck_require__(1079);
+var route = __nccwpck_require__(6455);
+
+var convert = {};
+
+var models = Object.keys(conversions);
+
+function wrapRaw(fn) {
+ var wrappedFn = function (args) {
+ if (args === undefined || args === null) {
+ return args;
+ }
+
+ if (arguments.length > 1) {
+ args = Array.prototype.slice.call(arguments);
+ }
+
+ return fn(args);
+ };
+
+ // preserve .conversion property if there is one
+ if ('conversion' in fn) {
+ wrappedFn.conversion = fn.conversion;
+ }
+
+ return wrappedFn;
+}
+
+function wrapRounded(fn) {
+ var wrappedFn = function (args) {
+ if (args === undefined || args === null) {
+ return args;
+ }
+
+ if (arguments.length > 1) {
+ args = Array.prototype.slice.call(arguments);
+ }
+
+ var result = fn(args);
+
+ // we're assuming the result is an array here.
+ // see notice in conversions.js; don't use box types
+ // in conversion functions.
+ if (typeof result === 'object') {
+ for (var len = result.length, i = 0; i < len; i++) {
+ result[i] = Math.round(result[i]);
+ }
+ }
+
+ return result;
+ };
+
+ // preserve .conversion property if there is one
+ if ('conversion' in fn) {
+ wrappedFn.conversion = fn.conversion;
+ }
+
+ return wrappedFn;
+}
+
+models.forEach(function (fromModel) {
+ convert[fromModel] = {};
+
+ Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
+ Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
+
+ var routes = route(fromModel);
+ var routeModels = Object.keys(routes);
+
+ routeModels.forEach(function (toModel) {
+ var fn = routes[toModel];
+
+ convert[fromModel][toModel] = wrapRounded(fn);
+ convert[fromModel][toModel].raw = wrapRaw(fn);
+ });
+});
+
+module.exports = convert;
+
+
+/***/ }),
+
+/***/ 6455:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+var conversions = __nccwpck_require__(1079);
+
+/*
+ this function routes a model to all other models.
+
+ all functions that are routed have a property `.conversion` attached
+ to the returned synthetic function. This property is an array
+ of strings, each with the steps in between the 'from' and 'to'
+ color models (inclusive).
+
+ conversions that are not possible simply are not included.
+*/
+
+function buildGraph() {
+ var graph = {};
+ // https://jsperf.com/object-keys-vs-for-in-with-closure/3
+ var models = Object.keys(conversions);
+
+ for (var len = models.length, i = 0; i < len; i++) {
+ graph[models[i]] = {
+ // http://jsperf.com/1-vs-infinity
+ // micro-opt, but this is simple.
+ distance: -1,
+ parent: null
+ };
+ }
+
+ return graph;
+}
+
+// https://en.wikipedia.org/wiki/Breadth-first_search
+function deriveBFS(fromModel) {
+ var graph = buildGraph();
+ var queue = [fromModel]; // unshift -> queue -> pop
+
+ graph[fromModel].distance = 0;
+
+ while (queue.length) {
+ var current = queue.pop();
+ var adjacents = Object.keys(conversions[current]);
+
+ for (var len = adjacents.length, i = 0; i < len; i++) {
+ var adjacent = adjacents[i];
+ var node = graph[adjacent];
+
+ if (node.distance === -1) {
+ node.distance = graph[current].distance + 1;
+ node.parent = current;
+ queue.unshift(adjacent);
+ }
+ }
+ }
+
+ return graph;
+}
+
+function link(from, to) {
+ return function (args) {
+ return to(from(args));
+ };
+}
+
+function wrapConversion(toModel, graph) {
+ var path = [graph[toModel].parent, toModel];
+ var fn = conversions[graph[toModel].parent][toModel];
+
+ var cur = graph[toModel].parent;
+ while (graph[cur].parent) {
+ path.unshift(graph[cur].parent);
+ fn = link(conversions[graph[cur].parent][cur], fn);
+ cur = graph[cur].parent;
+ }
+
+ fn.conversion = path;
+ return fn;
+}
+
+module.exports = function (fromModel) {
+ var graph = deriveBFS(fromModel);
+ var conversion = {};
+
+ var models = Object.keys(graph);
+ for (var len = models.length, i = 0; i < len; i++) {
+ var toModel = models[i];
+ var node = graph[toModel];
+
+ if (node.parent === null) {
+ // no possible conversion, or this node is the source model.
+ continue;
+ }
+
+ conversion[toModel] = wrapConversion(toModel, graph);
+ }
+
+ return conversion;
+};
+
+
+
+/***/ }),
+
+/***/ 1640:
+/***/ ((module) => {
+
+"use strict";
+
+
+module.exports = {
+ "aliceblue": [240, 248, 255],
+ "antiquewhite": [250, 235, 215],
+ "aqua": [0, 255, 255],
+ "aquamarine": [127, 255, 212],
+ "azure": [240, 255, 255],
+ "beige": [245, 245, 220],
+ "bisque": [255, 228, 196],
+ "black": [0, 0, 0],
+ "blanchedalmond": [255, 235, 205],
+ "blue": [0, 0, 255],
+ "blueviolet": [138, 43, 226],
+ "brown": [165, 42, 42],
+ "burlywood": [222, 184, 135],
+ "cadetblue": [95, 158, 160],
+ "chartreuse": [127, 255, 0],
+ "chocolate": [210, 105, 30],
+ "coral": [255, 127, 80],
+ "cornflowerblue": [100, 149, 237],
+ "cornsilk": [255, 248, 220],
+ "crimson": [220, 20, 60],
+ "cyan": [0, 255, 255],
+ "darkblue": [0, 0, 139],
+ "darkcyan": [0, 139, 139],
+ "darkgoldenrod": [184, 134, 11],
+ "darkgray": [169, 169, 169],
+ "darkgreen": [0, 100, 0],
+ "darkgrey": [169, 169, 169],
+ "darkkhaki": [189, 183, 107],
+ "darkmagenta": [139, 0, 139],
+ "darkolivegreen": [85, 107, 47],
+ "darkorange": [255, 140, 0],
+ "darkorchid": [153, 50, 204],
+ "darkred": [139, 0, 0],
+ "darksalmon": [233, 150, 122],
+ "darkseagreen": [143, 188, 143],
+ "darkslateblue": [72, 61, 139],
+ "darkslategray": [47, 79, 79],
+ "darkslategrey": [47, 79, 79],
+ "darkturquoise": [0, 206, 209],
+ "darkviolet": [148, 0, 211],
+ "deeppink": [255, 20, 147],
+ "deepskyblue": [0, 191, 255],
+ "dimgray": [105, 105, 105],
+ "dimgrey": [105, 105, 105],
+ "dodgerblue": [30, 144, 255],
+ "firebrick": [178, 34, 34],
+ "floralwhite": [255, 250, 240],
+ "forestgreen": [34, 139, 34],
+ "fuchsia": [255, 0, 255],
+ "gainsboro": [220, 220, 220],
+ "ghostwhite": [248, 248, 255],
+ "gold": [255, 215, 0],
+ "goldenrod": [218, 165, 32],
+ "gray": [128, 128, 128],
+ "green": [0, 128, 0],
+ "greenyellow": [173, 255, 47],
+ "grey": [128, 128, 128],
+ "honeydew": [240, 255, 240],
+ "hotpink": [255, 105, 180],
+ "indianred": [205, 92, 92],
+ "indigo": [75, 0, 130],
+ "ivory": [255, 255, 240],
+ "khaki": [240, 230, 140],
+ "lavender": [230, 230, 250],
+ "lavenderblush": [255, 240, 245],
+ "lawngreen": [124, 252, 0],
+ "lemonchiffon": [255, 250, 205],
+ "lightblue": [173, 216, 230],
+ "lightcoral": [240, 128, 128],
+ "lightcyan": [224, 255, 255],
+ "lightgoldenrodyellow": [250, 250, 210],
+ "lightgray": [211, 211, 211],
+ "lightgreen": [144, 238, 144],
+ "lightgrey": [211, 211, 211],
+ "lightpink": [255, 182, 193],
+ "lightsalmon": [255, 160, 122],
+ "lightseagreen": [32, 178, 170],
+ "lightskyblue": [135, 206, 250],
+ "lightslategray": [119, 136, 153],
+ "lightslategrey": [119, 136, 153],
+ "lightsteelblue": [176, 196, 222],
+ "lightyellow": [255, 255, 224],
+ "lime": [0, 255, 0],
+ "limegreen": [50, 205, 50],
+ "linen": [250, 240, 230],
+ "magenta": [255, 0, 255],
+ "maroon": [128, 0, 0],
+ "mediumaquamarine": [102, 205, 170],
+ "mediumblue": [0, 0, 205],
+ "mediumorchid": [186, 85, 211],
+ "mediumpurple": [147, 112, 219],
+ "mediumseagreen": [60, 179, 113],
+ "mediumslateblue": [123, 104, 238],
+ "mediumspringgreen": [0, 250, 154],
+ "mediumturquoise": [72, 209, 204],
+ "mediumvioletred": [199, 21, 133],
+ "midnightblue": [25, 25, 112],
+ "mintcream": [245, 255, 250],
+ "mistyrose": [255, 228, 225],
+ "moccasin": [255, 228, 181],
+ "navajowhite": [255, 222, 173],
+ "navy": [0, 0, 128],
+ "oldlace": [253, 245, 230],
+ "olive": [128, 128, 0],
+ "olivedrab": [107, 142, 35],
+ "orange": [255, 165, 0],
+ "orangered": [255, 69, 0],
+ "orchid": [218, 112, 214],
+ "palegoldenrod": [238, 232, 170],
+ "palegreen": [152, 251, 152],
+ "paleturquoise": [175, 238, 238],
+ "palevioletred": [219, 112, 147],
+ "papayawhip": [255, 239, 213],
+ "peachpuff": [255, 218, 185],
+ "peru": [205, 133, 63],
+ "pink": [255, 192, 203],
+ "plum": [221, 160, 221],
+ "powderblue": [176, 224, 230],
+ "purple": [128, 0, 128],
+ "rebeccapurple": [102, 51, 153],
+ "red": [255, 0, 0],
+ "rosybrown": [188, 143, 143],
+ "royalblue": [65, 105, 225],
+ "saddlebrown": [139, 69, 19],
+ "salmon": [250, 128, 114],
+ "sandybrown": [244, 164, 96],
+ "seagreen": [46, 139, 87],
+ "seashell": [255, 245, 238],
+ "sienna": [160, 82, 45],
+ "silver": [192, 192, 192],
+ "skyblue": [135, 206, 235],
+ "slateblue": [106, 90, 205],
+ "slategray": [112, 128, 144],
+ "slategrey": [112, 128, 144],
+ "snow": [255, 250, 250],
+ "springgreen": [0, 255, 127],
+ "steelblue": [70, 130, 180],
+ "tan": [210, 180, 140],
+ "teal": [0, 128, 128],
+ "thistle": [216, 191, 216],
+ "tomato": [255, 99, 71],
+ "turquoise": [64, 224, 208],
+ "violet": [238, 130, 238],
+ "wheat": [245, 222, 179],
+ "white": [255, 255, 255],
+ "whitesmoke": [245, 245, 245],
+ "yellow": [255, 255, 0],
+ "yellowgreen": [154, 205, 50]
+};
+
+
+/***/ }),
+
+/***/ 9762:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+/* MIT license */
+var colorNames = __nccwpck_require__(1640);
+var swizzle = __nccwpck_require__(3628);
+var hasOwnProperty = Object.hasOwnProperty;
+
+var reverseNames = Object.create(null);
+
+// create a list of reverse color names
+for (var name in colorNames) {
+ if (hasOwnProperty.call(colorNames, name)) {
+ reverseNames[colorNames[name]] = name;
+ }
+}
+
+var cs = module.exports = {
+ to: {},
+ get: {}
+};
+
+cs.get = function (string) {
+ var prefix = string.substring(0, 3).toLowerCase();
+ var val;
+ var model;
+ switch (prefix) {
+ case 'hsl':
+ val = cs.get.hsl(string);
+ model = 'hsl';
+ break;
+ case 'hwb':
+ val = cs.get.hwb(string);
+ model = 'hwb';
+ break;
+ default:
+ val = cs.get.rgb(string);
+ model = 'rgb';
+ break;
+ }
+
+ if (!val) {
+ return null;
+ }
+
+ return {model: model, value: val};
+};
+
+cs.get.rgb = function (string) {
+ if (!string) {
+ return null;
+ }
+
+ var abbr = /^#([a-f0-9]{3,4})$/i;
+ var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
+ var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
+ var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
+ var keyword = /^(\w+)$/;
+
+ var rgb = [0, 0, 0, 1];
+ var match;
+ var i;
+ var hexAlpha;
+
+ if (match = string.match(hex)) {
+ hexAlpha = match[2];
+ match = match[1];
+
+ for (i = 0; i < 3; i++) {
+ // https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
+ var i2 = i * 2;
+ rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
+ }
+
+ if (hexAlpha) {
+ rgb[3] = parseInt(hexAlpha, 16) / 255;
+ }
+ } else if (match = string.match(abbr)) {
+ match = match[1];
+ hexAlpha = match[3];
+
+ for (i = 0; i < 3; i++) {
+ rgb[i] = parseInt(match[i] + match[i], 16);
+ }
+
+ if (hexAlpha) {
+ rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
+ }
+ } else if (match = string.match(rgba)) {
+ for (i = 0; i < 3; i++) {
+ rgb[i] = parseInt(match[i + 1], 0);
+ }
+
+ if (match[4]) {
+ if (match[5]) {
+ rgb[3] = parseFloat(match[4]) * 0.01;
+ } else {
+ rgb[3] = parseFloat(match[4]);
+ }
+ }
+ } else if (match = string.match(per)) {
+ for (i = 0; i < 3; i++) {
+ rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
+ }
+
+ if (match[4]) {
+ if (match[5]) {
+ rgb[3] = parseFloat(match[4]) * 0.01;
+ } else {
+ rgb[3] = parseFloat(match[4]);
+ }
+ }
+ } else if (match = string.match(keyword)) {
+ if (match[1] === 'transparent') {
+ return [0, 0, 0, 0];
+ }
+
+ if (!hasOwnProperty.call(colorNames, match[1])) {
+ return null;
+ }
+
+ rgb = colorNames[match[1]];
+ rgb[3] = 1;
+
+ return rgb;
+ } else {
+ return null;
+ }
+
+ for (i = 0; i < 3; i++) {
+ rgb[i] = clamp(rgb[i], 0, 255);
+ }
+ rgb[3] = clamp(rgb[3], 0, 1);
+
+ return rgb;
+};
+
+cs.get.hsl = function (string) {
+ if (!string) {
+ return null;
+ }
+
+ var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
+ var match = string.match(hsl);
+
+ if (match) {
+ var alpha = parseFloat(match[4]);
+ var h = ((parseFloat(match[1]) % 360) + 360) % 360;
+ var s = clamp(parseFloat(match[2]), 0, 100);
+ var l = clamp(parseFloat(match[3]), 0, 100);
+ var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
+
+ return [h, s, l, a];
+ }
+
+ return null;
+};
+
+cs.get.hwb = function (string) {
+ if (!string) {
+ return null;
+ }
+
+ var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
+ var match = string.match(hwb);
+
+ if (match) {
+ var alpha = parseFloat(match[4]);
+ var h = ((parseFloat(match[1]) % 360) + 360) % 360;
+ var w = clamp(parseFloat(match[2]), 0, 100);
+ var b = clamp(parseFloat(match[3]), 0, 100);
+ var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
+ return [h, w, b, a];
+ }
+
+ return null;
+};
+
+cs.to.hex = function () {
+ var rgba = swizzle(arguments);
+
+ return (
+ '#' +
+ hexDouble(rgba[0]) +
+ hexDouble(rgba[1]) +
+ hexDouble(rgba[2]) +
+ (rgba[3] < 1
+ ? (hexDouble(Math.round(rgba[3] * 255)))
+ : '')
+ );
+};
+
+cs.to.rgb = function () {
+ var rgba = swizzle(arguments);
+
+ return rgba.length < 4 || rgba[3] === 1
+ ? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'
+ : 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';
+};
+
+cs.to.rgb.percent = function () {
+ var rgba = swizzle(arguments);
+
+ var r = Math.round(rgba[0] / 255 * 100);
+ var g = Math.round(rgba[1] / 255 * 100);
+ var b = Math.round(rgba[2] / 255 * 100);
+
+ return rgba.length < 4 || rgba[3] === 1
+ ? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'
+ : 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';
+};
+
+cs.to.hsl = function () {
+ var hsla = swizzle(arguments);
+ return hsla.length < 4 || hsla[3] === 1
+ ? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'
+ : 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
+};
+
+// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
+// (hwb have alpha optional & 1 is default value)
+cs.to.hwb = function () {
+ var hwba = swizzle(arguments);
+
+ var a = '';
+ if (hwba.length >= 4 && hwba[3] !== 1) {
+ a = ', ' + hwba[3];
+ }
+
+ return 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';
+};
+
+cs.to.keyword = function (rgb) {
+ return reverseNames[rgb.slice(0, 3)];
+};
+
+// helpers
+function clamp(num, min, max) {
+ return Math.min(Math.max(min, num), max);
+}
+
+function hexDouble(num) {
+ var str = Math.round(num).toString(16).toUpperCase();
+ return (str.length < 2) ? '0' + str : str;
+}
+
+
+/***/ }),
+
+/***/ 60:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+var colorString = __nccwpck_require__(9762);
+var convert = __nccwpck_require__(4162);
+
+var _slice = [].slice;
+
+var skippedModels = [
+ // to be honest, I don't really feel like keyword belongs in color convert, but eh.
+ 'keyword',
+
+ // gray conflicts with some method names, and has its own method defined.
+ 'gray',
+
+ // shouldn't really be in color-convert either...
+ 'hex'
+];
+
+var hashedModelKeys = {};
+Object.keys(convert).forEach(function (model) {
+ hashedModelKeys[_slice.call(convert[model].labels).sort().join('')] = model;
+});
+
+var limiters = {};
+
+function Color(obj, model) {
+ if (!(this instanceof Color)) {
+ return new Color(obj, model);
+ }
+
+ if (model && model in skippedModels) {
+ model = null;
+ }
+
+ if (model && !(model in convert)) {
+ throw new Error('Unknown model: ' + model);
+ }
+
+ var i;
+ var channels;
+
+ if (obj == null) { // eslint-disable-line no-eq-null,eqeqeq
+ this.model = 'rgb';
+ this.color = [0, 0, 0];
+ this.valpha = 1;
+ } else if (obj instanceof Color) {
+ this.model = obj.model;
+ this.color = obj.color.slice();
+ this.valpha = obj.valpha;
+ } else if (typeof obj === 'string') {
+ var result = colorString.get(obj);
+ if (result === null) {
+ throw new Error('Unable to parse color from string: ' + obj);
+ }
+
+ this.model = result.model;
+ channels = convert[this.model].channels;
+ this.color = result.value.slice(0, channels);
+ this.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;
+ } else if (obj.length) {
+ this.model = model || 'rgb';
+ channels = convert[this.model].channels;
+ var newArr = _slice.call(obj, 0, channels);
+ this.color = zeroArray(newArr, channels);
+ this.valpha = typeof obj[channels] === 'number' ? obj[channels] : 1;
+ } else if (typeof obj === 'number') {
+ // this is always RGB - can be converted later on.
+ obj &= 0xFFFFFF;
+ this.model = 'rgb';
+ this.color = [
+ (obj >> 16) & 0xFF,
+ (obj >> 8) & 0xFF,
+ obj & 0xFF
+ ];
+ this.valpha = 1;
+ } else {
+ this.valpha = 1;
+
+ var keys = Object.keys(obj);
+ if ('alpha' in obj) {
+ keys.splice(keys.indexOf('alpha'), 1);
+ this.valpha = typeof obj.alpha === 'number' ? obj.alpha : 0;
+ }
+
+ var hashedKeys = keys.sort().join('');
+ if (!(hashedKeys in hashedModelKeys)) {
+ throw new Error('Unable to parse color from object: ' + JSON.stringify(obj));
+ }
+
+ this.model = hashedModelKeys[hashedKeys];
+
+ var labels = convert[this.model].labels;
+ var color = [];
+ for (i = 0; i < labels.length; i++) {
+ color.push(obj[labels[i]]);
+ }
+
+ this.color = zeroArray(color);
+ }
+
+ // perform limitations (clamping, etc.)
+ if (limiters[this.model]) {
+ channels = convert[this.model].channels;
+ for (i = 0; i < channels; i++) {
+ var limit = limiters[this.model][i];
+ if (limit) {
+ this.color[i] = limit(this.color[i]);
+ }
+ }
+ }
+
+ this.valpha = Math.max(0, Math.min(1, this.valpha));
+
+ if (Object.freeze) {
+ Object.freeze(this);
+ }
+}
+
+Color.prototype = {
+ toString: function () {
+ return this.string();
+ },
+
+ toJSON: function () {
+ return this[this.model]();
+ },
+
+ string: function (places) {
+ var self = this.model in colorString.to ? this : this.rgb();
+ self = self.round(typeof places === 'number' ? places : 1);
+ var args = self.valpha === 1 ? self.color : self.color.concat(this.valpha);
+ return colorString.to[self.model](args);
+ },
+
+ percentString: function (places) {
+ var self = this.rgb().round(typeof places === 'number' ? places : 1);
+ var args = self.valpha === 1 ? self.color : self.color.concat(this.valpha);
+ return colorString.to.rgb.percent(args);
+ },
+
+ array: function () {
+ return this.valpha === 1 ? this.color.slice() : this.color.concat(this.valpha);
+ },
+
+ object: function () {
+ var result = {};
+ var channels = convert[this.model].channels;
+ var labels = convert[this.model].labels;
+
+ for (var i = 0; i < channels; i++) {
+ result[labels[i]] = this.color[i];
+ }
+
+ if (this.valpha !== 1) {
+ result.alpha = this.valpha;
+ }
+
+ return result;
+ },
+
+ unitArray: function () {
+ var rgb = this.rgb().color;
+ rgb[0] /= 255;
+ rgb[1] /= 255;
+ rgb[2] /= 255;
+
+ if (this.valpha !== 1) {
+ rgb.push(this.valpha);
+ }
+
+ return rgb;
+ },
+
+ unitObject: function () {
+ var rgb = this.rgb().object();
+ rgb.r /= 255;
+ rgb.g /= 255;
+ rgb.b /= 255;
+
+ if (this.valpha !== 1) {
+ rgb.alpha = this.valpha;
+ }
+
+ return rgb;
+ },
+
+ round: function (places) {
+ places = Math.max(places || 0, 0);
+ return new Color(this.color.map(roundToPlace(places)).concat(this.valpha), this.model);
+ },
+
+ alpha: function (val) {
+ if (arguments.length) {
+ return new Color(this.color.concat(Math.max(0, Math.min(1, val))), this.model);
+ }
+
+ return this.valpha;
+ },
+
+ // rgb
+ red: getset('rgb', 0, maxfn(255)),
+ green: getset('rgb', 1, maxfn(255)),
+ blue: getset('rgb', 2, maxfn(255)),
+
+ hue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, function (val) { return ((val % 360) + 360) % 360; }), // eslint-disable-line brace-style
+
+ saturationl: getset('hsl', 1, maxfn(100)),
+ lightness: getset('hsl', 2, maxfn(100)),
+
+ saturationv: getset('hsv', 1, maxfn(100)),
+ value: getset('hsv', 2, maxfn(100)),
+
+ chroma: getset('hcg', 1, maxfn(100)),
+ gray: getset('hcg', 2, maxfn(100)),
+
+ white: getset('hwb', 1, maxfn(100)),
+ wblack: getset('hwb', 2, maxfn(100)),
+
+ cyan: getset('cmyk', 0, maxfn(100)),
+ magenta: getset('cmyk', 1, maxfn(100)),
+ yellow: getset('cmyk', 2, maxfn(100)),
+ black: getset('cmyk', 3, maxfn(100)),
+
+ x: getset('xyz', 0, maxfn(100)),
+ y: getset('xyz', 1, maxfn(100)),
+ z: getset('xyz', 2, maxfn(100)),
+
+ l: getset('lab', 0, maxfn(100)),
+ a: getset('lab', 1),
+ b: getset('lab', 2),
+
+ keyword: function (val) {
+ if (arguments.length) {
+ return new Color(val);
+ }
+
+ return convert[this.model].keyword(this.color);
+ },
+
+ hex: function (val) {
+ if (arguments.length) {
+ return new Color(val);
+ }
+
+ return colorString.to.hex(this.rgb().round().color);
+ },
+
+ rgbNumber: function () {
+ var rgb = this.rgb().color;
+ return ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF);
+ },
+
+ luminosity: function () {
+ // http://www.w3.org/TR/WCAG20/#relativeluminancedef
+ var rgb = this.rgb().color;
+
+ var lum = [];
+ for (var i = 0; i < rgb.length; i++) {
+ var chan = rgb[i] / 255;
+ lum[i] = (chan <= 0.03928) ? chan / 12.92 : Math.pow(((chan + 0.055) / 1.055), 2.4);
+ }
+
+ return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
+ },
+
+ contrast: function (color2) {
+ // http://www.w3.org/TR/WCAG20/#contrast-ratiodef
+ var lum1 = this.luminosity();
+ var lum2 = color2.luminosity();
+
+ if (lum1 > lum2) {
+ return (lum1 + 0.05) / (lum2 + 0.05);
+ }
+
+ return (lum2 + 0.05) / (lum1 + 0.05);
+ },
+
+ level: function (color2) {
+ var contrastRatio = this.contrast(color2);
+ if (contrastRatio >= 7.1) {
+ return 'AAA';
+ }
+
+ return (contrastRatio >= 4.5) ? 'AA' : '';
+ },
+
+ isDark: function () {
+ // YIQ equation from http://24ways.org/2010/calculating-color-contrast
+ var rgb = this.rgb().color;
+ var yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000;
+ return yiq < 128;
+ },
+
+ isLight: function () {
+ return !this.isDark();
+ },
+
+ negate: function () {
+ var rgb = this.rgb();
+ for (var i = 0; i < 3; i++) {
+ rgb.color[i] = 255 - rgb.color[i];
+ }
+ return rgb;
+ },
+
+ lighten: function (ratio) {
+ var hsl = this.hsl();
+ hsl.color[2] += hsl.color[2] * ratio;
+ return hsl;
+ },
+
+ darken: function (ratio) {
+ var hsl = this.hsl();
+ hsl.color[2] -= hsl.color[2] * ratio;
+ return hsl;
+ },
+
+ saturate: function (ratio) {
+ var hsl = this.hsl();
+ hsl.color[1] += hsl.color[1] * ratio;
+ return hsl;
+ },
+
+ desaturate: function (ratio) {
+ var hsl = this.hsl();
+ hsl.color[1] -= hsl.color[1] * ratio;
+ return hsl;
+ },
+
+ whiten: function (ratio) {
+ var hwb = this.hwb();
+ hwb.color[1] += hwb.color[1] * ratio;
+ return hwb;
+ },
+
+ blacken: function (ratio) {
+ var hwb = this.hwb();
+ hwb.color[2] += hwb.color[2] * ratio;
+ return hwb;
+ },
+
+ grayscale: function () {
+ // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
+ var rgb = this.rgb().color;
+ var val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
+ return Color.rgb(val, val, val);
+ },
+
+ fade: function (ratio) {
+ return this.alpha(this.valpha - (this.valpha * ratio));
+ },
+
+ opaquer: function (ratio) {
+ return this.alpha(this.valpha + (this.valpha * ratio));
+ },
+
+ rotate: function (degrees) {
+ var hsl = this.hsl();
+ var hue = hsl.color[0];
+ hue = (hue + degrees) % 360;
+ hue = hue < 0 ? 360 + hue : hue;
+ hsl.color[0] = hue;
+ return hsl;
+ },
+
+ mix: function (mixinColor, weight) {
+ // ported from sass implementation in C
+ // https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
+ if (!mixinColor || !mixinColor.rgb) {
+ throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
+ }
+ var color1 = mixinColor.rgb();
+ var color2 = this.rgb();
+ var p = weight === undefined ? 0.5 : weight;
+
+ var w = 2 * p - 1;
+ var a = color1.alpha() - color2.alpha();
+
+ var w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
+ var w2 = 1 - w1;
+
+ return Color.rgb(
+ w1 * color1.red() + w2 * color2.red(),
+ w1 * color1.green() + w2 * color2.green(),
+ w1 * color1.blue() + w2 * color2.blue(),
+ color1.alpha() * p + color2.alpha() * (1 - p));
+ }
+};
+
+// model conversion methods and static constructors
+Object.keys(convert).forEach(function (model) {
+ if (skippedModels.indexOf(model) !== -1) {
+ return;
+ }
+
+ var channels = convert[model].channels;
+
+ // conversion methods
+ Color.prototype[model] = function () {
+ if (this.model === model) {
+ return new Color(this);
+ }
+
+ if (arguments.length) {
+ return new Color(arguments, model);
+ }
+
+ var newAlpha = typeof arguments[channels] === 'number' ? channels : this.valpha;
+ return new Color(assertArray(convert[this.model][model].raw(this.color)).concat(newAlpha), model);
+ };
+
+ // 'static' construction methods
+ Color[model] = function (color) {
+ if (typeof color === 'number') {
+ color = zeroArray(_slice.call(arguments), channels);
+ }
+ return new Color(color, model);
+ };
+});
+
+function roundTo(num, places) {
+ return Number(num.toFixed(places));
+}
+
+function roundToPlace(places) {
+ return function (num) {
+ return roundTo(num, places);
+ };
+}
+
+function getset(model, channel, modifier) {
+ model = Array.isArray(model) ? model : [model];
+
+ model.forEach(function (m) {
+ (limiters[m] || (limiters[m] = []))[channel] = modifier;
+ });
+
+ model = model[0];
+
+ return function (val) {
+ var result;
+
+ if (arguments.length) {
+ if (modifier) {
+ val = modifier(val);
+ }
+
+ result = this[model]();
+ result.color[channel] = val;
+ return result;
+ }
+
+ result = this[model]().color[channel];
+ if (modifier) {
+ result = modifier(result);
+ }
+
+ return result;
+ };
+}
+
+function maxfn(max) {
+ return function (v) {
+ return Math.max(0, Math.min(max, v));
+ };
+}
+
+function assertArray(val) {
+ return Array.isArray(val) ? val : [val];
+}
+
+function zeroArray(arr, length) {
+ for (var i = 0; i < length; i++) {
+ if (typeof arr[i] !== 'number') {
+ arr[i] = 0;
+ }
+ }
+
+ return arr;
+}
+
+module.exports = Color;
+
+
+/***/ }),
+
+/***/ 4798:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+var color = __nccwpck_require__(60)
+ , hex = __nccwpck_require__(5534);
+
+/**
+ * Generate a color for a given name. But be reasonably smart about it by
+ * understanding name spaces and coloring each namespace a bit lighter so they
+ * still have the same base color as the root.
+ *
+ * @param {string} namespace The namespace
+ * @param {string} [delimiter] The delimiter
+ * @returns {string} color
+ */
+module.exports = function colorspace(namespace, delimiter) {
+ var split = namespace.split(delimiter || ':');
+ var base = hex(split[0]);
+
+ if (!split.length) return base;
+
+ for (var i = 0, l = split.length - 1; i < l; i++) {
+ base = color(base)
+ .mix(color(hex(split[i + 1])))
+ .saturate(1)
+ .hex();
+ }
+
+ return base;
+};
+
+
+/***/ }),
+
+/***/ 1162:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// NOTE: These type checking functions intentionally don't use `instanceof`
+// because it is fragile and can be easily faked with `Object.create()`.
+
+function isArray(arg) {
+ if (Array.isArray) {
+ return Array.isArray(arg);
+ }
+ return objectToString(arg) === '[object Array]';
+}
+exports.isArray = isArray;
+
+function isBoolean(arg) {
+ return typeof arg === 'boolean';
+}
+exports.isBoolean = isBoolean;
+
+function isNull(arg) {
+ return arg === null;
+}
+exports.isNull = isNull;
+
+function isNullOrUndefined(arg) {
+ return arg == null;
+}
+exports.isNullOrUndefined = isNullOrUndefined;
+
+function isNumber(arg) {
+ return typeof arg === 'number';
+}
+exports.isNumber = isNumber;
+
+function isString(arg) {
+ return typeof arg === 'string';
+}
+exports.isString = isString;
+
+function isSymbol(arg) {
+ return typeof arg === 'symbol';
+}
+exports.isSymbol = isSymbol;
+
+function isUndefined(arg) {
+ return arg === void 0;
+}
+exports.isUndefined = isUndefined;
+
+function isRegExp(re) {
+ return objectToString(re) === '[object RegExp]';
+}
+exports.isRegExp = isRegExp;
+
+function isObject(arg) {
+ return typeof arg === 'object' && arg !== null;
+}
+exports.isObject = isObject;
+
+function isDate(d) {
+ return objectToString(d) === '[object Date]';
+}
+exports.isDate = isDate;
+
+function isError(e) {
+ return (objectToString(e) === '[object Error]' || e instanceof Error);
+}
+exports.isError = isError;
+
+function isFunction(arg) {
+ return typeof arg === 'function';
+}
+exports.isFunction = isFunction;
+
+function isPrimitive(arg) {
+ return arg === null ||
+ typeof arg === 'boolean' ||
+ typeof arg === 'number' ||
+ typeof arg === 'string' ||
+ typeof arg === 'symbol' || // ES6 symbol
+ typeof arg === 'undefined';
+}
+exports.isPrimitive = isPrimitive;
+
+exports.isBuffer = __nccwpck_require__(181).Buffer.isBuffer;
+
+function objectToString(o) {
+ return Object.prototype.toString.call(o);
+}
+
+
+/***/ }),
+
+/***/ 7454:
+/***/ ((module) => {
+
+"use strict";
+
+
+/**
+ * Checks if a given namespace is allowed by the given variable.
+ *
+ * @param {String} name namespace that should be included.
+ * @param {String} variable Value that needs to be tested.
+ * @returns {Boolean} Indication if namespace is enabled.
+ * @public
+ */
+module.exports = function enabled(name, variable) {
+ if (!variable) return false;
+
+ var variables = variable.split(/[\s,]+/)
+ , i = 0;
+
+ for (; i < variables.length; i++) {
+ variable = variables[i].replace('*', '.*?');
+
+ if ('-' === variable.charAt(0)) {
+ if ((new RegExp('^'+ variable.substr(1) +'$')).test(name)) {
+ return false;
+ }
+
+ continue;
+ }
+
+ if ((new RegExp('^'+ variable +'$')).test(name)) {
+ return true;
+ }
+ }
+
+ return false;
+};
+
+
+/***/ }),
+
+/***/ 4608:
+/***/ ((module, exports) => {
+
+"use strict";
+/**
+ * @author Toru Nagashima
+ * @copyright 2015 Toru Nagashima. All rights reserved.
+ * See LICENSE file in root directory for full license.
+ */
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+
+/**
+ * @typedef {object} PrivateData
+ * @property {EventTarget} eventTarget The event target.
+ * @property {{type:string}} event The original event object.
+ * @property {number} eventPhase The current event phase.
+ * @property {EventTarget|null} currentTarget The current event target.
+ * @property {boolean} canceled The flag to prevent default.
+ * @property {boolean} stopped The flag to stop propagation.
+ * @property {boolean} immediateStopped The flag to stop propagation immediately.
+ * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.
+ * @property {number} timeStamp The unix time.
+ * @private
+ */
+
+/**
+ * Private data for event wrappers.
+ * @type {WeakMap}
+ * @private
+ */
+const privateData = new WeakMap();
+
+/**
+ * Cache for wrapper classes.
+ * @type {WeakMap